]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blob - QRScanner/mobile/jni/thirdparty/freetype/src/truetype/ttsubpix.h
Add MuPDF native source codes
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / jni / thirdparty / freetype / src / truetype / ttsubpix.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ttsubpix.h                                                             */
4 /*                                                                         */
5 /*    TrueType Subpixel Hinting.                                           */
6 /*                                                                         */
7 /*  Copyright 2010-2012 by                                                 */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
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      */
12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
13 /*  this file you indicate that you have read the license and              */
14 /*  understand and accept it fully.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17
18
19 #ifndef __TTSUBPIX_H__
20 #define __TTSUBPIX_H__
21
22 #include <ft2build.h>
23 #include "ttobjs.h"
24 #include "ttinterp.h"
25
26
27 FT_BEGIN_HEADER
28
29
30 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
31
32   /*************************************************************************/
33   /*                                                                       */
34   /* Tweak flags that are set for each glyph by the below rules.           */
35   /*                                                                       */
36   /*                                                                       */
37 #define SPH_TWEAK_ALLOW_X_DMOVE                   0x0000001
38 #define SPH_TWEAK_ALLOW_X_DMOVEX                  0x0000002
39 #define SPH_TWEAK_ALLOW_X_MOVE_ZP2                0x0000004
40 #define SPH_TWEAK_ALWAYS_DO_DELTAP                0x0000008
41 #define SPH_TWEAK_ALWAYS_SKIP_DELTAP              0x0000010
42 #define SPH_TWEAK_COURIER_NEW_2_HACK              0x0000020
43 #define SPH_TWEAK_DEEMBOLDEN                      0x0000040
44 #define SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES  0x0000080
45 #define SPH_TWEAK_DO_SHPIX                        0x0000100
46 #define SPH_TWEAK_EMBOLDEN                        0x0000200
47 #define SPH_TWEAK_MIAP_HACK                       0x0000400
48 #define SPH_TWEAK_NORMAL_ROUND                    0x0000800
49 #define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP            0x0001000
50 #define SPH_TWEAK_NO_CALL_AFTER_IUP               0x0002000
51 #define SPH_TWEAK_NO_DELTAP_AFTER_IUP             0x0004000
52 #define SPH_TWEAK_PIXEL_HINTING                   0x0008000
53 #define SPH_TWEAK_RASTERIZER_35                   0x0010000
54 #define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES          0x0020000
55 #define SPH_TWEAK_SKIP_INLINE_DELTAS              0x0040000
56 #define SPH_TWEAK_SKIP_IUP                        0x0080000
57 #define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES           0x0100000
58 #define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES           0x0200000
59 #define SPH_TWEAK_TIMES_NEW_ROMAN_HACK            0x0400000
60 #define SPH_TWEAK_MIRP_CVT_ZERO                   0x0800000
61
62
63   FT_LOCAL( FT_Bool )
64   sph_test_tweak( TT_Face         face,
65                   FT_String*      family,
66                   FT_UInt         ppem,
67                   FT_String*      style,
68                   FT_UInt         glyph_index,
69                   SPH_TweakRule*  rule,
70                   FT_UInt         num_rules );
71
72   FT_LOCAL_DEF( FT_UInt )
73   scale_test_tweak( TT_Face         face,
74                     FT_String*      family,
75                     FT_UInt         ppem,
76                     FT_String*      style,
77                     FT_UInt         glyph_index,
78                     SPH_ScaleRule*  rule,
79                     FT_UInt         num_rules );
80
81   FT_LOCAL( void )
82   sph_set_tweaks( TT_Loader  loader,
83                   FT_UInt    glyph_index );
84
85
86   /*************************************************************************/
87   /*                                                                       */
88   /* These rules affect how the TT Interpreter does hinting, with the      */
89   /* goal of doing subpixel hinting by (in general) ignoring x moves.      */
90   /* Some of these rules are fixes that go above and beyond the            */
91   /* stated techniques in the MS whitepaper on Cleartype, due to           */
92   /* artifacts in many glyphs.  So, these rules make some glyphs render    */
93   /* better than they do in the MS rasterizer.                             */
94   /*                                                                       */
95   /* "" string or 0 int/char indicates to apply to all glyphs.             */
96   /* "-" used as dummy placeholders, but any non-matching string works.    */
97   /*                                                                       */
98   /* Some of this could arguably be implemented in fontconfig, however:    */
99   /*                                                                       */
100   /*  - Fontconfig can't set things on a glyph-by-glyph basis.             */
101   /*  - The tweaks that happen here are very low-level, from an average    */
102   /*    user's point of view and are best implemented in the hinter.       */
103   /*                                                                       */
104   /* The goal is to make the subpixel hinting techniques as generalized    */
105   /* as possible across all fonts to prevent the need for extra rules such */
106   /* as these.                                                             */
107   /*                                                                       */
108   /* The rule structure is designed so that entirely new rules can easily  */
109   /* be added when a new compatibility feature is discovered.              */
110   /*                                                                       */
111   /* The rule structures could also use some enhancement to handle ranges. */
112   /*                                                                       */
113   /*     ****************** WORK IN PROGRESS *******************           */
114   /*                                                                       */
115
116   /* These macros are defined absent a method for setting them */
117 #define SPH_OPTION_BITMAP_WIDTHS           FALSE
118 #define SPH_OPTION_SET_SUBPIXEL            TRUE
119 #define SPH_OPTION_SET_GRAYSCALE           FALSE
120 #define SPH_OPTION_SET_COMPATIBLE_WIDTHS   FALSE
121 #define SPH_OPTION_SET_RASTERIZER_VERSION  38
122
123
124   /* Define this to force natural (i.e. not bitmap-compatible) widths.     */
125   /* The default leans strongly towards natural widths except for a few    */
126   /* legacy fonts where a selective combination produces nicer results.    */
127 /* #define FORCE_NATURAL_WIDTHS   */
128
129
130   /* These are `classes' of fonts that can be grouped together and used in */
131   /* rules below.  A blank entry "" is required at the end of these!       */
132 #define FAMILY_CLASS_RULES_SIZE  7
133
134   Font_Class FAMILY_CLASS_Rules
135                [FAMILY_CLASS_RULES_SIZE] =
136   {
137     { "MS Legacy Fonts",
138       { "Aharoni",
139         "Andale Mono",
140         "Andalus",
141         "Angsana New",
142         "AngsanaUPC",
143         "Arabic Transparent",
144         "Arial Black",
145         "Arial Narrow",
146         "Arial Unicode MS",
147         "Arial",
148         "Batang",
149         "Browallia New",
150         "BrowalliaUPC",
151         "Comic Sans MS",
152         "Cordia New",
153         "CordiaUPC",
154         "Courier New",
155         "DFKai-SB",
156         "David Transparent",
157         "David",
158         "DilleniaUPC",
159         "Estrangelo Edessa",
160         "EucrosiaUPC",
161         "FangSong_GB2312",
162         "Fixed Miriam Transparent",
163         "FrankRuehl",
164         "Franklin Gothic Medium",
165         "FreesiaUPC",
166         "Garamond",
167         "Gautami",
168         "Georgia",
169         "Gulim",
170         "Impact",
171         "IrisUPC",
172         "JasmineUPC",
173         "KaiTi_GB2312",
174         "KodchiangUPC",
175         "Latha",
176         "Levenim MT",
177         "LilyUPC",
178         "Lucida Console",
179         "Lucida Sans Unicode",
180         "MS Gothic",
181         "MS Mincho",
182         "MV Boli",
183         "Mangal",
184         "Marlett",
185         "Microsoft Sans Serif",
186         "Mingliu",
187         "Miriam Fixed",
188         "Miriam Transparent",
189         "Miriam",
190         "Narkisim",
191         "Palatino Linotype",
192         "Raavi",
193         "Rod Transparent",
194         "Rod",
195         "Shruti",
196         "SimHei",
197         "Simplified Arabic Fixed",
198         "Simplified Arabic",
199         "Simsun",
200         "Sylfaen",
201         "Symbol",
202         "Tahoma",
203         "Times New Roman",
204         "Traditional Arabic",
205         "Trebuchet MS",
206         "Tunga",
207         "Verdana",
208         "Webdings",
209         "Wingdings",
210         "",
211       },
212     },
213     { "Core MS Legacy Fonts",
214       { "Arial Black",
215         "Arial Narrow",
216         "Arial Unicode MS",
217         "Arial",
218         "Comic Sans MS",
219         "Courier New",
220         "Garamond",
221         "Georgia",
222         "Impact",
223         "Lucida Console",
224         "Lucida Sans Unicode",
225         "Microsoft Sans Serif",
226         "Palatino Linotype",
227         "Tahoma",
228         "Times New Roman",
229         "Trebuchet MS",
230         "Verdana",
231         "",
232       },
233     },
234     { "Apple Legacy Fonts",
235       { "Geneva",
236         "Times",
237         "Monaco",
238         "Century",
239         "Chalkboard",
240         "Lobster",
241         "Century Gothic",
242         "Optima",
243         "Lucida Grande",
244         "Gill Sans",
245         "Baskerville",
246         "Helvetica",
247         "Helvetica Neue",
248         "",
249       },
250     },
251     { "Legacy Sans Fonts",
252       { "Andale Mono",
253         "Arial Unicode MS",
254         "Arial",
255         "Century Gothic",
256         "Comic Sans MS",
257         "Franklin Gothic Medium",
258         "Geneva",
259         "Lucida Console",
260         "Lucida Grande",
261         "Lucida Sans Unicode",
262         "Lucida Sans Typewriter",
263         "Microsoft Sans Serif",
264         "Monaco",
265         "Tahoma",
266         "Trebuchet MS",
267         "Verdana",
268         "",
269       },
270     },
271
272     { "Misc Legacy Fonts",
273       { "Dark Courier", "", }, },
274     { "Verdana Clones",
275       { "DejaVu Sans",
276         "Bitstream Vera Sans", "", }, },
277     { "Verdana and Clones",
278       { "DejaVu Sans",
279         "Bitstream Vera Sans",
280         "Verdana", "", }, },
281   };
282
283
284   /* Define `classes' of styles that can be grouped together and used in   */
285   /* rules below.  A blank entry "" is required at the end of these!       */
286 #define STYLE_CLASS_RULES_SIZE  5
287
288   Font_Class STYLE_CLASS_Rules
289                [STYLE_CLASS_RULES_SIZE] =
290   {
291     { "Regular Class",
292       { "Regular",
293         "Book",
294         "Medium",
295         "Roman",
296         "Normal",
297         "",
298       },
299     },
300     { "Regular/Italic Class",
301       { "Regular",
302         "Book",
303         "Medium",
304         "Italic",
305         "Oblique",
306         "Roman",
307         "Normal",
308         "",
309       },
310     },
311     { "Bold/BoldItalic Class",
312       { "Bold",
313         "Bold Italic",
314         "Black",
315         "",
316       },
317     },
318     { "Bold/Italic/BoldItalic Class",
319       { "Bold",
320         "Bold Italic",
321         "Black",
322         "Italic",
323         "Oblique",
324         "",
325       },
326     },
327     { "Regular/Bold Class",
328       { "Regular",
329         "Book",
330         "Medium",
331         "Normal",
332         "Roman",
333         "Bold",
334         "Black",
335         "",
336       },
337     },
338   };
339
340
341   /* Special fixes for known legacy fonts;                                 */
342   /* this is the primary workhorse rule for legacy fonts                   */
343 #define COMPATIBILITY_MODE_RULES_SIZE  4
344
345   SPH_TweakRule  COMPATIBILITY_MODE_Rules
346                    [COMPATIBILITY_MODE_RULES_SIZE] =
347   {
348     { "MS Legacy Fonts", 0, "", 0 },
349     { "Apple Legacy Fonts", 0, "", 0 },
350     { "Misc Legacy Fonts", 0, "", 0 },
351     { "Verdana Clones", 0, "", 0 },
352   };
353
354
355   /* Don't do subpixel (ignore_x_mode) hinting; do normal hinting.         */
356 #define PIXEL_HINTING_RULES_SIZE  4
357
358   SPH_TweakRule  PIXEL_HINTING_Rules
359                    [PIXEL_HINTING_RULES_SIZE] =
360   {
361     /* these characters are almost always safe */
362     { "", 0, "", '<' },
363     { "", 0, "", '>' },
364     /* fixes the vanishing stem */
365     { "Times New Roman", 0, "Bold", 'A' },
366     { "Times New Roman", 0, "Bold", 'V' },
367   };
368
369
370   /* According to Greg Hitchcock and the MS whitepaper, this should work   */
371   /* on all legacy MS fonts, but creates artifacts with some.  Only using  */
372   /* where absolutely necessary.                                           */
373 #define SKIP_INLINE_DELTAS_RULES_SIZE  1
374
375   SPH_TweakRule  SKIP_INLINE_DELTAS_Rules
376                    [SKIP_INLINE_DELTAS_RULES_SIZE] =
377   {
378     { "-", 0, "", 0 },
379   };
380
381
382   /* Subpixel hinting ignores SHPIX rules on X.  Force SHPIX for these.    */
383 #define DO_SHPIX_RULES_SIZE  1
384
385   SPH_TweakRule  DO_SHPIX_Rules
386                    [DO_SHPIX_RULES_SIZE] =
387   {
388     { "-", 0, "", 0 },
389   };
390
391
392   /* Skip Y moves that start with a point that is not on a Y pixel         */
393   /* boundary and don't move that point to a Y pixel boundary.             */
394 #define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE  10
395
396   SPH_TweakRule  SKIP_NONPIXEL_Y_MOVES_Rules
397                    [SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] =
398   {
399     /* fix vwxyz thinness*/
400     { "Consolas", 0, "Regular", 0 },
401     /* fix tiny gap at top of m */
402     { "Arial", 0, "Regular", 'm' },
403     /* Fix thin middle stems */
404     { "Core MS Legacy Fonts", 0, "Regular/Bold Class", 'N' },
405     { "Lucida Grande", 0, "", 'N' },
406     { "Lucida Grande", 0, "Bold", 'y' },
407     /* Cyrillic small letter I */
408     { "Legacy Sans Fonts", 0, "", 0x438 },
409     { "Verdana Clones", 0, "",'N' },
410     { "Ubuntu", 0, "Regular Class", 'N' },
411     /* Fix misshapen x */
412     { "Verdana", 0, "Bold", 'x' },
413     /* Fix misshapen s */
414     { "Tahoma", 0, "", 's' },
415   };
416
417
418 #define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  6
419
420   SPH_TweakRule  SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions
421                    [SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
422   {
423     { "Tahoma", 0, "", 'N' },
424     { "Comic Sans MS", 0, "", 'N' },
425     { "Verdana", 0, "Regular/Bold Class", 'N' },
426     { "Verdana", 11, "Bold", 'x' },
427     /* Cyrillic small letter I */
428     { "Arial", 0, "", 0x438 },
429     { "Trebuchet MS", 0, "Bold", 0 },
430   };
431
432
433   /* Skip Y moves that move a point off a Y pixel boundary.                */
434   /* This fixes Tahoma, Trebuchet oddities and some issues with `$'.       */
435 #define SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE  5
436
437   SPH_TweakRule  SKIP_OFFPIXEL_Y_MOVES_Rules
438                    [SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE] =
439   {
440     { "MS Legacy Fonts", 0, "", 0 },
441     { "Apple Legacy Fonts", 0, "", 0 },
442     { "Misc Legacy Fonts", 0, "", 0 },
443     { "Ubuntu", 0, "Regular Class", 0 },
444     { "Verdana Clones", 0, "", 0 },
445   };
446
447
448 #define SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  1
449
450   SPH_TweakRule  SKIP_OFFPIXEL_Y_MOVES_Rules_Exceptions
451                    [SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
452   {
453     { "-", 0, "", 0 },
454   };
455
456
457   /* Round moves that don't move a point to a Y pixel boundary.            */
458 #define ROUND_NONPIXEL_Y_MOVES_RULES_SIZE  3
459
460   SPH_TweakRule  ROUND_NONPIXEL_Y_MOVES_Rules
461                    [ROUND_NONPIXEL_Y_MOVES_RULES_SIZE] =
462   {
463     /* Droid font instructions don't snap Y to pixels */
464     { "Droid Sans", 0, "Regular/Italic Class", 0 },
465     { "Droid Sans Mono", 0, "", 0 },
466     { "Ubuntu", 0, "", 0 },
467   };
468
469
470 #define ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  3
471
472   SPH_TweakRule  ROUND_NONPIXEL_Y_MOVES_Rules_Exceptions
473                    [ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
474   {
475     { "Droid Sans", 12, "Bold", 0 },
476     { "Droid Sans", 13, "Bold", 0 },
477     { "Droid Sans", 16, "Bold", 0 },
478   };
479
480
481   /* Allow a Direct_Move_X along X freedom vector if matched.              */
482 #define ALLOW_X_DMOVEX_RULES_SIZE  1
483
484   SPH_TweakRule  ALLOW_X_DMOVEX_Rules
485                    [ALLOW_X_DMOVEX_RULES_SIZE] =
486   {
487     { "-", 0, "Regular", 0 },
488   };
489
490
491   /* Allow a Direct_Move along X freedom vector if matched.                */
492 #define ALLOW_X_DMOVE_RULES_SIZE  1
493
494   SPH_TweakRule  ALLOW_X_DMOVE_Rules
495                    [ALLOW_X_DMOVE_RULES_SIZE] =
496   {
497     /* Fixes vanishing diagonal in 4 */
498     { "Verdana", 0, "Regular", '4' },
499   };
500
501
502   /* Allow a ZP2 move along freedom vector if matched;                     */
503   /* This is called from SHP, SHPIX, SHC, SHZ.                             */
504 #define ALLOW_X_MOVE_ZP2_RULES_SIZE  1
505
506   SPH_TweakRule  ALLOW_X_MOVE_ZP2_Rules
507                    [ALLOW_X_MOVE_ZP2_RULES_SIZE] =
508   {
509     { "-", 0, "", 0 },
510   };
511
512
513   /* Return MS rasterizer version 35 if matched.                           */
514 #define RASTERIZER_35_RULES_SIZE  8
515
516   SPH_TweakRule  RASTERIZER_35_Rules
517                    [RASTERIZER_35_RULES_SIZE] =
518   {
519     /* This seems to be the only way to make these look good */
520     { "Times New Roman", 0, "Regular", 'i' },
521     { "Times New Roman", 0, "Regular", 'j' },
522     { "Times New Roman", 0, "Regular", 'm' },
523     { "Times New Roman", 0, "Regular", 'r' },
524     { "Times New Roman", 0, "Regular", 'a' },
525     { "Times New Roman", 0, "Regular", 'n' },
526     { "Times New Roman", 0, "Regular", 'p' },
527     { "Times", 0, "", 0 },
528   };
529
530
531   /* Don't round to the subpixel grid.  Round to pixel grid.               */
532 #define NORMAL_ROUND_RULES_SIZE  2
533
534   SPH_TweakRule  NORMAL_ROUND_Rules
535                    [NORMAL_ROUND_RULES_SIZE] =
536   {
537     /* Fix point "explosions" */
538     { "Courier New", 0, "", 0 },
539     { "Verdana", 10, "Regular", '4' },
540   };
541
542
543   /* Skip IUP instructions if matched.                                     */
544 #define SKIP_IUP_RULES_SIZE  1
545
546   SPH_TweakRule  SKIP_IUP_Rules
547                    [SKIP_IUP_RULES_SIZE] =
548   {
549     { "Arial", 13, "Regular", 'a' },
550   };
551
552
553   /* Skip MIAP Twilight hack if matched.                                   */
554 #define MIAP_HACK_RULES_SIZE  1
555
556   SPH_TweakRule  MIAP_HACK_Rules
557                    [MIAP_HACK_RULES_SIZE] =
558   {
559     { "Geneva", 12, "", 0 },
560   };
561
562
563   /* Skip DELTAP instructions if matched.                                  */
564 #define ALWAYS_SKIP_DELTAP_RULES_SIZE  16
565
566   SPH_TweakRule  ALWAYS_SKIP_DELTAP_Rules
567                    [ALWAYS_SKIP_DELTAP_RULES_SIZE] =
568   {
569     { "Georgia", 0, "Regular", 'k' },
570     /* fixes problems with W M w */
571     { "Trebuchet MS", 0, "Italic", 0 },
572     /* fix various problems with e in different versions */
573     { "Trebuchet MS", 14, "Regular", 'e' },
574     { "Trebuchet MS", 13, "Regular", 'e' },
575     { "Trebuchet MS", 15, "Regular", 'e' },
576     { "Arial", 11, "Regular", 's' },
577     { "Verdana", 10, "Regular", 0 },
578     { "Verdana", 9, "Regular", 0 },
579     /* Cyrillic small letter short I */
580     { "Legacy Sans Fonts", 0, "", 0x438 },
581     { "Legacy Sans Fonts", 0, "", 0x439 },
582     { "Arial", 10, "Regular", '6' },
583     { "Arial", 0, "Bold/BoldItalic Class", 'a' },
584     /* Make horizontal stems consistent with the rest */
585     { "Arial", 24, "Bold", 's' },
586     { "Arial", 25, "Bold", 's' },
587     { "Arial", 24, "Bold", 'a' },
588     { "Arial", 25, "Bold", 'a' },
589   };
590
591
592   /* Always do DELTAP instructions if matched.                             */
593 #define ALWAYS_DO_DELTAP_RULES_SIZE  2
594
595   SPH_TweakRule  ALWAYS_DO_DELTAP_Rules
596                    [ALWAYS_DO_DELTAP_RULES_SIZE] =
597   {
598     { "Verdana Clones", 17, "Regular Class", 'K' },
599     { "Verdana Clones", 17, "Regular Class", 'k' },
600   };
601
602
603   /* Do an extra RTG instruction in DELTAP if matched.                     */
604 #define DELTAP_RTG_RULES_SIZE  1
605
606   SPH_TweakRule  DELTAP_RTG_Rules
607                    [DELTAP_RTG_RULES_SIZE] =
608   {
609     { "-", 0, "", 0 },
610   };
611
612
613   /* Force CVT distance to zero in MIRP.                                   */
614 #define MIRP_CVT_ZERO_RULES_SIZE  1
615
616   SPH_TweakRule  MIRP_CVT_ZERO_Rules
617                    [MIRP_CVT_ZERO_RULES_SIZE] =
618   {
619     { "-", 0, "", 0 },
620   };
621
622
623   /* Skip moves that meet or exceed 1 pixel.                               */
624 #define DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE  1
625
626   SPH_TweakRule  DELTAP_SKIP_EXAGGERATED_VALUES_Rules
627                    [DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE] =
628   {
629     /* Fix vanishing stems */
630     { "Ubuntu", 0, "Regular", 'M' },
631   };
632
633
634   /* Don't allow ALIGNRP after IUP.                                        */
635 #define NO_ALIGNRP_AFTER_IUP_RULES_SIZE  4
636
637   SPH_TweakRule  NO_ALIGNRP_AFTER_IUP_Rules
638                    [NO_ALIGNRP_AFTER_IUP_RULES_SIZE] =
639   {
640     /* Prevent creation of dents in outline */
641     { "Courier New", 0, "Bold", 'C' },
642     { "Courier New", 0, "Bold", 'D' },
643     { "Courier New", 0, "Bold", 'Q' },
644     { "Courier New", 0, "Bold", '0' },
645   };
646
647
648   /* Don't allow DELTAP after IUP.                                         */
649 #define NO_DELTAP_AFTER_IUP_RULES_SIZE  2
650
651   SPH_TweakRule  NO_DELTAP_AFTER_IUP_Rules
652                    [NO_DELTAP_AFTER_IUP_RULES_SIZE] =
653   {
654     { "Arial", 0, "Bold", 'N' },
655     { "Verdana", 0, "Regular", '4' },
656   };
657
658
659   /* Don't allow CALL after IUP.                                           */
660 #define NO_CALL_AFTER_IUP_RULES_SIZE  4
661
662   SPH_TweakRule  NO_CALL_AFTER_IUP_Rules
663                    [NO_CALL_AFTER_IUP_RULES_SIZE] =
664   {
665     /* Prevent creation of dents in outline */
666     { "Courier New", 0, "Bold", 'O' },
667     { "Courier New", 0, "Bold", 'Q' },
668     { "Courier New", 0, "Bold", 'k' },
669     { "Courier New", 0, "Bold Italic", 'M' },
670   };
671
672
673   /* De-embolden these glyphs slightly.                                    */
674 #define DEEMBOLDEN_RULES_SIZE  9
675
676   SPH_TweakRule  DEEMBOLDEN_Rules
677                    [DEEMBOLDEN_RULES_SIZE] =
678   {
679     { "Courier New", 0, "Bold", 'A' },
680     { "Courier New", 0, "Bold", 'W' },
681     { "Courier New", 0, "Bold", 'w' },
682     { "Courier New", 0, "Bold", 'M' },
683     { "Courier New", 0, "Bold", 'X' },
684     { "Courier New", 0, "Bold", 'K' },
685     { "Courier New", 0, "Bold", 'x' },
686     { "Courier New", 0, "Bold", 'z' },
687     { "Courier New", 0, "Bold", 'v' },
688   };
689
690
691   /* Embolden these glyphs slightly.                                       */
692 #define EMBOLDEN_RULES_SIZE  5
693
694   SPH_TweakRule  EMBOLDEN_Rules
695                    [EMBOLDEN_RULES_SIZE] =
696   {
697     { "Courier New", 12, "Italic", 'z' },
698     { "Courier New", 11, "Italic", 'z' },
699     { "Courier New", 10, "Italic", 'z' },
700     { "Courier New", 0, "Regular", 0 },
701     { "Courier New", 0, "Italic", 0 },
702   };
703
704
705   /* Do an extra RDTG instruction in DELTAP if matched.                    */
706 #define DELTAP_RDTG_RULES_SIZE  1
707
708   SPH_TweakRule  DELTAP_RDTG_Rules
709                    [DELTAP_RDTG_RULES_SIZE] =
710   {
711     { "-", 0, "", 0 },
712   };
713
714
715   /* This is a CVT hack that makes thick horizontal stems on 2, 5, 7       */
716   /* similar to Windows XP.                                                */
717 #define TIMES_NEW_ROMAN_HACK_RULES_SIZE  12
718
719   SPH_TweakRule  TIMES_NEW_ROMAN_HACK_Rules
720                    [TIMES_NEW_ROMAN_HACK_RULES_SIZE] =
721   {
722     { "Times New Roman", 16, "Italic", '2' },
723     { "Times New Roman", 16, "Italic", '5' },
724     { "Times New Roman", 16, "Italic", '7' },
725     { "Times New Roman", 16, "Regular", '2' },
726     { "Times New Roman", 16, "Regular", '5' },
727     { "Times New Roman", 16, "Regular", '7' },
728     { "Times New Roman", 17, "Italic", '2' },
729     { "Times New Roman", 17, "Italic", '5' },
730     { "Times New Roman", 17, "Italic", '7' },
731     { "Times New Roman", 17, "Regular", '2' },
732     { "Times New Roman", 17, "Regular", '5' },
733     { "Times New Roman", 17, "Regular", '7' },
734   };
735
736
737   /* This fudges distance on 2 to get rid of the vanishing stem issue.     */
738   /* A real solution to this is certainly welcome.                         */
739 #define COURIER_NEW_2_HACK_RULES_SIZE  15
740
741   SPH_TweakRule  COURIER_NEW_2_HACK_Rules
742                    [COURIER_NEW_2_HACK_RULES_SIZE] =
743   {
744     { "Courier New", 10, "Regular", '2' },
745     { "Courier New", 11, "Regular", '2' },
746     { "Courier New", 12, "Regular", '2' },
747     { "Courier New", 13, "Regular", '2' },
748     { "Courier New", 14, "Regular", '2' },
749     { "Courier New", 15, "Regular", '2' },
750     { "Courier New", 16, "Regular", '2' },
751     { "Courier New", 17, "Regular", '2' },
752     { "Courier New", 18, "Regular", '2' },
753     { "Courier New", 19, "Regular", '2' },
754     { "Courier New", 20, "Regular", '2' },
755     { "Courier New", 21, "Regular", '2' },
756     { "Courier New", 22, "Regular", '2' },
757     { "Courier New", 23, "Regular", '2' },
758     { "Courier New", 24, "Regular", '2' },
759   };
760
761
762 #ifndef FORCE_NATURAL_WIDTHS
763
764   /* Use compatible widths with these glyphs.  Compatible widths is always */
765   /* on when doing B/W TrueType instructing, but is used selectively here, */
766   /* typically on glyphs with 3 or more vertical stems.                    */
767 #define COMPATIBLE_WIDTHS_RULES_SIZE  38
768
769   SPH_TweakRule  COMPATIBLE_WIDTHS_Rules
770                    [COMPATIBLE_WIDTHS_RULES_SIZE] =
771   {
772     { "Arial Unicode MS", 12, "Regular Class", 'm' },
773     { "Arial Unicode MS", 14, "Regular Class", 'm' },
774     /* Cyrillic small letter sha */
775     { "Arial", 10, "Regular Class", 0x448 },
776     { "Arial", 11, "Regular Class", 'm' },
777     { "Arial", 12, "Regular Class", 'm' },
778     /* Cyrillic small letter sha */
779     { "Arial", 12, "Regular Class", 0x448 },
780     { "Arial", 13, "Regular Class", 0x448 },
781     { "Arial", 14, "Regular Class", 'm' },
782     /* Cyrillic small letter sha */
783     { "Arial", 14, "Regular Class", 0x448 },
784     { "Arial", 15, "Regular Class", 0x448 },
785     { "Arial", 17, "Regular Class", 'm' },
786     { "DejaVu Sans", 15, "Regular Class", 0 },
787     { "Microsoft Sans Serif", 11, "Regular Class", 0 },
788     { "Microsoft Sans Serif", 12, "Regular Class", 0 },
789     { "Segoe UI", 11, "Regular Class", 0 },
790     { "Monaco", 0, "Regular Class", 0 },
791     { "Segoe UI", 12, "Regular Class", 'm' },
792     { "Segoe UI", 14, "Regular Class", 'm' },
793     { "Tahoma", 11, "Regular Class", 0 },
794     { "Times New Roman", 16, "Regular Class", 'c' },
795     { "Times New Roman", 16, "Regular Class", 'm' },
796     { "Times New Roman", 16, "Regular Class", 'o' },
797     { "Times New Roman", 16, "Regular Class", 'w' },
798     { "Trebuchet MS", 11, "Regular Class", 0 },
799     { "Trebuchet MS", 12, "Regular Class", 0 },
800     { "Trebuchet MS", 14, "Regular Class", 0 },
801     { "Trebuchet MS", 15, "Regular Class", 0 },
802     { "Ubuntu", 12, "Regular Class", 'm' },
803     /* Cyrillic small letter sha */
804     { "Verdana", 10, "Regular Class", 0x448 },
805     { "Verdana", 11, "Regular Class", 0x448 },
806     { "Verdana and Clones", 12, "Regular Class", 'i' },
807     { "Verdana and Clones", 12, "Regular Class", 'j' },
808     { "Verdana and Clones", 12, "Regular Class", 'l' },
809     { "Verdana and Clones", 12, "Regular Class", 'm' },
810     { "Verdana and Clones", 13, "Regular Class", 'i' },
811     { "Verdana and Clones", 13, "Regular Class", 'j' },
812     { "Verdana and Clones", 13, "Regular Class", 'l' },
813     { "Verdana and Clones", 14, "Regular Class", 'm' },
814   };
815
816
817   /* Scaling slightly in the x-direction prior to hinting results in       */
818   /* more visually pleasing glyphs in certain cases.                       */
819   /* This sometimes needs to be coordinated with compatible width rules.   */
820   /* A value of 1000 corresponds to a scaled value of 1.0.                 */
821 #define X_SCALING_RULES_SIZE  50
822
823   SPH_ScaleRule  X_SCALING_Rules
824                    [X_SCALING_RULES_SIZE] =
825   {
826     { "DejaVu Sans", 12, "Regular Class", 'm', 950 },
827     { "Verdana and Clones", 12, "Regular Class", 'a', 1100 },
828     { "Verdana and Clones", 13, "Regular Class", 'a', 1050 },
829     { "Arial", 11, "Regular Class", 'm', 975 },
830     { "Arial", 12, "Regular Class", 'm', 1050 },
831     /* Cyrillic small letter el */
832     { "Arial", 13, "Regular Class", 0x43B, 950 },
833     { "Arial", 13, "Regular Class", 'o', 950 },
834     { "Arial", 13, "Regular Class", 'e', 950 },
835     { "Arial", 14, "Regular Class", 'm', 950 },
836     /* Cyrillic small letter el */
837     { "Arial", 15, "Regular Class", 0x43B, 925 },
838     { "Bitstream Vera Sans", 10, "Regular/Italic Class", 0, 1100 },
839     { "Bitstream Vera Sans", 12, "Regular/Italic Class", 0, 1050 },
840     { "Bitstream Vera Sans", 16, "Regular Class", 0, 1050 },
841     { "Bitstream Vera Sans", 9, "Regular/Italic Class", 0, 1050 },
842     { "DejaVu Sans", 12, "Regular Class", 'l', 975 },
843     { "DejaVu Sans", 12, "Regular Class", 'i', 975 },
844     { "DejaVu Sans", 12, "Regular Class", 'j', 975 },
845     { "DejaVu Sans", 13, "Regular Class", 'l', 950 },
846     { "DejaVu Sans", 13, "Regular Class", 'i', 950 },
847     { "DejaVu Sans", 13, "Regular Class", 'j', 950 },
848     { "DejaVu Sans", 10, "Regular/Italic Class", 0, 1100 },
849     { "DejaVu Sans", 12, "Regular/Italic Class", 0, 1050 },
850     { "Georgia", 10, "", 0, 1050 },
851     { "Georgia", 11, "", 0, 1100 },
852     { "Georgia", 12, "", 0, 1025 },
853     { "Georgia", 13, "", 0, 1050 },
854     { "Georgia", 16, "", 0, 1050 },
855     { "Georgia", 17, "", 0, 1030 },
856     { "Liberation Sans", 12, "Regular Class", 'm', 1100 },
857     { "Lucida Grande", 11, "Regular Class", 'm', 1100 },
858     { "Microsoft Sans Serif", 11, "Regular Class", 'm', 950 },
859     { "Microsoft Sans Serif", 12, "Regular Class", 'm', 1050 },
860     { "Segoe UI", 12, "Regular Class", 'H', 1050 },
861     { "Segoe UI", 12, "Regular Class", 'm', 1050 },
862     { "Segoe UI", 14, "Regular Class", 'm', 1050 },
863     { "Tahoma", 11, "Regular Class", 'i', 975 },
864     { "Tahoma", 11, "Regular Class", 'l', 975 },
865     { "Tahoma", 11, "Regular Class", 'j', 900 },
866     { "Tahoma", 11, "Regular Class", 'm', 918 },
867     { "Verdana", 10, "Regular/Italic Class", 0, 1100 },
868     { "Verdana", 12, "Regular Class", 'm', 975 },
869     { "Verdana", 12, "Regular/Italic Class", 0, 1050 },
870     { "Verdana", 13, "Regular/Italic Class", 'i', 950 },
871     { "Verdana", 13, "Regular/Italic Class", 'j', 950 },
872     { "Verdana", 13, "Regular/Italic Class", 'l', 950 },
873     { "Verdana", 16, "Regular Class", 0, 1050 },
874     { "Verdana", 9, "Regular/Italic Class", 0, 1050 },
875     { "Times New Roman", 16, "Regular Class", 'm', 918 },
876     { "Trebuchet MS", 11, "Regular Class", 'm', 800 },
877     { "Trebuchet MS", 12, "Regular Class", 'm', 800 },
878   };
879
880 #else
881
882 #define COMPATIBLE_WIDTHS_RULES_SIZE  1
883
884   SPH_TweakRule  COMPATIBLE_WIDTHS_Rules
885                    [COMPATIBLE_WIDTHS_RULES_SIZE] =
886   {
887     { "-", 0, "", 0 },
888   };
889
890
891 #define X_SCALING_RULES_SIZE  1
892
893   SPH_ScaleRule  X_SCALING_Rules
894                    [X_SCALING_RULES_SIZE] =
895   {
896     { "-", 0, "", 0, 1000 },
897   };
898
899 #endif /* FORCE_NATURAL_WIDTHS */
900
901 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
902
903
904 FT_END_HEADER
905
906 #endif /* __TTSUBPIX_H__ */
907
908 /* END */