本文整理汇总了C++中FontPlatformData::size方法的典型用法代码示例。如果您正苦于以下问题:C++ FontPlatformData::size方法的具体用法?C++ FontPlatformData::size怎么用?C++ FontPlatformData::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontPlatformData
的用法示例。
在下文中一共展示了FontPlatformData::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ENABLE
SimpleFontData::SimpleFontData(const FontPlatformData& f, bool customFont, bool loading, SVGFontData* svgFontData)
: m_maxCharWidth(-1)
, m_avgCharWidth(-1)
, m_unitsPerEm(defaultUnitsPerEm)
, m_platformData(f)
, m_treatAsFixedPitch(false)
#if ENABLE(SVG_FONTS)
, m_svgFontData(svgFontData)
#endif
, m_isCustomFont(customFont)
, m_isLoading(loading)
, m_smallCapsFontData(0)
#if (PLATFORM(WKC))
, m_lineSpacing(0)
#endif
{
#if !ENABLE(SVG_FONTS)
UNUSED_PARAM(svgFontData);
#else
if (SVGFontFaceElement* svgFontFaceElement = svgFontData ? svgFontData->svgFontFaceElement() : 0) {
m_unitsPerEm = svgFontFaceElement->unitsPerEm();
double scale = f.size();
if (m_unitsPerEm)
scale /= m_unitsPerEm;
m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
m_lineGap = 0.1f * f.size();
m_lineSpacing = m_ascent + m_descent + m_lineGap;
SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement();
Vector<SVGGlyphIdentifier> spaceGlyphs;
associatedFontElement->getGlyphIdentifiersForString(String(" ", 1), spaceGlyphs);
m_spaceWidth = spaceGlyphs.isEmpty() ? m_xHeight : static_cast<float>(spaceGlyphs.first().horizontalAdvanceX * scale);
Vector<SVGGlyphIdentifier> numeralZeroGlyphs;
associatedFontElement->getGlyphIdentifiersForString(String("0", 1), numeralZeroGlyphs);
m_avgCharWidth = numeralZeroGlyphs.isEmpty() ? m_spaceWidth : static_cast<float>(numeralZeroGlyphs.first().horizontalAdvanceX * scale);
Vector<SVGGlyphIdentifier> letterWGlyphs;
associatedFontElement->getGlyphIdentifiersForString(String("W", 1), letterWGlyphs);
m_maxCharWidth = letterWGlyphs.isEmpty() ? m_ascent : static_cast<float>(letterWGlyphs.first().horizontalAdvanceX * scale);
// FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above?
m_spaceGlyph = 0;
determinePitch();
m_adjustedSpaceWidth = roundf(m_spaceWidth);
m_missingGlyphData.fontData = this;
m_missingGlyphData.glyph = 0;
return;
}
#endif
platformInit();
platformGlyphInit();
platformCharWidthInit();
}
示例2: paintSkiaText
void paintSkiaText(GraphicsContext* context,
const FontPlatformData& data,
int numGlyphs,
const WORD* glyphs,
const int* advances,
const GOFFSET* offsets,
const SkPoint* origin)
{
paintSkiaText(context, data.hfont(), data.typeface(), data.size(), data.lfQuality(),
numGlyphs, glyphs, advances, offsets, origin);
}
示例3: paintSkiaText
void paintSkiaText(GraphicsContext* context,
const FontPlatformData& data,
int numGlyphs,
const WORD* glyphs,
const int* advances,
const GOFFSET* offsets,
const SkPoint& origin,
const SkRect& textRect)
{
paintSkiaText(context, data.hfont(), data.typeface(), data.size(), data.paintTextFlags(),
numGlyphs, glyphs, advances, offsets, origin, textRect);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:12,代码来源:SkiaFontWin.cpp
示例4: ENABLE
SimpleFontData::SimpleFontData(const FontPlatformData& f, bool customFont, bool loading, SVGFontData* svgFontData)
: m_unitsPerEm(defaultUnitsPerEm)
, m_font(f)
, m_treatAsFixedPitch(false)
#if ENABLE(SVG_FONTS)
, m_svgFontData(svgFontData)
#endif
, m_isCustomFont(customFont)
, m_isLoading(loading)
, m_smallCapsFontData(0)
{
#if ENABLE(SVG_FONTS)
if (SVGFontFaceElement* svgFontFaceElement = svgFontData ? svgFontData->svgFontFaceElement() : 0) {
m_unitsPerEm = svgFontFaceElement->unitsPerEm();
double scale = f.size();
if (m_unitsPerEm)
scale /= m_unitsPerEm;
m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
m_lineGap = 0.1f * f.size();
m_lineSpacing = m_ascent + m_descent + m_lineGap;
m_spaceGlyph = 0;
m_spaceWidth = 0;
m_adjustedSpaceWidth = 0;
determinePitch();
m_missingGlyphData.fontData = this;
m_missingGlyphData.glyph = 0;
return;
}
#endif
platformInit();
platformGlyphInit();
}
示例5: ENABLE
SimpleFontData::SimpleFontData(const FontPlatformData& f, bool customFont, bool loading, SVGFontData* svgFontData)
: m_font(f)
, m_treatAsFixedPitch(false)
#if ENABLE(SVG_FONTS)
, m_svgFontData(svgFontData)
#endif
, m_isCustomFont(customFont)
, m_isLoading(loading)
, m_smallCapsFontData(0)
{
#if ENABLE(SVG_FONTS) && !PLATFORM(QT)
if (SVGFontFaceElement* svgFontFaceElement = svgFontData ? svgFontData->svgFontFaceElement() : 0) {
m_unitsPerEm = svgFontFaceElement->unitsPerEm();
double scale = f.size();
if (m_unitsPerEm)
scale /= m_unitsPerEm;
m_ascent = static_cast<int>(svgFontFaceElement->ascent() * scale);
m_descent = static_cast<int>(svgFontFaceElement->descent() * scale);
m_xHeight = static_cast<int>(svgFontFaceElement->xHeight() * scale);
m_lineGap = 0.1f * f.size();
m_lineSpacing = m_ascent + m_descent + m_lineGap;
m_spaceGlyph = 0;
m_spaceWidth = 0;
m_adjustedSpaceWidth = 0;
determinePitch();
m_missingGlyphData.fontData = this;
m_missingGlyphData.glyph = 0;
return;
}
#endif
platformInit();
GlyphPage* glyphPageZero = GlyphPageTreeNode::getRootChild(this, 0)->page();
if (!glyphPageZero) {
LOG_ERROR("Failed to get glyph page zero.");
m_spaceGlyph = 0;
m_spaceWidth = 0;
m_adjustedSpaceWidth = 0;
determinePitch();
m_missingGlyphData.fontData = this;
m_missingGlyphData.glyph = 0;
return;
}
// Nasty hack to determine if we should round or ceil space widths.
// If the font is monospace or fake monospace we ceil to ensure that
// every character and the space are the same width. Otherwise we round.
m_spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph;
float width = widthForGlyph(m_spaceGlyph);
m_spaceWidth = width;
determinePitch();
m_adjustedSpaceWidth = m_treatAsFixedPitch ? ceilf(width) : roundf(width);
// Force the glyph for ZERO WIDTH SPACE to have zero width, unless it is shared with SPACE.
// Helvetica is an example of a non-zero width ZERO WIDTH SPACE glyph.
// See <http://bugs.webkit.org/show_bug.cgi?id=13178>
// Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control characters, including 0,
// are mapped to the ZERO WIDTH SPACE glyph.
Glyph zeroWidthSpaceGlyph = glyphPageZero->glyphDataForCharacter(0).glyph;
if (zeroWidthSpaceGlyph) {
if (zeroWidthSpaceGlyph != m_spaceGlyph)
m_glyphToWidthMap.setWidthForGlyph(zeroWidthSpaceGlyph, 0);
else
LOG_ERROR("Font maps SPACE and ZERO WIDTH SPACE to the same glyph. Glyph width not overridden.");
}
m_missingGlyphData.fontData = this;
m_missingGlyphData.glyph = 0;
}