2 * Copyright © 2010,2012 Google, Inc.
4 * This is part of HarfBuzz, a text shaping library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 * Google Author(s): Behdad Esfahbod
27 #include "hb-ot-shape-complex-private.hh"
31 compose_hebrew (const hb_ot_shape_normalize_context_t
*c
,
36 /* Hebrew presentation-form shaping.
37 * https://bugzilla.mozilla.org/show_bug.cgi?id=728866
38 * Hebrew presentation forms with dagesh, for characters U+05D0..05EA;
39 * Note that some letters do not have a dagesh presForm encoded.
41 static const hb_codepoint_t sDageshForms
[0x05EAu
- 0x05D0u
+ 1] = {
52 0xFB3Au
, /* FINAL KAF */
55 0x0000u
, /* FINAL MEM */
57 0x0000u
, /* FINAL NUN */
61 0xFB43u
, /* FINAL PE */
63 0x0000u
, /* FINAL TSADI */
71 bool found
= c
->unicode
->compose (a
, b
, ab
);
73 if (!found
&& !c
->plan
->has_mark
)
75 /* Special-case Hebrew presentation forms that are excluded from
76 * standard normalization, but wanted for old fonts. */
78 case 0x05B4u
: /* HIRIQ */
79 if (a
== 0x05D9u
) { /* YOD */
84 case 0x05B7u
: /* patah */
85 if (a
== 0x05F2u
) { /* YIDDISH YOD YOD */
88 } else if (a
== 0x05D0u
) { /* ALEF */
93 case 0x05B8u
: /* QAMATS */
94 if (a
== 0x05D0u
) { /* ALEF */
99 case 0x05B9u
: /* HOLAM */
100 if (a
== 0x05D5u
) { /* VAV */
105 case 0x05BCu
: /* DAGESH */
106 if (a
>= 0x05D0u
&& a
<= 0x05EAu
) {
107 *ab
= sDageshForms
[a
- 0x05D0u
];
109 } else if (a
== 0xFB2Au
) { /* SHIN WITH SHIN DOT */
112 } else if (a
== 0xFB2Bu
) { /* SHIN WITH SIN DOT */
117 case 0x05BFu
: /* RAFE */
119 case 0x05D1u
: /* BET */
123 case 0x05DBu
: /* KAF */
127 case 0x05E4u
: /* PE */
133 case 0x05C1u
: /* SHIN DOT */
134 if (a
== 0x05E9u
) { /* SHIN */
137 } else if (a
== 0xFB49u
) { /* SHIN WITH DAGESH */
142 case 0x05C2u
: /* SIN DOT */
143 if (a
== 0x05E9u
) { /* SHIN */
146 } else if (a
== 0xFB49u
) { /* SHIN WITH DAGESH */
158 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew
=
161 NULL
, /* collect_features */
162 NULL
, /* override_features */
163 NULL
, /* data_create */
164 NULL
, /* data_destroy */
165 NULL
, /* preprocess_text */
166 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT
,
167 NULL
, /* decompose */
169 NULL
, /* setup_masks */
170 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE
,
171 true, /* fallback_position */