summaryrefslogtreecommitdiff
path: root/pango/pangofc-font.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2006-03-31 00:21:30 +0000
committerTor Lillqvist <tml@src.gnome.org>2006-03-31 00:21:30 +0000
commita2d9f1a92b48b9a878f8bd2f9be5fd8f3c7b4c82 (patch)
treec668a9b5cb1627d209f23880ab22f5bbe390173a /pango/pangofc-font.c
parentc4a19d3bf7a470605e86158f9c45fc3e630cd060 (diff)
downloadpango-a2d9f1a92b48b9a878f8bd2f9be5fd8f3c7b4c82.tar.gz
Fix blurred underlines on Win32 (#332656):
2006-03-30 Tor Lillqvist <tml@novell.com> Fix blurred underlines on Win32 (#332656): * pango/pango-utils.c (pango_quantize_line_geometry): New public function. Used to be the static quantize_position() in pangofc-font.c * pango/pango-utils.h: Declare it. * pango/pango.def: Here, too. * pango/pangofc-font.c (quantize_position): Remove. (get_face_metrics): Use pango_quantize_line_geometry() instead. * pango/pangocairo-win32font.c (create_metrics_for_context): Call pango_quantize_line_geometry() for underline and strikethrough geometries.
Diffstat (limited to 'pango/pangofc-font.c')
-rw-r--r--pango/pangofc-font.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index d6e2d8fd..1724f12f 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -252,28 +252,6 @@ pango_fc_font_get_coverage (PangoFont *font,
fcfont);
}
-static void
-quantize_position (int *thickness,
- int *position)
-{
- int thickness_pixels = (*thickness + PANGO_SCALE / 2) / PANGO_SCALE;
- if (thickness_pixels == 0)
- thickness_pixels = 1;
-
- if (thickness_pixels & 1)
- {
- int new_center = ((*position - *thickness / 2) & ~(PANGO_SCALE - 1)) + PANGO_SCALE / 2;
- *position = new_center + (PANGO_SCALE * thickness_pixels) / 2;
- }
- else
- {
- int new_center = ((*position - *thickness / 2 + PANGO_SCALE / 2) & ~(PANGO_SCALE - 1));
- *position = new_center + (PANGO_SCALE * thickness_pixels) / 2;
- }
-
- *thickness = thickness_pixels * PANGO_SCALE;
-}
-
/* For Xft, it would be slightly more efficient to simply to
* call Xft, and also more robust against changes in Xft.
* But for now, we simply use the same code for all backends.
@@ -386,8 +364,10 @@ get_face_metrics (PangoFcFont *fcfont,
*/
if (fcfont->is_hinted)
{
- quantize_position (&metrics->underline_thickness, &metrics->underline_position);
- quantize_position (&metrics->strikethrough_thickness, &metrics->strikethrough_position);
+ pango_quantize_line_geometry (&metrics->underline_thickness,
+ &metrics->underline_position);
+ pango_quantize_line_geometry (&metrics->strikethrough_thickness,
+ &metrics->strikethrough_position);
}
PANGO_FC_FONT_UNLOCK_FACE (fcfont);