[pango/pango2: 71/118] Store cairo_font_options in the context




commit 20f1ff9bdde004add302f14f52c40cf60a15ef02
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 8 21:54:57 2022 -0400

    Store cairo_font_options in the context
    
    Now that everything lives in the same shared
    object, this is easy.

 examples/cairosimple.c          |   5 +-
 examples/cairotwisted.c         |   5 +-
 pango/meson.build               |   2 +
 pango/pango-context-private.h   |  11 ++
 pango/pangocairo-context.c      | 284 +++++++++++-----------------------------
 pango/pangocairo-context.h      |  44 +++++++
 pango/pangocairo-private.h      |   2 +-
 pango/pangocairo-render.h       |  74 +++++++++++
 pango/pangocairo.h              |  89 +------------
 tests/test-pangocairo-threads.c |   5 +-
 10 files changed, 223 insertions(+), 298 deletions(-)
---
diff --git a/examples/cairosimple.c b/examples/cairosimple.c
index 6235a02a8..239e0e39d 100644
--- a/examples/cairosimple.c
+++ b/examples/cairosimple.c
@@ -17,6 +17,7 @@ draw_text (cairo_t *cr)
  */
 #define TWEAKABLE_SCALE ((double) 0.1)
 
+  PangoContext *context;
   PangoLayout *layout;
   PangoLines *lines;
   PangoFontDescription *desc;
@@ -27,7 +28,9 @@ draw_text (cairo_t *cr)
   cairo_translate (cr, RADIUS / TWEAKABLE_SCALE, RADIUS / TWEAKABLE_SCALE);
 
   /* Create a PangoLayout, set the font and text */
-  layout = pango_cairo_create_layout (cr);
+  context = pango_cairo_create_context (cr);
+  layout = pango_layout_new (context);
+  g_object_unref (context);
 
   pango_layout_set_text (layout, "Test\nسَلام", -1);
 
