119 layoutTables->entries[cacheIdx].ptr = (const void*)result;
120 }
121
122 length = len;
123 return (const void*)result;
124 };
125
126 LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
127 {
128 LEUnicode32 mappedChar = mapper->mapChar(ch);
129
130 if (mappedChar == 0xFFFF || mappedChar == 0xFFFE) {
131 return 0xFFFF;
132 }
133
134 if (mappedChar == 0x200C || mappedChar == 0x200D) {
135 return 1;
136 }
137
138 LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, (jint)mappedChar);
139 return id;
140 }
141
142 LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch) const
143 {
144 LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, ch);
145 return id;
146 }
147
148 void FontInstanceAdapter::mapCharsToWideGlyphs(const LEUnicode chars[],
149 le_int32 offset, le_int32 count, le_bool reverse,
150 const LECharMapper *mapper, le_uint32 glyphs[]) const
151 {
152 le_int32 i, out = 0, dir = 1;
153
154 if (reverse) {
155 out = count - 1;
156 dir = -1;
157 }
158
159 for (i = offset; i < offset + count; i += 1, out += dir) {
160 LEUnicode16 high = chars[i];
161 LEUnicode32 code = high;
162
163 if (i < offset + count - 1 && high >= 0xD800 && high <= 0xDBFF) {
164 LEUnicode16 low = chars[i + 1];
172
173 if (code >= 0x10000) {
174 i += 1;
175 glyphs[out += dir] = 0xFFFF;
176 }
177 }
178 }
179
180 le_uint32 FontInstanceAdapter::mapCharToWideGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
181 {
182 LEUnicode32 mappedChar = mapper->mapChar(ch);
183
184 if (mappedChar == 0xFFFF) {
185 return 0xFFFF;
186 }
187
188 if (mappedChar == 0x200C || mappedChar == 0x200D) {
189 return 1;
190 }
191
192 return (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.charToGlyphMID,
193 mappedChar);
194 }
195
196 void FontInstanceAdapter::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
197 {
198 getWideGlyphAdvance((le_uint32)glyph, advance);
199 }
200
201 void FontInstanceAdapter::getKerningAdjustment(LEPoint &adjustment) const
202 {
203 float xx, xy, yx, yy;
204 le_bool isIdentityMatrix;
205
206 isIdentityMatrix = (txMat[0] == 1 && txMat[1] == 0 &&
207 txMat[2] == 0 && txMat[3] == 1);
208
209 if (!isIdentityMatrix) {
210 xx = adjustment.fX;
211 xy = xx * txMat[1];
212 xx = xx * txMat[0];
213
|
119 layoutTables->entries[cacheIdx].ptr = (const void*)result;
120 }
121
122 length = len;
123 return (const void*)result;
124 };
125
126 LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
127 {
128 LEUnicode32 mappedChar = mapper->mapChar(ch);
129
130 if (mappedChar == 0xFFFF || mappedChar == 0xFFFE) {
131 return 0xFFFF;
132 }
133
134 if (mappedChar == 0x200C || mappedChar == 0x200D) {
135 return 1;
136 }
137
138 LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, (jint)mappedChar);
139 if ((int)id < 0) {
140 id = 0;
141 }
142 return id;
143 }
144
145 LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch) const
146 {
147 LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, ch);
148 if ((int)id < 0) {
149 id = 0;
150 }
151 return id;
152 }
153
154 void FontInstanceAdapter::mapCharsToWideGlyphs(const LEUnicode chars[],
155 le_int32 offset, le_int32 count, le_bool reverse,
156 const LECharMapper *mapper, le_uint32 glyphs[]) const
157 {
158 le_int32 i, out = 0, dir = 1;
159
160 if (reverse) {
161 out = count - 1;
162 dir = -1;
163 }
164
165 for (i = offset; i < offset + count; i += 1, out += dir) {
166 LEUnicode16 high = chars[i];
167 LEUnicode32 code = high;
168
169 if (i < offset + count - 1 && high >= 0xD800 && high <= 0xDBFF) {
170 LEUnicode16 low = chars[i + 1];
178
179 if (code >= 0x10000) {
180 i += 1;
181 glyphs[out += dir] = 0xFFFF;
182 }
183 }
184 }
185
186 le_uint32 FontInstanceAdapter::mapCharToWideGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
187 {
188 LEUnicode32 mappedChar = mapper->mapChar(ch);
189
190 if (mappedChar == 0xFFFF) {
191 return 0xFFFF;
192 }
193
194 if (mappedChar == 0x200C || mappedChar == 0x200D) {
195 return 1;
196 }
197
198 LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.charToGlyphMID,
199 mappedChar);
200 if ((int)id < 0) {
201 id = 0;
202 }
203 return id;
204 }
205
206 void FontInstanceAdapter::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
207 {
208 getWideGlyphAdvance((le_uint32)glyph, advance);
209 }
210
211 void FontInstanceAdapter::getKerningAdjustment(LEPoint &adjustment) const
212 {
213 float xx, xy, yx, yy;
214 le_bool isIdentityMatrix;
215
216 isIdentityMatrix = (txMat[0] == 1 && txMat[1] == 0 &&
217 txMat[2] == 0 && txMat[3] == 1);
218
219 if (!isIdentityMatrix) {
220 xx = adjustment.fX;
221 xy = xx * txMat[1];
222 xx = xx * txMat[0];
223
|