Пример #1
0
void SimpleFontData::platformGlyphInit() {
  SkTypeface* typeface = platformData().typeface();
  if (!typeface->countGlyphs()) {
    m_spaceGlyph = 0;
    m_spaceWidth = 0;
    m_zeroGlyph = 0;
    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 = glyphForCharacter(' ');
  float width = widthForGlyph(m_spaceGlyph);
  m_spaceWidth = width;
  m_zeroGlyph = glyphForCharacter('0');
  m_fontMetrics.setZeroWidth(widthForGlyph(m_zeroGlyph));

  m_missingGlyphData.fontData = this;
  m_missingGlyphData.glyph = 0;
}