1 /***************************************************************************/
5 /* High-level SFNT driver interface (body). */
7 /* Copyright 1996-2000 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 /***************************************************************************/
19 #include <freetype/internal/sfnt.h>
20 #include <freetype/internal/ftobjs.h>
23 #ifdef FT_FLAT_COMPILE
34 #include <freetype/src/sfnt/sfdriver.h>
35 #include <freetype/src/sfnt/ttload.h>
36 #include <freetype/src/sfnt/ttsbit.h>
37 #include <freetype/src/sfnt/ttpost.h>
38 #include <freetype/src/sfnt/ttcmap.h>
39 #include <freetype/src/sfnt/sfobjs.h>
44 #include <string.h> /* for strcmp() */
48 void* get_sfnt_table( TT_Face face,
57 table = &face->header;
61 table = &face->horizontal;
65 table = face->vertical_info ? &face->vertical : 0;
69 table = face->os2.version == 0xFFFF ? 0 : &face->os2;
73 table = &face->postscript;
77 table = &face->max_profile;
81 table = face->pclt.Version ? &face->pclt : 0;
92 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
96 FT_Error get_sfnt_glyph_name( TT_Face face,
105 error = TT_Get_PS_Name( face, glyph_index, &gname );
106 if ( !error && buffer_max > 0 )
108 FT_UInt len = strlen( gname );
111 if ( len >= buffer_max )
112 len = buffer_max - 1;
114 MEM_Copy( buffer, gname, len );
115 ((FT_Byte*)buffer)[len] = 0;
122 #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
126 FT_Module_Interface SFNT_Get_Interface( FT_Module module,
127 const char* interface )
131 if ( strcmp( interface, "get_sfnt" ) == 0 )
132 return (FT_Module_Interface)get_sfnt_table;
134 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
135 if ( strcmp( interface, "glyph_name" ) == 0 )
136 return (FT_Module_Interface)get_sfnt_glyph_name;
143 const SFNT_Interface sfnt_interface =
157 TT_Load_Metrics_Header,
173 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
176 TT_Load_SBit_Strikes,
178 TT_Free_SBit_Strikes,
180 #else /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
186 #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
188 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
194 #else /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
199 #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
208 FT_Module_Class sfnt_module_class =
210 0, /* not a font driver or renderer */
211 sizeof( FT_ModuleRec ),
213 "sfnt", /* driver name */
214 0x10000L, /* driver version 1.0 */
215 0x20000L, /* driver requires FreeType 2.0 or higher */
217 (const void*)&sfnt_interface, /* module specific interface */
219 (FT_Module_Constructor)0,
220 (FT_Module_Destructor) 0,
221 (FT_Module_Requester) SFNT_Get_Interface