}
int SkTypeface_FreeType::onCountGlyphs() const {
- // we cache this value, using -1 as a sentinel for "not computed"
- if (fGlyphCount < 0) {
- AutoFTAccess fta(this);
- FT_Face face = fta.face();
- // if the face failed, we still assign a non-negative value
- fGlyphCount = face ? face->num_glyphs : 0;
- }
- return fGlyphCount;
+ AutoFTAccess fta(this);
+ FT_Face face = fta.face();
+ return face ? face->num_glyphs : 0;
}
SkTypeface::LocalizedStrings* SkTypeface_FreeType::onCreateFamilyNameIterator() const {
protected:
SkTypeface_FreeType(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch)
: INHERITED(style, uniqueID, isFixedPitch)
- , fGlyphCount(-1)
{}
virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&,
size_t length, void* data) const override;
private:
- mutable int fGlyphCount;
-
typedef SkTypeface INHERITED;
};