aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2015-02-23 14:24:04 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-23 14:24:04 -0800
commit98c251bc7eec5aa236700d9936c740f2744788db (patch)
treef01c73ccedc0ac552f301ff84a6c0cc9959cadb8 /src
parent9671ecd44e48e8bbe1361830717b79c9c4dc9d17 (diff)
Use traits instead of table for color glyph detection.
The CTFont already knows if a font might contain color glyphs, so use that information directly instead of guessing ourselves. Review URL: https://codereview.chromium.org/949933003
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ports/SkFontHost_mac.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index fba8867de5..c4330cab1d 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -444,21 +444,9 @@ public:
, fRequestedName(requestedName)
, fFontRef(fontRef) // caller has already called CFRetain for us
, fIsLocalStream(isLocalStream)
- , fHasSbixTable(false)
+ , fHasColorGlyphs(CTFontGetSymbolicTraits(fFontRef) & kCTFontColorGlyphsTrait)
{
SkASSERT(fontRef);
-
- AutoCFRelease<CFArrayRef> tags(CTFontCopyAvailableTables(fFontRef,kCTFontTableOptionNoOptions));
- if (tags) {
- int count = SkToInt(CFArrayGetCount(tags));
- for (int i = 0; i < count; ++i) {
- uintptr_t tag = reinterpret_cast<uintptr_t>(CFArrayGetValueAtIndex(tags, i));
- if ('sbix' == tag) {
- fHasSbixTable = true;
- break;
- }
- }
- }
}
SkString fRequestedName;
@@ -484,7 +472,7 @@ protected:
private:
bool fIsLocalStream;
- bool fHasSbixTable;
+ bool fHasColorGlyphs;
typedef SkTypeface INHERITED;
};
@@ -1897,7 +1885,7 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
// CoreText provides no information as to whether a glyph will be color or not.
// Fonts may mix outlines and bitmaps, so information is needed on a glyph by glyph basis.
// If a font contains an 'sbix' table, consider it to be a color font, and disable lcd.
- if (fHasSbixTable) {
+ if (fHasColorGlyphs) {
rec->fMaskFormat = SkMask::kARGB32_Format;
}