diff options
author | 2017-01-25 11:15:50 -0500 | |
---|---|---|
committer | 2017-01-26 22:21:34 +0000 | |
commit | 25272300c308335f2d87c2a70e249965b268bcb0 (patch) | |
tree | db2d539a1b22e9db81918a40e6a05a9da47bea31 /src/ports/SkFontMgr_FontConfigInterface.cpp | |
parent | bbeb5730e7365d0952d3dbb5846001708b9517a3 (diff) |
Implement getFamilyName for stream fonts on Linux.
When SkFontMgr_fontconfig and SkFontMgr_FontConfigInterface create a
typeface from data they do not store the default font name and
getFamilyName will return the empty string. All of the code to handle
this properly now exists, it just needs to be hooked up.
BUG=skia:1508
Change-Id: I75f2a598a5451babb4a9ceb5e9a9e9d3daa41d60
Reviewed-on: https://skia-review.googlesource.com/7506
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/ports/SkFontMgr_FontConfigInterface.cpp')
-rw-r--r-- | src/ports/SkFontMgr_FontConfigInterface.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ports/SkFontMgr_FontConfigInterface.cpp b/src/ports/SkFontMgr_FontConfigInterface.cpp index 4795ba5974..81c4868e5d 100644 --- a/src/ports/SkFontMgr_FontConfigInterface.cpp +++ b/src/ports/SkFontMgr_FontConfigInterface.cpp @@ -211,14 +211,15 @@ protected: } // TODO should the caller give us the style or should we get it from freetype? + SkString name; SkFontStyle style; bool isFixedPitch = false; - if (!fScanner.scanFont(stream.get(), 0, nullptr, &style, &isFixedPitch, nullptr)) { + if (!fScanner.scanFont(stream.get(), 0, &name, &style, &isFixedPitch, nullptr)) { return nullptr; } auto fontData = skstd::make_unique<SkFontData>(std::move(stream), ttcIndex, nullptr, 0); - return SkTypeface_FCI::Create(std::move(fontData), style, isFixedPitch); + return SkTypeface_FCI::Create(std::move(fontData), std::move(name), style, isFixedPitch); } SkTypeface* onCreateFromStream(SkStreamAsset* s, const FontParameters& params) const override { @@ -251,7 +252,7 @@ protected: params.getCollectionIndex(), axisValues.get(), axisDefinitions.count()); - return SkTypeface_FCI::Create(std::move(fontData), style, isFixedPitch); + return SkTypeface_FCI::Create(std::move(fontData), std::move(name), style, isFixedPitch); } SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { @@ -284,7 +285,7 @@ protected: // Check if a typeface with this FontIdentity is already in the FontIdentity cache. face = fTFCache.findByProcAndRef(find_by_FontIdentity, &identity); if (!face) { - face = SkTypeface_FCI::Create(fFCI, identity, outFamilyName, outStyle); + face = SkTypeface_FCI::Create(fFCI, identity, std::move(outFamilyName), outStyle); // Add this FontIdentity to the FontIdentity cache. fTFCache.add(face); } |