From 24508663e1cf2ac25c6e460f625ca0220d7cc561 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 6 May 2019 22:56:41 +0200 Subject: Fix rendering for some SVG in OpenType fonts with glyphs that don't have a viewBox. --- src/libnrtype/FontInstance.cpp | 11 ++++++++++- src/libnrtype/OpenTypeUtil.cpp | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/libnrtype') diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index f0834ab73..2253b49c8 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -718,7 +718,16 @@ Inkscape::Pixbuf* font_instance::PixBuf(int glyph_id) // std::cout << "replacement: |" << replacement << "|" << std::endl; svg = regex->replace_literal(svg, 0, replacement, static_cast(0)); } else { - std::cerr << "font_instance::PixBuf: Failed to match!" << std::endl; + // No viewBox! We insert one. + Glib::RefPtr regex = Glib::Regex::create("<\\s*svg"); + Glib::ustring viewbox("replace_literal(svg, 0, viewbox, static_cast(0)); } // Finally create pixbuf! diff --git a/src/libnrtype/OpenTypeUtil.cpp b/src/libnrtype/OpenTypeUtil.cpp index 185d11004..0662c339b 100644 --- a/src/libnrtype/OpenTypeUtil.cpp +++ b/src/libnrtype/OpenTypeUtil.cpp @@ -381,7 +381,7 @@ void readOpenTypeSVGTable(const FT_Face ft_face, // for (auto glyph : glyphs) { // std::cout << "Glyph: " << glyph.first << std::endl; - // std::cout << glyph.second << std::endl; + // std::cout << glyph.second.svg << std::endl; // } } } -- cgit v1.2.3