summaryrefslogtreecommitdiff
path: root/pango
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
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')
-rw-r--r--pango/fonts.c15
-rw-r--r--pango/glyphstring.c38
-rw-r--r--pango/pango-font.h3
-rw-r--r--pango/pango-glyph.h4
-rw-r--r--pango/pango-tabs.c14
-rw-r--r--pango/pango-tabs.h3
-rw-r--r--pango/pango-types.h4
-rw-r--r--pango/pango-utils.c25
8 files changed, 106 insertions, 0 deletions
diff --git a/pango/fonts.c b/pango/fonts.c
index 606da183..76b077eb 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -29,6 +29,21 @@
#include "pango-fontmap.h"
#include "pango-utils.h"
+GType
+pango_font_description_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("PangoFontDescription",
+ NULL,
+ (GBoxedCopyFunc)pango_font_description_copy,
+ (GBoxedFreeFunc)pango_font_description_free,
+ FALSE);
+
+ return our_type;
+}
+
/**
* pango_font_description_copy:
* @desc: a #PangoFontDescription
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.
diff --git a/pango/pango-font.h b/pango/pango-font.h
index cbbf4bcb..b59038f2 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -104,6 +104,9 @@ struct _PangoFontMetrics
int approximate_digit_width;
};
+#define PANGO_TYPE_FONT_DESCRIPTION (pango_font_description_get_type ())
+
+GType pango_font_description_get_type (void);
PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc);
gboolean pango_font_description_equal (const PangoFontDescription *desc1,
const PangoFontDescription *desc2);
diff --git a/pango/pango-glyph.h b/pango/pango-glyph.h
index 7cb3542e..f30a3c4f 100644
--- a/pango/pango-glyph.h
+++ b/pango/pango-glyph.h
@@ -81,9 +81,13 @@ struct _PangoGlyphString {
gint space;
};
+#define PANGO_TYPE_GLYPH_STRING (pango_glyph_string_get_type ())
+
PangoGlyphString *pango_glyph_string_new (void);
void pango_glyph_string_set_size (PangoGlyphString *string,
gint new_len);
+GType pango_glyph_string_get_type (void);
+PangoGlyphString *pango_glyph_string_copy (PangoGlyphString *string);
void pango_glyph_string_free (PangoGlyphString *string);
void pango_glyph_string_extents (PangoGlyphString *glyphs,
PangoFont *font,
diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c
index 38319741..4dc9a319 100644
--- a/pango/pango-tabs.c
+++ b/pango/pango-tabs.c
@@ -152,6 +152,20 @@ pango_tab_array_new_with_positions (gint size,
return array;
}
+GType
+pango_tab_array_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("PangoTabArray",
+ NULL,
+ (GBoxedCopyFunc)pango_tab_array_copy,
+ (GBoxedFreeFunc)pango_tab_array_free,
+ FALSE);
+ return our_type;
+}
+
/**
* pango_tab_array_copy:
* @src: #PangoTabArray to copy
diff --git a/pango/pango-tabs.h b/pango/pango-tabs.h
index 9f1b5887..26adf499 100644
--- a/pango/pango-tabs.h
+++ b/pango/pango-tabs.h
@@ -43,6 +43,8 @@ typedef enum
*/
} PangoTabAlign;
+#define PANGO_TYPE_TAB_ARRAY (pango_tab_array_get_type ())
+
PangoTabArray *pango_tab_array_new (gint initial_size,
gboolean positions_in_pixels);
PangoTabArray *pango_tab_array_new_with_positions (gint size,
@@ -50,6 +52,7 @@ PangoTabArray *pango_tab_array_new_with_positions (gint size,
PangoTabAlign first_alignment,
gint first_position,
...);
+GType pango_tab_array_get_type (void);
PangoTabArray *pango_tab_array_copy (PangoTabArray *src);
void pango_tab_array_free (PangoTabArray *tab_array);
gint pango_tab_array_get_size (PangoTabArray *tab_array);
diff --git a/pango/pango-types.h b/pango/pango-types.h
index bc6beba9..d273b852 100644
--- a/pango/pango-types.h
+++ b/pango/pango-types.h
@@ -23,6 +23,7 @@
#define __PANGO_TYPES_H__
#include <glib.h>
+#include <glib-object.h>
typedef struct _PangoLangRange PangoLangRange;
typedef struct _PangoLogAttr PangoLogAttr;
@@ -74,6 +75,9 @@ typedef enum {
PANGO_DIRECTION_TTB_RTL
} PangoDirection;
+#define PANGO_TYPE_LANGUAGE (pango_language_get_type ())
+
+GType pango_language_get_type (void);
PangoLanguage *pango_language_from_string (const char *language);
#define pango_language_to_string(language) ((const char *)language)
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 568434f2..a899f510 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -934,6 +934,31 @@ lang_hash (gconstpointer key)
return h;
}
+static PangoLanguage *
+pango_language_copy (PangoLanguage *language)
+{
+ return language; /* language tags are const */
+}
+static void
+pango_language_free (PangoLanguage *language)
+{
+ return; /* nothing */
+}
+
+GType
+pango_language_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("PangoLanguage",
+ NULL,
+ (GBoxedCopyFunc)pango_language_copy,
+ (GBoxedFreeFunc)pango_language_free,
+ FALSE);
+ return our_type;
+}
+
/**
* pang_language_from_string:
* @language: a string representing a language tag