void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { #if PLATFORM(CHROMIUM) if (preferHarfBuzz(this)) { GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, run); shaper.setDrawRange(from, to); if (shaper.shape(&glyphBuffer)) { drawGlyphBuffer(context, run, glyphBuffer, point); return; } } #endif // This glyph buffer holds our glyphs + advances + font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; // Draw the glyph buffer now at the starting point returned in startX. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, run, glyphBuffer, startPoint); }
void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const { FontCachePurgePreventer purgePreventer; GlyphData markGlyphData; if (!getEmphasisMarkGlyphData(mark, markGlyphData)) return; const SimpleFontData* markFontData = markGlyphData.fontData; ASSERT(markFontData); if (!markFontData) return; Glyph markGlyph = markGlyphData.glyph; Glyph spaceGlyph = markFontData->spaceGlyph(); float middleOfLastGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, 0); FloatPoint startPoint(point.x() + middleOfLastGlyph - offsetToMiddleOfGlyph(markFontData, markGlyph), point.y()); GlyphBuffer markBuffer; for (int i = 0; i + 1 < glyphBuffer.size(); ++i) { float middleOfNextGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, i + 1); float advance = glyphBuffer.advanceAt(i).width() - middleOfLastGlyph + middleOfNextGlyph; markBuffer.add(glyphBuffer.glyphAt(i) ? markGlyph : spaceGlyph, markFontData, advance); middleOfLastGlyph = middleOfNextGlyph; } markBuffer.add(glyphBuffer.glyphAt(glyphBuffer.size() - 1) ? markGlyph : spaceGlyph, markFontData, 0); drawGlyphBuffer(context, run, markBuffer, startPoint); }
void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // This glyph buffer holds our glyphs + advances + font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x(); CoreTextController controller(this, run); controller.advance(from); float beforeWidth = controller.runWidthSoFar(); controller.advance(to, &glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; float afterWidth = controller.runWidthSoFar(); if (run.rtl()) { startX += controller.totalWidth() + controller.finalRoundingWidth() - afterWidth; for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end) glyphBuffer.swap(i, end); } else startX += beforeWidth; // Draw the glyph buffer now at the starting point returned in startX. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, glyphBuffer, run, startPoint); }
void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // This glyph buffer holds our glyphs+advances+font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x(); WidthIterator it(this, run); it.advance(from); float beforeWidth = it.m_runWidthSoFar; it.advance(to, &glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; float afterWidth = it.m_runWidthSoFar; if (run.rtl()) { float finalRoundingWidth = it.m_finalRoundingWidth; it.advance(run.length()); startX += finalRoundingWidth + it.m_runWidthSoFar - afterWidth; } else startX += beforeWidth; // Swap the order of the glyphs if right-to-left. if (run.rtl()) for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end) glyphBuffer.swap(i, end); // Calculate the starting point of the glyphs to be displayed by adding // all the advances up to the first glyph. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, glyphBuffer, run, startPoint); }
void Font::drawComplexText(GraphicsContext* gc, const TextRun& run, const FloatPoint& point, int from, int to) const { if (!run.length()) return; TextDrawingModeFlags textMode = gc->platformContext()->getTextDrawingMode(); bool fill = textMode & TextModeFill; bool stroke = (textMode & TextModeStroke) && gc->platformContext()->getStrokeStyle() != NoStroke && gc->platformContext()->getStrokeThickness() > 0; if (!fill && !stroke) return; SkPaint strokePaint, fillPaint; if (fill) { gc->platformContext()->setupPaintForFilling(&fillPaint); setupForTextPainting(&fillPaint, gc->fillColor().rgb()); } if (stroke) { gc->platformContext()->setupPaintForStroking(&strokePaint, 0, 0); setupForTextPainting(&strokePaint, gc->strokeColor().rgb()); } GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, run); shaper.setDrawRange(from, to); if (!shaper.shape(&glyphBuffer)) return; FloatPoint adjustedPoint = shaper.adjustStartPoint(point); drawGlyphBuffer(gc, run, glyphBuffer, adjustedPoint); }
void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { #if OS(WINDOWS) // This glyph buffer holds our glyphs + advances + font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x(); UniscribeController controller(this, run); controller.advance(from); float beforeWidth = controller.runWidthSoFar(); controller.advance(to, &glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; float afterWidth = controller.runWidthSoFar(); if (run.rtl()) { controller.advance(run.length()); startX += controller.runWidthSoFar() - afterWidth; } else startX += beforeWidth; // Draw the glyph buffer now at the starting point returned in startX. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, glyphBuffer, run, startPoint); #else notImplemented(); #endif }
void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int, int) const { GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, run); if (shaper.shape(&glyphBuffer)) drawGlyphBuffer(context, run, glyphBuffer, point); else LOG_ERROR("Shaper couldn't shape glyphBuffer."); }
void Font::drawSimpleText(GraphicsContext* context, const TextRunPaintInfo& runInfo, const FloatPoint& point) const { // This glyph buffer holds our glyphs+advances+font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x() + getGlyphsAndAdvancesForSimpleText(runInfo.run, runInfo.from, runInfo.to, glyphBuffer); if (glyphBuffer.isEmpty()) return; FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, runInfo, glyphBuffer, startPoint); }
float Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int, int) const { GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, run); if (shaper.shape(&glyphBuffer)) { FloatPoint startPoint = point; float startX = startPoint.x(); drawGlyphBuffer(context, run, glyphBuffer, startPoint); return startPoint.x() - startX; } LOG_ERROR("Shaper couldn't shape glyphBuffer."); return 0; }
void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { if (!run.length()) return; GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, run); shaper.setDrawRange(from, to); if (!shaper.shape(&glyphBuffer)) return; FloatPoint adjustedPoint = shaper.adjustStartPoint(point); drawGlyphBuffer(context, run, glyphBuffer, adjustedPoint); }
float Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // This glyph buffer holds our glyphs+advances+font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x() + getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer); if (glyphBuffer.isEmpty()) return 0; FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, run, glyphBuffer, startPoint); return startPoint.x() - startX; }
void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // This glyph buffer holds our glyphs + advances + font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; // Draw the glyph buffer now at the starting point returned in startX. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, glyphBuffer, startPoint); }
void Font::drawComplexText(GraphicsContext* gc, const TextRunPaintInfo& runInfo, const FloatPoint& point) const { if (!runInfo.run.length()) return; TextDrawingModeFlags textMode = gc->textDrawingMode(); bool fill = textMode & TextModeFill; bool stroke = (textMode & TextModeStroke) && gc->hasStroke(); if (!fill && !stroke) return; GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, runInfo.run); shaper.setDrawRange(runInfo.from, runInfo.to); if (!shaper.shape(&glyphBuffer) || glyphBuffer.isEmpty()) return; FloatPoint adjustedPoint = shaper.adjustStartPoint(point); drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint); }
void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // This glyph buffer holds our glyphs+advances+font data for each glyph. GlyphBuffer glyphBuffer; //SAMSUNG CHANGES>> //if Point has high negative value, SKIA is not handling, so handle here WidthIterator it(this, run, 0, false, 0); it.advance(from); float Width = it.m_runWidthSoFar; if(point.x() + Width < -9999) return; //SAMSUNG CHANGES<< float startX = point.x() + getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer); if (glyphBuffer.isEmpty()) return; FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, glyphBuffer, startPoint); }