Skip to content

Commit

Permalink
Fix raster glyph scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Apr 30, 2024
1 parent 3b7688a commit ecf9fc7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/agg/include/agg_font_freetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/agg/src/agg_font_freetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/text_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ class TextRenderer {
break;

case agg::glyph_data_color:
renderColourGlyph<TARGET>(glyph, x[i], y[i], rot, ren, sl, 1.0, ras_clip, clip);
renderColourGlyph<TARGET>(glyph, x[i], y[i], rot, ren, sl, get_engine().scaling(), ras_clip, clip);
break;

case agg::glyph_data_outline:
Expand Down

0 comments on commit ecf9fc7

Please sign in to comment.