summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-03-13 10:52:09 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-03-13 10:52:09 +0000
commitd945884cb11d347e27804bba402c28a6129fd099 (patch)
tree8cf5cde6cdd568c674be635da936645b56105115
parentf218297b7764fe282ad03198387bcc3f7ee94fe5 (diff)
downloadnetsurf-d945884cb11d347e27804bba402c28a6129fd099.tar.gz
netsurf-d945884cb11d347e27804bba402c28a6129fd099.tar.bz2
Fix font sizing in text widget
svn path=/trunk/netsurf/; revision=12016
-rw-r--r--framebuffer/fbtk/text.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/framebuffer/fbtk/text.c b/framebuffer/fbtk/text.c
index fff35bba4..2353b08b9 100644
--- a/framebuffer/fbtk/text.c
+++ b/framebuffer/fbtk/text.c
@@ -47,6 +47,9 @@
((((7 * ((c1 >> 8) & 0xff)) >> 3) + 32) << 8) | \
((((7 * (c1 & 0xff)) >> 3) + 32) << 0))
+/* Convert pixels to points, assuming a DPI of 90 */
+#define px_to_pt(x) (((x) * 72) / 90)
+
/** Text redraw callback.
*
* Called when a text widget requires redrawing.
@@ -91,7 +94,7 @@ fb_redraw_text(fbtk_widget_t *widget, fbtk_callback_info *cbi )
if (widget->u.text.text != NULL) {
fh = widget->height - border - border;
font_style.family = PLOT_FONT_FAMILY_SANS_SERIF;
- font_style.size = fh * FONT_SIZE_SCALE;
+ font_style.size = px_to_pt(fh) * FONT_SIZE_SCALE;
font_style.weight = 400;
font_style.flags = FONTF_NONE;
font_style.background = widget->bg;
@@ -189,7 +192,7 @@ fb_redraw_text_button(fbtk_widget_t *widget, fbtk_callback_info *cbi )
if (widget->u.text.text != NULL) {
fh = widget->height - border - border;
font_style.family = PLOT_FONT_FAMILY_SANS_SERIF;
- font_style.size = fh * FONT_SIZE_SCALE;
+ font_style.size = px_to_pt(fh) * FONT_SIZE_SCALE;
font_style.weight = 400;
font_style.flags = FONTF_NONE;
font_style.background = widget->bg;