diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2008-08-06 08:39:01 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2008-08-06 08:39:01 +0000 |
commit | 6a84b56502ed11b4d52d7be387be4ce26c7e4c61 (patch) | |
tree | 629d4e9791a14c27ecfd4ec4cb0fcfb39c12a168 /pango/pangox.c | |
parent | fb5d6ad85ca10e67db70575b0604894fa8c484f5 (diff) | |
download | pango-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
Diffstat (limited to 'pango/pangox.c')
-rw-r--r-- | pango/pangox.c | 63 |
1 files changed, 30 insertions, 33 deletions
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; |