本文整理汇总了C++中TextRun::setDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ TextRun::setDirection方法的具体用法?C++ TextRun::setDirection怎么用?C++ TextRun::setDirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextRun
的用法示例。
在下文中一共展示了TextRun::setDirection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawBidiText
void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const FloatPoint& point)
{
if (paintingDisabled())
return;
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
bidiResolver.setPosition(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.setText(run.data(bidiRun->start()), bidiRun->stop() - bidiRun->start());
bool isRTL = bidiRun->level() % 2;
subrun.setDirection(isRTL ? RTL : LTR);
subrun.setDirectionalOverride(bidiRun->dirOverride(false));
font.drawText(this, subrun, currPoint);
bidiRun = bidiRun->next();
// FIXME: Have Font::drawText return the width of what it drew so that we don't have to re-measure here.
if (bidiRun)
currPoint.move(font.width(subrun), 0);
}
bidiRuns.deleteRuns();
}
示例2: 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();
}
示例3: constructTextRun
TextRun constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
{
ASSERT(offset + length <= text->textLength());
TextRun run = text->is8Bit()
? constructTextRunInternal(context, font, text->characters8() + offset, length, style, LTR, expansion)
: constructTextRunInternal(context, font, text->characters16() + offset, length, style, LTR, expansion);
bool hasStrongDirectionality;
run.setDirection(directionForRun(run, hasStrongDirectionality));
return run;
}
示例4: constructTextRun
TextRun constructTextRun(const Font& font,
const LineLayoutText text,
unsigned offset,
unsigned length,
const ComputedStyle& style) {
ASSERT(offset + length <= text.textLength());
if (text.hasEmptyText())
return constructTextRunInternal(font, static_cast<const LChar*>(nullptr), 0,
style, LTR);
if (text.is8Bit())
return constructTextRunInternal(font, text.characters8() + offset, length,
style, LTR);
TextRun run = constructTextRunInternal(font, text.characters16() + offset,
length, style, LTR);
run.setDirection(directionForRun(run));
return run;
}
示例5: drawBidiText
float GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const FloatPoint& point, Font::CustomFontNotReadyAction customFontNotReadyAction, BidiStatus* status, int length)
#endif
{
if (paintingDisabled())
#if !PLATFORM(IOS)
return;
#else
return 0;
#endif
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
#if !PLATFORM(IOS)
bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
#else
bidiResolver.setStatus(status ? *status : BidiStatus(run.direction(), run.directionalOverride()));
#endif
bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0));
// FIXME: This ownership should be reversed. We should pass BidiRunList
// to BidiResolver in createBidiRunsForLine.
BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
#if !PLATFORM(IOS)
bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length()));
#else
bidiResolver.createBidiRunsForLine(TextRunIterator(&run, length < 0 ? run.length() : length));
#endif
if (!bidiRuns.runCount())
#if !PLATFORM(IOS)
return;
#else
return 0;
#endif
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));
#if !PLATFORM(IOS)
font.drawText(this, subrun, currPoint, 0, -1, customFontNotReadyAction);
bidiRun = bidiRun->next();
// FIXME: Have Font::drawText return the width of what it drew so that we don't have to re-measure here.
if (bidiRun)
currPoint.move(font.width(subrun), 0);
#else
float width = font.drawText(this, subrun, currPoint, 0, -1, customFontNotReadyAction);
currPoint.move(width, 0);
bidiRun = bidiRun->next();
#endif
}
#if PLATFORM(IOS)
if (status)
*status = bidiResolver.status();
#endif
bidiRuns.deleteRuns();
#if PLATFORM(IOS)
return currPoint.x() - static_cast<float>(point.x());
#endif
}