OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2013 Google, Inc. | 2 * Copyright © 2013 Google, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return hangul_plan; | 79 return hangul_plan; |
80 } | 80 } |
81 | 81 |
82 static void | 82 static void |
83 data_destroy_hangul (void *data) | 83 data_destroy_hangul (void *data) |
84 { | 84 { |
85 free (data); | 85 free (data); |
86 } | 86 } |
87 | 87 |
88 /* Constants for algorithmic hangul syllable [de]composition. */ | 88 /* Constants for algorithmic hangul syllable [de]composition. */ |
89 #define LBase 0x1100 | 89 #define LBase 0x1100u |
90 #define VBase 0x1161 | 90 #define VBase 0x1161u |
91 #define TBase 0x11A7 | 91 #define TBase 0x11A7u |
92 #define LCount 19 | 92 #define LCount 19u |
93 #define VCount 21 | 93 #define VCount 21u |
94 #define TCount 28 | 94 #define TCount 28u |
95 #define SBase 0xAC00 | 95 #define SBase 0xAC00u |
96 #define NCount (VCount * TCount) | 96 #define NCount (VCount * TCount) |
97 #define SCount (LCount * NCount) | 97 #define SCount (LCount * NCount) |
98 | 98 |
99 #define isCombiningL(u) (hb_in_range<hb_codepoint_t> ((u), LBase, LBase+LCount-1
)) | 99 #define isCombiningL(u) (hb_in_range ((u), LBase, LBase+LCount-1)) |
100 #define isCombiningV(u) (hb_in_range<hb_codepoint_t> ((u), VBase, VBase+VCount-1
)) | 100 #define isCombiningV(u) (hb_in_range ((u), VBase, VBase+VCount-1)) |
101 #define isCombiningT(u) (hb_in_range<hb_codepoint_t> ((u), TBase+1, TBase+TCount
-1)) | 101 #define isCombiningT(u) (hb_in_range ((u), TBase+1, TBase+TCount-1)) |
102 #define isCombinedS(u) (hb_in_range<hb_codepoint_t> ((u), SBase, SBase+SCount-1)
) | 102 #define isCombinedS(u) (hb_in_range ((u), SBase, SBase+SCount-1)) |
103 | 103 |
104 #define isL(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x1100, 0x115F, 0xA960, 0xA97
C)) | 104 #define isL(u) (hb_in_ranges ((u), 0x1100u, 0x115Fu, 0xA960u, 0xA97Cu)) |
105 #define isV(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x1160, 0x11A7, 0xD7B0, 0xD7C
6)) | 105 #define isV(u) (hb_in_ranges ((u), 0x1160u, 0x11A7u, 0xD7B0u, 0xD7C6u)) |
106 #define isT(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x11A8, 0x11FF, 0xD7CB, 0xD7F
B)) | 106 #define isT(u) (hb_in_ranges ((u), 0x11A8u, 0x11FFu, 0xD7CBu, 0xD7FBu)) |
107 | 107 |
108 #define isHangulTone(u) (hb_in_range<hb_codepoint_t> ((u), 0x302e, 0x302f)) | 108 #define isHangulTone(u) (hb_in_range ((u), 0x302Eu, 0x302Fu)) |
109 | 109 |
110 /* buffer var allocations */ | 110 /* buffer var allocations */ |
111 #define hangul_shaping_feature() complex_var_u8_0() /* hangul jamo shaping featu
re */ | 111 #define hangul_shaping_feature() complex_var_u8_0() /* hangul jamo shaping featu
re */ |
112 | 112 |
113 static bool | 113 static bool |
114 is_zero_width_char (hb_font_t *font, | 114 is_zero_width_char (hb_font_t *font, |
115 hb_codepoint_t unicode) | 115 hb_codepoint_t unicode) |
116 { | 116 { |
117 hb_codepoint_t glyph; | 117 hb_codepoint_t glyph; |
118 return hb_font_get_glyph (font, unicode, 0, &glyph) && hb_font_get_glyph_h_adv
ance (font, glyph) == 0; | 118 return hb_font_get_glyph (font, unicode, 0, &glyph) && hb_font_get_glyph_h_adv
ance (font, glyph) == 0; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 /* Merge clusters across the (possibly reordered) syllable+tone. | 204 /* Merge clusters across the (possibly reordered) syllable+tone. |
205 * We want to merge even in the zero-width tone mark case here, | 205 * We want to merge even in the zero-width tone mark case here, |
206 * so that clustering behavior isn't dependent on how the tone mark | 206 * so that clustering behavior isn't dependent on how the tone mark |
207 * is handled by the font. | 207 * is handled by the font. |
208 */ | 208 */ |
209 buffer->merge_out_clusters (start, end + 1); | 209 buffer->merge_out_clusters (start, end + 1); |
210 } | 210 } |
211 else | 211 else |
212 { | 212 { |
213 /* No valid syllable as base for tone mark; try to insert dotted circle.
*/ | 213 /* No valid syllable as base for tone mark; try to insert dotted circle.
*/ |
214 » if (font->has_glyph (0x25cc)) | 214 » if (font->has_glyph (0x25CCu)) |
215 { | 215 { |
216 hb_codepoint_t chars[2]; | 216 hb_codepoint_t chars[2]; |
217 if (!is_zero_width_char (font, u)) { | 217 if (!is_zero_width_char (font, u)) { |
218 chars[0] = u; | 218 chars[0] = u; |
219 » chars[1] = 0x25cc; | 219 » chars[1] = 0x25CCu; |
220 } else { | 220 } else { |
221 » chars[0] = 0x25cc; | 221 » chars[0] = 0x25CCu; |
222 chars[1] = u; | 222 chars[1] = u; |
223 } | 223 } |
224 buffer->replace_glyphs (1, 2, chars); | 224 buffer->replace_glyphs (1, 2, chars); |
225 } | 225 } |
226 else | 226 else |
227 { | 227 { |
228 /* No dotted circle available in the font; just leave tone mark untouc
hed. */ | 228 /* No dotted circle available in the font; just leave tone mark untouc
hed. */ |
229 buffer->next_glyph (); | 229 buffer->next_glyph (); |
230 } | 230 } |
231 } | 231 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 data_create_hangul, /* data_create */ | 408 data_create_hangul, /* data_create */ |
409 data_destroy_hangul, /* data_destroy */ | 409 data_destroy_hangul, /* data_destroy */ |
410 preprocess_text_hangul, | 410 preprocess_text_hangul, |
411 HB_OT_SHAPE_NORMALIZATION_MODE_NONE, | 411 HB_OT_SHAPE_NORMALIZATION_MODE_NONE, |
412 NULL, /* decompose */ | 412 NULL, /* decompose */ |
413 NULL, /* compose */ | 413 NULL, /* compose */ |
414 setup_masks_hangul, /* setup_masks */ | 414 setup_masks_hangul, /* setup_masks */ |
415 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, | 415 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
416 false, /* fallback_position */ | 416 false, /* fallback_position */ |
417 }; | 417 }; |
OLD | NEW |