Remove user specified typeface id.
Now that there may be multiple font managers in a process the typeface
ids must be unique across all typefaces, not just unique within a font
manager. If two typefaces have the same id there will be issues in the
glyph cache. All existing font managers were already doing this by
calling SkFontCache::NewFontID, so centralize this in SkTypeface.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2147733002
Review-Url: https://codereview.chromium.org/2147733002
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index dd280cd..da72542 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -115,12 +115,11 @@
}
static void test_matchStyleCSS3(skiatest::Reporter* reporter) {
- static const SkFontID invalidFontID = std::numeric_limits<SkFontID>::max();
static const SkFontStyle invalidFontStyle(101, SkFontStyle::kNormal_Width, SkFontStyle::kUpright_Slant);
class TestTypeface : public SkTypeface {
public:
- TestTypeface(const SkFontStyle& fontStyle, SkFontID id) : SkTypeface(fontStyle, id, false){}
+ TestTypeface(const SkFontStyle& fontStyle) : SkTypeface(fontStyle, false){}
protected:
SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; }
SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&,
@@ -168,9 +167,9 @@
}
SkTypeface* createTypeface(int index) override {
if (index < 0 || this->count() <= index) {
- return new TestTypeface(invalidFontStyle, invalidFontID);
+ return new TestTypeface(invalidFontStyle);
}
- return new TestTypeface(fStyles[index], index);
+ return new TestTypeface(fStyles[index]);
}
SkTypeface* matchStyle(const SkFontStyle& pattern) override {
return this->matchStyleCSS3(pattern);