summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-05-30 18:49:02 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-05-30 18:49:02 +0000
commitb988bf518feb66916cbd137d62deca149b8cdcef (patch)
tree2a397a3b6c3ed0dc1928b17ff686aa32a4b25961
parentf5692a3d420b3430deaf20ac6be3953966c4c479 (diff)
downloadpango-b988bf518feb66916cbd137d62deca149b8cdcef.tar.gz
Use g_strtod().
Tue May 30 14:30:24 2000 Owen Taylor <otaylor@redhat.com> * pango/fonts.c (pango_font_description_from_string): Use g_strtod(). * pango/fonts.c (pango_font_description_to_string): Fix bug where spaces where not properly inserted into font description string. * pango/fonts.c (pango_font_get_glyph_extents): Fix some 1000 <=> PANGO_SCALE bugs. * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix list manipulation bug.
-rw-r--r--ChangeLog14
-rw-r--r--ChangeLog.pre-1-014
-rw-r--r--ChangeLog.pre-1-1014
-rw-r--r--ChangeLog.pre-1-214
-rw-r--r--ChangeLog.pre-1-414
-rw-r--r--ChangeLog.pre-1-614
-rw-r--r--ChangeLog.pre-1-814
-rw-r--r--examples/viewer.c8
-rw-r--r--pango/fonts.c17
-rw-r--r--pango/pangox-fontcache.c1
10 files changed, 116 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 81ed39bd..ff832b77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Tue May 30 14:30:24 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_from_string): Use g_strtod().
+
+ * pango/fonts.c (pango_font_description_to_string): Fix bug
+ where spaces where not properly inserted into font description
+ string.
+
+ * pango/fonts.c (pango_font_get_glyph_extents): Fix some
+ 1000 <=> PANGO_SCALE bugs.
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix list
+ manipulation bug.
+
Mon May 29 13:22:36 2000 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c pango/pangox.h (pango_x_font_subfont_xlfd): New
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index 81ed39bd..ff832b77 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,17 @@
+Tue May 30 14:30:24 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_from_string): Use g_strtod().
+
+ * pango/fonts.c (pango_font_description_to_string): Fix bug
+ where spaces where not properly inserted into font description
+ string.
+
+ * pango/fonts.c (pango_font_get_glyph_extents): Fix some
+ 1000 <=> PANGO_SCALE bugs.
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix list
+ manipulation bug.
+
Mon May 29 13:22:36 2000 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c pango/pangox.h (pango_x_font_subfont_xlfd): New
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 81ed39bd..ff832b77 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,17 @@
+Tue May 30 14:30:24 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_from_string): Use g_strtod().
+
+ * pango/fonts.c (pango_font_description_to_string): Fix bug
+ where spaces where not properly inserted into font description
+ string.
+
+ * pango/fonts.c (pango_font_get_glyph_extents): Fix some
+ 1000 <=> PANGO_SCALE bugs.
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix list
+ manipulation bug.
+
Mon May 29 13:22:36 2000 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c pango/pangox.h (pango_x_font_subfont_xlfd): New
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 81ed39bd..ff832b77 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,17 @@
+Tue May 30 14:30:24 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_from_string): Use g_strtod().
+
+ * pango/fonts.c (pango_font_description_to_string): Fix bug
+ where spaces where not properly inserted into font description
+ string.
+
+ * pango/fonts.c (pango_font_get_glyph_extents): Fix some
+ 1000 <=> PANGO_SCALE bugs.
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix list
+ manipulation bug.
+
Mon May 29 13:22:36 2000 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c pango/pangox.h (pango_x_font_subfont_xlfd): New
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 81ed39bd..ff832b77 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,17 @@
+Tue May 30 14:30:24 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_from_string): Use g_strtod().
+
+ * pango/fonts.c (pango_font_description_to_string): Fix bug
+ where spaces where not properly inserted into font description
+ string.
+
+ * pango/fonts.c (pango_font_get_glyph_extents): Fix some
+ 1000 <=> PANGO_SCALE bugs.
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix list
+ manipulation bug.
+
Mon May 29 13:22:36 2000 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c pango/pangox.h (pango_x_font_subfont_xlfd): New
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 81ed39bd..ff832b77 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,17 @@
+Tue May 30 14:30:24 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_from_string): Use g_strtod().
+
+ * pango/fonts.c (pango_font_description_to_string): Fix bug
+ where spaces where not properly inserted into font description
+ string.
+
+ * pango/fonts.c (pango_font_get_glyph_extents): Fix some
+ 1000 <=> PANGO_SCALE bugs.
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix list
+ manipulation bug.
+
Mon May 29 13:22:36 2000 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c pango/pangox.h (pango_x_font_subfont_xlfd): New
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 81ed39bd..ff832b77 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,17 @@
+Tue May 30 14:30:24 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_from_string): Use g_strtod().
+
+ * pango/fonts.c (pango_font_description_to_string): Fix bug
+ where spaces where not properly inserted into font description
+ string.
+
+ * pango/fonts.c (pango_font_get_glyph_extents): Fix some
+ 1000 <=> PANGO_SCALE bugs.
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix list
+ manipulation bug.
+
Mon May 29 13:22:36 2000 Owen Taylor <otaylor@redhat.com>
* pango/pangox.c pango/pangox.h (pango_x_font_subfont_xlfd): New
diff --git a/examples/viewer.c b/examples/viewer.c
index 1fb93ef8..84b7b25d 100644
--- a/examples/viewer.c
+++ b/examples/viewer.c
@@ -426,7 +426,7 @@ set_style (GtkWidget *entry, gpointer data)
void
font_size_changed (GtkAdjustment *adj)
{
- font_description.size = (int)(adj->value * 1000 + 0.5);
+ font_description.size = (int)(adj->value * PANGO_SCALE + 0.5);
reload_font();
}
@@ -520,6 +520,12 @@ make_styles_combo ()
return combo;
}
+static int
+cmp_strings (const void *a, const void *b)
+{
+ return strcmp (*(const char **)a, *(const char **)b);
+}
+
GtkWidget *
make_families_menu ()
{
diff --git a/pango/fonts.c b/pango/fonts.c
index 4914c6f0..70650225 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <ctype.h>
+#include <math.h>
#include "pango.h"
@@ -244,10 +245,10 @@ pango_font_description_from_string (const char *str)
if (wordlen != 0)
{
char *end;
- double size = strtod (p, &end);
+ double size = g_strtod (p, &end);
if (end - p == wordlen) /* word is a valid float */
{
- desc->size = (int)(size * 1000 + 0.5);
+ desc->size = (int)(size * PANGO_SCALE + 0.5);
last = p;
}
}
@@ -297,7 +298,7 @@ append_field (GString *str, FieldMap *map, int n_elements, int val)
{
if (map[i].str)
{
- if (str->len != 0)
+ if (str->len > 0 && str->str[str->len -1] != ' ')
g_string_append_c (str, ' ');
g_string_append (str, map[i].str);
}
@@ -305,7 +306,7 @@ append_field (GString *str, FieldMap *map, int n_elements, int val)
}
}
- if (str->len != 0)
+ if (str->len > 0 || str->str[str->len -1] != ' ')
g_string_append_c (str, ' ');
g_string_sprintfa (str, "%d", val);
}
@@ -350,10 +351,12 @@ pango_font_description_to_string (const PangoFontDescription *desc)
if (desc->size > 0)
{
- if (result->len == 0)
+ if (result->len > 0 || result->str[result->len -1] != ' ')
g_string_append_c (result, ' ');
- g_string_sprintfa (result, "%f", desc->size / 1000.);
+ /* FIXME: %g is not right here. We need to always use '.
+ */
+ g_string_sprintfa (result, "%g", (double)desc->size / PANGO_SCALE);
}
str = result->str;
@@ -443,7 +446,7 @@ pango_font_find_shaper (PangoFont *font,
* coordinates extending to the right and down. The macros PANGO_ASCENT(),
* PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING can be used to convert
* from the extents rectangle to more traditional font metrics. The units
- * of the rectangles are in 1000ths of a device unit.
+ * of the rectangles are in 1/PANGO_SCALE of a device unit.
**/
void
pango_font_get_glyph_extents (PangoFont *font,
diff --git a/pango/pangox-fontcache.c b/pango/pangox-fontcache.c
index 929d3302..50264a2c 100644
--- a/pango/pangox-fontcache.c
+++ b/pango/pangox-fontcache.c
@@ -189,6 +189,7 @@ pango_x_font_cache_load (PangoXFontCache *cache,
entry->mru->next = cache->mru;
entry->mru->prev = NULL;
+ cache->mru->prev = entry->mru;
cache->mru = entry->mru;
}
}