From cb6940bf42e39271afe0fb3c2bfdd9e28d12f504 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Thu, 9 Nov 2017 13:45:10 -0500 Subject: DM FontMgr updates - return nullptr for the various makeFromFoo() that we can't support, and tweak a few unit tests to bail out early when they do - create FontStyleSet and SkTypefaces once - abort early from FontHostStream if we can't openStream() - implement SkTestTypeface::onCreateFamilyNameIterator() with SkOTUtils::LocalizedStrings_SingleName() so FontNames passes - pin out-of-range glyph IDs to zero in SkTestTypeface Change-Id: Iac53265e331fc1c5c507513af3ab299063e6610a Reviewed-on: https://skia-review.googlesource.com/69501 Reviewed-by: Ben Wagner Commit-Queue: Mike Klein --- tests/FontHostStreamTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/FontHostStreamTest.cpp') diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp index c3bc878da8..e97ea0dcc2 100644 --- a/tests/FontHostStreamTest.cpp +++ b/tests/FontHostStreamTest.cpp @@ -88,6 +88,12 @@ DEF_TEST(FontHostStream, reporter) { : SkTypeface::MakeDefault()); int ttcIndex; std::unique_ptr fontData(typeface->openStream(&ttcIndex)); + if (!fontData) { + // We're using a SkTypeface that can't give us a stream. + // This happens with portable or system fonts. End the test now. + return; + } + sk_sp streamTypeface(SkTypeface::MakeFromStream(fontData.release())); SkFontDescriptor desc; -- cgit v1.2.3