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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // set the glyph attributes heuristically. Assumes a 1 to 1 relationship between
chars and glyphs | 426 // set the glyph attributes heuristically. Assumes a 1 to 1 relationship between
chars and glyphs |
427 // and no reordering. | 427 // and no reordering. |
428 // also computes logClusters heuristically | 428 // also computes logClusters heuristically |
429 void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) | 429 void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) |
430 { | 430 { |
431 const HB_UChar16 *uc = item->string + item->item.pos; | 431 const HB_UChar16 *uc = item->string + item->item.pos; |
432 hb_uint32 length = item->item.length; | 432 hb_uint32 length = item->item.length; |
433 | 433 |
434 // ### zeroWidth and justification are missing here!!!!! | 434 // ### zeroWidth and justification are missing here!!!!! |
435 | 435 |
436 assert(item->num_glyphs <= length); | 436 assert(length <= item->num_glyphs); |
437 | 437 |
438 // qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item-
>num_glyphs); | 438 // qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item-
>num_glyphs); |
439 HB_GlyphAttributes *attributes = item->attributes; | 439 HB_GlyphAttributes *attributes = item->attributes; |
440 unsigned short *logClusters = item->log_clusters; | 440 unsigned short *logClusters = item->log_clusters; |
441 | 441 |
442 hb_uint32 glyph_pos = 0; | 442 hb_uint32 glyph_pos = 0; |
443 hb_uint32 i; | 443 hb_uint32 i; |
444 for (i = 0; i < length; i++) { | 444 for (i = 0; i < length; i++) { |
445 if (HB_IsHighSurrogate(uc[i]) && i < length - 1 | 445 if (HB_IsHighSurrogate(uc[i]) && i < length - 1 |
446 && HB_IsLowSurrogate(uc[i + 1])) { | 446 && HB_IsLowSurrogate(uc[i + 1])) { |
447 logClusters[i] = glyph_pos; | 447 logClusters[i] = glyph_pos; |
448 logClusters[++i] = glyph_pos; | 448 logClusters[++i] = glyph_pos; |
449 } else { | 449 } else { |
450 logClusters[i] = glyph_pos; | 450 logClusters[i] = glyph_pos; |
451 } | 451 } |
452 ++glyph_pos; | 452 ++glyph_pos; |
453 } | 453 } |
454 assert(glyph_pos == item->num_glyphs); | |
455 | 454 |
456 // first char in a run is never (treated as) a mark | 455 // first char in a run is never (treated as) a mark |
457 int cStart = 0; | 456 int cStart = 0; |
458 const bool symbolFont = item->face->isSymbolFont; | 457 const bool symbolFont = item->face->isSymbolFont; |
459 attributes[0].mark = false; | 458 attributes[0].mark = false; |
460 attributes[0].clusterStart = true; | 459 attributes[0].clusterStart = true; |
461 attributes[0].dontPrint = (!symbolFont && uc[0] == 0x00ad) || HB_IsControlCh
ar(uc[0]); | 460 attributes[0].dontPrint = (!symbolFont && uc[0] == 0x00ad) || HB_IsControlCh
ar(uc[0]); |
462 | 461 |
463 int pos = 0; | 462 int pos = 0; |
464 HB_CharCategory lastCat; | 463 HB_CharCategory lastCat; |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 if (shaper_item->num_glyphs < shaper_item->item.length) { | 1302 if (shaper_item->num_glyphs < shaper_item->item.length) { |
1304 shaper_item->num_glyphs = shaper_item->item.length; | 1303 shaper_item->num_glyphs = shaper_item->item.length; |
1305 return false; | 1304 return false; |
1306 } | 1305 } |
1307 assert(shaper_item->item.script < HB_ScriptCount); | 1306 assert(shaper_item->item.script < HB_ScriptCount); |
1308 result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); | 1307 result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); |
1309 shaper_item->glyphIndicesPresent = false; | 1308 shaper_item->glyphIndicesPresent = false; |
1310 return result; | 1309 return result; |
1311 } | 1310 } |
1312 | 1311 |
OLD | NEW |