summaryrefslogtreecommitdiff
path: root/pango/glyphstring.c
diff options
context:
space:
mode:
authorJames Henstridge <james@daa.com.au>2001-07-02 14:17:18 +0000
committerJames Henstridge <jamesh@src.gnome.org>2001-07-02 14:17:18 +0000
commit977dbeb2e823baa4940dbd8cfc054deed3017548 (patch)
tree55bb75b2a55105562cde92dfe3cb125e8db91686 /pango/glyphstring.c
parentd5f6f37adfff287b5d5cc1aadfb4cb79f3596d1f (diff)
downloadpango-977dbeb2e823baa4940dbd8cfc054deed3017548.tar.gz
copy function. (pango_glyph_string_get_type): implement get_type function.
2001-07-02 James Henstridge <james@daa.com.au> * pango/glyphstring.c (pango_glyph_string_copy): copy function. (pango_glyph_string_get_type): implement get_type function. * pango/pango-glyph.h (pango_glyph_string_get_type): get_type function prototype. (pango_glyph_string_copy): prototype for copy function. * pango/pango-utils.c (pango_language_get_type): implementation. * pango/pango-types.h (pango_language_get_type): get_type function. * pango/pango-tabs.c (pango_tab_array_get_type): implementation. * pango/pango-tabs.h (pango_tab_array_get_type): get_type function. * pango/fonts.c (pango_font_description_get_type): implementation. * pango/pango-font.h (pango_font_description_get_type): add get_type function for typecode.
Diffstat (limited to 'pango/glyphstring.c')
-rw-r--r--pango/glyphstring.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index ded4a856..feaefe2e 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -71,6 +71,44 @@ pango_glyph_string_set_size (PangoGlyphString *string, gint new_len)
string->num_glyphs = new_len;
}
+GType
+pango_glyph_string_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("PangoGlyphString",
+ NULL,
+ (GBoxedCopyFunc)pango_glyph_string_copy,
+ (GBoxedFreeFunc)pango_glyph_string_free,
+ FALSE);
+
+ return our_type;
+}
+
+/**
+ * pango_glyph_string_copy:
+ * @string: a PangoGlyphString.
+ *
+ * Copy a glyph string and associated storage.
+ *
+ * Returns the copied PangoGlyphString
+ */
+PangoGlyphString *
+pango_glyph_string_copy (PangoGlyphString *string)
+{
+ PangoGlyphString *new_string = g_new (PangoGlyphString, 1);
+
+ *new_string = *string;
+
+ new_string->glyphs = g_memdup (string->glyphs,
+ string->space * sizeof (PangoGlyphInfo));
+ new_string->log_clusters = g_memdup (string->log_clusters,
+ string->space * sizeof (gint));
+
+ return new_string;
+}
+
/**
* pango_glyph_string_free:
* @string: a PangoGlyphString.