File Coverage

src/pdfmake_font_std14.c
Criterion Covered Total %
statement 17 18 94.4
branch 9 12 75.0
condition n/a
subroutine n/a
pod n/a
total 26 30 86.6


line stmt bran cond sub pod time code
1             /*
2             * pdfmake_font_std14.c - Standard 14 font metrics (AFM data)
3             *
4             * Width data extracted from Adobe Core 14 AFM files (public domain).
5             * All widths in units of 1/1000 em.
6             *
7             * Reference: Adobe Core Font AFM specification
8             */
9              
10             #include "pdfmake_font.h"
11             #include
12             #include /* strcasecmp */
13              
14             /*============================================================================
15             * Helvetica widths (WinAnsi encoding subset)
16             *==========================================================================*/
17              
18             static const pdfmake_std14_width_t helvetica_widths[] = {
19             {32, 278}, {33, 278}, {34, 355}, {35, 556}, {36, 556}, {37, 889}, {38, 667}, {39, 191},
20             {40, 333}, {41, 333}, {42, 389}, {43, 584}, {44, 278}, {45, 333}, {46, 278}, {47, 278},
21             {48, 556}, {49, 556}, {50, 556}, {51, 556}, {52, 556}, {53, 556}, {54, 556}, {55, 556},
22             {56, 556}, {57, 556}, {58, 278}, {59, 278}, {60, 584}, {61, 584}, {62, 584}, {63, 556},
23             {64, 1015}, {65, 667}, {66, 667}, {67, 722}, {68, 722}, {69, 667}, {70, 611}, {71, 778},
24             {72, 722}, {73, 278}, {74, 500}, {75, 667}, {76, 556}, {77, 833}, {78, 722}, {79, 778},
25             {80, 667}, {81, 778}, {82, 722}, {83, 667}, {84, 611}, {85, 722}, {86, 667}, {87, 944},
26             {88, 667}, {89, 667}, {90, 611}, {91, 278}, {92, 278}, {93, 278}, {94, 469}, {95, 556},
27             {96, 333}, {97, 556}, {98, 556}, {99, 500}, {100, 556}, {101, 556}, {102, 278}, {103, 556},
28             {104, 556}, {105, 222}, {106, 222}, {107, 500}, {108, 222}, {109, 833}, {110, 556}, {111, 556},
29             {112, 556}, {113, 556}, {114, 333}, {115, 500}, {116, 278}, {117, 556}, {118, 500}, {119, 722},
30             {120, 500}, {121, 500}, {122, 500}, {123, 334}, {124, 260}, {125, 334}, {126, 584},
31             /* Extended Latin */
32             {160, 278}, {161, 333}, {162, 556}, {163, 556}, {164, 556}, {165, 556}, {166, 260},
33             {167, 556}, {168, 333}, {169, 737}, {170, 370}, {171, 556}, {172, 584}, {173, 333},
34             {174, 737}, {175, 333}, {176, 400}, {177, 584}, {178, 333}, {179, 333}, {180, 333},
35             {181, 556}, {182, 537}, {183, 278}, {184, 333}, {185, 333}, {186, 365}, {187, 556},
36             {188, 834}, {189, 834}, {190, 834}, {191, 611}, {192, 667}, {193, 667}, {194, 667},
37             {195, 667}, {196, 667}, {197, 667}, {198, 1000}, {199, 722}, {200, 667}, {201, 667},
38             {202, 667}, {203, 667}, {204, 278}, {205, 278}, {206, 278}, {207, 278}, {208, 722},
39             {209, 722}, {210, 778}, {211, 778}, {212, 778}, {213, 778}, {214, 778}, {215, 584},
40             {216, 778}, {217, 722}, {218, 722}, {219, 722}, {220, 722}, {221, 667}, {222, 667},
41             {223, 611}, {224, 556}, {225, 556}, {226, 556}, {227, 556}, {228, 556}, {229, 556},
42             {230, 889}, {231, 500}, {232, 556}, {233, 556}, {234, 556}, {235, 556}, {236, 278},
43             {237, 278}, {238, 278}, {239, 278}, {240, 556}, {241, 556}, {242, 556}, {243, 556},
44             {244, 556}, {245, 556}, {246, 556}, {247, 584}, {248, 611}, {249, 556}, {250, 556},
45             {251, 556}, {252, 556}, {253, 500}, {254, 556}, {255, 500},
46             };
47              
48             static const pdfmake_std14_data_t std14_helvetica = {
49             .name = "Helvetica",
50             .widths = helvetica_widths,
51             .width_count = sizeof(helvetica_widths) / sizeof(helvetica_widths[0]),
52             .metrics = {
53             .ascent = 718,
54             .descent = -207,
55             .cap_height = 718,
56             .x_height = 523,
57             .stem_v = 88,
58             .stem_h = 76,
59             .italic_angle = 0,
60             .bbox = {-166, -225, 1000, 931},
61             .flags = PDFMAKE_FONT_FLAG_NONSYMBOLIC
62             }
63             };
64              
65             /*============================================================================
66             * Helvetica-Bold widths
67             *==========================================================================*/
68              
69             static const pdfmake_std14_width_t helvetica_bold_widths[] = {
70             {32, 278}, {33, 333}, {34, 474}, {35, 556}, {36, 556}, {37, 889}, {38, 722}, {39, 238},
71             {40, 333}, {41, 333}, {42, 389}, {43, 584}, {44, 278}, {45, 333}, {46, 278}, {47, 278},
72             {48, 556}, {49, 556}, {50, 556}, {51, 556}, {52, 556}, {53, 556}, {54, 556}, {55, 556},
73             {56, 556}, {57, 556}, {58, 333}, {59, 333}, {60, 584}, {61, 584}, {62, 584}, {63, 611},
74             {64, 975}, {65, 722}, {66, 722}, {67, 722}, {68, 722}, {69, 667}, {70, 611}, {71, 778},
75             {72, 722}, {73, 278}, {74, 556}, {75, 722}, {76, 611}, {77, 833}, {78, 722}, {79, 778},
76             {80, 667}, {81, 778}, {82, 722}, {83, 667}, {84, 611}, {85, 722}, {86, 667}, {87, 944},
77             {88, 667}, {89, 667}, {90, 611}, {91, 333}, {92, 278}, {93, 333}, {94, 584}, {95, 556},
78             {96, 333}, {97, 556}, {98, 611}, {99, 556}, {100, 611}, {101, 556}, {102, 333}, {103, 611},
79             {104, 611}, {105, 278}, {106, 278}, {107, 556}, {108, 278}, {109, 889}, {110, 611}, {111, 611},
80             {112, 611}, {113, 611}, {114, 389}, {115, 556}, {116, 333}, {117, 611}, {118, 556}, {119, 778},
81             {120, 556}, {121, 556}, {122, 500}, {123, 389}, {124, 280}, {125, 389}, {126, 584},
82             /* Extended Latin */
83             {160, 278}, {161, 333}, {162, 556}, {163, 556}, {164, 556}, {165, 556}, {166, 280},
84             {167, 556}, {168, 333}, {169, 737}, {170, 370}, {171, 556}, {172, 584}, {173, 333},
85             {174, 737}, {175, 333}, {176, 400}, {177, 584}, {178, 333}, {179, 333}, {180, 333},
86             {181, 611}, {182, 556}, {183, 278}, {184, 333}, {185, 333}, {186, 365}, {187, 556},
87             {188, 834}, {189, 834}, {190, 834}, {191, 611}, {192, 722}, {193, 722}, {194, 722},
88             {195, 722}, {196, 722}, {197, 722}, {198, 1000}, {199, 722}, {200, 667}, {201, 667},
89             {202, 667}, {203, 667}, {204, 278}, {205, 278}, {206, 278}, {207, 278}, {208, 722},
90             {209, 722}, {210, 778}, {211, 778}, {212, 778}, {213, 778}, {214, 778}, {215, 584},
91             {216, 778}, {217, 722}, {218, 722}, {219, 722}, {220, 722}, {221, 667}, {222, 667},
92             {223, 611}, {224, 556}, {225, 556}, {226, 556}, {227, 556}, {228, 556}, {229, 556},
93             {230, 889}, {231, 556}, {232, 556}, {233, 556}, {234, 556}, {235, 556}, {236, 278},
94             {237, 278}, {238, 278}, {239, 278}, {240, 611}, {241, 611}, {242, 611}, {243, 611},
95             {244, 611}, {245, 611}, {246, 611}, {247, 584}, {248, 611}, {249, 611}, {250, 611},
96             {251, 611}, {252, 611}, {253, 556}, {254, 611}, {255, 556},
97             };
98              
99             static const pdfmake_std14_data_t std14_helvetica_bold = {
100             .name = "Helvetica-Bold",
101             .widths = helvetica_bold_widths,
102             .width_count = sizeof(helvetica_bold_widths) / sizeof(helvetica_bold_widths[0]),
103             .metrics = {
104             .ascent = 718,
105             .descent = -207,
106             .cap_height = 718,
107             .x_height = 532,
108             .stem_v = 140,
109             .stem_h = 118,
110             .italic_angle = 0,
111             .bbox = {-170, -228, 1003, 962},
112             .flags = PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_FORCE_BOLD
113             }
114             };
115              
116             /*============================================================================
117             * Helvetica-Oblique widths (same as Helvetica)
118             *==========================================================================*/
119              
120             static const pdfmake_std14_data_t std14_helvetica_oblique = {
121             .name = "Helvetica-Oblique",
122             .widths = helvetica_widths,
123             .width_count = sizeof(helvetica_widths) / sizeof(helvetica_widths[0]),
124             .metrics = {
125             .ascent = 718,
126             .descent = -207,
127             .cap_height = 718,
128             .x_height = 523,
129             .stem_v = 88,
130             .stem_h = 76,
131             .italic_angle = -12,
132             .bbox = {-170, -225, 1116, 931},
133             .flags = PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_ITALIC
134             }
135             };
136              
137             /*============================================================================
138             * Helvetica-BoldOblique widths (same as Helvetica-Bold)
139             *==========================================================================*/
140              
141             static const pdfmake_std14_data_t std14_helvetica_boldoblique = {
142             .name = "Helvetica-BoldOblique",
143             .widths = helvetica_bold_widths,
144             .width_count = sizeof(helvetica_bold_widths) / sizeof(helvetica_bold_widths[0]),
145             .metrics = {
146             .ascent = 718,
147             .descent = -207,
148             .cap_height = 718,
149             .x_height = 532,
150             .stem_v = 140,
151             .stem_h = 118,
152             .italic_angle = -12,
153             .bbox = {-174, -228, 1114, 962},
154             .flags = PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_ITALIC | PDFMAKE_FONT_FLAG_FORCE_BOLD
155             }
156             };
157              
158             /*============================================================================
159             * Times-Roman widths
160             *==========================================================================*/
161              
162             static const pdfmake_std14_width_t times_roman_widths[] = {
163             {32, 250}, {33, 333}, {34, 408}, {35, 500}, {36, 500}, {37, 833}, {38, 778}, {39, 180},
164             {40, 333}, {41, 333}, {42, 500}, {43, 564}, {44, 250}, {45, 333}, {46, 250}, {47, 278},
165             {48, 500}, {49, 500}, {50, 500}, {51, 500}, {52, 500}, {53, 500}, {54, 500}, {55, 500},
166             {56, 500}, {57, 500}, {58, 278}, {59, 278}, {60, 564}, {61, 564}, {62, 564}, {63, 444},
167             {64, 921}, {65, 722}, {66, 667}, {67, 667}, {68, 722}, {69, 611}, {70, 556}, {71, 722},
168             {72, 722}, {73, 333}, {74, 389}, {75, 722}, {76, 611}, {77, 889}, {78, 722}, {79, 722},
169             {80, 556}, {81, 722}, {82, 667}, {83, 556}, {84, 611}, {85, 722}, {86, 722}, {87, 944},
170             {88, 722}, {89, 722}, {90, 611}, {91, 333}, {92, 278}, {93, 333}, {94, 469}, {95, 500},
171             {96, 333}, {97, 444}, {98, 500}, {99, 444}, {100, 500}, {101, 444}, {102, 333}, {103, 500},
172             {104, 500}, {105, 278}, {106, 278}, {107, 500}, {108, 278}, {109, 778}, {110, 500}, {111, 500},
173             {112, 500}, {113, 500}, {114, 333}, {115, 389}, {116, 278}, {117, 500}, {118, 500}, {119, 722},
174             {120, 500}, {121, 500}, {122, 444}, {123, 480}, {124, 200}, {125, 480}, {126, 541},
175             /* Extended Latin */
176             {160, 250}, {161, 333}, {162, 500}, {163, 500}, {164, 500}, {165, 500}, {166, 200},
177             {167, 500}, {168, 333}, {169, 760}, {170, 276}, {171, 500}, {172, 564}, {173, 333},
178             {174, 760}, {175, 333}, {176, 400}, {177, 564}, {178, 300}, {179, 300}, {180, 333},
179             {181, 500}, {182, 453}, {183, 250}, {184, 333}, {185, 300}, {186, 310}, {187, 500},
180             {188, 750}, {189, 750}, {190, 750}, {191, 444}, {192, 722}, {193, 722}, {194, 722},
181             {195, 722}, {196, 722}, {197, 722}, {198, 889}, {199, 667}, {200, 611}, {201, 611},
182             {202, 611}, {203, 611}, {204, 333}, {205, 333}, {206, 333}, {207, 333}, {208, 722},
183             {209, 722}, {210, 722}, {211, 722}, {212, 722}, {213, 722}, {214, 722}, {215, 564},
184             {216, 722}, {217, 722}, {218, 722}, {219, 722}, {220, 722}, {221, 722}, {222, 556},
185             {223, 500}, {224, 444}, {225, 444}, {226, 444}, {227, 444}, {228, 444}, {229, 444},
186             {230, 667}, {231, 444}, {232, 444}, {233, 444}, {234, 444}, {235, 444}, {236, 278},
187             {237, 278}, {238, 278}, {239, 278}, {240, 500}, {241, 500}, {242, 500}, {243, 500},
188             {244, 500}, {245, 500}, {246, 500}, {247, 564}, {248, 500}, {249, 500}, {250, 500},
189             {251, 500}, {252, 500}, {253, 500}, {254, 500}, {255, 500},
190             };
191              
192             static const pdfmake_std14_data_t std14_times_roman = {
193             .name = "Times-Roman",
194             .widths = times_roman_widths,
195             .width_count = sizeof(times_roman_widths) / sizeof(times_roman_widths[0]),
196             .metrics = {
197             .ascent = 683,
198             .descent = -217,
199             .cap_height = 662,
200             .x_height = 450,
201             .stem_v = 84,
202             .stem_h = 28,
203             .italic_angle = 0,
204             .bbox = {-168, -218, 1000, 898},
205             .flags = PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_SERIF
206             }
207             };
208              
209             /*============================================================================
210             * Times-Bold widths
211             *==========================================================================*/
212              
213             static const pdfmake_std14_width_t times_bold_widths[] = {
214             {32, 250}, {33, 333}, {34, 555}, {35, 500}, {36, 500}, {37, 1000}, {38, 833}, {39, 278},
215             {40, 333}, {41, 333}, {42, 500}, {43, 570}, {44, 250}, {45, 333}, {46, 250}, {47, 278},
216             {48, 500}, {49, 500}, {50, 500}, {51, 500}, {52, 500}, {53, 500}, {54, 500}, {55, 500},
217             {56, 500}, {57, 500}, {58, 333}, {59, 333}, {60, 570}, {61, 570}, {62, 570}, {63, 500},
218             {64, 930}, {65, 722}, {66, 667}, {67, 722}, {68, 722}, {69, 667}, {70, 611}, {71, 778},
219             {72, 778}, {73, 389}, {74, 500}, {75, 778}, {76, 667}, {77, 944}, {78, 722}, {79, 778},
220             {80, 611}, {81, 778}, {82, 722}, {83, 556}, {84, 667}, {85, 722}, {86, 722}, {87, 1000},
221             {88, 722}, {89, 722}, {90, 667}, {91, 333}, {92, 278}, {93, 333}, {94, 581}, {95, 500},
222             {96, 333}, {97, 500}, {98, 556}, {99, 444}, {100, 556}, {101, 444}, {102, 333}, {103, 500},
223             {104, 556}, {105, 278}, {106, 333}, {107, 556}, {108, 278}, {109, 833}, {110, 556}, {111, 500},
224             {112, 556}, {113, 556}, {114, 444}, {115, 389}, {116, 333}, {117, 556}, {118, 500}, {119, 722},
225             {120, 500}, {121, 500}, {122, 444}, {123, 394}, {124, 220}, {125, 394}, {126, 520},
226             /* Extended Latin */
227             {160, 250}, {161, 333}, {162, 500}, {163, 500}, {164, 500}, {165, 500}, {166, 220},
228             {167, 500}, {168, 333}, {169, 747}, {170, 300}, {171, 500}, {172, 570}, {173, 333},
229             {174, 747}, {175, 333}, {176, 400}, {177, 570}, {178, 300}, {179, 300}, {180, 333},
230             {181, 556}, {182, 540}, {183, 250}, {184, 333}, {185, 300}, {186, 330}, {187, 500},
231             {188, 750}, {189, 750}, {190, 750}, {191, 500}, {192, 722}, {193, 722}, {194, 722},
232             {195, 722}, {196, 722}, {197, 722}, {198, 1000}, {199, 722}, {200, 667}, {201, 667},
233             {202, 667}, {203, 667}, {204, 389}, {205, 389}, {206, 389}, {207, 389}, {208, 722},
234             {209, 722}, {210, 778}, {211, 778}, {212, 778}, {213, 778}, {214, 778}, {215, 570},
235             {216, 778}, {217, 722}, {218, 722}, {219, 722}, {220, 722}, {221, 722}, {222, 611},
236             {223, 556}, {224, 500}, {225, 500}, {226, 500}, {227, 500}, {228, 500}, {229, 500},
237             {230, 722}, {231, 444}, {232, 444}, {233, 444}, {234, 444}, {235, 444}, {236, 278},
238             {237, 278}, {238, 278}, {239, 278}, {240, 500}, {241, 556}, {242, 500}, {243, 500},
239             {244, 500}, {245, 500}, {246, 500}, {247, 570}, {248, 500}, {249, 556}, {250, 556},
240             {251, 556}, {252, 556}, {253, 500}, {254, 556}, {255, 500},
241             };
242              
243             static const pdfmake_std14_data_t std14_times_bold = {
244             .name = "Times-Bold",
245             .widths = times_bold_widths,
246             .width_count = sizeof(times_bold_widths) / sizeof(times_bold_widths[0]),
247             .metrics = {
248             .ascent = 683,
249             .descent = -217,
250             .cap_height = 676,
251             .x_height = 461,
252             .stem_v = 139,
253             .stem_h = 44,
254             .italic_angle = 0,
255             .bbox = {-168, -218, 1000, 935},
256             .flags = PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_SERIF | PDFMAKE_FONT_FLAG_FORCE_BOLD
257             }
258             };
259              
260             /*============================================================================
261             * Times-Italic widths
262             *==========================================================================*/
263              
264             static const pdfmake_std14_width_t times_italic_widths[] = {
265             {32, 250}, {33, 333}, {34, 420}, {35, 500}, {36, 500}, {37, 833}, {38, 778}, {39, 214},
266             {40, 333}, {41, 333}, {42, 500}, {43, 675}, {44, 250}, {45, 333}, {46, 250}, {47, 278},
267             {48, 500}, {49, 500}, {50, 500}, {51, 500}, {52, 500}, {53, 500}, {54, 500}, {55, 500},
268             {56, 500}, {57, 500}, {58, 333}, {59, 333}, {60, 675}, {61, 675}, {62, 675}, {63, 500},
269             {64, 920}, {65, 611}, {66, 611}, {67, 667}, {68, 722}, {69, 611}, {70, 611}, {71, 722},
270             {72, 722}, {73, 333}, {74, 444}, {75, 667}, {76, 556}, {77, 833}, {78, 667}, {79, 722},
271             {80, 611}, {81, 722}, {82, 611}, {83, 500}, {84, 556}, {85, 722}, {86, 611}, {87, 833},
272             {88, 611}, {89, 556}, {90, 556}, {91, 389}, {92, 278}, {93, 389}, {94, 422}, {95, 500},
273             {96, 333}, {97, 500}, {98, 500}, {99, 444}, {100, 500}, {101, 444}, {102, 278}, {103, 500},
274             {104, 500}, {105, 278}, {106, 278}, {107, 444}, {108, 278}, {109, 722}, {110, 500}, {111, 500},
275             {112, 500}, {113, 500}, {114, 389}, {115, 389}, {116, 278}, {117, 500}, {118, 444}, {119, 667},
276             {120, 444}, {121, 444}, {122, 389}, {123, 400}, {124, 275}, {125, 400}, {126, 541},
277             /* Extended Latin */
278             {160, 250}, {161, 389}, {162, 500}, {163, 500}, {164, 500}, {165, 500}, {166, 275},
279             {167, 500}, {168, 333}, {169, 760}, {170, 276}, {171, 500}, {172, 675}, {173, 333},
280             {174, 760}, {175, 333}, {176, 400}, {177, 675}, {178, 300}, {179, 300}, {180, 333},
281             {181, 500}, {182, 523}, {183, 250}, {184, 333}, {185, 300}, {186, 310}, {187, 500},
282             {188, 750}, {189, 750}, {190, 750}, {191, 500}, {192, 611}, {193, 611}, {194, 611},
283             {195, 611}, {196, 611}, {197, 611}, {198, 889}, {199, 667}, {200, 611}, {201, 611},
284             {202, 611}, {203, 611}, {204, 333}, {205, 333}, {206, 333}, {207, 333}, {208, 722},
285             {209, 667}, {210, 722}, {211, 722}, {212, 722}, {213, 722}, {214, 722}, {215, 675},
286             {216, 722}, {217, 722}, {218, 722}, {219, 722}, {220, 722}, {221, 556}, {222, 611},
287             {223, 500}, {224, 500}, {225, 500}, {226, 500}, {227, 500}, {228, 500}, {229, 500},
288             {230, 667}, {231, 444}, {232, 444}, {233, 444}, {234, 444}, {235, 444}, {236, 278},
289             {237, 278}, {238, 278}, {239, 278}, {240, 500}, {241, 500}, {242, 500}, {243, 500},
290             {244, 500}, {245, 500}, {246, 500}, {247, 675}, {248, 500}, {249, 500}, {250, 500},
291             {251, 500}, {252, 500}, {253, 444}, {254, 500}, {255, 444},
292             };
293              
294             static const pdfmake_std14_data_t std14_times_italic = {
295             .name = "Times-Italic",
296             .widths = times_italic_widths,
297             .width_count = sizeof(times_italic_widths) / sizeof(times_italic_widths[0]),
298             .metrics = {
299             .ascent = 683,
300             .descent = -217,
301             .cap_height = 653,
302             .x_height = 441,
303             .stem_v = 76,
304             .stem_h = 32,
305             .italic_angle = -15,
306             .bbox = {-169, -217, 1010, 883},
307             .flags = PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_SERIF | PDFMAKE_FONT_FLAG_ITALIC
308             }
309             };
310              
311             /*============================================================================
312             * Times-BoldItalic widths
313             *==========================================================================*/
314              
315             static const pdfmake_std14_width_t times_bolditalic_widths[] = {
316             {32, 250}, {33, 389}, {34, 555}, {35, 500}, {36, 500}, {37, 833}, {38, 778}, {39, 278},
317             {40, 333}, {41, 333}, {42, 500}, {43, 570}, {44, 250}, {45, 333}, {46, 250}, {47, 278},
318             {48, 500}, {49, 500}, {50, 500}, {51, 500}, {52, 500}, {53, 500}, {54, 500}, {55, 500},
319             {56, 500}, {57, 500}, {58, 333}, {59, 333}, {60, 570}, {61, 570}, {62, 570}, {63, 500},
320             {64, 832}, {65, 667}, {66, 667}, {67, 667}, {68, 722}, {69, 667}, {70, 667}, {71, 722},
321             {72, 778}, {73, 389}, {74, 500}, {75, 667}, {76, 611}, {77, 889}, {78, 722}, {79, 722},
322             {80, 611}, {81, 722}, {82, 667}, {83, 556}, {84, 611}, {85, 722}, {86, 667}, {87, 889},
323             {88, 667}, {89, 611}, {90, 611}, {91, 333}, {92, 278}, {93, 333}, {94, 570}, {95, 500},
324             {96, 333}, {97, 500}, {98, 500}, {99, 444}, {100, 500}, {101, 444}, {102, 333}, {103, 500},
325             {104, 556}, {105, 278}, {106, 278}, {107, 500}, {108, 278}, {109, 778}, {110, 556}, {111, 500},
326             {112, 500}, {113, 500}, {114, 389}, {115, 389}, {116, 278}, {117, 556}, {118, 444}, {119, 667},
327             {120, 500}, {121, 444}, {122, 389}, {123, 348}, {124, 220}, {125, 348}, {126, 570},
328             /* Extended Latin */
329             {160, 250}, {161, 389}, {162, 500}, {163, 500}, {164, 500}, {165, 500}, {166, 220},
330             {167, 500}, {168, 333}, {169, 747}, {170, 266}, {171, 500}, {172, 606}, {173, 333},
331             {174, 747}, {175, 333}, {176, 400}, {177, 570}, {178, 300}, {179, 300}, {180, 333},
332             {181, 576}, {182, 500}, {183, 250}, {184, 333}, {185, 300}, {186, 300}, {187, 500},
333             {188, 750}, {189, 750}, {190, 750}, {191, 500}, {192, 667}, {193, 667}, {194, 667},
334             {195, 667}, {196, 667}, {197, 667}, {198, 944}, {199, 667}, {200, 667}, {201, 667},
335             {202, 667}, {203, 667}, {204, 389}, {205, 389}, {206, 389}, {207, 389}, {208, 722},
336             {209, 722}, {210, 722}, {211, 722}, {212, 722}, {213, 722}, {214, 722}, {215, 570},
337             {216, 722}, {217, 722}, {218, 722}, {219, 722}, {220, 722}, {221, 611}, {222, 611},
338             {223, 500}, {224, 500}, {225, 500}, {226, 500}, {227, 500}, {228, 500}, {229, 500},
339             {230, 722}, {231, 444}, {232, 444}, {233, 444}, {234, 444}, {235, 444}, {236, 278},
340             {237, 278}, {238, 278}, {239, 278}, {240, 500}, {241, 556}, {242, 500}, {243, 500},
341             {244, 500}, {245, 500}, {246, 500}, {247, 570}, {248, 500}, {249, 556}, {250, 556},
342             {251, 556}, {252, 556}, {253, 444}, {254, 500}, {255, 444},
343             };
344              
345             static const pdfmake_std14_data_t std14_times_bolditalic = {
346             .name = "Times-BoldItalic",
347             .widths = times_bolditalic_widths,
348             .width_count = sizeof(times_bolditalic_widths) / sizeof(times_bolditalic_widths[0]),
349             .metrics = {
350             .ascent = 683,
351             .descent = -217,
352             .cap_height = 669,
353             .x_height = 462,
354             .stem_v = 121,
355             .stem_h = 42,
356             .italic_angle = -15,
357             .bbox = {-200, -218, 996, 921},
358             .flags = PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_SERIF | PDFMAKE_FONT_FLAG_ITALIC | PDFMAKE_FONT_FLAG_FORCE_BOLD
359             }
360             };
361              
362             /*============================================================================
363             * Courier widths (monospace - all 600)
364             *==========================================================================*/
365              
366             static const pdfmake_std14_width_t courier_widths[] = {
367             {32, 600}, {33, 600}, {34, 600}, {35, 600}, {36, 600}, {37, 600}, {38, 600}, {39, 600},
368             {40, 600}, {41, 600}, {42, 600}, {43, 600}, {44, 600}, {45, 600}, {46, 600}, {47, 600},
369             {48, 600}, {49, 600}, {50, 600}, {51, 600}, {52, 600}, {53, 600}, {54, 600}, {55, 600},
370             {56, 600}, {57, 600}, {58, 600}, {59, 600}, {60, 600}, {61, 600}, {62, 600}, {63, 600},
371             {64, 600}, {65, 600}, {66, 600}, {67, 600}, {68, 600}, {69, 600}, {70, 600}, {71, 600},
372             {72, 600}, {73, 600}, {74, 600}, {75, 600}, {76, 600}, {77, 600}, {78, 600}, {79, 600},
373             {80, 600}, {81, 600}, {82, 600}, {83, 600}, {84, 600}, {85, 600}, {86, 600}, {87, 600},
374             {88, 600}, {89, 600}, {90, 600}, {91, 600}, {92, 600}, {93, 600}, {94, 600}, {95, 600},
375             {96, 600}, {97, 600}, {98, 600}, {99, 600}, {100, 600}, {101, 600}, {102, 600}, {103, 600},
376             {104, 600}, {105, 600}, {106, 600}, {107, 600}, {108, 600}, {109, 600}, {110, 600}, {111, 600},
377             {112, 600}, {113, 600}, {114, 600}, {115, 600}, {116, 600}, {117, 600}, {118, 600}, {119, 600},
378             {120, 600}, {121, 600}, {122, 600}, {123, 600}, {124, 600}, {125, 600}, {126, 600},
379             /* Extended Latin - all 600 */
380             {160, 600}, {161, 600}, {162, 600}, {163, 600}, {164, 600}, {165, 600}, {166, 600},
381             {167, 600}, {168, 600}, {169, 600}, {170, 600}, {171, 600}, {172, 600}, {173, 600},
382             {174, 600}, {175, 600}, {176, 600}, {177, 600}, {178, 600}, {179, 600}, {180, 600},
383             {181, 600}, {182, 600}, {183, 600}, {184, 600}, {185, 600}, {186, 600}, {187, 600},
384             {188, 600}, {189, 600}, {190, 600}, {191, 600}, {192, 600}, {193, 600}, {194, 600},
385             {195, 600}, {196, 600}, {197, 600}, {198, 600}, {199, 600}, {200, 600}, {201, 600},
386             {202, 600}, {203, 600}, {204, 600}, {205, 600}, {206, 600}, {207, 600}, {208, 600},
387             {209, 600}, {210, 600}, {211, 600}, {212, 600}, {213, 600}, {214, 600}, {215, 600},
388             {216, 600}, {217, 600}, {218, 600}, {219, 600}, {220, 600}, {221, 600}, {222, 600},
389             {223, 600}, {224, 600}, {225, 600}, {226, 600}, {227, 600}, {228, 600}, {229, 600},
390             {230, 600}, {231, 600}, {232, 600}, {233, 600}, {234, 600}, {235, 600}, {236, 600},
391             {237, 600}, {238, 600}, {239, 600}, {240, 600}, {241, 600}, {242, 600}, {243, 600},
392             {244, 600}, {245, 600}, {246, 600}, {247, 600}, {248, 600}, {249, 600}, {250, 600},
393             {251, 600}, {252, 600}, {253, 600}, {254, 600}, {255, 600},
394             };
395              
396             static const pdfmake_std14_data_t std14_courier = {
397             .name = "Courier",
398             .widths = courier_widths,
399             .width_count = sizeof(courier_widths) / sizeof(courier_widths[0]),
400             .metrics = {
401             .ascent = 629,
402             .descent = -157,
403             .cap_height = 562,
404             .x_height = 426,
405             .stem_v = 51,
406             .stem_h = 51,
407             .italic_angle = 0,
408             .bbox = {-23, -250, 715, 805},
409             .flags = PDFMAKE_FONT_FLAG_FIXED_PITCH | PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_SERIF
410             }
411             };
412              
413             static const pdfmake_std14_data_t std14_courier_bold = {
414             .name = "Courier-Bold",
415             .widths = courier_widths,
416             .width_count = sizeof(courier_widths) / sizeof(courier_widths[0]),
417             .metrics = {
418             .ascent = 629,
419             .descent = -157,
420             .cap_height = 562,
421             .x_height = 439,
422             .stem_v = 106,
423             .stem_h = 84,
424             .italic_angle = 0,
425             .bbox = {-113, -250, 749, 801},
426             .flags = PDFMAKE_FONT_FLAG_FIXED_PITCH | PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_SERIF | PDFMAKE_FONT_FLAG_FORCE_BOLD
427             }
428             };
429              
430             static const pdfmake_std14_data_t std14_courier_oblique = {
431             .name = "Courier-Oblique",
432             .widths = courier_widths,
433             .width_count = sizeof(courier_widths) / sizeof(courier_widths[0]),
434             .metrics = {
435             .ascent = 629,
436             .descent = -157,
437             .cap_height = 562,
438             .x_height = 426,
439             .stem_v = 51,
440             .stem_h = 51,
441             .italic_angle = -12,
442             .bbox = {-27, -250, 849, 805},
443             .flags = PDFMAKE_FONT_FLAG_FIXED_PITCH | PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_SERIF | PDFMAKE_FONT_FLAG_ITALIC
444             }
445             };
446              
447             static const pdfmake_std14_data_t std14_courier_boldoblique = {
448             .name = "Courier-BoldOblique",
449             .widths = courier_widths,
450             .width_count = sizeof(courier_widths) / sizeof(courier_widths[0]),
451             .metrics = {
452             .ascent = 629,
453             .descent = -157,
454             .cap_height = 562,
455             .x_height = 439,
456             .stem_v = 106,
457             .stem_h = 84,
458             .italic_angle = -12,
459             .bbox = {-57, -250, 869, 801},
460             .flags = PDFMAKE_FONT_FLAG_FIXED_PITCH | PDFMAKE_FONT_FLAG_NONSYMBOLIC | PDFMAKE_FONT_FLAG_SERIF | PDFMAKE_FONT_FLAG_ITALIC | PDFMAKE_FONT_FLAG_FORCE_BOLD
461             }
462             };
463              
464             /*============================================================================
465             * Symbol widths (partial - commonly used symbols)
466             *==========================================================================*/
467              
468             static const pdfmake_std14_width_t symbol_widths[] = {
469             {32, 250}, {33, 333}, {34, 713}, {35, 500}, {36, 549}, {37, 833}, {38, 778}, {39, 439},
470             {40, 333}, {41, 333}, {42, 500}, {43, 549}, {44, 250}, {45, 549}, {46, 250}, {47, 278},
471             {48, 500}, {49, 500}, {50, 500}, {51, 500}, {52, 500}, {53, 500}, {54, 500}, {55, 500},
472             {56, 500}, {57, 500}, {58, 278}, {59, 278}, {60, 549}, {61, 549}, {62, 549}, {63, 444},
473             {64, 549}, {65, 722}, {66, 667}, {67, 722}, {68, 612}, {69, 611}, {70, 763}, {71, 603},
474             {72, 722}, {73, 333}, {74, 631}, {75, 722}, {76, 686}, {77, 889}, {78, 722}, {79, 722},
475             {80, 768}, {81, 741}, {82, 556}, {83, 592}, {84, 611}, {85, 690}, {86, 439}, {87, 768},
476             {88, 645}, {89, 795}, {90, 611}, {91, 333}, {92, 863}, {93, 333}, {94, 658}, {95, 500},
477             {96, 500}, {97, 631}, {98, 549}, {99, 549}, {100, 494}, {101, 439}, {102, 521}, {103, 411},
478             {104, 603}, {105, 329}, {106, 603}, {107, 549}, {108, 549}, {109, 576}, {110, 521}, {111, 549},
479             {112, 549}, {113, 521}, {114, 549}, {115, 603}, {116, 439}, {117, 576}, {118, 713}, {119, 686},
480             {120, 493}, {121, 686}, {122, 494}, {123, 480}, {124, 200}, {125, 480}, {126, 549},
481             };
482              
483             static const pdfmake_std14_data_t std14_symbol = {
484             .name = "Symbol",
485             .widths = symbol_widths,
486             .width_count = sizeof(symbol_widths) / sizeof(symbol_widths[0]),
487             .metrics = {
488             .ascent = 1010,
489             .descent = -293,
490             .cap_height = 1010,
491             .x_height = 520,
492             .stem_v = 92,
493             .stem_h = 85,
494             .italic_angle = 0,
495             .bbox = {-180, -293, 1090, 1010},
496             .flags = PDFMAKE_FONT_FLAG_SYMBOLIC
497             }
498             };
499              
500             /*============================================================================
501             * ZapfDingbats widths (partial - commonly used dingbats)
502             *==========================================================================*/
503              
504             static const pdfmake_std14_width_t zapfdingbats_widths[] = {
505             {32, 278}, {33, 974}, {34, 961}, {35, 974}, {36, 980}, {37, 719}, {38, 789}, {39, 790},
506             {40, 791}, {41, 690}, {42, 960}, {43, 939}, {44, 549}, {45, 855}, {46, 911}, {47, 933},
507             {48, 911}, {49, 945}, {50, 974}, {51, 755}, {52, 846}, {53, 762}, {54, 761}, {55, 571},
508             {56, 677}, {57, 763}, {58, 760}, {59, 759}, {60, 754}, {61, 494}, {62, 552}, {63, 537},
509             {64, 577}, {65, 692}, {66, 786}, {67, 788}, {68, 788}, {69, 790}, {70, 793}, {71, 794},
510             {72, 816}, {73, 823}, {74, 789}, {75, 841}, {76, 823}, {77, 833}, {78, 816}, {79, 831},
511             {80, 923}, {81, 744}, {82, 723}, {83, 749}, {84, 790}, {85, 792}, {86, 695}, {87, 776},
512             {88, 768}, {89, 792}, {90, 759}, {91, 707}, {92, 708}, {93, 682}, {94, 701}, {95, 826},
513             {96, 815}, {97, 789}, {98, 789}, {99, 707}, {100, 687}, {101, 696}, {102, 689}, {103, 786},
514             {104, 787}, {105, 713}, {106, 791}, {107, 785}, {108, 791}, {109, 873}, {110, 761}, {111, 762},
515             {112, 762}, {113, 759}, {114, 759}, {115, 892}, {116, 892}, {117, 788}, {118, 784}, {119, 438},
516             {120, 138}, {121, 277}, {122, 415}, {123, 392}, {124, 392}, {125, 668}, {126, 668},
517             };
518              
519             static const pdfmake_std14_data_t std14_zapfdingbats = {
520             .name = "ZapfDingbats",
521             .widths = zapfdingbats_widths,
522             .width_count = sizeof(zapfdingbats_widths) / sizeof(zapfdingbats_widths[0]),
523             .metrics = {
524             .ascent = 820,
525             .descent = -143,
526             .cap_height = 820,
527             .x_height = 549,
528             .stem_v = 90,
529             .stem_h = 80,
530             .italic_angle = 0,
531             .bbox = {-1, -143, 981, 820},
532             .flags = PDFMAKE_FONT_FLAG_SYMBOLIC
533             }
534             };
535              
536             /*============================================================================
537             * Standard 14 font table
538             *==========================================================================*/
539              
540             static const pdfmake_std14_data_t *std14_fonts[PDFMAKE_STD14_COUNT] = {
541             [PDFMAKE_STD14_TIMES_ROMAN] = &std14_times_roman,
542             [PDFMAKE_STD14_TIMES_BOLD] = &std14_times_bold,
543             [PDFMAKE_STD14_TIMES_ITALIC] = &std14_times_italic,
544             [PDFMAKE_STD14_TIMES_BOLDITALIC] = &std14_times_bolditalic,
545             [PDFMAKE_STD14_HELVETICA] = &std14_helvetica,
546             [PDFMAKE_STD14_HELVETICA_BOLD] = &std14_helvetica_bold,
547             [PDFMAKE_STD14_HELVETICA_OBLIQUE] = &std14_helvetica_oblique,
548             [PDFMAKE_STD14_HELVETICA_BOLDOBLIQUE] = &std14_helvetica_boldoblique,
549             [PDFMAKE_STD14_COURIER] = &std14_courier,
550             [PDFMAKE_STD14_COURIER_BOLD] = &std14_courier_bold,
551             [PDFMAKE_STD14_COURIER_OBLIQUE] = &std14_courier_oblique,
552             [PDFMAKE_STD14_COURIER_BOLDOBLIQUE] = &std14_courier_boldoblique,
553             [PDFMAKE_STD14_SYMBOL] = &std14_symbol,
554             [PDFMAKE_STD14_ZAPFDINGBATS] = &std14_zapfdingbats,
555             };
556              
557             /*============================================================================
558             * API implementation
559             *==========================================================================*/
560              
561 897719           const pdfmake_std14_data_t *pdfmake_std14_get(pdfmake_std14_id_t id) {
562 897719 50         if (id < 0 || id >= PDFMAKE_STD14_COUNT) return NULL;
563 897719           return std14_fonts[id];
564             }
565              
566             /* Note: pdfmake_std14_lookup() is defined in pdfmake_page.c */
567              
568 896644           int pdfmake_std14_width(pdfmake_std14_id_t id, uint32_t codepoint) {
569 896644           const pdfmake_std14_data_t *data = pdfmake_std14_get(id);
570             size_t lo, hi;
571              
572 896644 50         if (!data) return 0;
573              
574             /* Binary search for codepoint (table is sorted) */
575 896644           lo = 0;
576 896644           hi = data->width_count;
577 6243306 100         while (lo < hi) {
578 6243212           size_t mid = lo + (hi - lo) / 2;
579 6243212 100         if (data->widths[mid].codepoint < codepoint) {
580 2155822           lo = mid + 1;
581 4087390 100         } else if (data->widths[mid].codepoint > codepoint) {
582 3190840           hi = mid;
583             } else {
584 896550           return data->widths[mid].width;
585             }
586             }
587            
588             /* Not found - return default width */
589             /* Most fonts use space width as default */
590 94 50         if (data->width_count > 0) {
591             /* First entry is usually space */
592 94           return data->widths[0].width;
593             }
594 0           return 500; /* Fallback */
595             }