本文整理汇总了C++中SVGFontElement::verticalKerningForPairOfStringsAndGlyphs方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGFontElement::verticalKerningForPairOfStringsAndGlyphs方法的具体用法?C++ SVGFontElement::verticalKerningForPairOfStringsAndGlyphs怎么用?C++ SVGFontElement::verticalKerningForPairOfStringsAndGlyphs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGFontElement
的用法示例。
在下文中一共展示了SVGFontElement::verticalKerningForPairOfStringsAndGlyphs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateSVGKerning
float SVGTextLayoutEngineSpacing::calculateSVGKerning(bool isVerticalText, const SVGTextMetrics::Glyph& currentGlyph)
{
#if ENABLE(SVG_FONTS)
if (!m_font.isSVGFont()) {
m_lastGlyph.isValid = false;
return 0;
}
SVGFontElement* svgFont = m_font.svgFont();
ASSERT(svgFont);
float kerning = 0;
if (m_lastGlyph.isValid) {
if (isVerticalText)
kerning = svgFont->verticalKerningForPairOfStringsAndGlyphs(m_lastGlyph.unicodeString, m_lastGlyph.name, currentGlyph.unicodeString, currentGlyph.name);
else
kerning = svgFont->horizontalKerningForPairOfStringsAndGlyphs(m_lastGlyph.unicodeString, m_lastGlyph.name, currentGlyph.unicodeString, currentGlyph.name);
}
m_lastGlyph = currentGlyph;
m_lastGlyph.isValid = true;
kerning *= m_font.size() / m_font.primaryFont()->unitsPerEm();
return kerning;
#else
UNUSED_PARAM(isVerticalText);
UNUSED_PARAM(currentGlyph);
return false;
#endif
}
示例2: calculateSVGKerning
float SVGTextLayoutEngineSpacing::calculateSVGKerning(bool isVerticalText, const SVGTextMetrics::Glyph& currentGlyph)
{
#if ENABLE(SVG_FONTS)
const SimpleFontData* fontData = m_font.primaryFont();
if (!fontData->isSVGFont()) {
m_lastGlyph.isValid = false;
return 0;
}
ASSERT(fontData->isCustomFont());
ASSERT(fontData->isSVGFont());
const SVGFontData* svgFontData = static_cast<const SVGFontData*>(fontData->fontData());
SVGFontFaceElement* svgFontFace = svgFontData->svgFontFaceElement();
ASSERT(svgFontFace);
SVGFontElement* svgFont = svgFontFace->associatedFontElement();
if (!svgFont) {
m_lastGlyph.isValid = false;
return 0;
}
float kerning = 0;
if (m_lastGlyph.isValid) {
if (isVerticalText)
kerning = svgFont->verticalKerningForPairOfStringsAndGlyphs(m_lastGlyph.unicodeString, m_lastGlyph.name, currentGlyph.unicodeString, currentGlyph.name);
else
kerning = svgFont->horizontalKerningForPairOfStringsAndGlyphs(m_lastGlyph.unicodeString, m_lastGlyph.name, currentGlyph.unicodeString, currentGlyph.name);
}
m_lastGlyph = currentGlyph;
m_lastGlyph.isValid = true;
kerning *= m_font.size() / m_font.fontMetrics().unitsPerEm();
return kerning;
#else
UNUSED_PARAM(isVerticalText);
UNUSED_PARAM(currentGlyph);
return false;
#endif
}