SkAdvancedTypefaceMetrics zeroing constructor
Review URL: https://codereview.chromium.org/1221903004
This commit is contained in:
parent
3ba043f460
commit
0007bde420
@ -25,7 +25,19 @@
|
||||
|
||||
class SkAdvancedTypefaceMetrics : public SkRefCnt {
|
||||
public:
|
||||
|
||||
|
||||
SkAdvancedTypefaceMetrics()
|
||||
: fType(SkAdvancedTypefaceMetrics::kOther_Font)
|
||||
, fFlags(SkAdvancedTypefaceMetrics::kEmpty_FontFlag)
|
||||
, fLastGlyphID(0)
|
||||
, fEmSize(0)
|
||||
, fStyle(0)
|
||||
, fItalicAngle(0)
|
||||
, fAscent(0)
|
||||
, fDescent(0)
|
||||
, fStemV(0)
|
||||
, fCapHeight(0)
|
||||
, fBBox(SkIRect::MakeEmpty()) {}
|
||||
|
||||
SkString fFontName;
|
||||
|
||||
|
@ -146,17 +146,7 @@ SkAdvancedTypefaceMetrics* SkTestTypeface::onGetAdvancedTypefaceMetrics(
|
||||
// pdf only
|
||||
SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
|
||||
info->fFontName.set(fTestFont->fName);
|
||||
info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
|
||||
info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag;
|
||||
info->fLastGlyphID = SkToU16(onCountGlyphs() - 1);
|
||||
info->fEmSize = 0;
|
||||
info->fStyle = 0;
|
||||
info->fItalicAngle = 0;
|
||||
info->fAscent = 0;
|
||||
info->fDescent = 0;
|
||||
info->fStemV = 0;
|
||||
info->fCapHeight = 0;
|
||||
info->fBBox = SkIRect::MakeEmpty();
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -1559,8 +1559,6 @@ SkAdvancedTypefaceMetrics* SkTypeface_Mac::onGetAdvancedTypefaceMetrics(
|
||||
CFIndex glyphCount = CTFontGetGlyphCount(ctFont);
|
||||
info->fLastGlyphID = SkToU16(glyphCount - 1);
|
||||
info->fEmSize = CTFontGetUnitsPerEm(ctFont);
|
||||
info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag;
|
||||
info->fStyle = 0;
|
||||
|
||||
if (perGlyphInfo & kToUnicode_PerGlyphInfo) {
|
||||
populate_glyph_to_unicode(ctFont, glyphCount, &info->fGlyphToUnicode);
|
||||
@ -1571,13 +1569,6 @@ SkAdvancedTypefaceMetrics* SkTypeface_Mac::onGetAdvancedTypefaceMetrics(
|
||||
// sfntly needs to subset the font. CTFontCopyAttribute() does not always
|
||||
// succeed in determining this directly.
|
||||
if (!this->getTableSize('glyf') || !this->getTableSize('loca')) {
|
||||
info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
|
||||
info->fItalicAngle = 0;
|
||||
info->fAscent = 0;
|
||||
info->fDescent = 0;
|
||||
info->fStemV = 0;
|
||||
info->fCapHeight = 0;
|
||||
info->fBBox = SkIRect::MakeEmpty();
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -1767,9 +1767,7 @@ SkAdvancedTypefaceMetrics* LogFontTypeface::onGetAdvancedTypefaceMetrics(
|
||||
info = new SkAdvancedTypefaceMetrics;
|
||||
info->fEmSize = otm.otmEMSquare;
|
||||
info->fLastGlyphID = SkToU16(glyphCount - 1);
|
||||
info->fStyle = 0;
|
||||
tchar_to_skstring(lf.lfFaceName, &info->fFontName);
|
||||
info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag;
|
||||
// If bit 1 is set, the font may not be embedded in a document.
|
||||
// If bit 1 is clear, the font can be embedded.
|
||||
// If bit 2 is set, the embedding is read-only.
|
||||
@ -1787,13 +1785,6 @@ SkAdvancedTypefaceMetrics* LogFontTypeface::onGetAdvancedTypefaceMetrics(
|
||||
(otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)) {
|
||||
info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font;
|
||||
} else {
|
||||
info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
|
||||
info->fItalicAngle = 0;
|
||||
info->fAscent = 0;
|
||||
info->fDescent = 0;
|
||||
info->fStemV = 0;
|
||||
info->fCapHeight = 0;
|
||||
info->fBBox = SkIRect::MakeEmpty();
|
||||
goto ReturnInfo;
|
||||
}
|
||||
|
||||
|
@ -339,8 +339,6 @@ SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics(
|
||||
info = new SkAdvancedTypefaceMetrics;
|
||||
info->fEmSize = dwfm.designUnitsPerEm;
|
||||
info->fLastGlyphID = SkToU16(glyphCount - 1);
|
||||
info->fStyle = 0;
|
||||
info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag;
|
||||
|
||||
// SkAdvancedTypefaceMetrics::fFontName is in theory supposed to be
|
||||
// the PostScript name of the font. However, due to the way it is currently
|
||||
@ -365,13 +363,9 @@ SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics(
|
||||
fontType == DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION) {
|
||||
info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font;
|
||||
} else {
|
||||
info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
|
||||
info->fItalicAngle = 0;
|
||||
info->fAscent = dwfm.ascent;
|
||||
info->fDescent = dwfm.descent;
|
||||
info->fStemV = 0;
|
||||
info->fCapHeight = dwfm.capHeight;
|
||||
info->fBBox = SkIRect::MakeEmpty();
|
||||
return info;
|
||||
}
|
||||
|
||||
@ -380,12 +374,9 @@ SkAdvancedTypefaceMetrics* DWriteFontTypeface::onGetAdvancedTypefaceMetrics(
|
||||
AutoTDWriteTable<SkOTTableHorizontalHeader> hheaTable(fDWriteFontFace.get());
|
||||
AutoTDWriteTable<SkOTTableOS2> os2Table(fDWriteFontFace.get());
|
||||
if (!headTable.fExists || !postTable.fExists || !hheaTable.fExists || !os2Table.fExists) {
|
||||
info->fItalicAngle = 0;
|
||||
info->fAscent = dwfm.ascent;
|
||||
info->fDescent = dwfm.descent;
|
||||
info->fStemV = 0;
|
||||
info->fCapHeight = dwfm.capHeight;
|
||||
info->fBBox = SkIRect::MakeEmpty();
|
||||
return info;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user