本文整理汇总了C++中SimpleFontData::zeroWidthSpaceGlyph方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleFontData::zeroWidthSpaceGlyph方法的具体用法?C++ SimpleFontData::zeroWidthSpaceGlyph怎么用?C++ SimpleFontData::zeroWidthSpaceGlyph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleFontData
的用法示例。
在下文中一共展示了SimpleFontData::zeroWidthSpaceGlyph方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustSpacing
float SimpleShaper::adjustSpacing(float width, const CharacterData& charData,
const SimpleFontData& fontData, GlyphBuffer* glyphBuffer)
{
// Account for letter-spacing.
if (width)
width += m_font->fontDescription().letterSpacing();
bool treatAsSpace = Character::treatAsSpace(charData.character);
if (treatAsSpace) {
// Distribute the run's total expansion evenly over all expansion opportunities in the run.
if (m_expansion) {
if (!treatAsSpace && !m_isAfterExpansion) {
// Take the expansion opportunity before this ideograph.
m_expansion -= m_expansionPerOpportunity;
float expansionAtThisOpportunity = m_expansionPerOpportunity;
m_runWidthSoFar += expansionAtThisOpportunity;
if (glyphBuffer) {
if (glyphBuffer->isEmpty()) {
if (m_forTextEmphasis)
glyphBuffer->add(fontData.zeroWidthSpaceGlyph(), &fontData, m_expansionPerOpportunity);
else
glyphBuffer->add(fontData.spaceGlyph(), &fontData, expansionAtThisOpportunity);
} else {
glyphBuffer->expandLastAdvance(expansionAtThisOpportunity);
}
}
}
if (m_run.allowsTrailingExpansion()
|| (m_run.ltr() && charData.characterOffset + charData.clusterLength < static_cast<size_t>(m_run.length()))
|| (m_run.rtl() && charData.characterOffset)) {
m_expansion -= m_expansionPerOpportunity;
width += m_expansionPerOpportunity;
m_isAfterExpansion = true;
}
} else {
m_isAfterExpansion = false;
}
// Account for word spacing.
// We apply additional space between "words" by adding width to the space character.
if (treatAsSpace && (charData.character != '\t' || !m_run.allowTabs())
&& (charData.characterOffset || charData.character == noBreakSpace)
&& m_font->fontDescription().wordSpacing()) {
width += m_font->fontDescription().wordSpacing();
}
} else {
m_isAfterExpansion = false;
}
return width;
}