summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-03-25 20:33:28 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-03-25 20:33:28 +0000
commitcb3f2bba1b88269086521993c9227710c314eebe (patch)
treedd1d1e9e0a3c25ff4b4127db6b5d691240d439a4
parentc49ee1c9c847805c93a5e4f40df3a9a26ab15b41 (diff)
downloadpango-cb3f2bba1b88269086521993c9227710c314eebe.tar.gz
Set the right font when computing the average digit width.
Mon Mar 25 15:31:17 2002 Owen Taylor <otaylor@redhat.com> * pango/pangowin32.c (pango_win32_font_get_metrics): Set the right font when computing the average digit width.
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-1-105
-rw-r--r--ChangeLog.pre-1-25
-rw-r--r--ChangeLog.pre-1-45
-rw-r--r--ChangeLog.pre-1-65
-rw-r--r--ChangeLog.pre-1-85
-rw-r--r--pango/pangowin32.c14
7 files changed, 39 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0941c43a..dcd1dffb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 25 15:31:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangowin32.c (pango_win32_font_get_metrics): Set
+ the right font when computing the average digit width.
+
Mon Mar 25 14:52:29 2002 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c (pango_x_font_get_metrics): Rewrite
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 0941c43a..dcd1dffb 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,8 @@
+Mon Mar 25 15:31:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangowin32.c (pango_win32_font_get_metrics): Set
+ the right font when computing the average digit width.
+
Mon Mar 25 14:52:29 2002 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c (pango_x_font_get_metrics): Rewrite
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 0941c43a..dcd1dffb 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,8 @@
+Mon Mar 25 15:31:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangowin32.c (pango_win32_font_get_metrics): Set
+ the right font when computing the average digit width.
+
Mon Mar 25 14:52:29 2002 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c (pango_x_font_get_metrics): Rewrite
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 0941c43a..dcd1dffb 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,8 @@
+Mon Mar 25 15:31:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangowin32.c (pango_win32_font_get_metrics): Set
+ the right font when computing the average digit width.
+
Mon Mar 25 14:52:29 2002 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c (pango_x_font_get_metrics): Rewrite
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 0941c43a..dcd1dffb 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,8 @@
+Mon Mar 25 15:31:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangowin32.c (pango_win32_font_get_metrics): Set
+ the right font when computing the average digit width.
+
Mon Mar 25 14:52:29 2002 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c (pango_x_font_get_metrics): Rewrite
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 0941c43a..dcd1dffb 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,8 @@
+Mon Mar 25 15:31:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangowin32.c (pango_win32_font_get_metrics): Set
+ the right font when computing the average digit width.
+
Mon Mar 25 14:52:29 2002 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c (pango_x_font_get_metrics): Rewrite
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index ee0e14f8..1c123655 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -364,21 +364,24 @@ pango_win32_font_get_metrics (PangoFont *font,
if (hfont != NULL)
{
+ PangoFontDescription *font_desc;
+
SelectObject (pango_win32_hdc, hfont);
GetTextMetrics (pango_win32_hdc, &tm);
metrics->ascent = tm.tmAscent * PANGO_SCALE;
metrics->descent = tm.tmDescent * PANGO_SCALE;
- metrics->approximate_digit_width = /* really an approximation ... */
metrics->approximate_char_width = tm.tmAveCharWidth * PANGO_SCALE;
- /* lovely copy&paste programming (from pangox.c) */
- /* This is sort of a sledgehammer solution, but we cache this
- * stuff so not a huge deal hopefully. Get the avg. width of the
- * chars in "0123456789"
+ /* lovely copy&paste programming (from pangox.c) FIXME: This is
+ * sort of a sledgehammer solution, if we cached the results,
+ * like the other backends did, it wouldn't big a huge performance
+ * problem. Get the avg. width of the chars in "0123456789"
*/
context = pango_win32_get_context ();
pango_context_set_language (context, language);
+ font_desc = pango_font_describe (font);
+ pango_context_set_font_description (context, font_desc);
layout = pango_layout_new (context);
pango_layout_set_text (layout, "0123456789", -1);
@@ -386,6 +389,7 @@ pango_win32_font_get_metrics (PangoFont *font,
metrics->approximate_digit_width = extents.width / 10.0;
+ pango_font_description_free (font_desc);
g_object_unref (G_OBJECT (layout));
g_object_unref (G_OBJECT (context));
}