summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2001-02-28 20:22:09 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-02-28 20:22:09 +0000
commit77626cb70d108fcba67dbc6085b864fcf166598d (patch)
tree6456900bad57025c22579b6490a2b71f71e237eb
parent835ef9ddfc5d71b136ed5c491533d76875bd6951 (diff)
downloadpango-77626cb70d108fcba67dbc6085b864fcf166598d.tar.gz
Add approximate_char_width field
2001-02-28 Havoc Pennington <hp@redhat.com> * pango/pango-font.h (struct _PangoFontMetrics): Add approximate_char_width field * pango/pangox.c (get_font_metrics_from_subfonts): "compute" the approximate char width. Other backends need to add this.
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-1-08
-rw-r--r--ChangeLog.pre-1-108
-rw-r--r--ChangeLog.pre-1-28
-rw-r--r--ChangeLog.pre-1-48
-rw-r--r--ChangeLog.pre-1-68
-rw-r--r--ChangeLog.pre-1-88
-rw-r--r--docs/tmpl/coverage-maps.sgml7
-rw-r--r--docs/tmpl/glyphs.sgml13
-rw-r--r--docs/tmpl/main.sgml7
-rw-r--r--pango/pango-font.h1
-rw-r--r--pango/pangox.c42
12 files changed, 126 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c186b66f..9005552f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-02-28 Havoc Pennington <hp@redhat.com>
+
+ * pango/pango-font.h (struct _PangoFontMetrics): Add
+ approximate_char_width field
+
+ * pango/pangox.c (get_font_metrics_from_subfonts): "compute" the
+ approximate char width. Other backends need to add this.
+
2001-02-28 Alexander Larsson <alla@lysator.liu.se>
* pango/pango-attributes.[c]:
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index c186b66f..9005552f 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,11 @@
+2001-02-28 Havoc Pennington <hp@redhat.com>
+
+ * pango/pango-font.h (struct _PangoFontMetrics): Add
+ approximate_char_width field
+
+ * pango/pangox.c (get_font_metrics_from_subfonts): "compute" the
+ approximate char width. Other backends need to add this.
+
2001-02-28 Alexander Larsson <alla@lysator.liu.se>
* pango/pango-attributes.[c]:
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index c186b66f..9005552f 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,11 @@
+2001-02-28 Havoc Pennington <hp@redhat.com>
+
+ * pango/pango-font.h (struct _PangoFontMetrics): Add
+ approximate_char_width field
+
+ * pango/pangox.c (get_font_metrics_from_subfonts): "compute" the
+ approximate char width. Other backends need to add this.
+
2001-02-28 Alexander Larsson <alla@lysator.liu.se>
* pango/pango-attributes.[c]:
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index c186b66f..9005552f 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,11 @@
+2001-02-28 Havoc Pennington <hp@redhat.com>
+
+ * pango/pango-font.h (struct _PangoFontMetrics): Add
+ approximate_char_width field
+
+ * pango/pangox.c (get_font_metrics_from_subfonts): "compute" the
+ approximate char width. Other backends need to add this.
+
2001-02-28 Alexander Larsson <alla@lysator.liu.se>
* pango/pango-attributes.[c]:
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index c186b66f..9005552f 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,11 @@
+2001-02-28 Havoc Pennington <hp@redhat.com>
+
+ * pango/pango-font.h (struct _PangoFontMetrics): Add
+ approximate_char_width field
+
+ * pango/pangox.c (get_font_metrics_from_subfonts): "compute" the
+ approximate char width. Other backends need to add this.
+
2001-02-28 Alexander Larsson <alla@lysator.liu.se>
* pango/pango-attributes.[c]:
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index c186b66f..9005552f 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,11 @@
+2001-02-28 Havoc Pennington <hp@redhat.com>
+
+ * pango/pango-font.h (struct _PangoFontMetrics): Add
+ approximate_char_width field
+
+ * pango/pangox.c (get_font_metrics_from_subfonts): "compute" the
+ approximate char width. Other backends need to add this.
+
2001-02-28 Alexander Larsson <alla@lysator.liu.se>
* pango/pango-attributes.[c]:
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index c186b66f..9005552f 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,11 @@
+2001-02-28 Havoc Pennington <hp@redhat.com>
+
+ * pango/pango-font.h (struct _PangoFontMetrics): Add
+ approximate_char_width field
+
+ * pango/pangox.c (get_font_metrics_from_subfonts): "compute" the
+ approximate char width. Other backends need to add this.
+
2001-02-28 Alexander Larsson <alla@lysator.liu.se>
* pango/pango-attributes.[c]:
diff --git a/docs/tmpl/coverage-maps.sgml b/docs/tmpl/coverage-maps.sgml
index 8cde2ac9..0169a82c 100644
--- a/docs/tmpl/coverage-maps.sgml
+++ b/docs/tmpl/coverage-maps.sgml
@@ -34,6 +34,13 @@ character point for a particular scrpt.
the current script.
@PANGO_COVERAGE_EXACT: The character is represented as the correct graphical form.
+<!-- ##### MACRO PANGO_TYPE_COVERAGE_LEVEL ##### -->
+<para>
+
+</para>
+
+
+
<!-- ##### STRUCT PangoCoverage ##### -->
<para>
The #PangoCoverage structure represents a map from ISO-10646 character
diff --git a/docs/tmpl/glyphs.sgml b/docs/tmpl/glyphs.sgml
index f099bdd9..d1697a45 100644
--- a/docs/tmpl/glyphs.sgml
+++ b/docs/tmpl/glyphs.sgml
@@ -275,6 +275,19 @@ accessible fields
@logical_rect:
+<!-- ##### FUNCTION pango_glyph_string_extents_range ##### -->
+<para>
+
+</para>
+
+@glyphs:
+@start:
+@end:
+@font:
+@ink_rect:
+@logical_rect:
+
+
<!-- ##### FUNCTION pango_glyph_string_index_to_x ##### -->
<para>
diff --git a/docs/tmpl/main.sgml b/docs/tmpl/main.sgml
index e9cb3a98..c746f137 100644
--- a/docs/tmpl/main.sgml
+++ b/docs/tmpl/main.sgml
@@ -164,6 +164,13 @@ for text.
top-to-bottom, with the rows ordered from
right to left.
+<!-- ##### MACRO PANGO_TYPE_DIRECTION ##### -->
+<para>
+
+</para>
+
+
+
<!-- ##### FUNCTION pango_itemize ##### -->
<para>
diff --git a/pango/pango-font.h b/pango/pango-font.h
index cac1b7bb..109a7819 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -90,6 +90,7 @@ struct _PangoFontMetrics
{
int ascent;
int descent;
+ int approximate_char_width;
};
PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc);
diff --git a/pango/pangox.c b/pango/pangox.c
index 509c5c35..172f64aa 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -522,6 +522,30 @@ pango_x_font_get_glyph_extents (PangoFont *font,
}
}
+static gboolean
+get_int_prop (Atom atom,
+ XFontStruct *fs,
+ gint *val)
+{
+ gint i;
+
+ *val = 0;
+
+ i = 0;
+ while (i < fs->n_properties)
+ {
+ if (fs->properties[i].name == atom)
+ {
+ *val = fs->properties[i].card32;
+ return TRUE;
+ }
+
+ ++i;
+ }
+
+ return FALSE;
+}
+
/* Get composite font metrics for all subfonts in list
*/
static void
@@ -529,8 +553,15 @@ get_font_metrics_from_subfonts (PangoFont *font,
GSList *subfonts,
PangoFontMetrics *metrics)
{
+ PangoXFont *xfont = (PangoXFont *)font;
GSList *tmp_list = subfonts;
gboolean first = TRUE;
+ gint total_avg_widths = 0;
+ gint n_avg_widths = 0;
+ Atom avg_width_atom;
+
+ avg_width_atom = pango_x_fontmap_atom_from_name (xfont->fontmap,
+ "AVERAGE_WIDTH");
metrics->ascent = 0;
metrics->descent = 0;
@@ -542,6 +573,8 @@ get_font_metrics_from_subfonts (PangoFont *font,
if (subfont)
{
XFontStruct *fs = pango_x_get_font_struct (font, subfont);
+ gint avg_width;
+
if (fs)
{
if (first)
@@ -556,12 +589,21 @@ get_font_metrics_from_subfonts (PangoFont *font,
metrics->descent = MAX (fs->descent * PANGO_SCALE, metrics->descent);
}
}
+
+ if (!get_int_prop (avg_width_atom, fs, &avg_width))
+ avg_width = (fs->min_bounds.width + fs->max_bounds.width) / 2;
+
+ total_avg_widths += avg_width;
+ n_avg_widths += 1;
}
else
g_warning ("Error parsing ligature info: Invalid subfont %d in get_font_metrics_from_subfonts", GPOINTER_TO_UINT (tmp_list->data));
tmp_list = tmp_list->next;
}
+
+ /* This is pretty darn bogus. */
+ metrics->approximate_char_width = total_avg_widths / n_avg_widths;
}
/* Get composite font metrics for all subfonts resulting from shaping