-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpdf_out-fonts.adb
386 lines (374 loc) · 26.6 KB
/
pdf_out-fonts.adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
with Interfaces;
package body PDF_Out.Fonts is
-- 9.6.2.2 Standard Type 1 Fonts (Standard 14 Fonts)
function Standard_Font_Name (f : Standard_Font_Type) return String is
begin -- Code generation: see pw_work.xls, Fonts (Std)
case f is
when Courier => return "Courier";
when Courier_Bold => return "Courier-Bold";
when Courier_Bold_Oblique => return "Courier-BoldOblique";
when Courier_Oblique => return "Courier-Oblique";
when Helvetica => return "Helvetica";
when Helvetica_Bold => return "Helvetica-Bold";
when Helvetica_Bold_Oblique => return "Helvetica-BoldOblique";
when Helvetica_Oblique => return "Helvetica-Oblique";
when Symbol => return "Symbol";
when Times_Bold => return "Times-Bold";
when Times_Bold_Italic => return "Times-BoldItalic";
when Times_Italic => return "Times-Italic";
when Times_Roman => return "Times-Roman";
when Zapf_Dingbats => return "ZapfDingbats";
end case;
end Standard_Font_Name;
function Font_Dictionary_Name (font_name : String) return String is
begin
return "/Ada_PDF_Font_" & font_name;
end Font_Dictionary_Name;
function Standard_Font_Dictionary_Name (f : Standard_Font_Type) return String is
begin
return "/Ada_PDF_Std_Font_" & Standard_Font_Name (f);
end Standard_Font_Dictionary_Name;
-- 7.8.3 Resource Dictionaries (any resources required by a page).
-- Table 33: Font: A dictionary that maps resource names to font dictionaries.
--
procedure Font_Dictionary (pdf : in out PDF_Out_Stream'Class) is
begin
WL (pdf, " /Font <<"); -- font dictionary
for f in Standard_Font_Type loop
if pdf.std_font_used_in_page (f) then
WL (pdf,
" " &
Standard_Font_Dictionary_Name (f) &
" << /Type /Font /Subtype /Type1 /BaseFont /" &
Standard_Font_Name (f) &
-- 7.9.2.2 Text String Type: "PDFDocEncoding can encode all of
-- the ISO Latin 1 character set and is documented in Annex D."
-- PDFDocEncoding is recognized by the Chrome PDF viewer on Windows but...
-- *isn't* by Adobe Reader X, on Windows! So we resort to another ISO
-- Latin 1 superset: WinAnsiEncoding = Windows Code Page 1252 (Table D.1).
" /Encoding /WinAnsiEncoding " &
" >>");
end if;
end loop;
WL (pdf, " >>");
end Font_Dictionary;
function Current_Font_Name (pdf : PDF_Out_Stream'Class) return String is
begin
if pdf.current_font in Standard_Font_Type then
return Standard_Font_Name (pdf.current_font);
else
return To_String (pdf.ext_font_name);
end if;
end Current_Font_Name;
function Current_Font_Dictionary_Name (pdf : PDF_Out_Stream'Class) return String is
begin
if pdf.current_font in Standard_Font_Type then
return Standard_Font_Dictionary_Name (pdf.current_font);
else
return Font_Dictionary_Name (To_String (pdf.ext_font_name));
end if;
end Current_Font_Dictionary_Name;
type Standard_Font_Width_Data_Array is array (Character) of Interfaces.Integer_16;
standard_font_width_data :
constant array (Standard_Font_Type) of Standard_Font_Width_Data_Array :=
(Courier .. Courier_Oblique =>
(others => 600),
Helvetica =>
(278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 0 .. 9
278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 10 .. 19
278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 20 .. 29
278, 278, 278, 278, 355, 556, 556, 889, 667, 191, -- 30 .. 39
333, 333, 389, 584, 278, 333, 278, 278, 556, 556, -- 40 .. 49
556, 556, 556, 556, 556, 556, 556, 556, 278, 278, -- 50 .. 59
584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, -- 60 .. 69
611, 778, 722, 278, 500, 667, 556, 833, 722, 778, -- 70 .. 79
667, 778, 722, 667, 611, 722, 667, 944, 667, 667, -- 80 .. 89
611, 278, 278, 278, 469, 556, 333, 556, 556, 500, -- 90 .. 99
556, 556, 278, 556, 556, 222, 222, 500, 222, 833, -- 100 .. 109
556, 556, 556, 556, 333, 500, 278, 556, 500, 722, -- 110 .. 119
500, 500, 500, 334, 260, 334, 584, 350, 556, 350, -- 120 .. 129
222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, -- 130 .. 139
1000, 350, 611, 350, 350, 222, 222, 333, 333, 350, -- 140 .. 149
556, 1000, 333, 1000, 500, 333, 944, 350, 500, 667, -- 150 .. 159
278, 333, 556, 556, 556, 556, 260, 556, 333, 737, -- 160 .. 169
370, 556, 584, 333, 737, 333, 400, 584, 333, 333, -- 170 .. 179
333, 556, 537, 278, 333, 333, 365, 556, 834, 834, -- 180 .. 189
834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, -- 190 .. 199
667, 667, 667, 667, 278, 278, 278, 278, 722, 722, -- 200 .. 209
778, 778, 778, 778, 778, 584, 778, 722, 722, 722, -- 210 .. 219
722, 667, 667, 611, 556, 556, 556, 556, 556, 556, -- 220 .. 229
889, 500, 556, 556, 556, 556, 278, 278, 278, 278, -- 230 .. 239
556, 556, 556, 556, 556, 556, 556, 584, 611, 556, -- 240 .. 249
556, 556, 556, 500, 556, 500),
Helvetica_Bold =>
(278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 0 .. 9
278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 10 .. 19
278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 20 .. 29
278, 278, 278, 333, 474, 556, 556, 889, 722, 238, -- 30 .. 39
333, 333, 389, 584, 278, 333, 278, 278, 556, 556, -- 40 .. 49
556, 556, 556, 556, 556, 556, 556, 556, 333, 333, -- 50 .. 59
584, 584, 584, 611, 975, 722, 722, 722, 722, 667, -- 60 .. 69
611, 778, 722, 278, 556, 722, 611, 833, 722, 778, -- 70 .. 79
667, 778, 722, 667, 611, 722, 667, 944, 667, 667, -- 80 .. 89
611, 333, 278, 333, 584, 556, 333, 556, 611, 556, -- 90 .. 99
611, 556, 333, 611, 611, 278, 278, 556, 278, 889, -- 100 .. 109
611, 611, 611, 611, 389, 556, 333, 611, 556, 778, -- 110 .. 119
556, 556, 500, 389, 280, 389, 584, 350, 556, 350, -- 120 .. 129
278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, -- 130 .. 139
1000, 350, 611, 350, 350, 278, 278, 500, 500, 350, -- 140 .. 149
556, 1000, 333, 1000, 556, 333, 944, 350, 500, 667, -- 150 .. 159
278, 333, 556, 556, 556, 556, 280, 556, 333, 737, -- 160 .. 169
370, 556, 584, 333, 737, 333, 400, 584, 333, 333, -- 170 .. 179
333, 611, 556, 278, 333, 333, 365, 556, 834, 834, -- 180 .. 189
834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, -- 190 .. 199
667, 667, 667, 667, 278, 278, 278, 278, 722, 722, -- 200 .. 209
778, 778, 778, 778, 778, 584, 778, 722, 722, 722, -- 210 .. 219
722, 667, 667, 611, 556, 556, 556, 556, 556, 556, -- 220 .. 229
889, 556, 556, 556, 556, 556, 278, 278, 278, 278, -- 230 .. 239
611, 611, 611, 611, 611, 611, 611, 584, 611, 611, -- 240 .. 249
611, 611, 611, 556, 611, 556),
Helvetica_Bold_Oblique =>
(278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 0 .. 9
278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 10 .. 19
278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 20 .. 29
278, 278, 278, 333, 474, 556, 556, 889, 722, 238, -- 30 .. 39
333, 333, 389, 584, 278, 333, 278, 278, 556, 556, -- 40 .. 49
556, 556, 556, 556, 556, 556, 556, 556, 333, 333, -- 50 .. 59
584, 584, 584, 611, 975, 722, 722, 722, 722, 667, -- 60 .. 69
611, 778, 722, 278, 556, 722, 611, 833, 722, 778, -- 70 .. 79
667, 778, 722, 667, 611, 722, 667, 944, 667, 667, -- 80 .. 89
611, 333, 278, 333, 584, 556, 333, 556, 611, 556, -- 90 .. 99
611, 556, 333, 611, 611, 278, 278, 556, 278, 889, -- 100 .. 109
611, 611, 611, 611, 389, 556, 333, 611, 556, 778, -- 110 .. 119
556, 556, 500, 389, 280, 389, 584, 350, 556, 350, -- 120 .. 129
278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, -- 130 .. 139
1000, 350, 611, 350, 350, 278, 278, 500, 500, 350, -- 140 .. 149
556, 1000, 333, 1000, 556, 333, 944, 350, 500, 667, -- 150 .. 159
278, 333, 556, 556, 556, 556, 280, 556, 333, 737, -- 160 .. 169
370, 556, 584, 333, 737, 333, 400, 584, 333, 333, -- 170 .. 179
333, 611, 556, 278, 333, 333, 365, 556, 834, 834, -- 180 .. 189
834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, -- 190 .. 199
667, 667, 667, 667, 278, 278, 278, 278, 722, 722, -- 200 .. 209
778, 778, 778, 778, 778, 584, 778, 722, 722, 722, -- 210 .. 219
722, 667, 667, 611, 556, 556, 556, 556, 556, 556, -- 220 .. 229
889, 556, 556, 556, 556, 556, 278, 278, 278, 278, -- 230 .. 239
611, 611, 611, 611, 611, 611, 611, 584, 611, 611, -- 240 .. 249
611, 611, 611, 556, 611, 556),
Helvetica_Oblique =>
(278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 0 .. 9
278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 10 .. 19
278, 278, 278, 278, 278, 278, 278, 278, 278, 278, -- 20 .. 29
278, 278, 278, 278, 355, 556, 556, 889, 667, 191, -- 30 .. 39
333, 333, 389, 584, 278, 333, 278, 278, 556, 556, -- 40 .. 49
556, 556, 556, 556, 556, 556, 556, 556, 278, 278, -- 50 .. 59
584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, -- 60 .. 69
611, 778, 722, 278, 500, 667, 556, 833, 722, 778, -- 70 .. 79
667, 778, 722, 667, 611, 722, 667, 944, 667, 667, -- 80 .. 89
611, 278, 278, 278, 469, 556, 333, 556, 556, 500, -- 90 .. 99
556, 556, 278, 556, 556, 222, 222, 500, 222, 833, -- 100 .. 109
556, 556, 556, 556, 333, 500, 278, 556, 500, 722, -- 110 .. 119
500, 500, 500, 334, 260, 334, 584, 350, 556, 350, -- 120 .. 129
222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, -- 130 .. 139
1000, 350, 611, 350, 350, 222, 222, 333, 333, 350, -- 140 .. 149
556, 1000, 333, 1000, 500, 333, 944, 350, 500, 667, -- 150 .. 159
278, 333, 556, 556, 556, 556, 260, 556, 333, 737, -- 160 .. 169
370, 556, 584, 333, 737, 333, 400, 584, 333, 333, -- 170 .. 179
333, 556, 537, 278, 333, 333, 365, 556, 834, 834, -- 180 .. 189
834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, -- 190 .. 199
667, 667, 667, 667, 278, 278, 278, 278, 722, 722, -- 200 .. 209
778, 778, 778, 778, 778, 584, 778, 722, 722, 722, -- 210 .. 219
722, 667, 667, 611, 556, 556, 556, 556, 556, 556, -- 220 .. 229
889, 500, 556, 556, 556, 556, 278, 278, 278, 278, -- 230 .. 239
556, 556, 556, 556, 556, 556, 556, 584, 611, 556, -- 240 .. 249
556, 556, 556, 500, 556, 500),
Symbol =>
(250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 0 .. 9
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 10 .. 19
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 20 .. 29
250, 250, 250, 333, 713, 500, 549, 833, 778, 439, -- 30 .. 39
333, 333, 500, 549, 250, 549, 250, 278, 500, 500, -- 40 .. 49
500, 500, 500, 500, 500, 500, 500, 500, 278, 278, -- 50 .. 59
549, 549, 549, 444, 549, 722, 667, 722, 612, 611, -- 60 .. 69
763, 603, 722, 333, 631, 722, 686, 889, 722, 722, -- 70 .. 79
768, 741, 556, 592, 611, 690, 439, 768, 645, 795, -- 80 .. 89
611, 333, 863, 333, 658, 500, 500, 631, 549, 549, -- 90 .. 99
494, 439, 521, 411, 603, 329, 603, 549, 549, 576, -- 100 .. 109
521, 549, 549, 521, 549, 603, 439, 576, 713, 686, -- 110 .. 119
493, 686, 494, 480, 200, 480, 549, 0, 0, 0, -- 120 .. 129
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 130 .. 139
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 140 .. 149
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 150 .. 159
750, 620, 247, 549, 167, 713, 500, 753, 753, 753, -- 160 .. 169
753, 1042, 987, 603, 987, 603, 400, 549, 411, 549, -- 170 .. 179
549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, -- 180 .. 189
1000, 658, 823, 686, 795, 987, 768, 768, 823, 768, -- 190 .. 199
768, 713, 713, 713, 713, 713, 713, 713, 768, 713, -- 200 .. 209
790, 790, 890, 823, 549, 250, 713, 603, 603, 1042, -- 210 .. 219
987, 603, 987, 603, 494, 329, 790, 790, 786, 713, -- 220 .. 229
384, 384, 384, 384, 384, 384, 494, 494, 494, 494, -- 230 .. 239
0, 329, 274, 686, 686, 686, 384, 384, 384, 384, -- 240 .. 249
384, 384, 494, 494, 494, 0),
Times_Roman =>
(250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 0 .. 9
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 10 .. 19
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 20 .. 29
250, 250, 250, 333, 408, 500, 500, 833, 778, 180, -- 30 .. 39
333, 333, 500, 564, 250, 333, 250, 278, 500, 500, -- 40 .. 49
500, 500, 500, 500, 500, 500, 500, 500, 278, 278, -- 50 .. 59
564, 564, 564, 444, 921, 722, 667, 667, 722, 611, -- 60 .. 69
556, 722, 722, 333, 389, 722, 611, 889, 722, 722, -- 70 .. 79
556, 722, 667, 556, 611, 722, 722, 944, 722, 722, -- 80 .. 89
611, 333, 278, 333, 469, 500, 333, 444, 500, 444, -- 90 .. 99
500, 444, 333, 500, 500, 278, 278, 500, 278, 778, -- 100 .. 109
500, 500, 500, 500, 333, 389, 278, 500, 500, 722, -- 110 .. 119
500, 500, 444, 480, 200, 480, 541, 350, 500, 350, -- 120 .. 129
333, 500, 444, 1000, 500, 500, 333, 1000, 556, 333, -- 130 .. 139
889, 350, 611, 350, 350, 333, 333, 444, 444, 350, -- 140 .. 149
500, 1000, 333, 980, 389, 333, 722, 350, 444, 722, -- 150 .. 159
250, 333, 500, 500, 500, 500, 200, 500, 333, 760, -- 160 .. 169
276, 500, 564, 333, 760, 333, 400, 564, 300, 300, -- 170 .. 179
333, 500, 453, 250, 333, 300, 310, 500, 750, 750, -- 180 .. 189
750, 444, 722, 722, 722, 722, 722, 722, 889, 667, -- 190 .. 199
611, 611, 611, 611, 333, 333, 333, 333, 722, 722, -- 200 .. 209
722, 722, 722, 722, 722, 564, 722, 722, 722, 722, -- 210 .. 219
722, 722, 556, 500, 444, 444, 444, 444, 444, 444, -- 220 .. 229
667, 444, 444, 444, 444, 444, 278, 278, 278, 278, -- 230 .. 239
500, 500, 500, 500, 500, 500, 500, 564, 500, 500, -- 240 .. 249
500, 500, 500, 500, 500, 500),
Times_Bold =>
(250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 0 .. 9
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 10 .. 19
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 20 .. 29
250, 250, 250, 333, 555, 500, 500, 1000, 833, 278, -- 30 .. 39
333, 333, 500, 570, 250, 333, 250, 278, 500, 500, -- 40 .. 49
500, 500, 500, 500, 500, 500, 500, 500, 333, 333, -- 50 .. 59
570, 570, 570, 500, 930, 722, 667, 722, 722, 667, -- 60 .. 69
611, 778, 778, 389, 500, 778, 667, 944, 722, 778, -- 70 .. 79
611, 778, 722, 556, 667, 722, 722, 1000, 722, 722, -- 80 .. 89
667, 333, 278, 333, 581, 500, 333, 500, 556, 444, -- 90 .. 99
556, 444, 333, 500, 556, 278, 333, 556, 278, 833, -- 100 .. 109
556, 500, 556, 556, 444, 389, 333, 556, 500, 722, -- 110 .. 119
500, 500, 444, 394, 220, 394, 520, 350, 500, 350, -- 120 .. 129
333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, -- 130 .. 139
1000, 350, 667, 350, 350, 333, 333, 500, 500, 350, -- 140 .. 149
500, 1000, 333, 1000, 389, 333, 722, 350, 444, 722, -- 150 .. 159
250, 333, 500, 500, 500, 500, 220, 500, 333, 747, -- 160 .. 169
300, 500, 570, 333, 747, 333, 400, 570, 300, 300, -- 170 .. 179
333, 556, 540, 250, 333, 300, 330, 500, 750, 750, -- 180 .. 189
750, 500, 722, 722, 722, 722, 722, 722, 1000, 722, -- 190 .. 199
667, 667, 667, 667, 389, 389, 389, 389, 722, 722, -- 200 .. 209
778, 778, 778, 778, 778, 570, 778, 722, 722, 722, -- 210 .. 219
722, 722, 611, 556, 500, 500, 500, 500, 500, 500, -- 220 .. 229
722, 444, 444, 444, 444, 444, 278, 278, 278, 278, -- 230 .. 239
500, 556, 500, 500, 500, 500, 500, 570, 500, 556, -- 240 .. 249
556, 556, 556, 500, 556, 500),
Times_Bold_Italic =>
(250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 0 .. 9
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 10 .. 19
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 20 .. 29
250, 250, 250, 389, 555, 500, 500, 833, 778, 278, -- 30 .. 39
333, 333, 500, 570, 250, 333, 250, 278, 500, 500, -- 40 .. 49
500, 500, 500, 500, 500, 500, 500, 500, 333, 333, -- 50 .. 59
570, 570, 570, 500, 832, 667, 667, 667, 722, 667, -- 60 .. 69
667, 722, 778, 389, 500, 667, 611, 889, 722, 722, -- 70 .. 79
611, 722, 667, 556, 611, 722, 667, 889, 667, 611, -- 80 .. 89
611, 333, 278, 333, 570, 500, 333, 500, 500, 444, -- 90 .. 99
500, 444, 333, 500, 556, 278, 278, 500, 278, 778, -- 100 .. 109
556, 500, 500, 500, 389, 389, 278, 556, 444, 667, -- 110 .. 119
500, 444, 389, 348, 220, 348, 570, 350, 500, 350, -- 120 .. 129
333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, -- 130 .. 139
944, 350, 611, 350, 350, 333, 333, 500, 500, 350, -- 140 .. 149
500, 1000, 333, 1000, 389, 333, 722, 350, 389, 611, -- 150 .. 159
250, 389, 500, 500, 500, 500, 220, 500, 333, 747, -- 160 .. 169
266, 500, 606, 333, 747, 333, 400, 570, 300, 300, -- 170 .. 179
333, 576, 500, 250, 333, 300, 300, 500, 750, 750, -- 180 .. 189
750, 500, 667, 667, 667, 667, 667, 667, 944, 667, -- 190 .. 199
667, 667, 667, 667, 389, 389, 389, 389, 722, 722, -- 200 .. 209
722, 722, 722, 722, 722, 570, 722, 722, 722, 722, -- 210 .. 219
722, 611, 611, 500, 500, 500, 500, 500, 500, 500, -- 220 .. 229
722, 444, 444, 444, 444, 444, 278, 278, 278, 278, -- 230 .. 239
500, 556, 500, 500, 500, 500, 500, 570, 500, 556, -- 240 .. 249
556, 556, 556, 444, 500, 444),
Times_Italic =>
(250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 0 .. 9
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 10 .. 19
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -- 20 .. 29
250, 250, 250, 333, 420, 500, 500, 833, 778, 214, -- 30 .. 39
333, 333, 500, 675, 250, 333, 250, 278, 500, 500, -- 40 .. 49
500, 500, 500, 500, 500, 500, 500, 500, 333, 333, -- 50 .. 59
675, 675, 675, 500, 920, 611, 611, 667, 722, 611, -- 60 .. 69
611, 722, 722, 333, 444, 667, 556, 833, 667, 722, -- 70 .. 79
611, 722, 611, 500, 556, 722, 611, 833, 611, 556, -- 80 .. 89
556, 389, 278, 389, 422, 500, 333, 500, 500, 444, -- 90 .. 99
500, 444, 278, 500, 500, 278, 278, 444, 278, 722, -- 100 .. 109
500, 500, 500, 500, 389, 389, 278, 500, 444, 667, -- 110 .. 119
444, 444, 389, 400, 275, 400, 541, 350, 500, 350, -- 120 .. 129
333, 500, 556, 889, 500, 500, 333, 1000, 500, 333, -- 130 .. 139
944, 350, 556, 350, 350, 333, 333, 556, 556, 350, -- 140 .. 149
500, 889, 333, 980, 389, 333, 667, 350, 389, 556, -- 150 .. 159
250, 389, 500, 500, 500, 500, 275, 500, 333, 760, -- 160 .. 169
276, 500, 675, 333, 760, 333, 400, 675, 300, 300, -- 170 .. 179
333, 500, 523, 250, 333, 300, 310, 500, 750, 750, -- 180 .. 189
750, 500, 611, 611, 611, 611, 611, 611, 889, 667, -- 190 .. 199
611, 611, 611, 611, 333, 333, 333, 333, 722, 667, -- 200 .. 209
722, 722, 722, 722, 722, 675, 722, 722, 722, 722, -- 210 .. 219
722, 556, 611, 500, 500, 500, 500, 500, 500, 500, -- 220 .. 229
667, 444, 444, 444, 444, 444, 278, 278, 278, 278, -- 230 .. 239
500, 500, 500, 500, 500, 500, 500, 675, 500, 500, -- 240 .. 249
500, 500, 500, 444, 500, 444),
Zapf_Dingbats =>
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 0 .. 9
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 10 .. 19
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 20 .. 29
0, 0, 278, 974, 961, 974, 980, 719, 789, 790, -- 30 .. 39
791, 690, 960, 939, 549, 855, 911, 933, 911, 945, -- 40 .. 49
974, 755, 846, 762, 761, 571, 677, 763, 760, 759, -- 50 .. 59
754, 494, 552, 537, 577, 692, 786, 788, 788, 790, -- 60 .. 69
793, 794, 816, 823, 789, 841, 823, 833, 816, 831, -- 70 .. 79
923, 744, 723, 749, 790, 792, 695, 776, 768, 792, -- 80 .. 89
759, 707, 708, 682, 701, 826, 815, 789, 789, 707, -- 90 .. 99
687, 696, 689, 786, 787, 713, 791, 785, 791, 873, -- 100 .. 109
761, 762, 762, 759, 759, 892, 892, 788, 784, 438, -- 110 .. 119
138, 277, 415, 392, 392, 668, 668, 0, 390, 390, -- 120 .. 129
317, 317, 276, 276, 509, 509, 410, 410, 234, 234, -- 130 .. 139
334, 334, 0, 0, 0, 0, 0, 0, 0, 0, -- 140 .. 149
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 150 .. 159
0, 732, 544, 544, 910, 667, 760, 760, 776, 595, -- 160 .. 169
694, 626, 788, 788, 788, 788, 788, 788, 788, 788, -- 170 .. 179
788, 788, 788, 788, 788, 788, 788, 788, 788, 788, -- 180 .. 189
788, 788, 788, 788, 788, 788, 788, 788, 788, 788, -- 190 .. 199
788, 788, 788, 788, 788, 788, 788, 788, 788, 788, -- 200 .. 209
788, 788, 894, 838, 1016, 458, 748, 924, 748, 918, -- 210 .. 219
927, 928, 928, 834, 873, 828, 924, 924, 917, 930, -- 220 .. 229
931, 463, 883, 836, 836, 867, 867, 696, 696, 874, -- 230 .. 239
0, 874, 760, 946, 771, 865, 771, 888, 967, 888, -- 240 .. 249
831, 873, 927, 970, 918, 0));
function Width (f : Standard_Font_Type; size : Real; latin_1_text : String) return Real is
sum : Real := 0.0;
begin
-- TBD: take into account non-default character spacing (9.3.2),
-- word spacing (9.3.3), horizontal scaling (9.3.4).
-- Table 105 (9.3.1) indicates how to set them on the PDF rendering machine.
for c of latin_1_text loop
sum := sum + Real (standard_font_width_data (f)(c));
end loop;
return sum * 0.001 * size;
end Width;
function Vertical_Offset (f : Standard_Font_Type; size : Real) return Real is
(size *
(case f is
when Courier => -0.25,
when Courier_Bold => -0.25,
when Courier_Bold_Oblique => -0.25,
when Courier_Oblique => -0.25,
when Helvetica => -0.25,
when Helvetica_Bold => -0.25,
when Helvetica_Bold_Oblique => -0.25,
when Helvetica_Oblique => -0.25,
when Symbol => -0.25,
when Times_Bold => -0.25,
when Times_Bold_Italic => -0.25,
when Times_Italic => -0.25,
when Times_Roman => -0.25,
when Zapf_Dingbats => -0.18));
end PDF_Out.Fonts;