summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-04-30 16:37:28 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-04-30 16:37:28 +0200
commitcf1c8b1125d58659e080c94280a1c72f8f0ec659 (patch)
tree4d6a4bb0f303eeab2e7d5eddfd8902e0bb413d4f
parent5341f0e45ead688a0bef59d2a6a30afcd02fadf1 (diff)
Fix for issue #438 : Wayland: Text drawing different from Xft version - cont'd.
-rw-r--r--src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H1
-rw-r--r--src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx10
2 files changed, 2 insertions, 9 deletions
diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
index f412328b3..db12ca9b1 100644
--- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
+++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
@@ -165,7 +165,6 @@ public:
void draw(const char* s, int nBytes, float x, float y);
void draw(int angle, const char *str, int n, int x, int y);
void rtl_draw(const char* str, int n, int x, int y);
- int height();
int descent();
double width(const char *str, int n);
double width(unsigned c);
diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
index 813917392..c47c0b6e4 100644
--- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
+++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
@@ -915,12 +915,6 @@ void Fl_Cairo_Graphics_Driver::delete_bitmask(fl_uintptr_t bm) {
}
-int Fl_Cairo_Graphics_Driver::height() {
- if (!font_descriptor()) font(0, 12);
- return (font_descriptor()->ascent + font_descriptor()->descent)*1.1 /*1.15 scale=1*/;
-}
-
-
int Fl_Cairo_Graphics_Driver::descent() {
return font_descriptor()->descent;
}
@@ -1124,9 +1118,9 @@ 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 vertical offset size()/21. below vertically positions output text adequately
+ // The vertical offset size()/6. below vertically positions output text adequately
// relatively to the baseline (empirical observation).
- cairo_translate(cairo_, x, y - height() + descent() + size()/21.);
+ cairo_translate(cairo_, x, y - height() + descent() - size()/6.);
pango_layout_set_text(pango_layout_, str, n);
pango_cairo_show_layout(cairo_, pango_layout_);
cairo_restore(cairo_);