From 3968961b4772bca1c3cc8c8f56323a115d048c3c Mon Sep 17 00:00:00 2001 From: scislac Date: Fri, 25 Sep 2009 21:48:48 +0000 Subject: [PATCH] Patch by Adib for 248721. Thanks Adib! --- src/libnrtype/Layout-TNG-Output.cpp | 42 +++++++++++------------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 2003ca26b..2b4b80e7c 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -215,7 +215,7 @@ void Layout::print(SPPrintContext *ctx, void Layout::showGlyphs(CairoRenderContext *ctx) const { if (_input_stream.empty()) return; - + bool clip_mode = false;//(ctx->getRenderMode() == CairoRenderContext::RENDER_MODE_CLIP); std::vector glyphtext; @@ -243,14 +243,9 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const continue; } - Geom::Matrix font_matrix; - if (_path_fitted == NULL) { - font_matrix = glyph_matrix; - font_matrix[4] = 0; - font_matrix[5] = 0; - } else { - font_matrix.setIdentity(); - } + Geom::Matrix font_matrix = glyph_matrix; + font_matrix[4] = 0; + font_matrix[5] = 0; Glib::ustring::const_iterator span_iter = span.input_stream_first_character; unsigned char_index = _glyphs[glyph_index].in_character; @@ -276,13 +271,10 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const CairoGlyphInfo info; info.index = _glyphs[glyph_index].glyph; - if (_path_fitted == NULL) { - info.x = glyph_matrix[4]; - info.y = glyph_matrix[5]; - } else { - info.x = 0; - info.y = 0; - } + // this is the translation for x,y-offset + info.x = glyph_matrix[4]; + info.y = glyph_matrix[5]; + glyphtext.push_back(info); glyph_index++; @@ -291,26 +283,24 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const && _path_fitted == NULL && NR::transform_equalp(font_matrix, glyph_matrix, NR_EPSILON) && _characters[_glyphs[glyph_index].in_character].in_span == this_span_index); - + // remove vertical flip - font_matrix[3] *= -1.0; + Geom::Matrix flip_matrix; + flip_matrix.setIdentity(); + flip_matrix[3] = -1.0; + font_matrix = flip_matrix * font_matrix; SPStyle const *style = text_source->style; float opacity = SP_SCALE24_TO_FLOAT(style->opacity.value); - - if (_path_fitted) { - ctx->pushState(); - ctx->transform(&glyph_matrix); - } else if (opacity != 1.0) { + + if (opacity != 1.0) { ctx->pushState(); ctx->setStateForStyle(style); ctx->pushLayer(); } if (glyph_index - first_index > 0) ctx->renderGlyphtext(span.font->pFont, &font_matrix, glyphtext, style); - if (_path_fitted) - ctx->popState(); - else if (opacity != 1.0) { + if (opacity != 1.0) { ctx->popLayer(); ctx->popState(); } -- 2.30.2