SkPDF: Font names need escaping
authorhalcanary <halcanary@google.com>
Tue, 16 Aug 2016 18:54:57 +0000 (11:54 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 16 Aug 2016 18:54:58 +0000 (11:54 -0700)
NOTRY=true

Review-Url: https://codereview.chromium.org/2250763002

src/pdf/SkPDFFont.cpp

index 6d8f09c2471a10d3dd4bcdcc8ed5cba6079fb98a..5cc80b04ec814f34398f89d3934e1b06075cdeb1 100644 (file)
@@ -756,7 +756,7 @@ bool SkPDFType0Font::populate(const SkPDFGlyphSet* subset) {
     SkAdvancedTypefaceMetrics::FontType type = this->getType();
     SkTypeface* face = this->typeface();
     SkASSERT(face);
-    const char* name = metrics.fFontName.c_str();
+    const SkString& name = metrics.fFontName;
 
     auto descriptor = sk_make_sp<SkPDFDict>("FontDescriptor");
     add_common_font_descriptor_entries(descriptor.get(), metrics, 0);
@@ -785,7 +785,7 @@ bool SkPDFType0Font::populate(const SkPDFGlyphSet* subset) {
                     subset->exportTo(&glyphIDs);
                 }
                 sk_sp<SkPDFObject> subsetStream = get_subset_font_stream(
-                        std::move(fontAsset), glyphIDs, name);
+                        std::move(fontAsset), glyphIDs, name.c_str());
                 if (subsetStream) {
                     descriptor->insertObjRef("FontFile2", std::move(subsetStream));
                     break;