summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-08-06 08:39:01 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-08-06 08:39:01 +0000
commit6a84b56502ed11b4d52d7be387be4ce26c7e4c61 (patch)
tree629d4e9791a14c27ecfd4ec4cb0fcfb39c12a168
parentfb5d6ad85ca10e67db70575b0604894fa8c484f5 (diff)
downloadpango-6a84b56502ed11b4d52d7be387be4ce26c7e4c61.tar.gz
Make the following API public:
2008-08-05 Behdad Esfahbod <behdad@gnome.org> * pango/pango-context.c: * pango/pango-context.h: Make the following API public: pango_context_new() pango_context_set_font_map() * pango/pango-fontmap.c (pango_font_map_create_context): * pango/pango-fontmap.h: New public API: pango_font_map_create_context() * pango/pangocairo-context.c (pango_cairo_create_context): * pango/pangocairo-font.c (_pango_cairo_font_get_metrics), (_pango_cairo_font_private_get_hex_box_info): * pango/pangocairo-fontmap.c (pango_cairo_font_map_create_context): * pango/pangocairo.h: Deprecate pango_cairo_font_map_create_context(). * pango/pangofc-font.c (pango_fc_font_get_metrics): * pango/pangofc-fontmap.c (pango_fc_font_map_create_context): * pango/pangofc-fontmap.h: Deprecate pango_fc_font_map_create_context(). * pango/pangoft2-fontmap.c (pango_ft2_font_map_create_context), (pango_ft2_get_context): * pango/pangoft2.h: Deprecate pango_ft2_font_map_create_context(). * pango/pangowin32.c (pango_win32_get_context), (pango_win32_font_get_metrics): * pango/pangowin32.h: Deprecate pango_win32_get_context(). * pango/pangoxft-font.c (_pango_xft_font_get_mini_font): * pango/pangoxft-fontmap.c (pango_xft_get_context): * pango/pangoxft.h: Deprecate pango_xft_get_context(). * pango/pangox-fontmap.c (pango_x_font_map_for_display): * pango/pangox.c (get_context_info), (pango_x_get_context), (pango_x_context_set_funcs), (pango_x_render_layout_line): Deprecate pango_x_get_context(), again. * docs/pango-sections.txt: * docs/tmpl/fonts.sgml: * pango-view/viewer-pangocairo.c (pangocairo_view_get_context): * pango-view/viewer-pangoft2.c (pangoft2_view_get_context): * pango-view/viewer-pangox.c (pangox_view_get_context): * pango-view/viewer-pangoxft.c (pangoxft_view_get_context): * pango/check.defs: * pango/pango.def: Update. svn path=/trunk/; revision=2675
-rw-r--r--ChangeLog57
-rw-r--r--docs/pango-sections.txt1
-rw-r--r--docs/tmpl/fonts.sgml9
-rw-r--r--pango-view/viewer-pangocairo.c2
-rw-r--r--pango-view/viewer-pangoft2.c2
-rw-r--r--pango-view/viewer-pangox.c2
-rw-r--r--pango-view/viewer-pangoxft.c2
-rwxr-xr-xpango/check.defs2
-rw-r--r--pango/pango-context.c15
-rw-r--r--pango/pango-context.h2
-rw-r--r--pango/pango-fontmap.c31
-rw-r--r--pango/pango-fontmap.h1
-rw-r--r--pango/pango.def1
-rw-r--r--pango/pangocairo-context.c16
-rw-r--r--pango/pangocairo-font.c4
-rw-r--r--pango/pangocairo-fontmap.c10
-rw-r--r--pango/pangocairo.h2
-rw-r--r--pango/pangofc-font.c2
-rw-r--r--pango/pangofc-fontmap.c8
-rw-r--r--pango/pangofc-fontmap.h2
-rw-r--r--pango/pangoft2-fontmap.c9
-rw-r--r--pango/pangoft2.h2
-rw-r--r--pango/pangowin32.c13
-rw-r--r--pango/pangowin32.h2
-rw-r--r--pango/pangox-fontmap.c10
-rw-r--r--pango/pangox.c63
-rw-r--r--pango/pangoxft-font.c2
-rw-r--r--pango/pangoxft-fontmap.c9
-rw-r--r--pango/pangoxft.h2
29 files changed, 200 insertions, 83 deletions
diff --git a/ChangeLog b/ChangeLog
index 5fd8deb3..e5e338ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,60 @@
+2008-08-05 Behdad Esfahbod <behdad@gnome.org>
+
+ * pango/pango-context.c:
+ * pango/pango-context.h:
+ Make the following API public:
+
+ pango_context_new()
+ pango_context_set_font_map()
+
+ * pango/pango-fontmap.c (pango_font_map_create_context):
+ * pango/pango-fontmap.h:
+ New public API:
+
+ pango_font_map_create_context()
+
+ * pango/pangocairo-context.c (pango_cairo_create_context):
+ * pango/pangocairo-font.c (_pango_cairo_font_get_metrics),
+ (_pango_cairo_font_private_get_hex_box_info):
+ * pango/pangocairo-fontmap.c (pango_cairo_font_map_create_context):
+ * pango/pangocairo.h:
+ Deprecate pango_cairo_font_map_create_context().
+
+ * pango/pangofc-font.c (pango_fc_font_get_metrics):
+ * pango/pangofc-fontmap.c (pango_fc_font_map_create_context):
+ * pango/pangofc-fontmap.h:
+ Deprecate pango_fc_font_map_create_context().
+
+ * pango/pangoft2-fontmap.c (pango_ft2_font_map_create_context),
+ (pango_ft2_get_context):
+ * pango/pangoft2.h:
+ Deprecate pango_ft2_font_map_create_context().
+
+ * pango/pangowin32.c (pango_win32_get_context),
+ (pango_win32_font_get_metrics):
+ * pango/pangowin32.h:
+ Deprecate pango_win32_get_context().
+
+ * pango/pangoxft-font.c (_pango_xft_font_get_mini_font):
+ * pango/pangoxft-fontmap.c (pango_xft_get_context):
+ * pango/pangoxft.h:
+ Deprecate pango_xft_get_context().
+
+ * pango/pangox-fontmap.c (pango_x_font_map_for_display):
+ * pango/pangox.c (get_context_info), (pango_x_get_context),
+ (pango_x_context_set_funcs), (pango_x_render_layout_line):
+ Deprecate pango_x_get_context(), again.
+
+ * docs/pango-sections.txt:
+ * docs/tmpl/fonts.sgml:
+ * pango-view/viewer-pangocairo.c (pangocairo_view_get_context):
+ * pango-view/viewer-pangoft2.c (pangoft2_view_get_context):
+ * pango-view/viewer-pangox.c (pangox_view_get_context):
+ * pango-view/viewer-pangoxft.c (pangoxft_view_get_context):
+ * pango/check.defs:
+ * pango/pango.def:
+ Update.
+
2008-07-30 Behdad Esfahbod <behdad@gnome.org>
* docs/pango-sections.txt:
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 1232b4e4..6c804a9c 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -243,6 +243,7 @@ PangoFontMapClass
PANGO_FONT_MAP_CLASS
PANGO_IS_FONT_MAP_CLASS
PANGO_FONT_MAP_GET_CLASS
+pango_font_map_create_context
pango_font_map_load_font
pango_font_map_load_fontset
pango_font_map_list_families
diff --git a/docs/tmpl/fonts.sgml b/docs/tmpl/fonts.sgml
index 0dff0479..aaddfc13 100644
--- a/docs/tmpl/fonts.sgml
+++ b/docs/tmpl/fonts.sgml
@@ -863,6 +863,15 @@ Returns the type of a #PangoFontMap.
@obj: a #PangoFontMap.
+<!-- ##### FUNCTION pango_font_map_create_context ##### -->
+<para>
+
+</para>
+
+@fontmap:
+@Returns:
+
+
<!-- ##### FUNCTION pango_font_map_load_font ##### -->
<para>
diff --git a/pango-view/viewer-pangocairo.c b/pango-view/viewer-pangocairo.c
index e3d63fed..de3fc89b 100644
--- a/pango-view/viewer-pangocairo.c
+++ b/pango-view/viewer-pangocairo.c
@@ -84,7 +84,7 @@ pangocairo_view_get_context (gpointer instance)
CairoViewer *c = (CairoViewer *) instance;
PangoContext *context;
- context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (c->fontmap));
+ context = pango_font_map_create_context (c->fontmap);
pango_cairo_context_set_font_options (context, c->font_options);
return context;
diff --git a/pango-view/viewer-pangoft2.c b/pango-view/viewer-pangoft2.c
index a419e089..f991ad15 100644
--- a/pango-view/viewer-pangoft2.c
+++ b/pango-view/viewer-pangoft2.c
@@ -65,7 +65,7 @@ pangoft2_view_destroy (gpointer instance)
static PangoContext *
pangoft2_view_get_context (gpointer instance)
{
- return pango_ft2_font_map_create_context (PANGO_FT2_FONT_MAP (instance));
+ return pango_font_map_create_context (PANGO_FONT_MAP (instance));
}
static gpointer
diff --git a/pango-view/viewer-pangox.c b/pango-view/viewer-pangox.c
index f4ea9d29..f48081a7 100644
--- a/pango-view/viewer-pangox.c
+++ b/pango-view/viewer-pangox.c
@@ -42,7 +42,7 @@ pangox_view_get_context (gpointer instance)
PangoContext *context;
PangoMatrix matrix = {0., 0., 0., 0., 0., 0.};
- context = pango_x_get_context (x->display);
+ context = pango_font_map_create_context (pango_x_font_map_for_display (x->display));
/* We set an all-zero matrix on the context, to negotiate that
* this backend doesn't support transformations.
diff --git a/pango-view/viewer-pangoxft.c b/pango-view/viewer-pangoxft.c
index 815aa887..1a10f5c4 100644
--- a/pango-view/viewer-pangoxft.c
+++ b/pango-view/viewer-pangoxft.c
@@ -72,7 +72,7 @@ pangoxft_view_get_context (gpointer instance)
{
XViewer *x = (XViewer *) instance;
- return pango_xft_get_context (x->display, x->screen);
+ return pango_font_map_create_context (pango_xft_get_font_map (x->display, x->screen));
}
typedef struct
diff --git a/pango/check.defs b/pango/check.defs
index b8f07cad..3c4454da 100755
--- a/pango/check.defs
+++ b/pango/check.defs
@@ -23,7 +23,7 @@ for def in $srcdir/*.def; do
eval $get_pango_syms | sort -u > "$expected"
cut -f 2 "$def" | grep -v EXPORTS | sort -u > "$list"
- diff "$list" "$expected" >&2 && rm -f "$list" "$expected" || status=1
+ diff -u "$list" "$expected" >&2 && rm -f "$list" "$expected" || status=1
done
exit $status
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 35e5e71e..1aa2fee9 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -107,19 +107,18 @@ pango_context_finalize (GObject *object)
/**
* pango_context_new:
*
- * Creates a new #PangoContext initialized to default value.
+ * Creates a new #PangoContext initialized to default values.
*
- * This function is only useful when implementing a new backend
- * for Pango, something applications won't do. You should use
- * the context creation function for the backend you are using,
- * for example, pango_cairo_font_map_create_context(), pango_xft_get_context(),
- * pango_win32_get_context() or, pango_ft2_font_map_create_context().
+ * This function is not particularly useful as it should always
+ * be followed by a pango_context_set_font_map() call, and the
+ * function pango_font_map_create_context() does these two steps
+ * together and hence users are recommended to use that.
*
* If you are using Pango as part of a higher-level system,
- * that system may have it's own ways of create a #PangoContext.
+ * that system may have it's own way of create a #PangoContext.
* For instance, the GTK+ toolkit has, among others,
* gdk_pango_context_get_for_screen(), and
- * gtk_widget_get_pango_context().
+ * gtk_widget_get_pango_context(). Use those instead.
*
* Return value: the newly allocated #PangoContext, which should
* be freed with g_object_unref().
diff --git a/pango/pango-context.h b/pango/pango-context.h
index 5cd88404..d8c3cb86 100644
--- a/pango/pango-context.h
+++ b/pango/pango-context.h
@@ -49,11 +49,9 @@ typedef struct _PangoContextClass PangoContextClass;
GType pango_context_get_type (void) G_GNUC_CONST;
-#ifdef PANGO_ENABLE_BACKEND
PangoContext *pango_context_new (void);
void pango_context_set_font_map (PangoContext *context,
PangoFontMap *font_map);
-#endif /* PANGO_ENABLE_BACKEND */
PangoFontMap *pango_context_get_font_map (PangoContext *context);
void pango_context_list_families (PangoContext *context,
diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c
index 8e6346e4..e9cbbe13 100644
--- a/pango/pango-fontmap.c
+++ b/pango/pango-fontmap.c
@@ -44,6 +44,37 @@ pango_font_map_init (PangoFontMap *fontmap)
}
/**
+ * pango_font_map_create_context:
+ * @fontmap: a #PangoFontMap
+ *
+ * Creates a #PangoContext connected to @fontmap. This is equivalent
+ * to pango_context_new() followed by pango_context_set_font_map().
+ *
+ * If you are using Pango as part of a higher-level system,
+ * that system may have it's own way of create a #PangoContext.
+ * For instance, the GTK+ toolkit has, among others,
+ * gdk_pango_context_get_for_screen(), and
+ * gtk_widget_get_pango_context(). Use those instead.
+ *
+ * Return value: the newly allocated #PangoContext, which should
+ * be freed with g_object_unref().
+ *
+ * Since: 1.22
+ **/
+PangoContext *
+pango_font_map_create_context (PangoFontMap *fontmap)
+{
+ PangoContext *context;
+
+ g_return_val_if_fail (fontmap != NULL, NULL);
+
+ context = pango_context_new ();
+ pango_context_set_font_map (context, fontmap);
+
+ return context;
+}
+
+/**
* pango_font_map_load_font:
* @fontmap: a #PangoFontMap
* @context: the #PangoContext the font will be used with
diff --git a/pango/pango-fontmap.h b/pango/pango-fontmap.h
index 204178fc..602ec9fe 100644
--- a/pango/pango-fontmap.h
+++ b/pango/pango-fontmap.h
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
typedef struct _PangoContext PangoContext;
GType pango_font_map_get_type (void) G_GNUC_CONST;
+PangoContext * pango_font_map_create_context (PangoFontMap *fontmap);
PangoFont * pango_font_map_load_font (PangoFontMap *fontmap,
PangoContext *context,
const PangoFontDescription *desc);
diff --git a/pango/pango.def b/pango/pango.def
index 8823b2ed..22a7969f 100644
--- a/pango/pango.def
+++ b/pango/pango.def
@@ -148,6 +148,7 @@ EXPORTS
pango_font_get_glyph_extents
pango_font_get_metrics
pango_font_get_type
+ pango_font_map_create_context
pango_font_map_get_shape_engine_type
pango_font_map_get_type
pango_font_map_list_families
diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c
index 1bffa8b1..455f5e49 100644
--- a/pango/pangocairo-context.c
+++ b/pango/pangocairo-context.c
@@ -145,7 +145,7 @@ _pango_cairo_update_context (cairo_t *cr,
/**
* pango_cairo_update_context:
* @cr: a Cairo context
- * @context: a #PangoContext, from pango_cairo_font_map_create_context()
+ * @context: a #PangoContext, from a pangocairo font map
*
* Updates a #PangoContext previously created for use with Cairo to
* match the current transformation and target surface of a Cairo
@@ -167,7 +167,7 @@ pango_cairo_update_context (cairo_t *cr,
/**
* pango_cairo_context_set_resolution:
- * @context: a #PangoContext, from pango_cairo_font_map_create_context()
+ * @context: a #PangoContext, from a pangocairo font map
* @dpi: the resolution in "dots per inch". (Physical inches aren't actually
* involved; the terminology is conventional.) A 0 or negative value
* means to use the resolution from the font map.
@@ -189,7 +189,7 @@ pango_cairo_context_set_resolution (PangoContext *context,
/**
* pango_cairo_context_get_resolution:
- * @context: a #PangoContext, from pango_cairo_font_map_create_context()
+ * @context: a #PangoContext, from a pangocairo font map
*
* Gets the resolution for the context. See pango_cairo_context_set_resolution()
*
@@ -211,7 +211,7 @@ pango_cairo_context_get_resolution (PangoContext *context)
/**
* pango_cairo_context_set_font_options:
- * @context: a #PangoContext, from pango_cairo_font_map_create_context()
+ * @context: a #PangoContext, from a pangocairo font map
* @options: a #cairo_font_options_t, or %NULL to unset any previously set
* options. A copy is made.
*
@@ -248,7 +248,7 @@ pango_cairo_context_set_font_options (PangoContext *context,
/**
* pango_cairo_context_get_font_options:
- * @context: a #PangoContext, from pango_cairo_font_map_create_context()
+ * @context: a #PangoContext, from a pangocairo font map
*
* Retrieves any font rendering options previously set with
* pango_cairo_font_map_set_font_options(). This functions not report options
@@ -306,7 +306,7 @@ _pango_cairo_context_get_merged_font_options (PangoContext *context)
/**
* pango_cairo_context_set_shape_renderer:
- * @context: a #PangoContext, from pango_cairo_font_map_create_context()
+ * @context: a #PangoContext, from a pangocairo font map
* @func: Callback function for rendering attributes of type
* %PANGO_ATTR_SHAPE, or %NULL to disable shape rendering.
* @data: User data that will be passed to @func.
@@ -341,7 +341,7 @@ pango_cairo_context_set_shape_renderer (PangoContext *context,
/**
* pango_cairo_context_get_shape_renderer:
- * @context: a #PangoContext, from pango_cairo_font_map_create_context()
+ * @context: a #PangoContext, from a pangocairo font map
* @data: Pointer to #gpointer to return user data
*
* Sets callback function for context to use for rendering attributes
@@ -408,7 +408,7 @@ pango_cairo_create_context (cairo_t *cr)
g_return_val_if_fail (cr != NULL, NULL);
fontmap = pango_cairo_font_map_get_default ();
- context = pango_cairo_font_map_create_context ((PangoCairoFontMap *) (fontmap));
+ context = pango_font_map_create_context (fontmap);
pango_cairo_update_context (cr, context);
return context;
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index b594ad62..0ce3cafc 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -233,7 +233,7 @@ _pango_cairo_font_get_metrics (PangoFont *font,
info->sample_str = sample_str;
- context = pango_cairo_font_map_create_context ((PangoCairoFontMap *) pango_font_get_font_map (font));
+ context = pango_font_map_create_context (pango_font_get_font_map (font));
pango_context_set_language (context, language);
font_options = cairo_font_options_create ();
cairo_scaled_font_get_font_options (_pango_cairo_font_private_get_scaled_font (cf_priv), font_options);
@@ -388,7 +388,7 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
/* load mini_font */
- context = pango_cairo_font_map_create_context ((PangoCairoFontMap *) (fontmap));
+ context = pango_font_map_create_context (fontmap);
pango_context_set_matrix (context, &pango_ctm);
pango_context_set_language (context, pango_script_get_sample_language (PANGO_SCRIPT_LATIN));
diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c
index 75da237d..1661c88b 100644
--- a/pango/pangocairo-fontmap.c
+++ b/pango/pangocairo-fontmap.c
@@ -252,6 +252,9 @@ pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap)
*
* Create a #PangoContext for the given fontmap.
*
+ * As of Pango 1.20 this function is deprecated.
+ * Use pango_font_map_create_context() instead.
+ *
* Return value: the newly created context; free with g_object_unref().
*
* Since: 1.10
@@ -259,14 +262,9 @@ pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap)
PangoContext *
pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap)
{
- PangoContext *context;
-
g_return_val_if_fail (PANGO_IS_CAIRO_FONT_MAP (fontmap), NULL);
- context = pango_context_new ();
- pango_context_set_font_map (context, PANGO_FONT_MAP (fontmap));
-
- return context;
+ return pango_font_map_create_context (PANGO_FONT_MAP (fontmap));
}
/**
diff --git a/pango/pangocairo.h b/pango/pangocairo.h
index f11bf65f..f6fc261e 100644
--- a/pango/pangocairo.h
+++ b/pango/pangocairo.h
@@ -74,7 +74,9 @@ cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap
void pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap,
double dpi);
double pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap);
+#ifndef PANGO_DISABLE_DEPRECATED
PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap);
+#endif
/*
* PangoCairoFont
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 6bd5146e..8bd23e2b 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -541,7 +541,7 @@ pango_fc_font_get_metrics (PangoFont *font,
info->sample_str = sample_str;
- context = pango_fc_font_map_create_context (PANGO_FC_FONT_MAP (fcfont->fontmap));
+ context = pango_font_map_create_context (fcfont->fontmap);
pango_context_set_language (context, language);
info->metrics = pango_fc_font_create_metrics_for_context (fcfont, context);
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 479f8fef..053c3461 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -1415,6 +1415,9 @@ _pango_fc_font_map_fc_to_coverage (FcCharSet *charset)
* needed for correct operation on the #PangoContext after calling
* this function.
*
+ * As of Pango 1.20 this function is deprecated.
+ * Use pango_font_map_create_context() instead.
+ *
* Return value: a new #PangoContext
*
* Since: 1.4
@@ -1422,10 +1425,9 @@ _pango_fc_font_map_fc_to_coverage (FcCharSet *charset)
PangoContext *
pango_fc_font_map_create_context (PangoFcFontMap *fcfontmap)
{
- PangoContext *context = pango_context_new ();
- pango_context_set_font_map (context, PANGO_FONT_MAP (fcfontmap));
+ g_return_val_if_fail (PANGO_IS_FC_FONT_MAP (fcfontmap), NULL);
- return context;
+ return pango_font_map_create_context (PANGO_FONT_MAP (fcfontmap));
}
static void
diff --git a/pango/pangofc-fontmap.h b/pango/pangofc-fontmap.h
index e0871a62..d50563ef 100644
--- a/pango/pangofc-fontmap.h
+++ b/pango/pangofc-fontmap.h
@@ -143,7 +143,9 @@ struct _PangoFcFontMapClass
void (*_pango_reserved4) (void);
};
+#ifndef PANGO_DISABLE_DEPRECATED
PangoContext * pango_fc_font_map_create_context (PangoFcFontMap *fcfontmap);
+#endif
void pango_fc_font_map_shutdown (PangoFcFontMap *fcfontmap);
#endif
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c
index 9118524e..f14ab9aa 100644
--- a/pango/pangoft2-fontmap.c
+++ b/pango/pangoft2-fontmap.c
@@ -217,6 +217,9 @@ pango_ft2_font_map_set_resolution (PangoFT2FontMap *fontmap,
*
* Create a #PangoContext for the given fontmap.
*
+ * As of Pango 1.20 this function is deprecated.
+ * Use pango_font_map_create_context() instead.
+ *
* Return value: the newly created context; free with g_object_unref().
*
* Since: 1.2
@@ -226,7 +229,7 @@ pango_ft2_font_map_create_context (PangoFT2FontMap *fontmap)
{
g_return_val_if_fail (PANGO_FT2_IS_FONT_MAP (fontmap), NULL);
- return pango_fc_font_map_create_context (PANGO_FC_FONT_MAP (fontmap));
+ return pango_font_map_create_context (PANGO_FONT_MAP (fontmap));
}
/**
@@ -238,7 +241,7 @@ pango_ft2_font_map_create_context (PangoFT2FontMap *fontmap)
* (see pango_ft2_fontmap_get_for_display()) and sets the resolution
* for the default fontmap to @dpi_x by @dpi_y.
*
- * Use of this function is deprecated; see pango_ft2_fontmap_create_context()
+ * Use of this function is deprecated. Use pango_fontmap_create_context()
* instead.
*
* Return value: the new #PangoContext
@@ -251,7 +254,7 @@ pango_ft2_get_context (double dpi_x, double dpi_y)
fontmap = pango_ft2_font_map_for_display ();
pango_ft2_font_map_set_resolution (PANGO_FT2_FONT_MAP (fontmap), dpi_x, dpi_y);
- return pango_ft2_font_map_create_context (PANGO_FT2_FONT_MAP (fontmap));
+ return pango_font_map_create_context (fontmap);
}
/**
diff --git a/pango/pangoft2.h b/pango/pangoft2.h
index 27acfa6e..e43e2e42 100644
--- a/pango/pangoft2.h
+++ b/pango/pangoft2.h
@@ -85,7 +85,9 @@ void pango_ft2_font_map_set_default_substitute (PangoFT2FontMap
gpointer data,
GDestroyNotify notify);
void pango_ft2_font_map_substitute_changed (PangoFT2FontMap *fontmap);
+#ifndef PANGO_DISABLE_DEPRECATED
PangoContext *pango_ft2_font_map_create_context (PangoFT2FontMap *fontmap);
+#endif
/* API for rendering modules
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index ca441626..889472b5 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -122,17 +122,16 @@ pango_win32_get_hfont (PangoFont *font)
*
* Retrieves a #PangoContext appropriate for rendering with Windows fonts.
*
+ * As of Pango 1.20 this function is deprecated.
+ * Use pango_win32_font_map_for_display() followed by
+ * pango_font_map_create_context() instead.
+ *
* Return value: the new #PangoContext
**/
PangoContext *
pango_win32_get_context (void)
{
- PangoContext *result;
-
- result = pango_context_new ();
- pango_context_set_font_map (result, pango_win32_font_map_for_display ());
-
- return result;
+ return pango_font_map_create_context (pango_win32_font_map_for_display ());
}
G_DEFINE_TYPE (PangoWin32Font, _pango_win32_font, PANGO_TYPE_FONT)
@@ -586,7 +585,7 @@ pango_win32_font_get_metrics (PangoFont *font,
PangoLayout *layout;
/* Get the average width of the chars in "0123456789" */
- context = pango_win32_get_context ();
+ context = pango_font_map_create_context (pango_win32_font_map_for_display ());
pango_context_set_language (context, language);
font_desc = pango_font_describe_with_absolute_size (font);
pango_context_set_font_description (context, font_desc);
diff --git a/pango/pangowin32.h b/pango/pangowin32.h
index 8e07218e..6653a17a 100644
--- a/pango/pangowin32.h
+++ b/pango/pangowin32.h
@@ -41,7 +41,9 @@ G_BEGIN_DECLS
/* Calls for applications
*/
+#ifndef PANGO_DISABLE_DEPRECATED
PangoContext * pango_win32_get_context (void);
+#endif
void pango_win32_render (HDC hdc,
PangoFont *font,
diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c
index d8421f2d..716374ba 100644
--- a/pango/pangox-fontmap.c
+++ b/pango/pangox-fontmap.c
@@ -34,6 +34,7 @@
#include "pango-engine-private.h"
#include "pango-fontmap.h"
#include "pango-impl-utils.h"
+#include "modules.h"
#undef PANGO_DISABLE_DEPRECATED
@@ -278,9 +279,18 @@ pango_x_font_map_for_display (Display *display)
char **xfontnames;
int num_fonts, i;
int screen;
+ static gboolean registered_modules = FALSE;
g_return_val_if_fail (display != NULL, NULL);
+ if (!registered_modules)
+ {
+ registered_modules = TRUE;
+
+ for (i = 0; _pango_included_x_modules[i].list; i++)
+ pango_module_register (&_pango_included_x_modules[i]);
+ }
+
/* Make sure that the type system is initialized */
g_type_init ();
diff --git a/pango/pangox.c b/pango/pangox.c
index c3ab3f48..36ae85fb 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -26,7 +26,6 @@
#include <X11/Xlib.h>
#include "pango-impl-utils.h"
-#include "modules.h"
#undef PANGO_DISABLE_DEPRECATED
@@ -159,6 +158,30 @@ free_context_info (PangoXContextInfo *info)
g_slice_free (PangoXContextInfo, info);
}
+static PangoXContextInfo *
+get_context_info (PangoContext *context)
+{
+ PangoXContextInfo *info;
+ static quark = 0;
+
+ if (G_UNLIKELY (!quark))
+ quark = g_quark_from_static_string ("pango-x-info");
+
+ info = g_object_get_qdata (G_OBJECT (context), quark);
+
+ if (G_UNLIKELY (!info))
+ {
+ info = g_slice_new (PangoXContextInfo);
+ info->get_gc_func = NULL;
+ info->free_gc_func = NULL;
+ g_object_set_qdata_full (G_OBJECT (context),
+ quark,
+ info, (GDestroyNotify)free_context_info);
+ }
+
+ return info;
+}
+
/**
* pango_x_get_context:
* @display: an X display (As returned by XOpenDisplay().)
@@ -166,38 +189,15 @@ free_context_info (PangoXContextInfo *info)
* Retrieves a #PangoContext appropriate for rendering with X fonts on the
* given display.
*
+ * This function is deprecated. Use pango_x_font_map_for_display() followed
+ * by pango_font_map_create_context() instead.
+ *
* Return value: the new #PangoContext.
**/
PangoContext *
pango_x_get_context (Display *display)
{
- PangoContext *result;
- PangoXContextInfo *info;
- int i;
- static gboolean registered_modules = FALSE;
-
- g_return_val_if_fail (display != NULL, NULL);
-
- if (!registered_modules)
- {
- registered_modules = TRUE;
-
- for (i = 0; _pango_included_x_modules[i].list; i++)
- pango_module_register (&_pango_included_x_modules[i]);
- }
-
- result = pango_context_new ();
-
- info = g_slice_new (PangoXContextInfo);
- info->get_gc_func = NULL;
- info->free_gc_func = NULL;
- g_object_set_qdata_full (G_OBJECT (result),
- g_quark_from_static_string ("pango-x-info"),
- info, (GDestroyNotify)free_context_info);
-
- pango_context_set_font_map (result, pango_x_font_map_for_display (display));
-
- return result;
+ return pango_font_map_create_context (pango_x_font_map_for_display (display));
}
/**
@@ -218,8 +218,7 @@ pango_x_context_set_funcs (PangoContext *context,
g_return_if_fail (context != NULL);
- info = g_object_get_qdata (G_OBJECT (context),
- g_quark_from_static_string ("pango-x-info"));
+ info = get_context_info (context);
info->get_gc_func = get_gc_func;
info->free_gc_func = free_gc_func;
@@ -1497,9 +1496,7 @@ pango_x_render_layout_line (Display *display,
PangoRectangle logical_rect;
PangoRectangle ink_rect;
PangoContext *context = pango_layout_get_context (line->layout);
- PangoXContextInfo *info =
- g_object_get_qdata (G_OBJECT (context),
- g_quark_from_static_string ("pango-x-info"));
+ PangoXContextInfo *info = get_context_info (context);
int x_off = 0;
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index 8e8a0709..6101ae9e 100644
--- a/pango/pangoxft-font.c
+++ b/pango/pangoxft-font.c
@@ -138,7 +138,7 @@ _pango_xft_font_get_mini_font (PangoXftFont *xfont)
_pango_xft_font_map_get_info (fcfont->fontmap, &display, &screen);
- context = pango_xft_get_context (display, screen);
+ context = pango_font_map_create_context (pango_xft_get_font_map (display, screen));
pango_context_set_language (context, pango_language_from_string ("en"));
pango_font_description_set_family_static (desc, "monospace");
diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c
index 1c063279..d2f582f0 100644
--- a/pango/pangoxft-fontmap.c
+++ b/pango/pangoxft-fontmap.c
@@ -317,18 +317,19 @@ _pango_xft_font_map_get_info (PangoFontMap *fontmap,
* Retrieves a #PangoContext appropriate for rendering with
* Xft fonts on the given screen of the given display.
*
+ * As of Pango 1.20 this function is deprecated.
+ * Use pango_xft_get_font_map() followed by
+ * pango_font_map_create_context() instead.
+ *
* Return value: the new #PangoContext.
**/
PangoContext *
pango_xft_get_context (Display *display,
int screen)
{
- PangoFontMap *fontmap;
-
g_return_val_if_fail (display != NULL, NULL);
- fontmap = pango_xft_get_font_map (display, screen);
- return pango_fc_font_map_create_context (PANGO_FC_FONT_MAP (fontmap));
+ return pango_font_map_create_context (pango_xft_get_font_map (display, screen));
}
/**
diff --git a/pango/pangoxft.h b/pango/pangoxft.h
index a84571a8..177bf974 100644
--- a/pango/pangoxft.h
+++ b/pango/pangoxft.h
@@ -50,8 +50,10 @@ typedef void (*PangoXftSubstituteFunc) (FcPattern *pattern,
*/
PangoFontMap *pango_xft_get_font_map (Display *display,
int screen);
+#ifndef PANGO_DISABLE_DEPRECATED
PangoContext *pango_xft_get_context (Display *display,
int screen);
+#endif
void pango_xft_shutdown_display (Display *display,
int screen);