summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-07-21 16:55:35 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-07-21 16:55:35 +0000
commit6e13c2fb0a9b386bcca999a5744a655ec3721aad (patch)
tree461ffcbde37aff1ef6bce80cbfb0045e43032ce1 /desktop
parent4ff22c67df940cdf6bd635e27ae07db0f3737b21 (diff)
downloadnetsurf-6e13c2fb0a9b386bcca999a5744a655ec3721aad.tar.gz
netsurf-6e13c2fb0a9b386bcca999a5744a655ec3721aad.tar.bz2
Scale font sizes, for better accuracy.
svn path=/trunk/netsurf/; revision=8657
Diffstat (limited to 'desktop')
-rw-r--r--desktop/plot_style.h7
-rw-r--r--desktop/save_pdf/font_haru.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/desktop/plot_style.h b/desktop/plot_style.h
index 3b74a4efd..088f0d275 100644
--- a/desktop/plot_style.h
+++ b/desktop/plot_style.h
@@ -105,11 +105,16 @@ typedef unsigned long plot_font_flags_t;
#define FONTF_SMALLCAPS 4
/**
+ * Scaling factor for font sizes
+ */
+#define FONT_SIZE_SCALE 1024
+
+/**
* Font style for plotting
*/
typedef struct {
plot_font_generic_family_t family; /**< Generic family to plot with */
- int size; /**< Font size, in points */
+ int size; /**< Font size, in points * FONT_SIZE_SCALE */
int weight; /**< Font weight: value in range [100,900] as per CSS */
plot_font_flags_t flags; /**< Font flags */
colour background; /**< Background colour to blend to, if appropriate */
diff --git a/desktop/save_pdf/font_haru.c b/desktop/save_pdf/font_haru.c
index faed7c168..0bf86c340 100644
--- a/desktop/save_pdf/font_haru.c
+++ b/desktop/save_pdf/font_haru.c
@@ -336,7 +336,7 @@ bool haru_nsfont_apply_style(const plot_font_style_t *fstyle,
LOG(("Setting font: %s", font_name));
#endif
- size = fstyle->size;
+ size = fstyle->size;
if (font != NULL)
size *= pdf_text_scale;
@@ -344,6 +344,8 @@ bool haru_nsfont_apply_style(const plot_font_style_t *fstyle,
if (size <= 0)
return true;
+ size /= FONT_SIZE_SCALE;
+
if (size > HPDF_MAX_FONTSIZE)
size = HPDF_MAX_FONTSIZE;