Skip to content

Commit

Permalink
X11 + Pango platform: improve text drawing with angle.
Browse files Browse the repository at this point in the history
Make sure that text length computed without angle is equal to text length drawn with angle.
This property is essential so that rotated text appears at controlled location at both ends.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12244 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed May 22, 2017
1 parent c364bb7 commit 3a390bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
Expand Up @@ -1214,8 +1214,14 @@ void Fl_Xlib_Graphics_Driver::draw_unscaled(const char *str, int n, int x, int y
void Fl_Xlib_Graphics_Driver::draw_unscaled(int angle, const char *str, int n, int x, int y) {
PangoMatrix mat = PANGO_MATRIX_INIT; // 1.6
pango_matrix_translate(&mat, x+offset_x_*scale_, y+offset_y_*scale_); // 1.6
double l = width_unscaled(str, n);
pango_matrix_rotate(&mat, angle); // 1.6
pango_context_set_matrix(pctxt_, &mat); // 1.6
pango_layout_set_text(playout_, str, n);
int w, h;
pango_layout_get_pixel_size(playout_, &w, &h);
pango_matrix_scale(&mat, l/w, l/w); // 1.6
pango_context_set_matrix(pctxt_, &mat); // 1.6
do_draw(0, str, n, 0, 0);
pango_context_set_matrix(pctxt_, NULL); // 1.6
}
Expand Down

0 comments on commit 3a390bf

Please sign in to comment.