Lines Matching refs:shaperItem

332 void TextLayoutCacheValue::initShaperItem(HB_ShaperItem& shaperItem, HB_FontRec* font,
335 memset(&shaperItem, 0, sizeof(shaperItem));
349 shaperItem.kerning_applied = false;
359 shaperItem.font = font;
360 shaperItem.font->userData = fontData;
362 shaperItem.face = HB_NewFace(NULL, harfbuzzSkiaGetTable);
368 createGlyphArrays(shaperItem, (contextCount + 2) * 2);
371 shaperItem.string = chars;
372 shaperItem.stringLength = contextCount;
375 void TextLayoutCacheValue::freeShaperItem(HB_ShaperItem& shaperItem) {
376 deleteGlyphArrays(shaperItem);
377 HB_FreeFace(shaperItem.face);
380 void TextLayoutCacheValue::shapeRun(HB_ShaperItem& shaperItem, size_t start, size_t count,
383 shaperItem.item.pos = start;
384 shaperItem.item.length = count;
385 shaperItem.item.bidiLevel = isRTL;
387 shaperItem.item.script = isRTL ? HB_Script_Arabic : HB_Script_Common;
390 assert(shaperItem.item.length > 0); // Harfbuzz will overwrite other memory if length is 0.
391 while (!HB_ShapeItem(&shaperItem)) {
393 // HB_ShapeItem fills in shaperItem.num_glyphs with the needed size.
394 deleteGlyphArrays(shaperItem);
395 createGlyphArrays(shaperItem, shaperItem.num_glyphs << 1);
421 HB_ShaperItem shaperItem;
426 initShaperItem(shaperItem, &font, &fontData, paint, chars, contextCount);
495 computeRunValuesWithHarfbuzz(shaperItem, paint,
521 computeRunValuesWithHarfbuzz(shaperItem, paint,
527 freeShaperItem(shaperItem);
534 static void logGlyphs(HB_ShaperItem shaperItem) {
535 LOGD("Got glyphs - count=%d", shaperItem.num_glyphs);
536 for (size_t i = 0; i < shaperItem.num_glyphs; i++) {
537 LOGD(" glyph[%d]=%d - offset.x=%f offset.y=%f", i, shaperItem.glyphs[i],
538 HBFixedToFloat(shaperItem.offsets[i].x),
539 HBFixedToFloat(shaperItem.offsets[i].y));
543 void TextLayoutCacheValue::computeRunValuesWithHarfbuzz(HB_ShaperItem& shaperItem, SkPaint* paint,
552 shapeRun(shaperItem, start, count, isRTL);
555 LOGD("HARFBUZZ -- num_glypth=%d - kerning_applied=%d", shaperItem.num_glyphs,
556 shaperItem.kerning_applied);
557 LOGD(" -- string= '%s'", String8(shaperItem.string + start, count).string());
560 logGlyphs(shaperItem);
563 if (shaperItem.advances == NULL || shaperItem.num_glyphs == 0) {
573 jfloat currentAdvance = HBFixedToFloat(shaperItem.advances[shaperItem.log_clusters[0]]);
577 size_t clusterPrevious = shaperItem.log_clusters[i - 1];
578 size_t cluster = shaperItem.log_clusters[i];
582 currentAdvance = HBFixedToFloat(shaperItem.advances[shaperItem.log_clusters[i]]);
592 (*outAdvances)[i], shaperItem.log_clusters[i], totalAdvance);
598 size_t countGlyphs = shaperItem.num_glyphs;
600 jchar glyph = (jchar) shaperItem.glyphs[(!isRTL) ? i : countGlyphs - 1 - i];
609 void TextLayoutCacheValue::deleteGlyphArrays(HB_ShaperItem& shaperItem) {
610 delete[] shaperItem.glyphs;
611 delete[] shaperItem.attributes;
612 delete[] shaperItem.advances;
613 delete[] shaperItem.offsets;
614 delete[] shaperItem.log_clusters;
617 void TextLayoutCacheValue::createGlyphArrays(HB_ShaperItem& shaperItem, int size) {
618 shaperItem.num_glyphs = size;
621 shaperItem.glyphs = new HB_Glyph[size];
622 shaperItem.attributes = new HB_GlyphAttributes[size];
623 shaperItem.advances = new HB_Fixed[size];
624 shaperItem.offsets = new HB_FixedPoint[size];
629 shaperItem.log_clusters = new unsigned short[size];