diff options
Diffstat (limited to 'dviware/dvisvgm/src/SVGCharPathHandler.cpp')
-rw-r--r-- | dviware/dvisvgm/src/SVGCharPathHandler.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/dviware/dvisvgm/src/SVGCharPathHandler.cpp b/dviware/dvisvgm/src/SVGCharPathHandler.cpp index fc59d2280e..2c753d2e5c 100644 --- a/dviware/dvisvgm/src/SVGCharPathHandler.cpp +++ b/dviware/dvisvgm/src/SVGCharPathHandler.cpp @@ -60,7 +60,7 @@ void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) { // Apply text color changes only if the color of the entire font is black. // Glyphs of non-black fonts (e.g. defined in a XeTeX document) can't change their color. CharProperty<Color> &color = (_fontColor.get() != Color::BLACK) ? _fontColor : _color; - bool applyColor = color.get() != Color::BLACK; + bool applyColor = color.get() != Color::BLACK || (SVGElement::USE_CURRENTCOLOR && SVGElement::CURRENTCOLOR == Color::BLACK); bool applyMatrix = !_matrix->isIdentity(); bool applyOpacity = !_opacity->isFillDefault(); if (!_groupNode) { @@ -85,16 +85,19 @@ void SVGCharPathHandler::appendChar (uint32_t c, double x, double y) { GlyphMetrics metrics; font->getGlyphMetrics(c, _vertical, metrics); x -= metrics.wl; - if (auto pf = font_cast<const PhysicalFont*>(font)) { - // Center glyph between top and bottom border of the TFM box. - // This is just an approximation used until I find a way to compute - // the exact location in vertical mode. - GlyphMetrics exact_metrics; - pf->getExactGlyphBox(c, exact_metrics, false, nullptr); - y += exact_metrics.h+(metrics.d-exact_metrics.h-exact_metrics.d)/2; + if (_vertical) { + auto physicalFont = font_cast<const PhysicalFont *>(font); + if (!physicalFont) + y += metrics.d; + else { + // Center glyph between top and bottom border of the TFM box. + // This is just an approximation used until I find a way to compute + // the exact location in vertical mode. + GlyphMetrics exact_metrics; + physicalFont->getExactGlyphBox(c, exact_metrics, false, nullptr); + y += exact_metrics.h + (metrics.d - exact_metrics.h - exact_metrics.d) / 2; + } } - else - y += metrics.d; } Matrix rotation(1); if (_vertical && !font->verticalLayout()) { |