diff --git a/examples/cairotwisted.c b/examples/cairotwisted.c
index 4a6dff56e..98735ecc6 100644
--- a/examples/cairotwisted.c
+++ b/examples/cairotwisted.c
@@ -472,6 +472,7 @@ draw_text (cairo_t *cr,
            const char *font,
            const char *text)
 {
+  PangoContext *context;
   PangoLayout *layout;
   PangoLine *line;
   PangoFontDescription *desc;
@@ -485,7 +486,9 @@ draw_text (cairo_t *cr,
   cairo_set_font_options (cr, font_options);
   cairo_font_options_destroy (font_options);
 
-  layout = pango_cairo_create_layout (cr);
+  context = pango_cairo_create_context (cr);
+  layout = pango_layout_new (context);
+  g_object_unref (context);
 
   desc = pango_font_description_from_string (font);
   pango_layout_set_font_description (layout, desc);
diff --git a/pango/meson.build b/pango/meson.build
index 70a1a2239..862816d73 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -101,6 +101,8 @@ pango_gir_includes = [
 if cairo_dep.found()
   pango_headers += [
     'pangocairo.h',
+    'pangocairo-context.h',
+    'pangocairo-render.h',
   ]
 
   pango_sources += [
diff --git a/pango/pango-context-private.h b/pango/pango-context-private.h
index 69c2287b4..d9d07712b 100644
--- a/pango/pango-context-private.h
+++ b/pango/pango-context-private.h
@@ -21,6 +21,9 @@
 
 #include <pango/pango-context.h>
 
+#ifdef HAVE_CAIRO
+#include <cairo.h>
+#endif
 
 struct _PangoContext
 {
@@ -44,4 +47,12 @@ struct _PangoContext
   PangoFontMetrics *metrics;
 
   gboolean round_glyph_positions;
+
+#ifdef HAVE_CAIRO
+  gboolean set_options_explicit;
+
+  cairo_font_options_t *set_options;
+  cairo_font_options_t *surface_options;
+  cairo_font_options_t *merged_options;
+#endif
 };
diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c
index 21dce46dc..daa122ff8 100644
--- a/pango/pangocairo-context.c
+++ b/pango/pangocairo-context.c
@@ -10,7 +10,7 @@
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
@@ -24,69 +24,26 @@
 #include "pangocairo.h"
 #include "pangocairo-private.h"
 #include "pango-impl-utils.h"
+#include "pango-context-private.h"
 
 #include <string.h>
 
-typedef struct _PangoCairoContextInfo PangoCairoContextInfo;
-
-struct _PangoCairoContextInfo
-{
-  double dpi;
-  gboolean set_options_explicit;
-
-  cairo_font_options_t *set_options;
-  cairo_font_options_t *surface_options;
-  cairo_font_options_t *merged_options;
-};
-
-static void
-free_context_info (PangoCairoContextInfo *info)
-{
-  if (info->set_options)
-    cairo_font_options_destroy (info->set_options);
-  if (info->surface_options)
-    cairo_font_options_destroy (info->surface_options);
-  if (info->merged_options)
-    cairo_font_options_destroy (info->merged_options);
-
-  g_slice_free (PangoCairoContextInfo, info);
-}
-
-static PangoCairoContextInfo *
-get_context_info (PangoContext *context,
-                 gboolean      create)
-{
-  static GQuark context_info_quark; /* MT-safe */
-  PangoCairoContextInfo *info;
-
-  if (G_UNLIKELY (!context_info_quark))
-    context_info_quark = g_quark_from_static_string ("pango-cairo-context-info");
-
-retry:
-  info = g_object_get_qdata (G_OBJECT (context), context_info_quark);
-
-  if (G_UNLIKELY (!info) && create)
-    {
-      info = g_slice_new0 (PangoCairoContextInfo);
-      info->dpi = -1.0;
-
-      if (!g_object_replace_qdata (G_OBJECT (context), context_info_quark, NULL,
-                                   info, (GDestroyNotify)free_context_info,
-                                   NULL))
-        {
-          free_context_info (info);
-          goto retry;
-        }
-    }
-
-  return info;
-}
-
-static void
-_pango_cairo_update_context (cairo_t      *cr,
-                            PangoContext *context)
+/**
+ * pango_cairo_update_context:
+ * @cr: a Cairo 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
+ * context.
+ *
+ * If any layouts have been created for the context, it's necessary
+ * to call [method@Pango.Layout.context_changed] on those layouts.
+ */
+void
+pango_cairo_update_context (cairo_t      *cr,
+                            PangoContext *context)
 {
-  PangoCairoContextInfo *info;
   cairo_matrix_t cairo_matrix;
   cairo_surface_t *target;
   PangoMatrix pango_matrix;
@@ -95,29 +52,30 @@ _pango_cairo_update_context (cairo_t      *cr,
   cairo_font_options_t *old_merged_options;
   gboolean changed = FALSE;
 
-  info = get_context_info (context, TRUE);
+  g_return_if_fail (cr != NULL);
+  g_return_if_fail (PANGO_IS_CONTEXT (context));
 
   target = cairo_get_target (cr);
 
-  if (!info->surface_options)
-    info->surface_options = cairo_font_options_create ();
-  cairo_surface_get_font_options (target, info->surface_options);
-  if (!info->set_options_explicit)
+  if (!context->surface_options)
+    context->surface_options = cairo_font_options_create ();
+  cairo_surface_get_font_options (target, context->surface_options);
+  if (!context->set_options_explicit)
   {
-    if (!info->set_options)
-      info->set_options = cairo_font_options_create ();
-    cairo_get_font_options (cr, info->set_options);
+    if (!context->set_options)
+      context->set_options = cairo_font_options_create ();
+    cairo_get_font_options (cr, context->set_options);
   }
 
-  old_merged_options = info->merged_options;
-  info->merged_options = NULL;
+  old_merged_options = context->merged_options;
+  context->merged_options = NULL;
 
-  merged_options = _pango_cairo_context_get_merged_font_options (context);
+  merged_options = pango_cairo_context_get_merged_font_options (context);
 
   if (old_merged_options)
     {
       if (!cairo_font_options_equal (merged_options, old_merged_options))
-       changed = TRUE;
+        changed = TRUE;
       cairo_font_options_destroy (old_merged_options);
       old_merged_options = NULL;
     }
@@ -137,7 +95,8 @@ _pango_cairo_update_context (cairo_t      *cr,
     current_matrix = &identity_matrix;
 
   /* layout is matrix-independent if metrics-hinting is off.
-   * also ignore matrix translation offsets */
+   * also ignore matrix translation offsets
+   */
   if ((cairo_font_options_get_hint_metrics (merged_options) != CAIRO_HINT_METRICS_OFF) &&
       (0 != memcmp (&pango_matrix, current_matrix, sizeof (PangoMatrix))))
     changed = TRUE;
@@ -148,71 +107,6 @@ _pango_cairo_update_context (cairo_t      *cr,
     pango_context_changed (context);
 }
 
-/**
- * pango_cairo_update_context:
- * @cr: a Cairo 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
- * context.
- *
- * If any layouts have been created for the context, it's necessary
- * to call [method@Pango.Layout.context_changed] on those layouts.
- */
-void
-pango_cairo_update_context (cairo_t      *cr,
-                           PangoContext *context)
-{
-  g_return_if_fail (cr != NULL);
-  g_return_if_fail (PANGO_IS_CONTEXT (context));
-
-  _pango_cairo_update_context (cr, context);
-}
-
-/**
- * pango_cairo_context_set_resolution:
- * @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.
- *
- * Sets the resolution for the context.
- *
- * This is a scale factor between points specified in a `PangoFontDescription`
- * and Cairo units. The default value is 96, meaning that a 10 point font will
- * be 13 units high. (10 * 96. / 72. = 13.3).
- */
-void
-pango_cairo_context_set_resolution (PangoContext *context,
-                                   double        dpi)
-{
-  PangoCairoContextInfo *info = get_context_info (context, TRUE);
-  info->dpi = dpi;
-}
-
-/**
- * pango_cairo_context_get_resolution:
- * @context: a `PangoContext`, from a pangocairo font map
- *
- * Gets the resolution for the context.
- *
- * See [func@PangoCairo.context_set_resolution]
- *
- * Return value: the resolution in "dots per inch". A negative value will
- *   be returned if no resolution has previously been set.
- */
-double
-pango_cairo_context_get_resolution (PangoContext *context)
-{
-  PangoCairoContextInfo *info = get_context_info (context, FALSE);
-
-  if (info)
-    return info->dpi;
-  else
-    return -1.0;
-}
-
 /**
  * pango_cairo_context_set_font_options:
  * @context: a `PangoContext`, from a pangocairo font map
@@ -226,43 +120,38 @@ pango_cairo_context_get_resolution (PangoContext *context)
  */
 void
 pango_cairo_context_set_font_options (PangoContext               *context,
-                                     const cairo_font_options_t *options)
+                                      const cairo_font_options_t *options)
 {
-  PangoCairoContextInfo *info;
-
   g_return_if_fail (PANGO_IS_CONTEXT (context));
 
-  info = get_context_info (context, TRUE);
-
-  if (!info->set_options && !options)
+  if (!context->set_options && !options)
     return;
 
-  if (info->set_options &&
-      options &&
-      cairo_font_options_equal (info->set_options, options))
+  if (context->set_options && options &&
+      cairo_font_options_equal (context->set_options, options))
     return;
 
-  if (info->set_options || options)
+  if (context->set_options || options)
     pango_context_changed (context);
 
- if (info->set_options)
-    cairo_font_options_destroy (info->set_options);
+ if (context->set_options)
+    cairo_font_options_destroy (context->set_options);
 
   if (options)
   {
-    info->set_options = cairo_font_options_copy (options);
-    info->set_options_explicit = TRUE;
+    context->set_options = cairo_font_options_copy (options);
+    context->set_options_explicit = TRUE;
   }
   else
   {
-    info->set_options = NULL;
-    info->set_options_explicit = FALSE;
+    context->set_options = NULL;
+    context->set_options_explicit = FALSE;
   }
 
-  if (info->merged_options)
+  if (context->merged_options)
     {
-      cairo_font_options_destroy (info->merged_options);
-      info->merged_options = NULL;
+      cairo_font_options_destroy (context->merged_options);
+      context->merged_options = NULL;
     }
 }
 
@@ -283,45 +172,26 @@ pango_cairo_context_set_font_options (PangoContext               *context,
 const cairo_font_options_t *
 pango_cairo_context_get_font_options (PangoContext *context)
 {
-  PangoCairoContextInfo *info;
-
   g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
 
-  info = get_context_info (context, FALSE);
-
-  if (info)
-    return info->set_options;
-  else
-    return NULL;
+  return context->set_options;
 }
 
-/**
- * _pango_cairo_context_merge_font_options:
- * @context: a `PangoContext`
- * @options: a `cairo_font_options_t`
- *
- * Merge together options from the target surface and explicitly set
- * on the context.
- *
- * Return value: the combined set of font options. This value is owned
- *   by the context and must not be modified or freed.
- */
 const cairo_font_options_t *
-_pango_cairo_context_get_merged_font_options (PangoContext *context)
+pango_cairo_context_get_merged_font_options (PangoContext *context)
 {
-  PangoCairoContextInfo *info = get_context_info (context, TRUE);
-
-  if (!info->merged_options)
+  if (!context->merged_options)
     {
-      info->merged_options = cairo_font_options_create ();
+      context->merged_options = cairo_font_options_create ();
 
-      if (info->surface_options)
-       cairo_font_options_merge (info->merged_options, info->surface_options);
-      if (info->set_options)
-       cairo_font_options_merge (info->merged_options, info->set_options);
+      if (context->surface_options)
+        cairo_font_options_merge (context->merged_options, context->surface_options)
+;
+      if (context->set_options)
+        cairo_font_options_merge (context->merged_options, context->set_options);
     }
 
-  return info->merged_options;
+  return context->merged_options;
 }
 
 /**
@@ -356,6 +226,25 @@ pango_cairo_create_context (cairo_t *cr)
   return context;
 }
 
+/**
+ * pango_cairo_update_layout:
+ * @cr: a Cairo context
+ * @layout: a `PangoLayout`, from [func@create_layout]
+ *
+ * Updates the private `PangoContext` of a `PangoLayout` created with
+ * [func@create_layout] to match the current transformation and target
+ * surface of a Cairo context.
+ */
+void
+pango_cairo_update_layout (cairo_t     *cr,
+                           PangoLayout *layout)
+{
+  g_return_if_fail (cr != NULL);
+  g_return_if_fail (PANGO_IS_LAYOUT (layout));
+
+  pango_cairo_update_context (cr, pango_layout_get_context (layout));
+}
+
 /**
  * pango_cairo_create_layout:
  * @cr: a Cairo context
@@ -365,8 +254,8 @@ pango_cairo_create_context (cairo_t *cr)
  *
  * This layout can then be used for text measurement with functions
  * like [method@Pango.Lines.get_size] or drawing with functions like
- * [func@show_layout]. If you change the transformation or target
- * surface for @cr, you need to call [func@update_layout].
+ * [func@Pango.cairo_show_layout]. If you change the transformation or target
+ * surface for @cr, you need to call [func@Pango.cairo_update_layout].
  *
  * This function is the most convenient way to use Cairo with Pango,
  * however it is slightly inefficient since it creates a separate
@@ -389,22 +278,3 @@ pango_cairo_create_layout (cairo_t *cr)
 
   return layout;
 }
-
-/**
- * pango_cairo_update_layout:
- * @cr: a Cairo context
- * @layout: a `PangoLayout`, from [func@create_layout]
- *
- * Updates the private `PangoContext` of a `PangoLayout` created with
- * [func@create_layout] to match the current transformation and target
- * surface of a Cairo context.
- */
-void
-pango_cairo_update_layout (cairo_t     *cr,
-                           PangoLayout *layout)
-{
-  g_return_if_fail (cr != NULL);
-  g_return_if_fail (PANGO_IS_LAYOUT (layout));
-
-  _pango_cairo_update_context (cr, pango_layout_get_context (layout));
-}
diff --git a/pango/pangocairo-context.h b/pango/pangocairo-context.h
new file mode 100644
index 000000000..9a2d8d7eb
--- /dev/null
+++ b/pango/pangocairo-context.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 1999, 2004 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <pango/pango.h>
+#include <cairo.h>
+
+G_BEGIN_DECLS
+
+PANGO_AVAILABLE_IN_ALL
+PangoContext *          pango_cairo_create_context              (cairo_t                        *cr);
+PANGO_AVAILABLE_IN_ALL
+void                    pango_cairo_update_context              (cairo_t                        *cr,
+                                                                 PangoContext                   *context);
+PANGO_AVAILABLE_IN_ALL
+PangoLayout *           pango_cairo_create_layout               (cairo_t                        *cr);
+PANGO_AVAILABLE_IN_ALL
+void                    pango_cairo_update_layout               (cairo_t                        *cr,
+                                                                 PangoLayout                    *layout);
+PANGO_AVAILABLE_IN_ALL
+void                    pango_cairo_context_set_font_options    (PangoContext                   *context,
+                                                                 const cairo_font_options_t     *options);
+PANGO_AVAILABLE_IN_ALL
+const cairo_font_options_t *
+                        pango_cairo_context_get_font_options    (PangoContext                   *context);
+
+G_END_DECLS
diff --git a/pango/pangocairo-private.h b/pango/pangocairo-private.h
index 7c16cf8c8..23e3c49f3 100644
--- a/pango/pangocairo-private.h
+++ b/pango/pangocairo-private.h
@@ -62,4 +62,4 @@ _PANGO_EXTERN
 GType pango_cairo_renderer_get_type    (void) G_GNUC_CONST;
 
 
-const cairo_font_options_t *_pango_cairo_context_get_merged_font_options (PangoContext *context);
+const cairo_font_options_t *pango_cairo_context_get_merged_font_options (PangoContext *context);
diff --git a/pango/pangocairo-render.h b/pango/pangocairo-render.h
new file mode 100644
index 000000000..aadb831e5
--- /dev/null
+++ b/pango/pangocairo-render.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 1999, 2004 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <pango/pango.h>
+#include <cairo.h>
+
+G_BEGIN_DECLS
+
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_show_glyph_string           (cairo_t          *cr,
+                                                 PangoFont        *font,
+                                                 PangoGlyphString *glyphs);
+
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_show_glyph_item             (cairo_t          *cr,
+                                                 const char       *text,
+                                                 PangoGlyphItem   *glyph_item);
+PANGO_AVAILABLE_IN_ALL
+void     pango_cairo_show_line                  (cairo_t          *cr,
+                                                 PangoLine        *line);
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_show_lines                  (cairo_t          *cr,
+                                                 PangoLines       *lines);
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_show_layout                 (cairo_t          *cr,
+                                                 PangoLayout      *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_show_error_underline        (cairo_t          *cr,
+                                                 double            x,
+                                                 double            y,
+                                                 double            width,
+                                                 double            height);
+
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_glyph_string_path           (cairo_t          *cr,
+                                                 PangoFont        *font,
+                                                 PangoGlyphString *glyphs);
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_layout_path                 (cairo_t          *cr,
+                                                 PangoLayout      *layout);
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_line_path                   (cairo_t          *cr,
+                                                 PangoLine        *line);
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_lines_path                  (cairo_t          *cr,
+                                                 PangoLines       *lines);
+
+PANGO_AVAILABLE_IN_ALL
+void    pango_cairo_error_underline_path        (cairo_t          *cr,
+                                                 double            x,
+                                                 double            y,
+                                                 double            width,
+                                                 double            height);
+
+G_END_DECLS
diff --git a/pango/pangocairo.h b/pango/pangocairo.h
index 51a5f5ea5..a2658f825 100644
--- a/pango/pangocairo.h
+++ b/pango/pangocairo.h
@@ -19,90 +19,5 @@
 
 #pragma once
 
-#include <pango/pango.h>
-#include <cairo.h>
-
-G_BEGIN_DECLS
-
-/* Update a Pango context for the current state of a cairo context
- */
-PANGO_AVAILABLE_IN_ALL
-void         pango_cairo_update_context (cairo_t      *cr,
-                                         PangoContext *context);
-
-PANGO_AVAILABLE_IN_ALL
-void                        pango_cairo_context_set_font_options (PangoContext               *context,
-                                                                  const cairo_font_options_t *options);
-PANGO_AVAILABLE_IN_ALL
-const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext               *context);
-
-PANGO_AVAILABLE_IN_ALL
-void               pango_cairo_context_set_resolution     (PangoContext       *context,
-                                                           double              dpi);
-PANGO_AVAILABLE_IN_ALL
-double             pango_cairo_context_get_resolution     (PangoContext       *context);
-
-/* Convenience
- */
-PANGO_AVAILABLE_IN_ALL
-PangoContext *pango_cairo_create_context (cairo_t   *cr);
-PANGO_AVAILABLE_IN_ALL
-PangoLayout *pango_cairo_create_layout (cairo_t     *cr);
-PANGO_AVAILABLE_IN_ALL
-void         pango_cairo_update_layout (cairo_t     *cr,
-                                        PangoLayout *layout);
-
-/*
- * Rendering
- */
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_glyph_string (cairo_t          *cr,
-                                    PangoFont        *font,
-                                    PangoGlyphString *glyphs);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_glyph_item   (cairo_t          *cr,
-                                    const char       *text,
-                                    PangoGlyphItem   *glyph_item);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_line         (cairo_t          *cr,
-                                    PangoLine        *line);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_lines        (cairo_t          *cr,
-                                    PangoLines       *lines);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_layout       (cairo_t          *cr,
-                                    PangoLayout      *layout);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_error_underline (cairo_t       *cr,
-                                       double         x,
-                                       double         y,
-                                       double         width,
-                                       double         height);
-
-
-/*
- * Rendering to a path
- */
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_glyph_string_path (cairo_t          *cr,
-                                    PangoFont        *font,
-                                    PangoGlyphString *glyphs);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_layout_path       (cairo_t          *cr,
-                                    PangoLayout      *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_line_path         (cairo_t          *cr,
-                                    PangoLine        *line);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_lines_path        (cairo_t          *cr,
-                                    PangoLines       *lines);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_error_underline_path (cairo_t       *cr,
-                                       double         x,
-                                       double         y,
-                                       double         width,
-                                       double         height);
-
-G_END_DECLS
+#include <pango/pangocairo-context.h>
+#include <pango/pangocairo-render.h>
diff --git a/tests/test-pangocairo-threads.c b/tests/test-pangocairo-threads.c
index aa1e1bcad..429e3011b 100644
--- a/tests/test-pangocairo-threads.c
+++ b/tests/test-pangocairo-threads.c
@@ -21,9 +21,12 @@ create_surface (void)
 static PangoLayout *
 create_layout (cairo_t *cr)
 {
+  PangoContext *context;
   PangoLayout *layout;
 
-  layout = pango_cairo_create_layout (cr);
+  context = pango_cairo_create_context (cr);
+  layout = pango_layout_new (context);
+  g_object_unref (context);
   pango_layout_set_text (layout, text, -1);
   pango_layout_set_width (layout, WIDTH * PANGO_SCALE);
 


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