zenilib: zenilib/jni/external/freetype2/src/autofit/afindic.c Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
afindic.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* afindic.c */
4 /* */
5 /* Auto-fitter hinting routines for Indic scripts (body). */
6 /* */
7 /* Copyright 2007, 2011 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, 0x7530 );
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 AF_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 static const AF_Script_UniRangeRec af_indic_uniranges[] =
101 {
102 #if 0
103 AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ), /* why this? */
104 #endif
105 AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL), /* Indic Range */
106 AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL), /* Tibetan */
107 AF_UNIRANGE_REC( 0x1900UL, 0x194FUL), /* Limbu */
108 AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL), /* Sundanese */
109 AF_UNIRANGE_REC( 0x1C80UL, 0x1CDFUL), /* Meetei Mayak */
110 AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL), /* Syloti Nagri */
111 AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL), /* Sharada */
112 AF_UNIRANGE_REC( 0UL, 0UL)
113 };
114
115
116 AF_DEFINE_SCRIPT_CLASS( af_indic_script_class,
117 AF_SCRIPT_INDIC,
118 af_indic_uniranges,
119
120 sizeof ( AF_CJKMetricsRec ),
121
122 (AF_Script_InitMetricsFunc) af_indic_metrics_init,
123 (AF_Script_ScaleMetricsFunc)af_indic_metrics_scale,
124 (AF_Script_DoneMetricsFunc) NULL,
125
126 (AF_Script_InitHintsFunc) af_indic_hints_init,
127 (AF_Script_ApplyHintsFunc) af_indic_hints_apply
128 )
129
130 #else /* !AF_CONFIG_OPTION_INDIC */
131
132 static const AF_Script_UniRangeRec af_indic_uniranges[] =
133 {
134 { 0, 0 }
135 };
136
137
138 AF_DEFINE_SCRIPT_CLASS( af_indic_script_class,
139 AF_SCRIPT_INDIC,
140 af_indic_uniranges,
141
142 sizeof ( AF_CJKMetricsRec ),
143
144 (AF_Script_InitMetricsFunc) NULL,
145 (AF_Script_ScaleMetricsFunc)NULL,
146 (AF_Script_DoneMetricsFunc) NULL,
147
148 (AF_Script_InitHintsFunc) NULL,
149 (AF_Script_ApplyHintsFunc) NULL
150 )
151
152 #endif /* !AF_CONFIG_OPTION_INDIC */
153
154
155 /* END */
FT_FaceRec_::units_per_EM
FT_UShort units_per_EM
Definition: freetype.h:938
af_cjk_metrics_check_digits
af_cjk_metrics_check_digits(AF_CJKMetrics metrics, FT_Face face)
FT_Error
int FT_Error
Definition: fttypes.h:296
AF_CJKMetricsRec_::units_per_em
FT_UInt units_per_em
Definition: afcjk.h:100
AF_Script_ApplyHintsFunc
void(* AF_Script_ApplyHintsFunc)(AF_GlyphHints hints, FT_Outline *outline, AF_ScriptMetrics metrics)
Definition: aftypes.h:278
afindic.h
FT_FaceRec_::charmap
FT_CharMap charmap
Definition: freetype.h:951
NULL
#define NULL
Definition: ftobjs.h:61
af_cjk_metrics_scale
af_cjk_metrics_scale(AF_CJKMetrics metrics, AF_Scaler scaler)
af_cjk_hints_apply
af_cjk_hints_apply(AF_GlyphHints hints, FT_Outline *outline, AF_CJKMetrics metrics)
af_indic_uniranges
static const AF_Script_UniRangeRec af_indic_uniranges[]
Definition: afindic.c:132
AF_Script_InitHintsFunc
FT_Error(* AF_Script_InitHintsFunc)(AF_GlyphHints hints, AF_ScriptMetrics metrics)
Definition: aftypes.h:274
metrics
GLuint GLsizei GLsizei GLfloat * metrics
Definition: glew.h:12394
FT_Outline_
Definition: ftimage.h:383
AF_UNIRANGE_REC
#define AF_UNIRANGE_REC(a, b)
Definition: aftypes.h:290
aferrors.h
AF_ScalerRec_
Definition: aftypes.h:180
AF_Script_InitMetricsFunc
FT_Error(* AF_Script_InitMetricsFunc)(AF_ScriptMetrics metrics, FT_Face face)
Definition: aftypes.h:262
afwarp.h
FT_FaceRec_
Definition: freetype.h:912
FT_Select_Charmap
FT_Select_Charmap(FT_Face face, FT_Encoding encoding)
Definition: ftobjs.c:3054
face
GLenum face
Definition: gl2ext.h:1490
AF_GlyphHintsRec_
Definition: afhints.h:331
AF_Script_ScaleMetricsFunc
void(* AF_Script_ScaleMetricsFunc)(AF_ScriptMetrics metrics, AF_Scaler scaler)
Definition: aftypes.h:266
FT_Set_Charmap
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3105
aftypes.h
AF_CJKMetricsRec_
Definition: afcjk.h:97
af_cjk_metrics_init_widths
af_cjk_metrics_init_widths(AF_CJKMetrics metrics, FT_Face face, FT_ULong charcode)
AF_DEFINE_SCRIPT_CLASS
#define AF_DEFINE_SCRIPT_CLASS(script_class, script_, ranges, m_size,m_init, m_scale, m_done, h_init, h_apply)
Definition: aftypes.h:318
FT_CharMapRec_
Definition: freetype.h:736
af_cjk_hints_init
af_cjk_hints_init(AF_GlyphHints hints, AF_CJKMetrics metrics)
afcjk.h
AF_Script_UniRangeRec_
Definition: aftypes.h:283
AF_SCRIPT_INDIC
Definition: aftypes.h:234
aflatin.h
AF_Script_DoneMetricsFunc
void(* AF_Script_DoneMetricsFunc)(AF_ScriptMetrics metrics)
Definition: aftypes.h:270