From f8db18597a545c245b885ad18dbfb8862161966a Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sun, 6 Mar 2022 19:47:06 +0100 Subject: Complete class Fl_Cairo_Graphics_Driver using Fl_Wayland_Graphics_Driver --- src/drivers/PostScript/Fl_PostScript.cxx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/drivers/PostScript/Fl_PostScript.cxx') diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx index 38407d5c4..e930bbee7 100644 --- a/src/drivers/PostScript/Fl_PostScript.cxx +++ b/src/drivers/PostScript/Fl_PostScript.cxx @@ -1,7 +1,7 @@ // // Classes Fl_PostScript_File_Device and Fl_PostScript_Graphics_Driver for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2020 by Bill Spitzak and others. +// Copyright 2010-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -1499,8 +1499,24 @@ int Fl_PostScript_Graphics_Driver::start_eps(int width, int height) { return 0; } -PangoFontDescription* Fl_PostScript_Graphics_Driver::pango_font_description(Fl_Font fnum) { - return Fl_Graphics_Driver::default_driver().pango_font_description(fnum); + +void Fl_PostScript_Graphics_Driver::transformed_draw(const char* str, int n, double x, double y) { + if (!n) return; + PangoFontDescription *pfd = Fl_Graphics_Driver::default_driver().pango_font_description(font()); + pango_layout_set_font_description(pango_layout_, pfd); + int pwidth, pheight; + cairo_save(cairo_); + pango_layout_set_text(pango_layout_, str, n); + pango_layout_get_size(pango_layout_, &pwidth, &pheight); + if (pwidth > 0) { + double s = width(str, n); + cairo_translate(cairo_, x, y - height() + descent()); + s = (s/pwidth) * PANGO_SCALE; + cairo_scale(cairo_, s, s); + pango_cairo_show_layout(cairo_, pango_layout_); + } + cairo_restore(cairo_); + check_status(); } #endif // USE_PANGO -- cgit v1.2.3