diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2019-05-06 20:56:41 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2019-05-06 20:56:41 +0000 |
| commit | 24508663e1cf2ac25c6e460f625ca0220d7cc561 (patch) | |
| tree | 3c0493134ddaf2444be1d37f0269d70034eeaf3e /src | |
| parent | Possibly fix build on Windows. (diff) | |
| download | inkscape-24508663e1cf2ac25c6e460f625ca0220d7cc561.tar.gz inkscape-24508663e1cf2ac25c6e460f625ca0220d7cc561.zip | |
Fix rendering for some SVG in OpenType fonts with glyphs that don't have a viewBox.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libnrtype/FontInstance.cpp | 11 | ||||
| -rw-r--r-- | src/libnrtype/OpenTypeUtil.cpp | 2 |
2 files changed, 11 insertions, 2 deletions
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<Glib::RegexMatchFlags >(0)); } else { - std::cerr << "font_instance::PixBuf: Failed to match!" << std::endl; + // No viewBox! We insert one. + Glib::RefPtr<Glib::Regex> regex = Glib::Regex::create("<\\s*svg"); + Glib::ustring viewbox("<svg viewBox=\"0 "); + viewbox += std::to_string(-_design_units); + viewbox += " "; + viewbox += std::to_string(_design_units); + viewbox += " "; + viewbox += std::to_string(_design_units*2); + viewbox += "\""; + svg = regex->replace_literal(svg, 0, viewbox, static_cast<Glib::RegexMatchFlags >(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; // } } } |
