summaryrefslogtreecommitdiff
path: root/pango/fonts.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-04-05 00:31:59 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-04-05 00:31:59 +0000
commit613302136667231bcefd772b419369516eb3bf45 (patch)
tree919ed907f3ca69f79210d0778c65df8bec97d4d0 /pango/fonts.c
parent52f2e805bf993f711d09ba6fe4972c7f7ee33eae (diff)
downloadpango-613302136667231bcefd772b419369516eb3bf45.tar.gz
Add user data to PangoContext
Tue Apr 4 20:13:06 2000 Owen Taylor <otaylor@redhat.com> * pango/pango-context.h: Add user data to PangoContext * pango/pangox.[ch] examples/viewer.c: Rework system for create GC's so that the necessary information is stored on the PangoContext instead of being passed to layout_render() * pango/utils.[ch] pango/pango-context.c: fribidi-0.1.9 wants UCS-4 not UCS2; switch accordingly. * pango/fonts.c pango/pango-font.h pango/pangox.c: Add functions to get overall font metrics, possibly per-language. (Right now, just font ascent, descent.) The implementation of this for X is horribly complex.
Diffstat (limited to 'pango/fonts.c')
-rw-r--r--pango/fonts.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/pango/fonts.c b/pango/fonts.c
index 5b74a0f7..ad6de117 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -431,11 +431,13 @@ pango_font_unref (PangoFont *font)
* font.
*/
void
-pango_font_set_data (PangoFont *font,
- gchar *key,
+pango_font_set_data (PangoFont *font,
+ const gchar *key,
gpointer data,
GDestroyNotify destroy_func)
{
+ g_return_if_fail (font != NULL);
+
g_datalist_set_data_full (&font->data, key, data, destroy_func);
}
@@ -449,9 +451,11 @@ pango_font_set_data (PangoFont *font,
* Returns the data, or NULL if that key does not exist.
*/
gpointer
-pango_font_get_data (PangoFont *font,
- gchar *key)
+pango_font_get_data (PangoFont *font,
+ const gchar *key)
{
+ g_return_val_if_fail (font != NULL, NULL);
+
return g_datalist_get_data (&font->data, key);
}
@@ -521,7 +525,31 @@ pango_font_get_glyph_extents (PangoFont *font,
font->klass->get_glyph_extents (font, glyph, ink_rect, logical_rect);
}
+
+/**
+ * pango_font_get_metrics:
+ * @font: a #PangoFont
+ * @lang: language tag used to determine which script to get the metrics
+ * for, or %NULL to indicate to get the metrics for the entire
+ * font.
+ * @metrics: Structure to fill in with the metrics of the font
+ *
+ * Get overall metric information for a font. Since the metrics may be
+ * substantially different for different scripts, a language tag can
+ * be provided to indicate that the metrics should be retrieved that
+ * correspond to the script(s) used by that language.
+ **/
+void
+pango_font_get_metrics (PangoFont *font,
+ const gchar *lang,
+ PangoFontMetrics *metrics)
+{
+ g_return_if_fail (font != NULL);
+
+ font->klass->get_metrics (font, lang, metrics);
+}
+
/**
* pango_font_map_init:
* @fontmap: a #PangoFontMap