1 /***************************************************************************/
5 /* FreeType utility file for X11 support (body). */
7 /* Copyright 2002 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
16 /***************************************************************************/
21 #include FT_INTERNAL_OBJECTS_H
23 /* XXX: This really is a sad hack, but I didn't want to change every */
24 /* driver just to support this at the moment, since other important */
25 /* changes are coming anyway. */
27 typedef struct FT_FontFormatRec_
29 const char* driver_name;
30 const char* format_name;
35 FT_EXPORT_DEF( const char* )
36 FT_Get_X11_Font_Format( FT_Face face )
38 static const FT_FontFormatRec font_formats[] =
40 { "type1", "Type 1" },
41 { "truetype", "TrueType" },
44 { "type42", "Type 42" },
45 { "cidtype1", "CID Type 1" },
48 { "winfonts", "Windows FNT" }
51 const char* result = NULL;
54 if ( face && face->driver )
56 FT_Module driver = (FT_Module)face->driver;
59 if ( driver->clazz && driver->clazz->module_name )
62 FT_Int count = sizeof( font_formats ) / sizeof ( font_formats[0] );
65 result = driver->clazz->module_name;
67 for ( n = 0; n < count; n++ )
68 if ( ft_strcmp( result, font_formats[n].driver_name ) == 0 )
70 result = font_formats[n].format_name;