1 /***************************************************************************/ |
1 /**************************************************************************** |
2 /* */ |
2 * |
3 /* ttpost.c */ |
3 * ttpost.c |
4 /* */ |
4 * |
5 /* PostScript name table processing for TrueType and OpenType fonts */ |
5 * PostScript name table processing for TrueType and OpenType fonts |
6 /* (body). */ |
6 * (body). |
7 /* */ |
7 * |
8 /* Copyright 1996-2018 by */ |
8 * Copyright (C) 1996-2019 by |
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 * David Turner, Robert Wilhelm, and Werner Lemberg. |
10 /* */ |
10 * |
11 /* This file is part of the FreeType project, and may only be used, */ |
11 * This file is part of the FreeType project, and may only be used, |
12 /* modified, and distributed under the terms of the FreeType project */ |
12 * modified, and distributed under the terms of the FreeType project |
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 * license, LICENSE.TXT. By continuing to use, modify, or distribute |
14 /* this file you indicate that you have read the license and */ |
14 * this file you indicate that you have read the license and |
15 /* understand and accept it fully. */ |
15 * understand and accept it fully. |
16 /* */ |
16 * |
17 /***************************************************************************/ |
17 */ |
18 |
18 |
19 /*************************************************************************/ |
19 /************************************************************************** |
20 /* */ |
20 * |
21 /* The post table is not completely loaded by the core engine. This */ |
21 * The post table is not completely loaded by the core engine. This |
22 /* file loads the missing PS glyph names and implements an API to access */ |
22 * file loads the missing PS glyph names and implements an API to access |
23 /* them. */ |
23 * them. |
24 /* */ |
24 * |
25 /*************************************************************************/ |
25 */ |
26 |
26 |
27 |
27 |
28 #include <ft2build.h> |
28 #include <ft2build.h> |
29 #include FT_INTERNAL_DEBUG_H |
29 #include FT_INTERNAL_DEBUG_H |
30 #include FT_INTERNAL_STREAM_H |
30 #include FT_INTERNAL_STREAM_H |
36 #include "ttpost.h" |
36 #include "ttpost.h" |
37 |
37 |
38 #include "sferrors.h" |
38 #include "sferrors.h" |
39 |
39 |
40 |
40 |
41 /*************************************************************************/ |
41 /************************************************************************** |
42 /* */ |
42 * |
43 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
43 * The macro FT_COMPONENT is used in trace mode. It is an implicit |
44 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
44 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log |
45 /* messages during execution. */ |
45 * messages during execution. |
46 /* */ |
46 */ |
47 #undef FT_COMPONENT |
47 #undef FT_COMPONENT |
48 #define FT_COMPONENT trace_ttpost |
48 #define FT_COMPONENT ttpost |
49 |
49 |
50 |
50 |
51 /* If this configuration macro is defined, we rely on the `PSNames' */ |
51 /* If this configuration macro is defined, we rely on the `psnames' */ |
52 /* module to grab the glyph names. */ |
52 /* module to grab the glyph names. */ |
53 |
53 |
54 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES |
54 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES |
55 |
55 |
56 |
56 |
60 |
60 |
61 |
61 |
62 #else /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ |
62 #else /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ |
63 |
63 |
64 |
64 |
65 /* Otherwise, we ignore the `PSNames' module, and provide our own */ |
65 /* Otherwise, we ignore the `psnames' module, and provide our own */ |
66 /* table of Mac names. Thus, it is possible to build a version of */ |
66 /* table of Mac names. Thus, it is possible to build a version of */ |
67 /* FreeType without the Type 1 driver & PSNames module. */ |
67 /* FreeType without the Type 1 driver & psnames module. */ |
68 |
68 |
69 #define MAC_NAME( x ) (FT_String*)tt_post_default_names[x] |
69 #define MAC_NAME( x ) (FT_String*)tt_post_default_names[x] |
70 |
70 |
71 /* the 258 default Mac PS glyph names; see file `tools/glnames.py' */ |
71 /* the 258 default Mac PS glyph names; see file `tools/glnames.py' */ |
72 |
72 |
457 } |
457 } |
458 names->loaded = 0; |
458 names->loaded = 0; |
459 } |
459 } |
460 |
460 |
461 |
461 |
462 /*************************************************************************/ |
462 /************************************************************************** |
463 /* */ |
463 * |
464 /* <Function> */ |
464 * @Function: |
465 /* tt_face_get_ps_name */ |
465 * tt_face_get_ps_name |
466 /* */ |
466 * |
467 /* <Description> */ |
467 * @Description: |
468 /* Get the PostScript glyph name of a glyph. */ |
468 * Get the PostScript glyph name of a glyph. |
469 /* */ |
469 * |
470 /* <Input> */ |
470 * @Input: |
471 /* face :: A handle to the parent face. */ |
471 * face :: |
472 /* */ |
472 * A handle to the parent face. |
473 /* idx :: The glyph index. */ |
473 * |
474 /* */ |
474 * idx :: |
475 /* <InOut> */ |
475 * The glyph index. |
476 /* PSname :: The address of a string pointer. Undefined in case of */ |
476 * |
477 /* error, otherwise it is a pointer to the glyph name. */ |
477 * @InOut: |
478 /* */ |
478 * PSname :: |
479 /* You must not modify the returned string! */ |
479 * The address of a string pointer. Undefined in case of |
480 /* */ |
480 * error, otherwise it is a pointer to the glyph name. |
481 /* <Output> */ |
481 * |
482 /* FreeType error code. 0 means success. */ |
482 * You must not modify the returned string! |
483 /* */ |
483 * |
|
484 * @Output: |
|
485 * FreeType error code. 0 means success. |
|
486 */ |
484 FT_LOCAL_DEF( FT_Error ) |
487 FT_LOCAL_DEF( FT_Error ) |
485 tt_face_get_ps_name( TT_Face face, |
488 tt_face_get_ps_name( TT_Face face, |
486 FT_UInt idx, |
489 FT_UInt idx, |
487 FT_String** PSname ) |
490 FT_String** PSname ) |
488 { |
491 { |