Hash :
2a4fa134
Author :
Date :
2002-05-28T22:07:49
* include/freetype/ftxf86.h, src/base/ftxf86.c: added a new API named
FT_Get_X11_Font_Format to return an X11-compatible string describing the
font format of a given face. This was put in a new optional base source
file, corresponding to a new public header (named FT_XFREE86_H since
this function should only be used within the XFree86 font server IMO).
* include/freetype/config/ftheader.h: adding FT_XFREE86_H, though it's
not documented yet.
* include/freetype/t1tables.h, src/base/fttype1.c: adding two new APIs
named "FT_Get_PS_Font_Info" and "FT_Has_PS_Glyph_Names". This required
a new optional source in 'src/base' named "fttype1.c"
* src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: updating
build control files for the new files "ftxf86.c" and "fttype1.c" in
src/base
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#include <ft2build.h>
#include FT_XFREE86_H
#include FT_INTERNAL_OBJECTS_H
/* XXX: this really is a sad hack, but I didn't want to change every */
/* driver just to support this at the moment, since other important */
/* changes are coming anyway !! */
typedef struct
{
const char* driver_name;
const char* format_name;
} FT_FontFormatRec;
FT_EXPORT_DEF( const char* )
FT_Get_X11_Font_Format( FT_Face face )
{
static const FT_FontFormatRec font_formats[] =
{
{ "type1", "Type 1" },
{ "truetype", "TrueType" },
{ "bdf", "BDF" },
{ "pcf", "PCF" },
{ "type42", "Type 42" },
{ "cidtype1", "CID Type 1" },
{ "cff", "CFF" },
{ "pfr", "PFR" },
{ "winfonts", "Windows FNT" }
};
const char* result = NULL;
if ( face && face->driver )
{
FT_Module driver = (FT_Module) face->driver;
if ( driver->clazz && driver->clazz->module_name )
{
FT_Int n, count = sizeof(font_formats)/sizeof(font_formats[0]);
result = driver->clazz->module_name;
for ( n = 0; n < count; n++ )
if ( ft_strcmp( result, font_formats[n].driver_name ) == 0 )
{
result = font_formats[n].format_name;
break;
}
}
}
return result;
}