OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* sfdriver.c */ | 3 /* sfdriver.c */ |
4 /* */ | 4 /* */ |
5 /* High-level SFNT driver interface (body). */ | 5 /* High-level SFNT driver interface (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2007, 2009-2013 by */ | 7 /* Copyright 1996-2007, 2009-2014 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 #include "../../include/ft2build.h" | 19 #include <ft2build.h> |
20 #include "../../include/freetype/internal/ftdebug.h" | 20 #include FT_INTERNAL_DEBUG_H |
21 #include "../../include/freetype/internal/sfnt.h" | 21 #include FT_INTERNAL_SFNT_H |
22 #include "../../include/freetype/internal/ftobjs.h" | 22 #include FT_INTERNAL_OBJECTS_H |
23 | 23 |
24 #include "sfdriver.h" | 24 #include "sfdriver.h" |
25 #include "ttload.h" | 25 #include "ttload.h" |
26 #include "sfobjs.h" | 26 #include "sfobjs.h" |
27 #include "sfntpic.h" | 27 #include "sfntpic.h" |
28 | 28 |
29 #include "sferrors.h" | 29 #include "sferrors.h" |
30 | 30 |
31 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS | 31 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS |
32 #include "ttsbit.h" | 32 #include "ttsbit.h" |
33 #endif | 33 #endif |
34 | 34 |
35 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES | 35 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES |
36 #include "ttpost.h" | 36 #include "ttpost.h" |
37 #endif | 37 #endif |
38 | 38 |
39 #ifdef TT_CONFIG_OPTION_BDF | 39 #ifdef TT_CONFIG_OPTION_BDF |
40 #include "ttbdf.h" | 40 #include "ttbdf.h" |
41 #include "../../include/freetype/internal/services/svbdf.h" | 41 #include FT_SERVICE_BDF_H |
42 #endif | 42 #endif |
43 | 43 |
44 #include "ttcmap.h" | 44 #include "ttcmap.h" |
45 #include "ttkern.h" | 45 #include "ttkern.h" |
46 #include "ttmtx.h" | 46 #include "ttmtx.h" |
47 | 47 |
48 #include "../../include/freetype/internal/services/svgldict.h" | 48 #include FT_SERVICE_GLYPH_DICT_H |
49 #include "../../include/freetype/internal/services/svpostnm.h" | 49 #include FT_SERVICE_POSTSCRIPT_NAME_H |
50 #include "../../include/freetype/internal/services/svsfnt.h" | 50 #include FT_SERVICE_SFNT_H |
51 #include "../../include/freetype/internal/services/svttcmap.h" | 51 #include FT_SERVICE_TT_CMAP_H |
52 | 52 |
53 | 53 |
54 /*************************************************************************/ | 54 /*************************************************************************/ |
55 /* */ | 55 /* */ |
56 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ | 56 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
57 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ | 57 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
58 /* messages during execution. */ | 58 /* messages during execution. */ |
59 /* */ | 59 /* */ |
60 #undef FT_COMPONENT | 60 #undef FT_COMPONENT |
61 #define FT_COMPONENT trace_sfdriver | 61 #define FT_COMPONENT trace_sfdriver |
62 | 62 |
63 | 63 |
64 /* | 64 /* |
65 * SFNT TABLE SERVICE | 65 * SFNT TABLE SERVICE |
66 * | 66 * |
67 */ | 67 */ |
68 | 68 |
69 static void* | 69 static void* |
70 get_sfnt_table( TT_Face face, | 70 get_sfnt_table( TT_Face face, |
71 FT_Sfnt_Tag tag ) | 71 FT_Sfnt_Tag tag ) |
72 { | 72 { |
73 void* table; | 73 void* table; |
74 | 74 |
75 | 75 |
76 switch ( tag ) | 76 switch ( tag ) |
77 { | 77 { |
78 case ft_sfnt_head: | 78 case FT_SFNT_HEAD: |
79 table = &face->header; | 79 table = &face->header; |
80 break; | 80 break; |
81 | 81 |
82 case ft_sfnt_hhea: | 82 case FT_SFNT_HHEA: |
83 table = &face->horizontal; | 83 table = &face->horizontal; |
84 break; | 84 break; |
85 | 85 |
86 case ft_sfnt_vhea: | 86 case FT_SFNT_VHEA: |
87 table = face->vertical_info ? &face->vertical : 0; | 87 table = face->vertical_info ? &face->vertical : NULL; |
88 break; | 88 break; |
89 | 89 |
90 case ft_sfnt_os2: | 90 case FT_SFNT_OS2: |
91 table = face->os2.version == 0xFFFFU ? 0 : &face->os2; | 91 table = face->os2.version == 0xFFFFU ? NULL : &face->os2; |
92 break; | 92 break; |
93 | 93 |
94 case ft_sfnt_post: | 94 case FT_SFNT_POST: |
95 table = &face->postscript; | 95 table = &face->postscript; |
96 break; | 96 break; |
97 | 97 |
98 case ft_sfnt_maxp: | 98 case FT_SFNT_MAXP: |
99 table = &face->max_profile; | 99 table = &face->max_profile; |
100 break; | 100 break; |
101 | 101 |
102 case ft_sfnt_pclt: | 102 case FT_SFNT_PCLT: |
103 table = face->pclt.Version ? &face->pclt : 0; | 103 table = face->pclt.Version ? &face->pclt : NULL; |
104 break; | 104 break; |
105 | 105 |
106 default: | 106 default: |
107 table = 0; | 107 table = NULL; |
108 } | 108 } |
109 | 109 |
110 return table; | 110 return table; |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 static FT_Error | 114 static FT_Error |
115 sfnt_table_info( TT_Face face, | 115 sfnt_table_info( TT_Face face, |
116 FT_UInt idx, | 116 FT_UInt idx, |
117 FT_ULong *tag, | 117 FT_ULong *tag, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 FT_UInt len = name->stringLength / 2; | 259 FT_UInt len = name->stringLength / 2; |
260 FT_Error error = FT_Err_Ok; | 260 FT_Error error = FT_Err_Ok; |
261 | 261 |
262 FT_UNUSED( error ); | 262 FT_UNUSED( error ); |
263 | 263 |
264 | 264 |
265 if ( !FT_ALLOC( result, name->stringLength + 1 ) ) | 265 if ( !FT_ALLOC( result, name->stringLength + 1 ) ) |
266 { | 266 { |
267 FT_Stream stream = face->name_table.stream; | 267 FT_Stream stream = face->name_table.stream; |
268 FT_String* r = (FT_String*)result; | 268 FT_String* r = (FT_String*)result; |
269 FT_Byte* p = (FT_Byte*)name->string; | 269 FT_Byte* p; |
270 | 270 |
271 | 271 |
272 if ( FT_STREAM_SEEK( name->stringOffset ) || | 272 if ( FT_STREAM_SEEK( name->stringOffset ) || |
273 FT_FRAME_ENTER( name->stringLength ) ) | 273 FT_FRAME_ENTER( name->stringLength ) ) |
274 { | 274 { |
275 FT_FREE( result ); | 275 FT_FREE( result ); |
276 name->stringLength = 0; | 276 name->stringLength = 0; |
277 name->stringOffset = 0; | 277 name->stringOffset = 0; |
278 FT_FREE( name->string ); | 278 FT_FREE( name->string ); |
279 | 279 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 PUT_PS_NAMES( tt_face_free_ps_names ), | 492 PUT_PS_NAMES( tt_face_free_ps_names ), |
493 | 493 |
494 /* since version 2.1.8 */ | 494 /* since version 2.1.8 */ |
495 tt_face_get_kerning, | 495 tt_face_get_kerning, |
496 | 496 |
497 /* since version 2.2 */ | 497 /* since version 2.2 */ |
498 tt_face_load_font_dir, | 498 tt_face_load_font_dir, |
499 tt_face_load_hmtx, | 499 tt_face_load_hmtx, |
500 | 500 |
501 /* see `ttsbit.h' and `sfnt.h' */ | 501 /* see `ttsbit.h' and `sfnt.h' */ |
502 PUT_EMBEDDED_BITMAPS( tt_face_load_eblc ), | 502 PUT_EMBEDDED_BITMAPS( tt_face_load_sbit ), |
503 PUT_EMBEDDED_BITMAPS( tt_face_free_eblc ), | 503 PUT_EMBEDDED_BITMAPS( tt_face_free_sbit ), |
504 | 504 |
505 PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike ), | 505 PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike ), |
506 PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ), | 506 PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ), |
507 | 507 |
508 tt_face_get_metrics | 508 tt_face_get_metrics |
509 ) | 509 ) |
510 | 510 |
511 | 511 |
512 FT_DEFINE_MODULE( | 512 FT_DEFINE_MODULE( |
513 sfnt_module_class, | 513 sfnt_module_class, |
514 | 514 |
515 0, /* not a font driver or renderer */ | 515 0, /* not a font driver or renderer */ |
516 sizeof ( FT_ModuleRec ), | 516 sizeof ( FT_ModuleRec ), |
517 | 517 |
518 "sfnt", /* driver name */ | 518 "sfnt", /* driver name */ |
519 0x10000L, /* driver version 1.0 */ | 519 0x10000L, /* driver version 1.0 */ |
520 0x20000L, /* driver requires FreeType 2.0 or higher */ | 520 0x20000L, /* driver requires FreeType 2.0 or higher */ |
521 | 521 |
522 (const void*)&SFNT_INTERFACE_GET, /* module specific interface */ | 522 (const void*)&SFNT_INTERFACE_GET, /* module specific interface */ |
523 | 523 |
524 (FT_Module_Constructor)0, | 524 (FT_Module_Constructor)0, |
525 (FT_Module_Destructor) 0, | 525 (FT_Module_Destructor) 0, |
526 (FT_Module_Requester) sfnt_get_interface ) | 526 (FT_Module_Requester) sfnt_get_interface ) |
527 | 527 |
528 | 528 |
529 /* END */ | 529 /* END */ |
OLD | NEW |