diff --git a/NEWS.md b/NEWS.md index 28600b29..fb2bb07a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ * Make sure the linejoin/linemitre setting is honored when drawing rectangles (#162) * Fix a bug with resetting clipping during group and pattern rendering +* Fix scaling of raster glyphs in drawGlyph # ragg 1.3.0 diff --git a/src/agg/include/agg_font_freetype.h b/src/agg/include/agg_font_freetype.h index b4ed9ad7..1999c8b1 100644 --- a/src/agg/include/agg_font_freetype.h +++ b/src/agg/include/agg_font_freetype.h @@ -83,6 +83,7 @@ namespace agg FT_Encoding char_map() const { return m_char_map; } double height() const { return double(m_height) / 64.0; } double width() const { return double(m_width) / 64.0; } + double scaling() const { return m_scaling; } double ascender() const; double descender() const; bool hinting() const { return m_hinting; } @@ -129,6 +130,7 @@ namespace agg char* m_signature; unsigned m_height; unsigned m_width; + double m_scaling; bool m_hinting; bool m_flip_y; bool m_library_initialized; diff --git a/src/agg/src/agg_font_freetype.cpp b/src/agg/src/agg_font_freetype.cpp index 73f9cb7e..e45ac39c 100644 --- a/src/agg/src/agg_font_freetype.cpp +++ b/src/agg/src/agg_font_freetype.cpp @@ -953,6 +953,7 @@ namespace agg best_match = largest_ind; } FT_Select_Size(m_cur_face, best_match); + m_scaling = double(m_height) / double(m_cur_face->size->metrics.height); m_height = m_cur_face->size->metrics.height; } else if(m_resolution) diff --git a/src/text_renderer.h b/src/text_renderer.h index bb4b7a63..fb2cbded 100644 --- a/src/text_renderer.h +++ b/src/text_renderer.h @@ -385,7 +385,7 @@ class TextRenderer { break; case agg::glyph_data_color: - renderColourGlyph(glyph, x[i], y[i], rot, ren, sl, 1.0, ras_clip, clip); + renderColourGlyph(glyph, x[i], y[i], rot, ren, sl, get_engine().scaling(), ras_clip, clip); break; case agg::glyph_data_outline: