summaryrefslogtreecommitdiff
blob: 652926f4c56343b77a549d37cf09e1ed5fd7549d (plain)
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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
/* Copyright (C) 2001-2019 Artifex Software, Inc.
   All Rights Reserved.

   This software is provided AS-IS with no warranty, either express or
   implied.

   This software is distributed under license and may not be copied,
   modified or distributed except as expressly authorized under the terms
   of the license contained in the file LICENSE in this distribution.

   Refer to licensing information at http://www.artifex.com or contact
   Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
   CA 94945, U.S.A., +1(415)492-9861, for further information.
*/


/* $Id: whitelst.c 11608 2010-08-06 11:11:40Z ken $ */
/* The following font names are taken from the Adobe webs site
   (http://www.adobe.com/type/browser/legal/embeddingeula.html)
   and comprise a list of font names for which permission is granted to embed
   either for preview and print or fully editable. These names are used to
   override the embedding flags in TrueType fonts for pdfwrite and ps2write.

   Its not entirely clear whether the font names should include TM and R
   characters or not, and the only example font we have contains neither. For
   the moment the fonts are stored without TM and R characters but this may
   need to be altered.
 */
#include "whitelst.h"

#define WHITE_LIST_SIZE 483

static const char EmbeddingWhiteList[][WHITE_LIST_SIZE] = {
"Aachen",
"Adobe Arabic",
"Adobe Caslon",
"Adobe Devanagari",
"Adobe Fangsong",
"Adobe FanHeiti",
"Adobe Garamond",
"Adobe Gothic",
"Adobe Hebrew",
"Adobe Heiti",
"Adobe Jenson",
"Adobe Kaiti",
"Adobe Ming",
"Adobe Myungjo",
"Adobe Naskh",
"Adobe Pi",
"Adobe Song",
"Adobe Text",
"Adobe Thai",
"Adobe Wood Type",
"Albertus",
"Aldus",
"Alexa",
"Americana",
"Amigo",
"Andreas",
"Antique Olive",
"Apollo",
"Arcadia",
"Arcana",
"Ariadne",
"Arno",
"Arnold B\366cklin", /* Arnold B�cklin */
"Ashley Script",
"Astrology Pi",
"Audio Pi",
"Auriol",
"Avenir",
"Baker",
"Baker Signet",
"Balzano",
"Banco",
"Banshee",
"Baskerville Cyrillic",
"Bauer Bodoni",
"Bell",
"Bell Centennial",
"Bell Gothic",
"Belwe",
"Bembo",
"Berling",
"Bermuda",
"Bernhard",
"Bernhard Modern",
"Bickham Script",
"Biffo",
"Birch",
"Blackoak",
"Blue Island",
"Bodoni",
"Border Pi",
"Briem Akademi",
"Briem Script",
"Brioso",
"Bruno",
"Brush Script",
"Bulmer",
"Bundesbahn Pi",
"Caflisch Script",
"Caflisch Script Web",
"Calcite",
"Caliban",
"Calvert",
"Candida",
"Cantoria",
"Caravan Borders",
"Carolina",
"Carta",
"Cascade Script",
"Caslon 3",
"Caslon 540",
"Caslon Open Face",
"Castellar",
"Caxton",
"Centaur",
"Century Expanded",
"Century Old Style",
"Chaparral",
"Charlemagne",
"Charme",
"Cheq",
"Clairvaux",
"Clarendon",
"Clearface Gothic",
"Cloister",
"Club Type",
"Club Type Mercurius",
"Cochin",
"Conga Brava",
"Conga Brava Stencil",
"Conga Brava Std Stencil",
"Cooper Black",
"Copal",
"Copperplate Gothic",
"Coriander",
"Corona",
"Coronet",
"Cottonwood",
"Courier",
"Critter",
"Cronos",
"Cutout",
"Dante",
"Decoration Pi",
"Delphin",
"DIN Schriften",
"Diotima",
"Diskus",
"Dom Casual",
"Dorchester Script",
"Doric",
"Duc de Berry",
"Eccentric",
"Egyptienne F",
"Ehrhardt",
"Electra",
"Ellington",
"Else NPL",
"Engravers",
"European Pi",
"Eurostile",
"Ex Ponto",
"Excelsior",
"Excelsior Cyrillic",
"Fairfield",
"Falstaff",
"Fette Fraktur",
"Flood",
"Florens",
"Flyer",
"Folio",
"Forte",
"Fournier",
"Franklin Gothic",
"Freestyle Script",
"Friz Quadrata",
"Frutiger",
"Fusaka",
"Futura",
"Galahad",
"Game Pi",
"Garamond 3",
"Garamond Premier",
"Garth Graphic",
"Gazette",
"Giddyup",
"Giddyup Web",
"Gill Floriated Capitals",
"Gill Sans",
"Glypha",
"Gothic 13",
"Goudy",
"Goudy Text",
"Granjon",
"Graphite",
"Guardi",
"Hadriano",
"Hardwood",
"Heisei Kaku Gothic",
"Heisei Maru Gothic",
"Heisei Mincho",
"Helvetica",
"Helvetica Cyrillic",
"Helvetica Inserat",
"Helvetica Inserat Cyrillic",
"Helvetica Neue",
"Helvetica Rounded",
"Herculanum",
"Hiroshige",
"Hobo",
"Holiday Pi",
"Horley Old Style",
"HY Gothic",
"HY GungSo",
"HY Kak Headline Std",
"HY Rounded Gothic",
"Hypatia",
"Hypatia Sans",
"Immi 505",
"Impact",
"Impressum",
"Industria",
"Inflex",
"Insignia",
"Ironwood",
"Isabella",
"Italia",
"ITC American Typewriter",
"ITC Anna",
"ITC Avant Garde Gothic",
"ITC Bauhaus",
"ITC Beesknees",
"ITC Benguiat",
"ITC Benguiat Gothic",
"ITC Berkeley Oldstyle",
"ITC Bookman",
"ITC Caslon 224",
"ITC Century",
"ITC Century Handtooled",
"ITC Cerigo",
"ITC Cheltenham",
"ITC Cheltenham Handtooled",
"ITC Clearface",
"ITC Cushing",
"ITC Eras",
"ITC Esprit",
"ITC Fenice",
"ITC Flora",
"ITC Franklin Gothic",
"ITC Galliard",
"ITC Garamond",
"ITC Garamond Handtooled",
"ITC Giovanni",
"ITC Goudy Sans",
"ITC Highlander",
"ITC Isadora",
"ITC Kabel",
"ITC Korinna",
"ITC Leawood",
"ITC Legacy Sans",
"ITC Legacy Serif",
"ITC Lubalin Graph",
"ITC Machine",
"ITC Mendoza Roman",
"ITC Mona Lisa",
"ITC Motter Corpus",
"ITC New Baskerville",
"ITC Novarese",
"ITC Officina Sans",
"ITC Officina Serif",
"ITC Ozwald",
"ITC Quorum",
"ITC Serif Gothic",
"ITC Slimbach",
"ITC Souvenir",
"ITC Stone Informal",
"ITC Stone Sans",
"ITC Stone Serif",
"ITC Symbol",
"ITC Tiepolo",
"ITC Tiffany",
"ITC Usherwood",
"ITC Veljovic",
"ITC Weidemann",
"ITC Zapf Chancery",
"ITC Zapf Dingbats",
"Janson Text",
"Jimbo",
"Joanna",
"Juniper",
"Kabel",
"Kaufmann",
"Kazuraki SP2N",
"Kepler",
"Khaki",
"Kigali",
"Kinesis",
"Kino",
"Klang",
"Koch Antiqua",
"Kolo",
"Kompakt",
"Kozuka Gothic",
"Kozuka Mincho",
"K\374nstler Script", /* K�nstler Script */
"Latin",
"Leander Script",
"Legault",
"Letter Gothic",
"Life",
"LinoLetter",
"Linoscript",
"Linotext",
"Linotype Centennial",
"Linotype Didot",
"Lithos",
"LogoArl",
"LogoCut",
"LogoLine",
"Lucida",
"Lucida Math",
"Lucida Sans",
"Lucida Sans Typewriter",
"Lucida Typewriter",
"Madrone",
"Manito",
"Marigold",
"Mathematical Pi",
"Matura",
"Maximus",
"Medici Script",
"Melior",
"Memphis",
"Mercurius",
"Meridien",
"Mesquite",
"Mezz",
"Mezz Web",
"MICR",
"Minion",
"Minion Cyrillic",
"Minion Web",
"Minister",
"Mistral",
"Mojo",
"Monoline Script",
"Monotype Goudy Modern",
"Monotype Grotesque",
"Monotype Italian Old Style",
"Monotype Modern",
"Monotype Old Style",
"Monotype Scotch Roman",
"Monotype Script",
"Montara",
"Moonglow",
"MVB Bossa Nova",
"MVB Celestia Antiqua",
"MVB Emmascript",
"MVB Greymantle",
"MVB Magnesium",
"MVB Magnolia",
"Myriad",
"Myriad Arabic",
"Myriad Hebrew",
"Myriad Hebrew Cursive",
"Myriad Web",
"Mythos",
"National Codes",
"National Codes Pi",
"Neue Hammer Unziale",
"Neuland",
"Neuzeit S",
"New Aster",
"New Berolina",
"New Caledonia",
"New Century Schoolbook",
"News Gothic",
"Notre Dame",
"Nueva",
"Nuptial Script",
"Nyx",
"Ocean Sans",
"OCR-A",
"OCR-B",
"Octavian",
"Old Claude",
"Old Style 7",
"Olympian",
"Omnia",
"Ondine",
"Onyx",
"Optima",
"Orator",
"Org\321nica GMM", /* Org�nica GMM */
"Origami",
"Ouch!",
"Oxford",
"Palace Script",
"Palatino",
"Parisian",
"Park Avenue",
"Peignot",
"Pelican",
"Penumbra",
"Penumbra Flare",
"Penumbra Half Serif",
"Penumbra Sans",
"Penumbra Serif",
"Penumbra Web",
"Pepita",
"Pepperwood",
"Perpetua",
"Photina",
"Plantin",
"PMN Caecilia",
"Poetica",
"Pompeia",
"Pompeijana",
"Ponderosa",
"Poplar",
"Postino",
"Present",
"Prestige Elite",
"Quake",
"Rad",
"Raleigh",
"Raphael",
"Reliq",
"Reporter",
"Revue",
"Rockwell",
"Romic",
"Rosewood",
"Rotation",
"Rotis Sans Serif",
"Rotis Semi Sans",
"Rotis Semi Serif",
"Rotis Serif",
"Ruling Script",
"Runic",
"Russell Oblique",
"Russell Square",
"Rusticana",
"Ruzicka Freehand",
"Ryo Display",
"Ryo Display PlusN",
"Ryo Gothic",
"Ryo Gothic PlusN",
"Ryo Text",
"Ryo Text PlusN",
"Sabon",
"San Marco",
"Sanvito",
"Sassafras",
"Sava",
"Serifa",
"Serlio",
"Serpentine",
"Shannon",
"Shelley",
"Sho",
"Shuriken Boy",
"Silentium",
"Simoncini Garamond",
"Smaragd",
"SMGothic",
"SMMyungjo",
"Snell Roundhand",
"Sonata",
"Source Sans",
"Spartan",
"Spectrum",
"Spring",
"Spumoni",
"Stempel Garamond",
"Stempel Schneidler",
"Stencil",
"Strayhorn",
"Strumpf",
"Studz",
"Symbol",
"Syntax",
"Tekton",
"Tempo",
"Times",
"Times Europa",
"Times New Roman",
"Times Ten",
"Times Ten Cyrillic",
"Toolbox",
"Trade Gothic",
"Trajan",
"Trajan Sans",
"Trump Medi\324val", /* Trump Medi�val */
"Umbra",
"Univers",
"Universal",
"University",
"Utopia",
"VAG Rounded",
"Vectora",
"Versailles",
"Verve",
"Visigoth",
"Viva",
"Voluta Script",
"Warning Pi",
"Warnock",
"Waters Titling",
"Weiss",
"Wendy",
"Wiesbaden Swing",
"Wilhelm Klingspor Gotisch",
"Wilke",
"Willow",
"Wittenberger Fraktur",
"Zebrawood",
"Zipty Do"
};

