本文整理汇总了C++中TextRun::allowsLeadingExpansion方法的典型用法代码示例。如果您正苦于以下问题:C++ TextRun::allowsLeadingExpansion方法的具体用法?C++ TextRun::allowsLeadingExpansion怎么用?C++ TextRun::allowsLeadingExpansion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextRun
的用法示例。
在下文中一共展示了TextRun::allowsLeadingExpansion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
WidthIterator::WidthIterator(const Font* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis)
: m_font(font)
, m_run(run)
, m_currentCharacter(0)
, m_runWidthSoFar(0)
, m_isAfterExpansion(!run.allowsLeadingExpansion())
, m_finalRoundingWidth(0)
, m_typesettingFeatures(font->typesettingFeatures())
, m_fallbackFonts(fallbackFonts)
, m_accountForGlyphBounds(accountForGlyphBounds)
, m_maxGlyphBoundingBoxY(numeric_limits<float>::min())
, m_minGlyphBoundingBoxY(numeric_limits<float>::max())
, m_firstGlyphOverflow(0)
, m_lastGlyphOverflow(0)
, m_forTextEmphasis(forTextEmphasis)
{
// If the padding is non-zero, count the number of spaces in the run
// and divide that by the padding for per space addition.
m_expansion = m_run.expansion();
if (!m_expansion)
m_expansionPerOpportunity = 0;
else {
bool isAfterExpansion = m_isAfterExpansion;
unsigned expansionOpportunityCount = m_run.is8Bit() ? Font::expansionOpportunityCount(m_run.characters8(), m_run.length(), m_run.ltr() ? LTR : RTL, isAfterExpansion) : Font::expansionOpportunityCount(m_run.characters16(), m_run.length(), m_run.ltr() ? LTR : RTL, isAfterExpansion);
if (isAfterExpansion && !m_run.allowsTrailingExpansion())
expansionOpportunityCount--;
if (!expansionOpportunityCount)
m_expansionPerOpportunity = 0;
else
m_expansionPerOpportunity = m_expansion / expansionOpportunityCount;
}
}
示例2:
SimpleShaper::SimpleShaper(const Font* font, const TextRun& run,
HashSet<const SimpleFontData*>* fallbackFonts, GlyphBounds* bounds,
bool forTextEmphasis)
: m_font(font)
, m_run(run)
, m_currentCharacter(0)
, m_runWidthSoFar(0)
, m_isAfterExpansion(!run.allowsLeadingExpansion())
, m_fallbackFonts(fallbackFonts)
, m_bounds(bounds)
, m_forTextEmphasis(forTextEmphasis)
{
// If the padding is non-zero, count the number of spaces in the run
// and divide that by the padding for per space addition.
m_expansion = m_run.expansion();
if (!m_expansion) {
m_expansionPerOpportunity = 0;
} else {
bool isAfterExpansion = m_isAfterExpansion;
unsigned expansionOpportunityCount = m_run.is8Bit() ? Character::expansionOpportunityCount(m_run.characters8(), m_run.length(), m_run.direction(), isAfterExpansion) : Character::expansionOpportunityCount(m_run.characters16(), m_run.length(), m_run.direction(), isAfterExpansion);
if (isAfterExpansion && !m_run.allowsTrailingExpansion())
expansionOpportunityCount--;
if (!expansionOpportunityCount)
m_expansionPerOpportunity = 0;
else
m_expansionPerOpportunity = m_expansion / expansionOpportunityCount;
}
}
示例3: ASSERT
ShapeResultSpacing::ShapeResultSpacing(const TextRun& run,
const FontDescription& fontDescription)
: m_textRun(run)
, m_letterSpacing(fontDescription.letterSpacing())
, m_wordSpacing(fontDescription.wordSpacing())
, m_expansion(run.expansion())
, m_expansionPerOpportunity(0)
, m_expansionOpportunityCount(0)
, m_textJustify(TextJustify::TextJustifyAuto)
, m_hasSpacing(false)
, m_normalizeSpace(run.normalizeSpace())
, m_allowTabs(run.allowTabs())
, m_isAfterExpansion(false)
, m_isVerticalOffset(fontDescription.isVerticalAnyUpright())
{
if (m_textRun.spacingDisabled())
return;
if (!m_letterSpacing && !m_wordSpacing && !m_expansion)
return;
m_hasSpacing = true;
if (!m_expansion)
return;
// Setup for justifications (expansions.)
m_textJustify = run.getTextJustify();
m_isAfterExpansion = !run.allowsLeadingExpansion();
bool isAfterExpansion = m_isAfterExpansion;
m_expansionOpportunityCount = Character::expansionOpportunityCount(run,
isAfterExpansion);
if (isAfterExpansion && !run.allowsTrailingExpansion()) {
ASSERT(m_expansionOpportunityCount > 0);
--m_expansionOpportunityCount;
}
if (m_expansionOpportunityCount)
m_expansionPerOpportunity = m_expansion / m_expansionOpportunityCount;
}