diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 5e5e585..bdede7b 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -68,8 +68,15 @@ static GHashTable *name_map = NULL;
 PangoAttrType
 pango_attr_type_register (const gchar *name)
 {
-  static guint current_type = 0x1000000;
-  guint type = current_type++;
+  pango_attr_type_register_similar (name, PANGO_ATTR_INVALID);
+}
+
+PangoAttrType
+pango_attr_type_register_similar (const gchar   *name,
+				  PangoAttrType  similar_type)
+{
+  static guint current_type = 1;
+  guint type = current_type++ | (int)similar_type << 24;
 
   if (name)
     {
@@ -82,6 +89,27 @@ pango_attr_type_register (const gchar *name)
   return type;
 }
 
+PangoAttrType
+pango_attr_type_get_base_type (PangoAttrType attr_type)
+{
+  return attr_type >> 24;
+}
+
+gboolean
+pango_attr_type_is_similar (PangoAttrType first_type,
+			    PangoAttrType second_type)
+{
+  return (pango_attr_type_get_base_type (first_type) == second_type ||
+	  pango_attr_type_get_base_type (second_type) == first_type);
+}
+
+gboolean
+pango_attr_similar_to (PangoAttribute *attr,
+		       PangoAttrType   other_type)
+{
+  return pango_attr_type_is_similar (attr->klass->type, other_type);
+}
+
 /**
  * pango_attr_type_get_name:
  * @type: an attribute type ID to fetch the name for
@@ -475,7 +503,7 @@ pango_attr_size_copy (const PangoAttribute *attr)
 {
   const PangoAttrSize *size_attr = (PangoAttrSize *)attr;
 
-  if (attr->klass->type == PANGO_ATTR_ABSOLUTE_SIZE)
+  if (pango_attr_type_get_base_type (attr->klass->type) == PANGO_ATTR_ABSOLUTE_SIZE)
     return pango_attr_size_new_absolute (size_attr->size);
   else
     return pango_attr_size_new (size_attr->size);
@@ -1828,7 +1856,7 @@ pango_attr_iterator_get_font (PangoAttrIterator     *iterator,
       PangoAttribute *attr = tmp_list1->data;
       tmp_list1 = tmp_list1->next;
 
-      switch (attr->klass->type)
+      switch (pango_attr_type_get_base_type (attr->klass->type))
 	{
 	case PANGO_ATTR_FONT_DESC:
 	  {
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index d4ce840..b293a99 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -176,8 +176,15 @@ struct _PangoAttrFontDesc
   PangoFontDescription *desc;
 };
 
-PangoAttrType         pango_attr_type_register (const gchar        *name);
-G_CONST_RETURN char * pango_attr_type_get_name (PangoAttrType       type) G_GNUC_CONST;
+PangoAttrType         pango_attr_type_register         (const gchar   *name);
+PangoAttrType         pango_attr_type_register_similar (const char    *name,
+							PangoAttrType  similar_type);
+G_CONST_RETURN char * pango_attr_type_get_name         (PangoAttrType  type) G_GNUC_CONST;
+PangoAttrType         pango_attr_type_get_base_type    (PangoAttrType  attr_type);
+gboolean              pango_attr_type_is_similar       (PangoAttrType first_type,
+							PangoAttrType second_type);
+gboolean              pango_attr_similar_to            (PangoAttribute *attr,
+							PangoAttrType   other_type);
 
 void             pango_attribute_init        (PangoAttribute       *attr,
 					      const PangoAttrClass *klass);
