Sync with trunk r63343.
[reactos.git] / lib / 3rdparty / freetype / src / autofit / afindic.c
1 /***************************************************************************/
2 /* */
3 /* afindic.c */
4 /* */
5 /* Auto-fitter hinting routines for Indic writing system (body). */
6 /* */
7 /* Copyright 2007, 2011-2013 by */
8 /* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
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 #include "aftypes.h"
20 #include "aflatin.h"
21
22
23 #ifdef AF_CONFIG_OPTION_INDIC
24
25 #include "afindic.h"
26 #include "aferrors.h"
27 #include "afcjk.h"
28
29
30 #ifdef AF_CONFIG_OPTION_USE_WARPER
31 #include "afwarp.h"
32 #endif
33
34
35 static FT_Error
36 af_indic_metrics_init( AF_CJKMetrics metrics,
37 FT_Face face )
38 {
39 /* skip blue zone init in CJK routines */
40 FT_CharMap oldmap = face->charmap;
41
42
43 metrics->units_per_em = face->units_per_EM;
44
45 if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
46 face->charmap = NULL;
47 else
48 {
49 af_cjk_metrics_init_widths( metrics, face );
50 #if 0
51 /* either need indic specific blue_chars[] or just skip blue zones */
52 af_cjk_metrics_init_blues( metrics, face, af_cjk_blue_chars );
53 #endif
54 af_cjk_metrics_check_digits( metrics, face );
55 }
56
57 FT_Set_Charmap( face, oldmap );
58
59 return FT_Err_Ok;
60 }
61
62
63 static void
64 af_indic_metrics_scale( AF_CJKMetrics metrics,
65 AF_Scaler scaler )
66 {
67 /* use CJK routines */
68 af_cjk_metrics_scale( metrics, scaler );
69 }
70
71
72 static FT_Error
73 af_indic_hints_init( AF_GlyphHints hints,
74 AF_CJKMetrics metrics )
75 {
76 /* use CJK routines */
77 return af_cjk_hints_init( hints, metrics );
78 }
79
80
81 static FT_Error
82 af_indic_hints_apply( AF_GlyphHints hints,
83 FT_Outline* outline,
84 AF_CJKMetrics metrics )
85 {
86 /* use CJK routines */
87 return af_cjk_hints_apply( hints, outline, metrics );
88 }
89
90
91 /*************************************************************************/
92 /*************************************************************************/
93 /***** *****/
94 /***** I N D I C S C R I P T C L A S S *****/
95 /***** *****/
96 /*************************************************************************/
97 /*************************************************************************/
98
99
100 AF_DEFINE_WRITING_SYSTEM_CLASS(
101 af_indic_writing_system_class,
102
103 AF_WRITING_SYSTEM_INDIC,
104
105 sizeof ( AF_CJKMetricsRec ),
106
107 (AF_WritingSystem_InitMetricsFunc) af_indic_metrics_init,
108 (AF_WritingSystem_ScaleMetricsFunc)af_indic_metrics_scale,
109 (AF_WritingSystem_DoneMetricsFunc) NULL,
110
111 (AF_WritingSystem_InitHintsFunc) af_indic_hints_init,
112 (AF_WritingSystem_ApplyHintsFunc) af_indic_hints_apply
113 )
114
115
116 #else /* !AF_CONFIG_OPTION_INDIC */
117
118
119 AF_DEFINE_WRITING_SYSTEM_CLASS(
120 af_indic_writing_system_class,
121
122 AF_WRITING_SYSTEM_INDIC,
123
124 sizeof ( AF_CJKMetricsRec ),
125
126 (AF_WritingSystem_InitMetricsFunc) NULL,
127 (AF_WritingSystem_ScaleMetricsFunc)NULL,
128 (AF_WritingSystem_DoneMetricsFunc) NULL,
129
130 (AF_WritingSystem_InitHintsFunc) NULL,
131 (AF_WritingSystem_ApplyHintsFunc) NULL
132 )
133
134
135 #endif /* !AF_CONFIG_OPTION_INDIC */
136
137
138 /* END */