OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2009 Red Hat, Inc. |
3 * Copyright © 2011 Codethink Limited | 3 * Copyright © 2011 Codethink Limited |
4 * Copyright © 2010,2011 Google, Inc. | 4 * Copyright © 2010,2011 Google, Inc. |
5 * | 5 * |
6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
7 * | 7 * |
8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return HB_SCRIPT_UNKNOWN; | 78 return HB_SCRIPT_UNKNOWN; |
79 } | 79 } |
80 | 80 |
81 static hb_bool_t | 81 static hb_bool_t |
82 hb_unicode_compose_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, | 82 hb_unicode_compose_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, |
83 hb_codepoint_t a HB_UNUSED, | 83 hb_codepoint_t a HB_UNUSED, |
84 hb_codepoint_t b HB_UNUSED, | 84 hb_codepoint_t b HB_UNUSED, |
85 hb_codepoint_t *ab HB_UNUSED, | 85 hb_codepoint_t *ab HB_UNUSED, |
86 void *user_data HB_UNUSED) | 86 void *user_data HB_UNUSED) |
87 { | 87 { |
88 /* TODO handle Hangul jamo here? */ | |
89 return FALSE; | 88 return FALSE; |
90 } | 89 } |
91 | 90 |
92 static hb_bool_t | 91 static hb_bool_t |
93 hb_unicode_decompose_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, | 92 hb_unicode_decompose_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, |
94 hb_codepoint_t ab HB_UNUSED, | 93 hb_codepoint_t ab HB_UNUSED, |
95 hb_codepoint_t *a HB_UNUSED, | 94 hb_codepoint_t *a HB_UNUSED, |
96 hb_codepoint_t *b HB_UNUSED, | 95 hb_codepoint_t *b HB_UNUSED, |
97 void *user_data HB_UNUSED) | 96 void *user_data HB_UNUSED) |
98 { | 97 { |
99 /* TODO handle Hangul jamo here? */ | |
100 return FALSE; | 98 return FALSE; |
101 } | 99 } |
102 | 100 |
103 | 101 |
104 hb_unicode_funcs_t _hb_unicode_funcs_nil = { | 102 hb_unicode_funcs_t _hb_unicode_funcs_nil = { |
105 HB_OBJECT_HEADER_STATIC, | 103 HB_OBJECT_HEADER_STATIC, |
106 | 104 |
107 NULL, /* parent */ | 105 NULL, /* parent */ |
108 TRUE, /* immutable */ | 106 TRUE, /* immutable */ |
109 { | 107 { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 hb_bool_t | 262 hb_bool_t |
265 hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, | 263 hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, |
266 hb_codepoint_t ab, | 264 hb_codepoint_t ab, |
267 hb_codepoint_t *a, | 265 hb_codepoint_t *a, |
268 hb_codepoint_t *b) | 266 hb_codepoint_t *b) |
269 { | 267 { |
270 *a = ab; *b = 0; | 268 *a = ab; *b = 0; |
271 return ufuncs->func.decompose (ufuncs, ab, a, b, ufuncs->user_data.decompose); | 269 return ufuncs->func.decompose (ufuncs, ab, a, b, ufuncs->user_data.decompose); |
272 } | 270 } |
273 | 271 |
| 272 |
| 273 |
| 274 unsigned int |
| 275 _hb_unicode_modified_combining_class (hb_unicode_funcs_t *ufuncs, |
| 276 hb_codepoint_t unicode) |
| 277 { |
| 278 int c = hb_unicode_combining_class (ufuncs, unicode); |
| 279 |
| 280 if (unlikely (hb_in_range<int> (c, 27, 33))) |
| 281 { |
| 282 /* Modify the combining-class to suit Arabic better. See: |
| 283 * http://unicode.org/faq/normalization.html#8 |
| 284 * http://unicode.org/faq/normalization.html#9 |
| 285 */ |
| 286 c = c == 33 ? 27 : c + 1; |
| 287 } |
| 288 else if (unlikely (hb_in_range<int> (c, 10, 25))) |
| 289 { |
| 290 /* The equivalent fix for Hebrew is more complex. |
| 291 * |
| 292 * We permute the "fixed-position" classes 10-25 into the order |
| 293 * described in the SBL Hebrew manual: |
| 294 * |
| 295 * http://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf |
| 296 * |
| 297 * (as recommended by: |
| 298 * http://forum.fontlab.com/archive-old-microsoft-volt-group/vista-and-diac
ritic-ordering-t6751.0.html) |
| 299 * |
| 300 * More details here: |
| 301 * https://bugzilla.mozilla.org/show_bug.cgi?id=662055 |
| 302 */ |
| 303 static const int permuted_hebrew_classes[25 - 10 + 1] = { |
| 304 /* 10 sheva */ 22, |
| 305 /* 11 hataf segol */ 15, |
| 306 /* 12 hataf patah */ 16, |
| 307 /* 13 hataf qamats */ 17, |
| 308 /* 14 hiriq */ 23, |
| 309 /* 15 tsere */ 18, |
| 310 /* 16 segol */ 19, |
| 311 /* 17 patah */ 20, |
| 312 /* 18 qamats */ 21, |
| 313 /* 19 holam */ 14, |
| 314 /* 20 qubuts */ 24, |
| 315 /* 21 dagesh */ 12, |
| 316 /* 22 meteg */ 25, |
| 317 /* 23 rafe */ 13, |
| 318 /* 24 shin dot */ 10, |
| 319 /* 25 sin dot */ 11, |
| 320 }; |
| 321 c = permuted_hebrew_classes[c - 10]; |
| 322 } |
| 323 |
| 324 return c; |
| 325 } |
| 326 |
OLD | NEW |