freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more FT2 Mac ponderings


From: Just van Rossum
Subject: more FT2 Mac ponderings
Date: Mon, 28 Feb 2000 22:43:12 +0100

While thinking David's suggestion through, about adding an FOND driver, I
found out that's still not possible without modifications elsewhere in FT2.

This is because I need to create a special new stream from information that
can't be reached from the (stdio) stream created by FT_Open_Face(). (The
reason that I can't get at the information is due to the nature of Mac
files in general, and the nature of Mac font suitcase files in particular.)

I see two solutions:
1) the *driver* should be responsible for creating the stream -- but this
seems inefficient for the general case, since most often various drivers
can check whether they can handle the resource by looking at the default
stream.
2) I supply a Mac-specific FT_New_Stream().

The second solution sounds best to me, but I'm worried about the
implications. For one, I still need the stdio stream implementation (as in
config/ansi/ftsystem.c) for non-Mac fonts, and I'd hate to duplicate that
code just to add one test:

    if ( is_mac_suitcase(file) )
         return FT_New_Stream_From_Mac_Suitcase(args);
    ...continue, create stdio stream...

Secondly, I really, *really* dislike to duplicate that code. More on that
in my upcoming reply to Werner's post.

So, is it negotiable to add a compiler switch to ft_new_input_stream()?
Something like this:

    /* do we have an 8-bit pathname? */
    else if ( args->pathname )
#ifndef macintosh
      error = FT_New_Stream( args->pathname, stream );
#else
      error = FT_New_Stream_Mac( args->pathname, stream );
#endif


FT_New_Stream_Mac() would look roughly like this:

FT_New_Stream_Mac(path, stream)
{
    if ( is_mac_suitcase(path) )
         return FT_New_Stream_From_Mac_Suitcase(path, stream);
    else:
         return FT_New_Stream(path, stream);
}


The advantage is that I don't even *need* to write a driver (at least for
TT), since I can just create a memory stream containing pure sfnt data. For
T1 I'm not so sure yet (although I can easily create a PFA stream): I still
need a way to attach the kerning from the FOND to the face object. But
first things first.

Just





reply via email to

[Prev in Thread] Current Thread [Next in Thread]