FLTK logo

[master] 7d5d2af - Cairo: reduce vertical offset for text position needed by Fl_Text_Display.

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 7d5d2af - Cairo: reduce vertical offset for text position needed by Fl_Text_Display. "ManoloFLTK" May 03, 2022  
 
commit 7d5d2af5475f2ce8f6a0b6d0bee1f4a12c1d36aa
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Wed May 4 08:28:12 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Wed May 4 08:28:12 2022 +0200

    Cairo: reduce vertical offset for text position needed by Fl_Text_Display.

 src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
index 0405036..e74a987 100644
--- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
+++ src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
@@ -1125,8 +1125,8 @@ void Fl_Cairo_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize s) {
 void Fl_Cairo_Graphics_Driver::draw(const char* str, int n, float x, float y) {
   if (!n) return;
   cairo_save(cairo_);
-  // The -1 below is necessary for Fl_Text_Display at scale = 1
-  cairo_translate(cairo_, x, y - height() + descent() -1);
+  // The -0.5 below makes underscores visible in Fl_Text_Display at scale = 1
+  cairo_translate(cairo_, x, y - height() + descent() -0.5);
   pango_layout_set_text(pango_layout_, str, n);
   pango_cairo_show_layout(cairo_, pango_layout_);
   cairo_restore(cairo_);
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.