本文整理汇总了C++中FontCascade::drawText方法的典型用法代码示例。如果您正苦于以下问题:C++ FontCascade::drawText方法的具体用法?C++ FontCascade::drawText怎么用?C++ FontCascade::drawText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontCascade
的用法示例。
在下文中一共展示了FontCascade::drawText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawBidiText
void GraphicsContext::drawBidiText(const FontCascade& font, const TextRun& run, const FloatPoint& point, FontCascade::CustomFontNotReadyAction customFontNotReadyAction)
{
if (paintingDisabled())
return;
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0));
// FIXME: This ownership should be reversed. We should pass BidiRunList
// to BidiResolver in createBidiRunsForLine.
BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length()));
if (!bidiRuns.runCount())
return;
FloatPoint currPoint = point;
BidiCharacterRun* bidiRun = bidiRuns.firstRun();
while (bidiRun) {
TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun->start());
bool isRTL = bidiRun->level() % 2;
subrun.setDirection(isRTL ? RTL : LTR);
subrun.setDirectionalOverride(bidiRun->dirOverride(false));
float width = font.drawText(*this, subrun, currPoint, 0, -1, customFontNotReadyAction);
currPoint.move(width, 0);
bidiRun = bidiRun->next();
}
bidiRuns.deleteRuns();
}
示例2: drawText
float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, const FloatPoint& point, int from, int to)
{
if (paintingDisabled())
return 0;
return font.drawText(*this, run, point, from, to);
}
示例3: doDrawTextAtPoint
static void doDrawTextAtPoint(GraphicsContext& context, const String& text, const IntPoint& point, const FontCascade& font, const Color& color, int underlinedIndex)
{
TextRun run(text);
context.setFillColor(color);
if (isOneLeftToRightRun(run))
font.drawText(context, run, point);
else
context.drawBidiText(font, run, point);
if (underlinedIndex >= 0) {
ASSERT_WITH_SECURITY_IMPLICATION(underlinedIndex < static_cast<int>(text.length()));
int beforeWidth;
if (underlinedIndex > 0) {
TextRun beforeRun(StringView(text).substring(0, underlinedIndex));
beforeWidth = font.width(beforeRun);
} else
beforeWidth = 0;
TextRun underlinedRun(StringView(text).substring(underlinedIndex, 1));
int underlinedWidth = font.width(underlinedRun);
IntPoint underlinePoint(point);
underlinePoint.move(beforeWidth, 1);
context.setStrokeColor(color);
context.drawLineForText(underlinePoint, underlinedWidth, false);
}
}