diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2019-05-06 09:39:24 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2019-05-06 09:39:24 +0000 |
| commit | e9916b0ca221016add9268b6d83dffc4be457fac (patch) | |
| tree | 108bff7a3c6160bf976096f8a667400733e24982 /src/display/drawing-text.cpp | |
| parent | Fix GdkMotionEvents under Wayland (diff) | |
| download | inkscape-e9916b0ca221016add9268b6d83dffc4be457fac.tar.gz inkscape-e9916b0ca221016add9268b6d83dffc4be457fac.zip | |
Add basic SVG in OpenType support.
Diffstat (limited to 'src/display/drawing-text.cpp')
| -rw-r--r-- | src/display/drawing-text.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index 9d81d736d..b92886691 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -584,7 +584,34 @@ unsigned DrawingText::_renderItem(DrawingContext &dc, Geom::IntRect const &/*are if (g->_ctm.isSingular()) continue; dc.transform(g->_ctm); if (g->_drawable) { - dc.path(*g->_font->PathVector(g->_glyph)); + if (g->_font->FontHasSVG()) { + Inkscape::Pixbuf* pixbuf = g->_font->PixBuf(g->_glyph); + if (pixbuf) { + // Geom::OptRect box = bounds_exact(*g->_font->PathVector(g->_glyph)); + // if (box) { + // Inkscape::DrawingContext::Save save(dc); + // dc.newPath(); + // dc.rectangle(*box); + // dc.setLineWidth(0.01); + // dc.setSource(0x8080ffff); + // dc.stroke(); + // } + { + // pixbuf is in font design units, scale to embox. + double scale = g->_font->GetDesignUnits(); + if (scale <= 0) scale = 1000; + Inkscape::DrawingContext::Save save(dc); + dc.translate(0, 1); + dc.scale(1.0/scale, -1.0/scale); + dc.setSource(pixbuf->getSurfaceRaw(), 0, 0); + dc.paint(1); + } + } else { + dc.path(*g->_font->PathVector(g->_glyph)); + } + } else { + dc.path(*g->_font->PathVector(g->_glyph)); + } } } |
