aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/fonts/SkTestSVGTypeface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/fonts/SkTestSVGTypeface.cpp')
-rw-r--r--tools/fonts/SkTestSVGTypeface.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/fonts/SkTestSVGTypeface.cpp b/tools/fonts/SkTestSVGTypeface.cpp
index ceb523aa72..199c3b5df6 100644
--- a/tools/fonts/SkTestSVGTypeface.cpp
+++ b/tools/fonts/SkTestSVGTypeface.cpp
@@ -100,15 +100,17 @@ void SkTestSVGTypeface::onFilterRec(SkScalerContextRec* rec) const {
rec->setHinting(SkPaint::kNo_Hinting);
}
+void SkTestSVGTypeface::getGlyphToUnicodeMap(SkUnichar* glyphToUnicode) const {
+ SkDEBUGCODE(unsigned glyphCount = this->countGlyphs());
+ fCMap.foreach([=](const SkUnichar& c, const SkGlyphID& g) {
+ SkASSERT(g < glyphCount);
+ glyphToUnicode[g] = c;
+ });
+}
+
std::unique_ptr<SkAdvancedTypefaceMetrics> SkTestSVGTypeface::onGetAdvancedMetrics() const {
std::unique_ptr<SkAdvancedTypefaceMetrics> info(new SkAdvancedTypefaceMetrics);
- info->fFontName.set(fName);
-
- SkTDArray<SkUnichar>& toUnicode = info->fGlyphToUnicode;
- toUnicode.setCount(fGlyphCount);
- fCMap.foreach([&toUnicode](const SkUnichar& c, const SkGlyphID& g) {
- toUnicode[g] = c;
- });
+ info->fFontName = fName;
return info;
}