pango r2600 - in trunk: . docs docs/tmpl pango



Author: behdad
Date: Mon Apr 21 19:41:40 2008
New Revision: 2600
URL: http://svn.gnome.org/viewvc/pango?rev=2600&view=rev

Log:
2008-04-21  Behdad Esfahbod  <behdad gnome org>

        Bug 514617 â Add pango_cairo_font_map_set_default()

        * docs/pango-sections.txt:
        * docs/tmpl/pangocairo.sgml:
        * pango/pangocairo-fontmap.c (pango_cairo_font_map_get_default),
        (pango_cairo_font_map_set_default):
        * pango/pangocairo.def:
        * pango/pangocairo.h:
        New public API:

                pango_cairo_font_map_set_default()



Modified:
   trunk/ChangeLog
   trunk/docs/pango-sections.txt
   trunk/docs/tmpl/pangocairo.sgml
   trunk/pango/pangocairo-fontmap.c
   trunk/pango/pangocairo.def
   trunk/pango/pangocairo.h

Modified: trunk/docs/pango-sections.txt
==============================================================================
--- trunk/docs/pango-sections.txt	(original)
+++ trunk/docs/pango-sections.txt	Mon Apr 21 19:41:40 2008
@@ -836,6 +836,7 @@
 PangoCairoFont
 PangoCairoFontMap
 pango_cairo_font_map_get_default
+pango_cairo_font_map_set_default
 pango_cairo_font_map_new
 pango_cairo_font_map_new_for_font_type
 pango_cairo_font_map_get_font_type

Modified: trunk/docs/tmpl/pangocairo.sgml
==============================================================================
--- trunk/docs/tmpl/pangocairo.sgml	(original)
+++ trunk/docs/tmpl/pangocairo.sgml	Mon Apr 21 19:41:40 2008
@@ -165,6 +165,14 @@
 @Returns: 
 
 
+<!-- ##### FUNCTION pango_cairo_font_map_set_default ##### -->
+<para>
+
+</para>
+
+ fontmap: 
+
+
 <!-- ##### FUNCTION pango_cairo_font_map_new ##### -->
 <para>
 

Modified: trunk/pango/pangocairo-fontmap.c
==============================================================================
--- trunk/pango/pangocairo-fontmap.c	(original)
+++ trunk/pango/pangocairo-fontmap.c	Mon Apr 21 19:41:40 2008
@@ -146,6 +146,8 @@
   }
 }
 
+static PangoFontMap *default_font_map = NULL;
+
 /**
  * pango_cairo_font_map_get_default:
  *
@@ -156,7 +158,12 @@
  * You generally should only use the #PangoFontMap and
  * #PangoCairoFontMap interfaces on the returned object.
  *
- * Return value: the default Cairo fontmap for #Pango. This
+ * The default Cairo fontmap can be changed by using
+ * pango_cairo_font_map_set_default().  This can be used to
+ * change the Cairo font backend that the default fontmap
+ * uses for example.
+ *
+ * Return value: the default Cairo fontmap for Pango. This
  *  object is owned by Pango and must not be freed.
  *
  * Since: 1.10
@@ -164,8 +171,6 @@
 PangoFontMap *
 pango_cairo_font_map_get_default (void)
 {
-  static PangoFontMap *default_font_map = NULL;
-
   if (G_UNLIKELY (!default_font_map))
     default_font_map = pango_cairo_font_map_new ();
 
@@ -173,6 +178,35 @@
 }
 
 /**
+ * pango_cairo_font_map_set_default:
+ * @fontmap: The new default font map, or %NULL
+ *
+ * Sets a default #PangoCairoFontMap to use with Cairo.
+ *
+ * This can be used to change the Cairo font backend that the
+ * default fontmap uses for example.  The old default font map
+ * is unreffed and the new font map referenced.
+ *
+ * A value of %NULL for @fontmap will cause a new default font
+ * map to be created on demand, using pango_cairo_font_map_new().
+ *
+ * Since: 1.22
+ **/
+void
+pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap)
+{
+  g_return_if_fail (PANGO_IS_CAIRO_FONT_MAP (fontmap));
+
+  if ((PangoFontMap *) fontmap == default_font_map)
+    return;
+
+  if (default_font_map)
+    g_object_unref (default_font_map);
+
+  default_font_map = g_object_ref (fontmap);
+}
+
+/**
  * pango_cairo_font_map_set_resolution:
  * @fontmap: a #PangoCairoFontMap
  * @dpi: the resolution in "dots per inch". (Physical inches aren't actually

Modified: trunk/pango/pangocairo.def
==============================================================================
--- trunk/pango/pangocairo.def	(original)
+++ trunk/pango/pangocairo.def	Mon Apr 21 19:41:40 2008
@@ -13,6 +13,7 @@
 	pango_cairo_font_get_scaled_font
 	pango_cairo_font_map_create_context
 	pango_cairo_font_map_get_default
+	pango_cairo_font_map_set_default
 	pango_cairo_font_map_get_font_type
 	pango_cairo_font_map_get_resolution
 	pango_cairo_font_map_get_type

Modified: trunk/pango/pangocairo.h
==============================================================================
--- trunk/pango/pangocairo.h	(original)
+++ trunk/pango/pangocairo.h	Mon Apr 21 19:41:40 2008
@@ -68,6 +68,7 @@
 PangoFontMap *pango_cairo_font_map_new               (void);
 PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype);
 PangoFontMap *pango_cairo_font_map_get_default       (void);
+void          pango_cairo_font_map_set_default       (PangoCairoFontMap *fontmap);
 cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap);
 
 void          pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]