Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | static const HB_OpenTypeFeature hebrew_features[] = { | - |
8 | { ( ( (HB_UInt)'c' << 24 ) | ( (HB_UInt)'c' << 16 ) | ( (HB_UInt)'m' << 8 ) | (HB_UInt)'p' ), CcmpProperty }, | - |
9 | {0, 0} | - |
10 | }; | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) | - |
19 | { | - |
20 | enum { | - |
21 | Dagesh = 0x5bc, | - |
22 | ShinDot = 0x5c1, | - |
23 | SinDot = 0x5c2, | - |
24 | Patah = 0x5b7, | - |
25 | Qamats = 0x5b8, | - |
26 | Holam = 0x5b9, | - |
27 | Rafe = 0x5bf | - |
28 | }; | - |
29 | | - |
30 | ((shaper_item->item.script == HB_Script_Hebrew) ? static_cast<void> (0) : __assert_fail ("shaper_item->item.script == HB_Script_Hebrew", "../3rdparty/harfbuzz/src/harfbuzz-hebrew.c", 57, __PRETTY_FUNCTION__)); | - |
31 | | - |
32 | | - |
33 | if (HB_SelectScript(shaper_item, hebrew_features)) { partially evaluated: HB_SelectScript(shaper_item, hebrew_features) yes Evaluation Count:114 | no Evaluation Count:0 |
| 0-114 |
34 | | - |
35 | const int availableGlyphs = shaper_item->num_glyphs; | - |
36 | if (!HB_ConvertStringToGlyphIndices(shaper_item)) partially evaluated: !HB_ConvertStringToGlyphIndices(shaper_item) no Evaluation Count:0 | yes Evaluation Count:114 |
| 0-114 |
37 | return 0; never executed: return 0; | 0 |
38 | | - |
39 | HB_HeuristicSetGlyphAttributes(shaper_item); | - |
40 | HB_OpenTypeShape(shaper_item, 0); | - |
41 | return HB_OpenTypePosition(shaper_item, availableGlyphs, (!0)); executed: return HB_OpenTypePosition(shaper_item, availableGlyphs, (!0)); Execution Count:114 | 114 |
42 | } | - |
43 | | - |
44 | | - |
45 | { | - |
46 | const HB_UChar16 *uc = shaper_item->string + shaper_item->item.pos; | - |
47 | unsigned short *logClusters = shaper_item->log_clusters; | - |
48 | HB_GlyphAttributes *attributes = shaper_item->attributes; | - |
49 | | - |
50 | HB_Bool haveGlyphs; | - |
51 | int slen = 1; | - |
52 | int cluster_start = 0; | - |
53 | hb_uint32 i; | - |
54 | | - |
55 | HB_UChar16 stackshapedChars[512]; HB_UChar16 *shapedChars = stackshapedChars; if ((2 * shaper_item->item.length) >= 512) shapedChars = (HB_UChar16 *)malloc((2 * shaper_item->item.length) * sizeof(HB_UChar16));; never executed: shapedChars = (HB_UChar16 *)malloc((2 * shaper_item->item.length) * sizeof(HB_UChar16)); never evaluated: (2 * shaper_item->item.length) >= 512 | 0 |
56 | *shapedChars = *uc; | - |
57 | logClusters[0] = 0; | - |
58 | | - |
59 | for (i = 1; i < shaper_item->item.length; ++i) { never evaluated: i < shaper_item->item.length | 0 |
60 | hb_uint16 base = shapedChars[cluster_start]; | - |
61 | hb_uint16 shaped = 0; | - |
62 | HB_Bool invalid = 0; | - |
63 | if (uc[i] == Dagesh) { never evaluated: uc[i] == Dagesh | 0 |
64 | if (base >= 0x5d0 never evaluated: base >= 0x5d0 | 0 |
65 | && base <= 0x5ea never evaluated: base <= 0x5ea | 0 |
66 | && base != 0x5d7 never evaluated: base != 0x5d7 | 0 |
67 | && base != 0x5dd never evaluated: base != 0x5dd | 0 |
68 | && base != 0x5df never evaluated: base != 0x5df | 0 |
69 | && base != 0x5e2 never evaluated: base != 0x5e2 | 0 |
70 | && base != 0x5e5) { never evaluated: base != 0x5e5 | 0 |
71 | shaped = base - 0x5d0 + 0xfb30; | - |
72 | } else if (base == 0xfb2a || base == 0xfb2b ) { never evaluated: base == 0xfb2a never evaluated: base == 0xfb2b | 0 |
73 | shaped = base + 2; | - |
74 | } else { | 0 |
75 | invalid = (!0); | - |
76 | } | 0 |
77 | } else if (uc[i] == ShinDot) { never evaluated: uc[i] == ShinDot | 0 |
78 | if (base == 0x05e9) never evaluated: base == 0x05e9 | 0 |
79 | shaped = 0xfb2a; never executed: shaped = 0xfb2a; | 0 |
80 | else if (base == 0xfb49) never evaluated: base == 0xfb49 | 0 |
81 | shaped = 0xfb2c; never executed: shaped = 0xfb2c; | 0 |
82 | else | - |
83 | invalid = (!0); never executed: invalid = (!0); | 0 |
84 | } else if (uc[i] == SinDot) { never evaluated: uc[i] == SinDot | 0 |
85 | if (base == 0x05e9) never evaluated: base == 0x05e9 | 0 |
86 | shaped = 0xfb2b; never executed: shaped = 0xfb2b; | 0 |
87 | else if (base == 0xfb49) never evaluated: base == 0xfb49 | 0 |
88 | shaped = 0xfb2d; never executed: shaped = 0xfb2d; | 0 |
89 | else | - |
90 | invalid = (!0); never executed: invalid = (!0); | 0 |
91 | } else if (uc[i] == Patah) { never evaluated: uc[i] == Patah | 0 |
92 | if (base == 0x5d0) never evaluated: base == 0x5d0 | 0 |
93 | shaped = 0xfb2e; never executed: shaped = 0xfb2e; | 0 |
94 | } else if (uc[i] == Qamats) { never evaluated: uc[i] == Qamats | 0 |
95 | if (base == 0x5d0) never evaluated: base == 0x5d0 | 0 |
96 | shaped = 0xfb2f; never executed: shaped = 0xfb2f; | 0 |
97 | } else if (uc[i] == Holam) { never evaluated: uc[i] == Holam | 0 |
98 | if (base == 0x5d5) never evaluated: base == 0x5d5 | 0 |
99 | shaped = 0xfb4b; never executed: shaped = 0xfb4b; | 0 |
100 | } else if (uc[i] == Rafe) { never evaluated: uc[i] == Rafe | 0 |
101 | if (base == 0x5d1) never evaluated: base == 0x5d1 | 0 |
102 | shaped = 0xfb4c; never executed: shaped = 0xfb4c; | 0 |
103 | else if (base == 0x5db) never evaluated: base == 0x5db | 0 |
104 | shaped = 0xfb4d; never executed: shaped = 0xfb4d; | 0 |
105 | else if (base == 0x5e4) never evaluated: base == 0x5e4 | 0 |
106 | shaped = 0xfb4e; never executed: shaped = 0xfb4e; | 0 |
107 | } | - |
108 | | - |
109 | if (invalid) { | 0 |
110 | shapedChars[slen] = 0x25cc; | - |
111 | attributes[slen].clusterStart = (!0); | - |
112 | attributes[slen].mark = 0; | - |
113 | attributes[slen].combiningClass = 0; | - |
114 | cluster_start = slen; | - |
115 | ++slen; | - |
116 | } | 0 |
117 | if (shaped) { | 0 |
118 | if (shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)) { never evaluated: shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1) | 0 |
119 | shapedChars[cluster_start] = shaped; | - |
120 | } else | 0 |
121 | shaped = 0; never executed: shaped = 0; | 0 |
122 | } | - |
123 | if (!shaped) { | 0 |
124 | HB_CharCategory category; | - |
125 | int cmb; | - |
126 | shapedChars[slen] = uc[i]; | - |
127 | HB_GetUnicodeCharProperties(uc[i], &category, &cmb); | - |
128 | if (category != HB_Mark_NonSpacing) { never evaluated: category != HB_Mark_NonSpacing | 0 |
129 | attributes[slen].clusterStart = (!0); | - |
130 | attributes[slen].mark = 0; | - |
131 | attributes[slen].combiningClass = 0; | - |
132 | attributes[slen].dontPrint = ((uc[i] >= 0x200b && uc[i] <= 0x200f ) || (uc[i] >= 0x2028 && uc[i] <= 0x202f ) || (uc[i] >= 0x206a && uc[i] <= 0x206f )); never evaluated: uc[i] >= 0x200b never evaluated: uc[i] <= 0x200f never evaluated: uc[i] >= 0x2028 never evaluated: uc[i] <= 0x202f never evaluated: uc[i] >= 0x206a never evaluated: uc[i] <= 0x206f | 0 |
133 | cluster_start = slen; | - |
134 | } else { | 0 |
135 | attributes[slen].clusterStart = 0; | - |
136 | attributes[slen].mark = (!0); | - |
137 | attributes[slen].combiningClass = cmb; | - |
138 | } | 0 |
139 | ++slen; | - |
140 | } | 0 |
141 | logClusters[i] = cluster_start; | - |
142 | } | 0 |
143 | | - |
144 | haveGlyphs = shaper_item->font->klass | - |
145 | ->convertStringToGlyphIndices(shaper_item->font, | - |
146 | shapedChars, slen, | - |
147 | shaper_item->glyphs, &shaper_item->num_glyphs, | - |
148 | shaper_item->item.bidiLevel % 2); | - |
149 | | - |
150 | if (stackshapedChars != shapedChars) free(shapedChars);; never executed: free(shapedChars); never evaluated: stackshapedChars != shapedChars | 0 |
151 | | - |
152 | if (!haveGlyphs) never evaluated: !haveGlyphs | 0 |
153 | return 0; never executed: return 0; | 0 |
154 | | - |
155 | HB_HeuristicPosition(shaper_item); | - |
156 | } | - |
157 | | - |
158 | return (!0); never executed: return (!0); | 0 |
159 | } | - |
160 | | - |
| | |