static int whitelist_strncmp(const char *s1, const char *s2, int length)
{
    int s1_index, s2_index, result = 0;

    s1_index = s2_index = 0;

    while (s2_index < length && s1[s1_index] != 0x00) {
        while (s1[s1_index] == ' ')
            s1_index++;
        while (s2[s2_index] == ' ' && s2_index < length)
            s2_index++;
        if (s2_index > length) {
            if (s1[s1_index] == 0x00)
                return 0;
            return 1;
        }
        if (s1[s1_index] == 0x00) {
            if (s2_index > length)
                return 0;
            return -1;
        }
        if (s1[s1_index] == s2[s2_index]) {
            s1_index++;
            s2_index++;
            continue;
        }
        if(s1[s1_index] < s2[s2_index])
            return -1;
        if(s1[s1_index] > s2[s2_index])
            return 1;
    }
    return result;
}

int IsInWhiteList (const char *Name, int size)
{
    int low = 0, mid, high = WHITE_LIST_SIZE, test;

    while (low < high) {
        /* bisect current range */
        mid = (low + high) / 2;
        test = whitelist_strncmp(EmbeddingWhiteList[mid], Name, size);
        if (test == 0)
            return 1;
        /* Not a match, select either upper or lower group and try again */
        if(test < 0)
            low = mid + 1;
        else
        high = mid - 1;
    }
    if (low == high) {
        if (whitelist_strncmp(EmbeddingWhiteList[low], Name, size) == 0)
            return 1;
    }
    return 0;
}