‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, February 5th, 2021 at 2:10 AM, Nigel Tao <[email protected]> wrote:

> On Fri, Feb 5, 2021 at 7:00 AM Sebastien Binet <[email protected]> wrote:
>
> > but as I wrote in the OP, it's not completely satisfying.
> > one needs to keep track of the association font.Face/[]byte.
> > so that's either double the memory (give or take), or a filename/io.Reader 
> > handle to keep around.
>
> Two []byte values aren't double the memory if the slices share the same 
> backing array.

sure, I was thinking more of the memory taken up by the []byte and its 
"equivalent" as a sfnt.Font.

>
> If you're passing a file-backed io.ReaderAt to sfnt.ParseReaderAt, you're 
> going to have to keep the file open anyway, and having multiple references to 
> the same io.ReaderAt similarly all share the same file descriptor. You're 
> probably also going to have to track the underlying *os.File separately 
> anyway, in order to Close it when you're done (or else you'd leak it).
>
> What's your proposed API?

package sfnt

// Marshal returns the OTF encoding of f.
func Marshal(f Font) ([]byte, error)
func MarshalWriter(w io.Writer, f Font) error

(for a lack of a better naming mirroring the Parse/ParseReaderAt function)

-s

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3YDnhLHo6WNAltgiAO1j6xcuOooZmgFRcIgYem-Ba1YokCCNh9rIWJERohqqUXbM8O_HihBZDlB5ujuWTwn7gbO4xcR6T5DTLU0FJQsWvGM%3D%40sbinet.org.

Reply via email to