| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 3 * | 3 * |
| 4 * This is part of HarfBuzz, an OpenType Layout engine library. | 4 * This is part of HarfBuzz, an OpenType Layout engine 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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 DEBUG("shaped glyphs:"); | 1182 DEBUG("shaped glyphs:"); |
| 1183 for (int i = 0; i < length; ++i) | 1183 for (int i = 0; i < length; ++i) |
| 1184 DEBUG(" glyph=%4x", hb_buffer->in_string[i].gindex); | 1184 DEBUG(" glyph=%4x", hb_buffer->in_string[i].gindex); |
| 1185 DEBUG("-----------------------------------------"); | 1185 DEBUG("-----------------------------------------"); |
| 1186 // dump_string(hb_buffer); | 1186 // dump_string(hb_buffer); |
| 1187 #endif | 1187 #endif |
| 1188 | 1188 |
| 1189 return true; | 1189 return true; |
| 1190 } | 1190 } |
| 1191 | 1191 |
| 1192 /* See comments near the definition of HB_ShaperFlag_ArabicHack for a descriptio
n |
| 1193 of why this function exists. */ |
| 1194 void HB_FixupArabicZeroWidth(HB_ShaperItem *item) |
| 1195 { |
| 1196 HB_UShort property; |
| 1197 |
| 1198 if (!item->face->gdef) |
| 1199 return; |
| 1200 |
| 1201 for (unsigned int i = 0; i < item->num_glyphs; ++i) { |
| 1202 /* If the glyph is a mark, force its advance to zero. */ |
| 1203 if (HB_GDEF_Get_Glyph_Property (item->face->gdef, item->glyphs[i], &prop
erty) == HB_Err_Ok && |
| 1204 property == HB_GDEF_MARK) { |
| 1205 item->advances[i] = 0; |
| 1206 } |
| 1207 } |
| 1208 } |
| 1209 |
| 1192 HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
LogClusters) | 1210 HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
LogClusters) |
| 1193 { | 1211 { |
| 1194 HB_Face face = item->face; | 1212 HB_Face face = item->face; |
| 1195 | 1213 |
| 1196 bool glyphs_positioned = false; | 1214 bool glyphs_positioned = false; |
| 1197 if (face->gpos) { | 1215 if (face->gpos) { |
| 1198 if (face->buffer->positions) | 1216 if (face->buffer->positions) |
| 1199 memset(face->buffer->positions, 0, face->buffer->in_length*sizeof(HB
_PositionRec)); | 1217 memset(face->buffer->positions, 0, face->buffer->in_length*sizeof(HB
_PositionRec)); |
| 1200 // #### check that passing "false,false" is correct | 1218 // #### check that passing "false,false" is correct |
| 1201 glyphs_positioned = HB_GPOS_Apply_String(item->font, face->gpos, face->c
urrent_flags, face->buffer, false, false) != HB_Err_Not_Covered; | 1219 glyphs_positioned = HB_GPOS_Apply_String(item->font, face->gpos, face->c
urrent_flags, face->buffer, false, false) != HB_Err_Not_Covered; |
| 1202 } | 1220 } |
| 1203 | 1221 |
| 1204 if (!face->glyphs_substituted && !glyphs_positioned) { | 1222 if (!face->glyphs_substituted && !glyphs_positioned) { |
| 1205 HB_GetGlyphAdvances(item); | 1223 HB_GetGlyphAdvances(item); |
| 1224 if (item->face->current_flags & HB_ShaperFlag_ArabicHack) |
| 1225 HB_FixupArabicZeroWidth(item); |
| 1206 return true; // nothing to do for us | 1226 return true; // nothing to do for us |
| 1207 } | 1227 } |
| 1208 | 1228 |
| 1209 // make sure we have enough space to write everything back | 1229 // make sure we have enough space to write everything back |
| 1210 if (availableGlyphs < (int)face->buffer->in_length) { | 1230 if (availableGlyphs < (int)face->buffer->in_length) { |
| 1211 item->num_glyphs = face->buffer->in_length; | 1231 item->num_glyphs = face->buffer->in_length; |
| 1212 return false; | 1232 return false; |
| 1213 } | 1233 } |
| 1214 | 1234 |
| 1215 HB_Glyph *glyphs = item->glyphs; | 1235 HB_Glyph *glyphs = item->glyphs; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 if (shaper_item->num_glyphs < shaper_item->item.length) { | 1348 if (shaper_item->num_glyphs < shaper_item->item.length) { |
| 1329 shaper_item->num_glyphs = shaper_item->item.length; | 1349 shaper_item->num_glyphs = shaper_item->item.length; |
| 1330 return false; | 1350 return false; |
| 1331 } | 1351 } |
| 1332 assert(shaper_item->item.script < HB_ScriptCount); | 1352 assert(shaper_item->item.script < HB_ScriptCount); |
| 1333 result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); | 1353 result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); |
| 1334 shaper_item->glyphIndicesPresent = false; | 1354 shaper_item->glyphIndicesPresent = false; |
| 1335 return result; | 1355 return result; |
| 1336 } | 1356 } |
| 1337 | 1357 |
| OLD | NEW |