diff options
| author | Manolo Gouy <Manolo> | 2017-05-22 14:42:06 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-05-22 14:42:06 +0000 |
| commit | 3a390bfb5fd2dc0c0b034c262cf79a6fb1db1e5f (patch) | |
| tree | 446b5c3b64d4843d68b5d7821cd4d3d31e4dcbc8 /src/drivers | |
| parent | c364bb73f6506f286a77949c05d6cad08f6e3c4b (diff) | |
X11 + Pango platform: improve text drawing with angle.
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
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx index a2c655455..657f867f8 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx @@ -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 } |
