freetype
[Top][All Lists]
Advanced

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

Re: [ft] Carbon-free fonts support for Mac OS X 10.5 (Leopard) compatibi


From: mpsuzuki
Subject: Re: [ft] Carbon-free fonts support for Mac OS X 10.5 (Leopard) compatibility
Date: Wed, 7 Nov 2007 04:29:32 +0900

Hi,

On 06 Nov 2007 11:34:03 -0800
George Williams <address@hidden> wrote:

>On Tue, 2007-11-06 at 02:48, Dipsy Po wrote:
>> (a) The POSIX code in ftobjs.c only handles "data fork suitcase fonts"
>> (.dfont), such as "Helvetica.dfont", but not the more important "resource
>> fork suitcase fonts", like Arial, Times New Roman, Courier New, etc.. 
>> 
>> I am not sure if it is possible to read "resource fork" with POSIX API at
>> all. It may need to use some lower level system calls to get the "resource
>> fork" of a file. If this is possible, then implementing "resource fork"
>> support can solve the problem.
>You can read a resource fork easily through the standard C library given
>a file name by appending "/rsrc" to it, so for:
>       /Users/foobar/Library/Fonts/FrabNuts
>   fopen("/Users/foobar/Library/Fonts/FrabNuts/rsrc","rb")
>The format of a resource fork isn't hard to parse, there is code in
>fontforge (in the file macbinary.c of the ff source distribution) to do
>this (I may even have added it to freetype at one point).

Thank you for comment. Masatake Yamato had already supported
by this strategy. In src/base/ftrfork.c, like this:

  static FT_Error
  raccess_guess_darwin_hfsplus( FT_Library  library,
                                FT_Stream   stream,
                                char *      base_file_name,
                                char      **result_file_name,
                                FT_Long    *result_offset )
  {
    /*
      Only meaningful on systems with hfs+ drivers (or Macs).
     */
    FT_Error   error;
    char*      newpath;
    FT_Memory  memory;
    FT_Long    base_file_len = ft_strlen( base_file_name );

    FT_UNUSED( stream );


    memory = library->memory;

    if ( base_file_len > FT_INT_MAX )
      return FT_Err_Array_Too_Large;

    if ( FT_ALLOC( newpath, base_file_len + 6 ) )
      return error;

    FT_MEM_COPY( newpath, base_file_name, base_file_len );
    FT_MEM_COPY( newpath + base_file_len, "/rsrc", 6 );

    *result_file_name = newpath;
    *result_offset    = 0;

    return FT_Err_Ok;
  }

>> (b) The ftmac.c currently has a function to map the "logical font name" to a
>> font file + face index. I believe there is no way to duplicate this feature
>> without using Carbon, as it requires access to the Mac OS Font Manager. But
>> I think giving up this feature is OK for forked applications, as this
>> feature (mapping logical font name to font file) does not exist on Windows
>> or any other OS as well.
>This I don't know how to do.

I think the logical font name in Mac OS is selected from
FOND or sfnt-head (or sfnt-post ?), but the selection is
quite dependent with system environment, and emulation
code by POSIX functions will be complicated. Yet I'm
not sure if such complex code is permitted just for back
compatibility.

Regards,
mpsuzuki




reply via email to

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