1 /***************************************************************************/ |
1 /**************************************************************************** |
2 /* */ |
2 * |
3 /* psobjs.c */ |
3 * psobjs.c |
4 /* */ |
4 * |
5 /* Auxiliary functions for PostScript fonts (body). */ |
5 * Auxiliary functions for PostScript fonts (body). |
6 /* */ |
6 * |
7 /* Copyright 1996-2018 by */ |
7 * Copyright (C) 1996-2019 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 <ft2build.h> |
19 #include <ft2build.h> |
20 #include FT_INTERNAL_POSTSCRIPT_AUX_H |
20 #include FT_INTERNAL_POSTSCRIPT_AUX_H |
21 #include FT_INTERNAL_DEBUG_H |
21 #include FT_INTERNAL_DEBUG_H |
27 |
27 |
28 #include "psauxerr.h" |
28 #include "psauxerr.h" |
29 #include "psauxmod.h" |
29 #include "psauxmod.h" |
30 |
30 |
31 |
31 |
32 /*************************************************************************/ |
32 /************************************************************************** |
33 /* */ |
33 * |
34 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
34 * The macro FT_COMPONENT is used in trace mode. It is an implicit |
35 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
35 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log |
36 /* messages during execution. */ |
36 * messages during execution. |
37 /* */ |
37 */ |
38 #undef FT_COMPONENT |
38 #undef FT_COMPONENT |
39 #define FT_COMPONENT trace_psobjs |
39 #define FT_COMPONENT psobjs |
40 |
40 |
41 |
41 |
42 /*************************************************************************/ |
42 /*************************************************************************/ |
43 /*************************************************************************/ |
43 /*************************************************************************/ |
44 /***** *****/ |
44 /***** *****/ |
45 /***** PS_TABLE *****/ |
45 /***** PS_TABLE *****/ |
46 /***** *****/ |
46 /***** *****/ |
47 /*************************************************************************/ |
47 /*************************************************************************/ |
48 /*************************************************************************/ |
48 /*************************************************************************/ |
49 |
49 |
50 /*************************************************************************/ |
50 /************************************************************************** |
51 /* */ |
51 * |
52 /* <Function> */ |
52 * @Function: |
53 /* ps_table_new */ |
53 * ps_table_new |
54 /* */ |
54 * |
55 /* <Description> */ |
55 * @Description: |
56 /* Initializes a PS_Table. */ |
56 * Initializes a PS_Table. |
57 /* */ |
57 * |
58 /* <InOut> */ |
58 * @InOut: |
59 /* table :: The address of the target table. */ |
59 * table :: |
60 /* */ |
60 * The address of the target table. |
61 /* <Input> */ |
61 * |
62 /* count :: The table size = the maximum number of elements. */ |
62 * @Input: |
63 /* */ |
63 * count :: |
64 /* memory :: The memory object to use for all subsequent */ |
64 * The table size = the maximum number of elements. |
65 /* reallocations. */ |
65 * |
66 /* */ |
66 * memory :: |
67 /* <Return> */ |
67 * The memory object to use for all subsequent |
68 /* FreeType error code. 0 means success. */ |
68 * reallocations. |
69 /* */ |
69 * |
|
70 * @Return: |
|
71 * FreeType error code. 0 means success. |
|
72 */ |
70 FT_LOCAL_DEF( FT_Error ) |
73 FT_LOCAL_DEF( FT_Error ) |
71 ps_table_new( PS_Table table, |
74 ps_table_new( PS_Table table, |
72 FT_Int count, |
75 FT_Int count, |
73 FT_Memory memory ) |
76 FT_Memory memory ) |
74 { |
77 { |
142 |
145 |
143 return FT_Err_Ok; |
146 return FT_Err_Ok; |
144 } |
147 } |
145 |
148 |
146 |
149 |
147 /*************************************************************************/ |
150 /************************************************************************** |
148 /* */ |
151 * |
149 /* <Function> */ |
152 * @Function: |
150 /* ps_table_add */ |
153 * ps_table_add |
151 /* */ |
154 * |
152 /* <Description> */ |
155 * @Description: |
153 /* Adds an object to a PS_Table, possibly growing its memory block. */ |
156 * Adds an object to a PS_Table, possibly growing its memory block. |
154 /* */ |
157 * |
155 /* <InOut> */ |
158 * @InOut: |
156 /* table :: The target table. */ |
159 * table :: |
157 /* */ |
160 * The target table. |
158 /* <Input> */ |
161 * |
159 /* idx :: The index of the object in the table. */ |
162 * @Input: |
160 /* */ |
163 * idx :: |
161 /* object :: The address of the object to copy in memory. */ |
164 * The index of the object in the table. |
162 /* */ |
165 * |
163 /* length :: The length in bytes of the source object. */ |
166 * object :: |
164 /* */ |
167 * The address of the object to copy in memory. |
165 /* <Return> */ |
168 * |
166 /* FreeType error code. 0 means success. An error is returned if a */ |
169 * length :: |
167 /* reallocation fails. */ |
170 * The length in bytes of the source object. |
168 /* */ |
171 * |
|
172 * @Return: |
|
173 * FreeType error code. 0 means success. An error is returned if a |
|
174 * reallocation fails. |
|
175 */ |
169 FT_LOCAL_DEF( FT_Error ) |
176 FT_LOCAL_DEF( FT_Error ) |
170 ps_table_add( PS_Table table, |
177 ps_table_add( PS_Table table, |
171 FT_Int idx, |
178 FT_Int idx, |
172 void* object, |
179 void* object, |
173 FT_UInt length ) |
180 FT_UInt length ) |
214 table->cursor += length; |
221 table->cursor += length; |
215 return FT_Err_Ok; |
222 return FT_Err_Ok; |
216 } |
223 } |
217 |
224 |
218 |
225 |
219 /*************************************************************************/ |
226 /************************************************************************** |
220 /* */ |
227 * |
221 /* <Function> */ |
228 * @Function: |
222 /* ps_table_done */ |
229 * ps_table_done |
223 /* */ |
230 * |
224 /* <Description> */ |
231 * @Description: |
225 /* Finalizes a PS_TableRec (i.e., reallocate it to its current */ |
232 * Finalizes a PS_TableRec (i.e., reallocate it to its current |
226 /* cursor). */ |
233 * cursor). |
227 /* */ |
234 * |
228 /* <InOut> */ |
235 * @InOut: |
229 /* table :: The target table. */ |
236 * table :: |
230 /* */ |
237 * The target table. |
231 /* <Note> */ |
238 * |
232 /* This function does NOT release the heap's memory block. It is up */ |
239 * @Note: |
233 /* to the caller to clean it, or reference it in its own structures. */ |
240 * This function does NOT release the heap's memory block. It is up |
234 /* */ |
241 * to the caller to clean it, or reference it in its own structures. |
|
242 */ |
235 FT_LOCAL_DEF( void ) |
243 FT_LOCAL_DEF( void ) |
236 ps_table_done( PS_Table table ) |
244 ps_table_done( PS_Table table ) |
237 { |
245 { |
238 FT_Memory memory = table->memory; |
246 FT_Memory memory = table->memory; |
239 FT_Error error; |
247 FT_Error error; |
496 |
504 |
497 return error; |
505 return error; |
498 } |
506 } |
499 |
507 |
500 |
508 |
501 /***********************************************************************/ |
509 /************************************************************************ |
502 /* */ |
510 * |
503 /* All exported parsing routines handle leading whitespace and stop at */ |
511 * All exported parsing routines handle leading whitespace and stop at |
504 /* the first character which isn't part of the just handled token. */ |
512 * the first character which isn't part of the just handled token. |
505 /* */ |
513 * |
506 /***********************************************************************/ |
514 */ |
507 |
515 |
508 |
516 |
509 FT_LOCAL_DEF( void ) |
517 FT_LOCAL_DEF( void ) |
510 ps_parser_skip_PS_token( PS_Parser parser ) |
518 ps_parser_skip_PS_token( PS_Parser parser ) |
511 { |
519 { |
1098 |
1106 |
1099 switch ( type ) |
1107 switch ( type ) |
1100 { |
1108 { |
1101 case T1_FIELD_TYPE_BOOL: |
1109 case T1_FIELD_TYPE_BOOL: |
1102 val = ps_tobool( &cur, limit ); |
1110 val = ps_tobool( &cur, limit ); |
|
1111 FT_TRACE4(( " %s", val ? "true" : "false" )); |
1103 goto Store_Integer; |
1112 goto Store_Integer; |
1104 |
1113 |
1105 case T1_FIELD_TYPE_FIXED: |
1114 case T1_FIELD_TYPE_FIXED: |
1106 val = PS_Conv_ToFixed( &cur, limit, 0 ); |
1115 val = PS_Conv_ToFixed( &cur, limit, 0 ); |
|
1116 FT_TRACE4(( " %f", (double)val / 65536 )); |
1107 goto Store_Integer; |
1117 goto Store_Integer; |
1108 |
1118 |
1109 case T1_FIELD_TYPE_FIXED_1000: |
1119 case T1_FIELD_TYPE_FIXED_1000: |
1110 val = PS_Conv_ToFixed( &cur, limit, 3 ); |
1120 val = PS_Conv_ToFixed( &cur, limit, 3 ); |
|
1121 FT_TRACE4(( " %f", (double)val / 65536 / 1000 )); |
1111 goto Store_Integer; |
1122 goto Store_Integer; |
1112 |
1123 |
1113 case T1_FIELD_TYPE_INTEGER: |
1124 case T1_FIELD_TYPE_INTEGER: |
1114 val = PS_Conv_ToInt( &cur, limit ); |
1125 val = PS_Conv_ToInt( &cur, limit ); |
|
1126 FT_TRACE4(( " %ld", val )); |
1115 /* fall through */ |
1127 /* fall through */ |
1116 |
1128 |
1117 Store_Integer: |
1129 Store_Integer: |
1118 switch ( field->size ) |
1130 switch ( field->size ) |
1119 { |
1131 { |
1186 goto Exit; |
1198 goto Exit; |
1187 |
1199 |
1188 FT_MEM_COPY( string, cur, len ); |
1200 FT_MEM_COPY( string, cur, len ); |
1189 string[len] = 0; |
1201 string[len] = 0; |
1190 |
1202 |
|
1203 #ifdef FT_DEBUG_LEVEL_TRACE |
|
1204 if ( token.type == T1_TOKEN_TYPE_STRING ) |
|
1205 FT_TRACE4(( " (%s)", string )); |
|
1206 else |
|
1207 FT_TRACE4(( " /%s", string )); |
|
1208 #endif |
|
1209 |
1191 *(FT_String**)q = string; |
1210 *(FT_String**)q = string; |
1192 } |
1211 } |
1193 break; |
1212 break; |
1194 |
1213 |
1195 case T1_FIELD_TYPE_BBOX: |
1214 case T1_FIELD_TYPE_BBOX: |
1211 |
1230 |
1212 bbox->xMin = FT_RoundFix( temp[0] ); |
1231 bbox->xMin = FT_RoundFix( temp[0] ); |
1213 bbox->yMin = FT_RoundFix( temp[1] ); |
1232 bbox->yMin = FT_RoundFix( temp[1] ); |
1214 bbox->xMax = FT_RoundFix( temp[2] ); |
1233 bbox->xMax = FT_RoundFix( temp[2] ); |
1215 bbox->yMax = FT_RoundFix( temp[3] ); |
1234 bbox->yMax = FT_RoundFix( temp[3] ); |
|
1235 |
|
1236 FT_TRACE4(( " [%d %d %d %d]", |
|
1237 bbox->xMin / 65536, |
|
1238 bbox->yMin / 65536, |
|
1239 bbox->xMax / 65536, |
|
1240 bbox->yMax / 65536 )); |
1216 } |
1241 } |
1217 break; |
1242 break; |
1218 |
1243 |
1219 case T1_FIELD_TYPE_MM_BBOX: |
1244 case T1_FIELD_TYPE_MM_BBOX: |
1220 { |
1245 { |
1249 } |
1274 } |
1250 |
1275 |
1251 skip_spaces( &cur, limit ); |
1276 skip_spaces( &cur, limit ); |
1252 } |
1277 } |
1253 |
1278 |
|
1279 FT_TRACE4(( " [" )); |
1254 for ( i = 0; i < max_objects; i++ ) |
1280 for ( i = 0; i < max_objects; i++ ) |
1255 { |
1281 { |
1256 FT_BBox* bbox = (FT_BBox*)objects[i]; |
1282 FT_BBox* bbox = (FT_BBox*)objects[i]; |
1257 |
1283 |
1258 |
1284 |
1259 bbox->xMin = FT_RoundFix( temp[i ] ); |
1285 bbox->xMin = FT_RoundFix( temp[i ] ); |
1260 bbox->yMin = FT_RoundFix( temp[i + max_objects] ); |
1286 bbox->yMin = FT_RoundFix( temp[i + max_objects] ); |
1261 bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] ); |
1287 bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] ); |
1262 bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] ); |
1288 bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] ); |
|
1289 |
|
1290 FT_TRACE4(( " [%d %d %d %d]", |
|
1291 bbox->xMin / 65536, |
|
1292 bbox->yMin / 65536, |
|
1293 bbox->xMax / 65536, |
|
1294 bbox->yMax / 65536 )); |
1263 } |
1295 } |
|
1296 FT_TRACE4(( "]" )); |
1264 |
1297 |
1265 FT_FREE( temp ); |
1298 FT_FREE( temp ); |
1266 } |
1299 } |
1267 break; |
1300 break; |
1268 |
1301 |
1331 /* we further assume that `count_offset' can't be zero */ |
1364 /* we further assume that `count_offset' can't be zero */ |
1332 if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 ) |
1365 if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 ) |
1333 *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) = |
1366 *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) = |
1334 (FT_Byte)num_elements; |
1367 (FT_Byte)num_elements; |
1335 |
1368 |
|
1369 FT_TRACE4(( " [" )); |
|
1370 |
1336 /* we now load each element, adjusting the field.offset on each one */ |
1371 /* we now load each element, adjusting the field.offset on each one */ |
1337 token = elements; |
1372 token = elements; |
1338 for ( ; num_elements > 0; num_elements--, token++ ) |
1373 for ( ; num_elements > 0; num_elements--, token++ ) |
1339 { |
1374 { |
1340 parser->cursor = token->start; |
1375 parser->cursor = token->start; |
1408 *pnum_bytes = PS_Conv_ASCIIHexDecode( &cur, |
1445 *pnum_bytes = PS_Conv_ASCIIHexDecode( &cur, |
1409 parser->limit, |
1446 parser->limit, |
1410 bytes, |
1447 bytes, |
1411 max_bytes ); |
1448 max_bytes ); |
1412 |
1449 |
|
1450 parser->cursor = cur; |
|
1451 |
1413 if ( delimiters ) |
1452 if ( delimiters ) |
1414 { |
1453 { |
1415 if ( cur < parser->limit && *cur != '>' ) |
1454 if ( cur < parser->limit && *cur != '>' ) |
1416 { |
1455 { |
1417 FT_ERROR(( "ps_parser_to_bytes: Missing closing delimiter `>'\n" )); |
1456 FT_ERROR(( "ps_parser_to_bytes: Missing closing delimiter `>'\n" )); |
1418 error = FT_THROW( Invalid_File_Format ); |
1457 error = FT_THROW( Invalid_File_Format ); |
1419 goto Exit; |
1458 goto Exit; |
1420 } |
1459 } |
1421 |
1460 |
1422 cur++; |
1461 parser->cursor++; |
1423 } |
1462 } |
1424 |
|
1425 parser->cursor = cur; |
|
1426 |
1463 |
1427 Exit: |
1464 Exit: |
1428 return error; |
1465 return error; |
1429 } |
1466 } |
1430 |
1467 |
1507 /***** T1 BUILDER *****/ |
1544 /***** T1 BUILDER *****/ |
1508 /***** *****/ |
1545 /***** *****/ |
1509 /*************************************************************************/ |
1546 /*************************************************************************/ |
1510 /*************************************************************************/ |
1547 /*************************************************************************/ |
1511 |
1548 |
1512 /*************************************************************************/ |
1549 /************************************************************************** |
1513 /* */ |
1550 * |
1514 /* <Function> */ |
1551 * @Function: |
1515 /* t1_builder_init */ |
1552 * t1_builder_init |
1516 /* */ |
1553 * |
1517 /* <Description> */ |
1554 * @Description: |
1518 /* Initializes a given glyph builder. */ |
1555 * Initializes a given glyph builder. |
1519 /* */ |
1556 * |
1520 /* <InOut> */ |
1557 * @InOut: |
1521 /* builder :: A pointer to the glyph builder to initialize. */ |
1558 * builder :: |
1522 /* */ |
1559 * A pointer to the glyph builder to initialize. |
1523 /* <Input> */ |
1560 * |
1524 /* face :: The current face object. */ |
1561 * @Input: |
1525 /* */ |
1562 * face :: |
1526 /* size :: The current size object. */ |
1563 * The current face object. |
1527 /* */ |
1564 * |
1528 /* glyph :: The current glyph object. */ |
1565 * size :: |
1529 /* */ |
1566 * The current size object. |
1530 /* hinting :: Whether hinting should be applied. */ |
1567 * |
1531 /* */ |
1568 * glyph :: |
|
1569 * The current glyph object. |
|
1570 * |
|
1571 * hinting :: |
|
1572 * Whether hinting should be applied. |
|
1573 */ |
1532 FT_LOCAL_DEF( void ) |
1574 FT_LOCAL_DEF( void ) |
1533 t1_builder_init( T1_Builder builder, |
1575 t1_builder_init( T1_Builder builder, |
1534 FT_Face face, |
1576 FT_Face face, |
1535 FT_Size size, |
1577 FT_Size size, |
1536 FT_GlyphSlot glyph, |
1578 FT_GlyphSlot glyph, |
1570 |
1612 |
1571 builder->funcs = t1_builder_funcs; |
1613 builder->funcs = t1_builder_funcs; |
1572 } |
1614 } |
1573 |
1615 |
1574 |
1616 |
1575 /*************************************************************************/ |
1617 /************************************************************************** |
1576 /* */ |
1618 * |
1577 /* <Function> */ |
1619 * @Function: |
1578 /* t1_builder_done */ |
1620 * t1_builder_done |
1579 /* */ |
1621 * |
1580 /* <Description> */ |
1622 * @Description: |
1581 /* Finalizes a given glyph builder. Its contents can still be used */ |
1623 * Finalizes a given glyph builder. Its contents can still be used |
1582 /* after the call, but the function saves important information */ |
1624 * after the call, but the function saves important information |
1583 /* within the corresponding glyph slot. */ |
1625 * within the corresponding glyph slot. |
1584 /* */ |
1626 * |
1585 /* <Input> */ |
1627 * @Input: |
1586 /* builder :: A pointer to the glyph builder to finalize. */ |
1628 * builder :: |
1587 /* */ |
1629 * A pointer to the glyph builder to finalize. |
|
1630 */ |
1588 FT_LOCAL_DEF( void ) |
1631 FT_LOCAL_DEF( void ) |
1589 t1_builder_done( T1_Builder builder ) |
1632 t1_builder_done( T1_Builder builder ) |
1590 { |
1633 { |
1591 FT_GlyphSlot glyph = builder->glyph; |
1634 FT_GlyphSlot glyph = builder->glyph; |
1592 |
1635 |
1767 /***** *****/ |
1810 /***** *****/ |
1768 /*************************************************************************/ |
1811 /*************************************************************************/ |
1769 /*************************************************************************/ |
1812 /*************************************************************************/ |
1770 |
1813 |
1771 |
1814 |
1772 /*************************************************************************/ |
1815 /************************************************************************** |
1773 /* */ |
1816 * |
1774 /* <Function> */ |
1817 * @Function: |
1775 /* cff_builder_init */ |
1818 * cff_builder_init |
1776 /* */ |
1819 * |
1777 /* <Description> */ |
1820 * @Description: |
1778 /* Initializes a given glyph builder. */ |
1821 * Initializes a given glyph builder. |
1779 /* */ |
1822 * |
1780 /* <InOut> */ |
1823 * @InOut: |
1781 /* builder :: A pointer to the glyph builder to initialize. */ |
1824 * builder :: |
1782 /* */ |
1825 * A pointer to the glyph builder to initialize. |
1783 /* <Input> */ |
1826 * |
1784 /* face :: The current face object. */ |
1827 * @Input: |
1785 /* */ |
1828 * face :: |
1786 /* size :: The current size object. */ |
1829 * The current face object. |
1787 /* */ |
1830 * |
1788 /* glyph :: The current glyph object. */ |
1831 * size :: |
1789 /* */ |
1832 * The current size object. |
1790 /* hinting :: Whether hinting is active. */ |
1833 * |
1791 /* */ |
1834 * glyph :: |
|
1835 * The current glyph object. |
|
1836 * |
|
1837 * hinting :: |
|
1838 * Whether hinting is active. |
|
1839 */ |
1792 FT_LOCAL_DEF( void ) |
1840 FT_LOCAL_DEF( void ) |
1793 cff_builder_init( CFF_Builder* builder, |
1841 cff_builder_init( CFF_Builder* builder, |
1794 TT_Face face, |
1842 TT_Face face, |
1795 CFF_Size size, |
1843 CFF_Size size, |
1796 CFF_GlyphSlot glyph, |
1844 CFF_GlyphSlot glyph, |
1839 |
1887 |
1840 builder->funcs = cff_builder_funcs; |
1888 builder->funcs = cff_builder_funcs; |
1841 } |
1889 } |
1842 |
1890 |
1843 |
1891 |
1844 /*************************************************************************/ |
1892 /************************************************************************** |
1845 /* */ |
1893 * |
1846 /* <Function> */ |
1894 * @Function: |
1847 /* cff_builder_done */ |
1895 * cff_builder_done |
1848 /* */ |
1896 * |
1849 /* <Description> */ |
1897 * @Description: |
1850 /* Finalizes a given glyph builder. Its contents can still be used */ |
1898 * Finalizes a given glyph builder. Its contents can still be used |
1851 /* after the call, but the function saves important information */ |
1899 * after the call, but the function saves important information |
1852 /* within the corresponding glyph slot. */ |
1900 * within the corresponding glyph slot. |
1853 /* */ |
1901 * |
1854 /* <Input> */ |
1902 * @Input: |
1855 /* builder :: A pointer to the glyph builder to finalize. */ |
1903 * builder :: |
1856 /* */ |
1904 * A pointer to the glyph builder to finalize. |
|
1905 */ |
1857 FT_LOCAL_DEF( void ) |
1906 FT_LOCAL_DEF( void ) |
1858 cff_builder_done( CFF_Builder* builder ) |
1907 cff_builder_done( CFF_Builder* builder ) |
1859 { |
1908 { |
1860 CFF_GlyphSlot glyph = builder->glyph; |
1909 CFF_GlyphSlot glyph = builder->glyph; |
1861 |
1910 |
1990 if ( !outline ) |
2039 if ( !outline ) |
1991 return; |
2040 return; |
1992 |
2041 |
1993 first = outline->n_contours <= 1 |
2042 first = outline->n_contours <= 1 |
1994 ? 0 : outline->contours[outline->n_contours - 2] + 1; |
2043 ? 0 : outline->contours[outline->n_contours - 2] + 1; |
|
2044 |
|
2045 /* in malformed fonts it can happen that a contour was started */ |
|
2046 /* but no points were added */ |
|
2047 if ( outline->n_contours && first == outline->n_points ) |
|
2048 { |
|
2049 outline->n_contours--; |
|
2050 return; |
|
2051 } |
1995 |
2052 |
1996 /* We must not include the last point in the path if it */ |
2053 /* We must not include the last point in the path if it */ |
1997 /* is located on the first point. */ |
2054 /* is located on the first point. */ |
1998 if ( outline->n_points > 1 ) |
2055 if ( outline->n_points > 1 ) |
1999 { |
2056 { |
2031 /***** PS BUILDER *****/ |
2088 /***** PS BUILDER *****/ |
2032 /***** *****/ |
2089 /***** *****/ |
2033 /*************************************************************************/ |
2090 /*************************************************************************/ |
2034 /*************************************************************************/ |
2091 /*************************************************************************/ |
2035 |
2092 |
2036 /*************************************************************************/ |
2093 /************************************************************************** |
2037 /* */ |
2094 * |
2038 /* <Function> */ |
2095 * @Function: |
2039 /* ps_builder_init */ |
2096 * ps_builder_init |
2040 /* */ |
2097 * |
2041 /* <Description> */ |
2098 * @Description: |
2042 /* Initializes a given glyph builder. */ |
2099 * Initializes a given glyph builder. |
2043 /* */ |
2100 * |
2044 /* <InOut> */ |
2101 * @InOut: |
2045 /* builder :: A pointer to the glyph builder to initialize. */ |
2102 * builder :: |
2046 /* */ |
2103 * A pointer to the glyph builder to initialize. |
2047 /* <Input> */ |
2104 * |
2048 /* face :: The current face object. */ |
2105 * @Input: |
2049 /* */ |
2106 * face :: |
2050 /* size :: The current size object. */ |
2107 * The current face object. |
2051 /* */ |
2108 * |
2052 /* glyph :: The current glyph object. */ |
2109 * size :: |
2053 /* */ |
2110 * The current size object. |
2054 /* hinting :: Whether hinting should be applied. */ |
2111 * |
2055 /* */ |
2112 * glyph :: |
|
2113 * The current glyph object. |
|
2114 * |
|
2115 * hinting :: |
|
2116 * Whether hinting should be applied. |
|
2117 */ |
2056 FT_LOCAL_DEF( void ) |
2118 FT_LOCAL_DEF( void ) |
2057 ps_builder_init( PS_Builder* ps_builder, |
2119 ps_builder_init( PS_Builder* ps_builder, |
2058 void* builder, |
2120 void* builder, |
2059 FT_Bool is_t1 ) |
2121 FT_Bool is_t1 ) |
2060 { |
2122 { |
2114 ps_builder->is_t1 = is_t1; |
2176 ps_builder->is_t1 = is_t1; |
2115 ps_builder->funcs = ps_builder_funcs; |
2177 ps_builder->funcs = ps_builder_funcs; |
2116 } |
2178 } |
2117 |
2179 |
2118 |
2180 |
2119 /*************************************************************************/ |
2181 /************************************************************************** |
2120 /* */ |
2182 * |
2121 /* <Function> */ |
2183 * @Function: |
2122 /* ps_builder_done */ |
2184 * ps_builder_done |
2123 /* */ |
2185 * |
2124 /* <Description> */ |
2186 * @Description: |
2125 /* Finalizes a given glyph builder. Its contents can still be used */ |
2187 * Finalizes a given glyph builder. Its contents can still be used |
2126 /* after the call, but the function saves important information */ |
2188 * after the call, but the function saves important information |
2127 /* within the corresponding glyph slot. */ |
2189 * within the corresponding glyph slot. |
2128 /* */ |
2190 * |
2129 /* <Input> */ |
2191 * @Input: |
2130 /* builder :: A pointer to the glyph builder to finalize. */ |
2192 * builder :: |
2131 /* */ |
2193 * A pointer to the glyph builder to finalize. |
|
2194 */ |
2132 FT_LOCAL_DEF( void ) |
2195 FT_LOCAL_DEF( void ) |
2133 ps_builder_done( PS_Builder* builder ) |
2196 ps_builder_done( PS_Builder* builder ) |
2134 { |
2197 { |
2135 CFF_GlyphSlot glyph = builder->glyph; |
2198 CFF_GlyphSlot glyph = builder->glyph; |
2136 |
2199 |
2334 /***** *****/ |
2397 /***** *****/ |
2335 /*************************************************************************/ |
2398 /*************************************************************************/ |
2336 /*************************************************************************/ |
2399 /*************************************************************************/ |
2337 |
2400 |
2338 |
2401 |
2339 /*************************************************************************/ |
2402 /************************************************************************** |
2340 /* */ |
2403 * |
2341 /* <Function> */ |
2404 * @Function: |
2342 /* ps_decoder_init */ |
2405 * ps_decoder_init |
2343 /* */ |
2406 * |
2344 /* <Description> */ |
2407 * @Description: |
2345 /* Creates a wrapper decoder for use in the combined */ |
2408 * Creates a wrapper decoder for use in the combined |
2346 /* Type 1 / CFF interpreter. */ |
2409 * Type 1 / CFF interpreter. |
2347 /* */ |
2410 * |
2348 /* <InOut> */ |
2411 * @InOut: |
2349 /* ps_decoder :: A pointer to the decoder to initialize. */ |
2412 * ps_decoder :: |
2350 /* */ |
2413 * A pointer to the decoder to initialize. |
2351 /* <Input> */ |
2414 * |
2352 /* decoder :: A pointer to the original decoder. */ |
2415 * @Input: |
2353 /* */ |
2416 * decoder :: |
2354 /* is_t1 :: Flag indicating Type 1 or CFF */ |
2417 * A pointer to the original decoder. |
2355 /* */ |
2418 * |
|
2419 * is_t1 :: |
|
2420 * Flag indicating Type 1 or CFF |
|
2421 */ |
2356 FT_LOCAL_DEF( void ) |
2422 FT_LOCAL_DEF( void ) |
2357 ps_decoder_init( PS_Decoder* ps_decoder, |
2423 ps_decoder_init( PS_Decoder* ps_decoder, |
2358 void* decoder, |
2424 void* decoder, |
2359 FT_Bool is_t1 ) |
2425 FT_Bool is_t1 ) |
2360 { |
2426 { |