2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>

Bug 1215 - Move the Pango renderer to the public API

	* clutter/pango/*: Rename PangoClutter -> CoglPango.

	* clutter/Makefile.am:
	* clutter/clutter-backend.c:
	* clutter/clutter-entry.c:
	* clutter/clutter-label.c:
	* clutter/clutter-main.[ch]:
	* clutter/clutter-private.h: Update the users of the Pango
	renderer API.

	* README: Update release notes.
This commit is contained in:
Emmanuele Bassi 2008-10-30 17:11:29 +00:00
parent a32eca26b6
commit b5cc7a4044
18 changed files with 518 additions and 489 deletions

View File

@ -1,3 +1,19 @@
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1215 - Move the Pango renderer to the public API
* clutter/pango/*: Rename PangoClutter -> CoglPango.
* clutter/Makefile.am:
* clutter/clutter-backend.c:
* clutter/clutter-entry.c:
* clutter/clutter-label.c:
* clutter/clutter-main.[ch]:
* clutter/clutter-private.h: Update the users of the Pango
renderer API.
* README: Update release notes.
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com> 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1212 - Allow only a single include file for Clutter Bug 1212 - Allow only a single include file for Clutter

6
README
View File

@ -170,6 +170,12 @@ wanting to port to newer releases (See NEWS for general new feature info).
Release Notes for Clutter 1.0 Release Notes for Clutter 1.0
------------------------------- -------------------------------
* The Pango renderer API has been exposed as public API, after
a full rename from PangoClutter to CoglPango, to avoid namespace
collisions with upstream Pango. The Pango font map, renderer and
glyph cache can be used by third party code and depend only on
COGL.
* Both Clutter and COGL only allow including <clutter/clutter.h> * Both Clutter and COGL only allow including <clutter/clutter.h>
and <cogl/cogl.h> directly, respectively. This allows avoiding and <cogl/cogl.h> directly, respectively. This allows avoiding
breaking API every time a type definition is moved across breaking API every time a type definition is moved across

View File

@ -189,14 +189,14 @@ source_h_priv = \
libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_LIBADD = \ libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_LIBADD = \
$(CLUTTER_LIBS) \ $(CLUTTER_LIBS) \
$(top_builddir)/clutter/pango/libpangoclutter.la \ $(top_builddir)/clutter/pango/libcoglpango.la \
$(top_builddir)/clutter/$(CLUTTER_FLAVOUR)/libclutter-$(CLUTTER_FLAVOUR).la \ $(top_builddir)/clutter/$(CLUTTER_FLAVOUR)/libclutter-$(CLUTTER_FLAVOUR).la \
$(top_builddir)/clutter/cogl/$(CLUTTER_COGL)/libclutter-cogl.la \ $(top_builddir)/clutter/cogl/$(CLUTTER_COGL)/libclutter-cogl.la \
$(clutter_json_libadd) \ $(clutter_json_libadd) \
$(backendextralib) $(backendextralib)
libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_DEPENDENCIES = \ libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_DEPENDENCIES = \
pango/libpangoclutter.la \ pango/libcoglpango.la \
$(CLUTTER_FLAVOUR)/libclutter-$(CLUTTER_FLAVOUR).la \ $(CLUTTER_FLAVOUR)/libclutter-$(CLUTTER_FLAVOUR).la \
cogl/$(CLUTTER_COGL)/libclutter-cogl.la \ cogl/$(CLUTTER_COGL)/libclutter-cogl.la \
$(clutter_json_dep) \ $(clutter_json_dep) \

View File

@ -388,7 +388,7 @@ clutter_backend_set_resolution (ClutterBackend *backend,
priv->resolution = fixed_dpi; priv->resolution = fixed_dpi;
if (CLUTTER_CONTEXT ()->font_map) if (CLUTTER_CONTEXT ()->font_map)
pango_clutter_font_map_set_resolution (CLUTTER_CONTEXT ()->font_map, cogl_pango_font_map_set_resolution (CLUTTER_CONTEXT ()->font_map,
COGL_FIXED_TO_FLOAT (fixed_dpi)); COGL_FIXED_TO_FLOAT (fixed_dpi));
} }

View File

@ -49,7 +49,8 @@
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-rectangle.h" #include "clutter-rectangle.h"
#include "clutter-units.h" #include "clutter-units.h"
#include "pangoclutter.h"
#include "cogl-pango.h"
#define DEFAULT_FONT_NAME "Sans 10" #define DEFAULT_FONT_NAME "Sans 10"
#define ENTRY_CURSOR_WIDTH 1 #define ENTRY_CURSOR_WIDTH 1
@ -309,7 +310,7 @@ clutter_entry_ensure_layout (ClutterEntry *entry, gint width)
pango_layout_set_width (priv->layout, -1); pango_layout_set_width (priv->layout, -1);
/* Prime the cache for the layout */ /* Prime the cache for the layout */
pango_clutter_ensure_glyph_cache_for_layout (priv->layout); cogl_pango_ensure_glyph_cache_for_layout (priv->layout);
} }
} }
@ -434,7 +435,7 @@ clutter_entry_paint (ClutterActor *self)
gint width, actor_width; gint width, actor_width;
gint text_width; gint text_width;
gint cursor_x; gint cursor_x;
ClutterColor color = { 0, }; CoglColor color;
entry = CLUTTER_ENTRY(self); entry = CLUTTER_ENTRY(self);
priv = entry->priv; priv = entry->priv;
@ -504,10 +505,13 @@ clutter_entry_paint (ClutterActor *self)
priv->cursor_pos.x += priv->text_x + priv->entry_padding; priv->cursor_pos.x += priv->text_x + priv->entry_padding;
} }
memcpy (&color, &priv->fgcol, sizeof (ClutterColor)); cogl_color_set_from_4ub (&color,
color.alpha = clutter_actor_get_paint_opacity (self); priv->fgcol.red,
priv->fgcol.green,
priv->fgcol.blue,
clutter_actor_get_paint_opacity (self));
pango_clutter_render_layout (priv->layout, cogl_pango_render_layout (priv->layout,
priv->text_x + priv->entry_padding, 0, priv->text_x + priv->entry_padding, 0,
&color, 0); &color, 0);

View File

@ -41,7 +41,7 @@
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-units.h" #include "clutter-units.h"
#include "pangoclutter.h" #include "cogl-pango.h"
#define DEFAULT_FONT_NAME "Sans 10" #define DEFAULT_FONT_NAME "Sans 10"
@ -265,7 +265,7 @@ clutter_label_create_layout (ClutterLabel *label,
oldest_cache->layout oldest_cache->layout
= clutter_label_create_layout_no_cache (label, allocation_width); = clutter_label_create_layout_no_cache (label, allocation_width);
pango_clutter_ensure_glyph_cache_for_layout (oldest_cache->layout); cogl_pango_ensure_glyph_cache_for_layout (oldest_cache->layout);
/* Mark the 'time' this cache was created and advance the time */ /* Mark the 'time' this cache was created and advance the time */
oldest_cache->age = priv->cache_age++; oldest_cache->age = priv->cache_age++;
@ -281,7 +281,7 @@ clutter_label_paint (ClutterActor *self)
ClutterLabel *label = CLUTTER_LABEL (self); ClutterLabel *label = CLUTTER_LABEL (self);
ClutterLabelPrivate *priv = label->priv; ClutterLabelPrivate *priv = label->priv;
PangoLayout *layout; PangoLayout *layout;
ClutterColor color = { 0, }; CoglColor color;
ClutterActorBox alloc = { 0, }; ClutterActorBox alloc = { 0, };
if (priv->font_desc == NULL || priv->text == NULL) if (priv->font_desc == NULL || priv->text == NULL)
@ -297,10 +297,13 @@ clutter_label_paint (ClutterActor *self)
clutter_actor_get_allocation_box (self, &alloc); clutter_actor_get_allocation_box (self, &alloc);
layout = clutter_label_create_layout (label, alloc.x2 - alloc.x1); layout = clutter_label_create_layout (label, alloc.x2 - alloc.x1);
memcpy (&color, &priv->fgcol, sizeof (ClutterColor)); cogl_color_set_from_4ub (&color,
color.alpha = clutter_actor_get_paint_opacity (self); priv->fgcol.red,
priv->fgcol.green,
priv->fgcol.blue,
clutter_actor_get_paint_opacity (self));
pango_clutter_render_layout (layout, 0, 0, &color, 0); cogl_pango_render_layout (layout, 0, 0, &color, 0);
} }
static void static void

View File

@ -50,6 +50,7 @@
#include "clutter-frame-source.h" #include "clutter-frame-source.h"
#include "cogl/cogl.h" #include "cogl/cogl.h"
#include "pango/cogl-pango.h"
/* main context */ /* main context */
static ClutterMainContext *ClutterCntx = NULL; static ClutterMainContext *ClutterCntx = NULL;
@ -410,7 +411,7 @@ _clutter_context_create_pango_context (ClutterMainContext *self)
if (resolution < 0) if (resolution < 0)
resolution = 96.0; /* fall back */ resolution = 96.0; /* fall back */
context = pango_clutter_font_map_create_context (self->font_map); context = cogl_pango_font_map_create_context (self->font_map);
pango_cairo_context_set_resolution (context, resolution); pango_cairo_context_set_resolution (context, resolution);
@ -1070,12 +1071,11 @@ clutter_init_real (GError **error)
* Resolution requires display to be open, so can only be queried after * Resolution requires display to be open, so can only be queried after
* the post_parse hooks run. * the post_parse hooks run.
*/ */
ctx->font_map = PANGO_CLUTTER_FONT_MAP (pango_clutter_font_map_new ()); ctx->font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new ());
resolution = clutter_backend_get_resolution (ctx->backend); resolution = clutter_backend_get_resolution (ctx->backend);
pango_clutter_font_map_set_resolution (ctx->font_map, resolution); cogl_pango_font_map_set_resolution (ctx->font_map, resolution);
cogl_pango_font_map_set_use_mipmapping (ctx->font_map, TRUE);
pango_clutter_font_map_set_use_mipmapping (ctx->font_map, TRUE);
/* Stage will give us a GL Context etc */ /* Stage will give us a GL Context etc */
stage = clutter_stage_get_default (); stage = clutter_stage_get_default ();
@ -2491,7 +2491,7 @@ void
clutter_clear_glyph_cache (void) clutter_clear_glyph_cache (void)
{ {
if (CLUTTER_CONTEXT ()->font_map) if (CLUTTER_CONTEXT ()->font_map)
pango_clutter_font_map_clear_glyph_cache (CLUTTER_CONTEXT ()->font_map); cogl_pango_font_map_clear_glyph_cache (CLUTTER_CONTEXT ()->font_map);
} }
/** /**
@ -2508,7 +2508,7 @@ void
clutter_set_use_mipmapped_text (gboolean value) clutter_set_use_mipmapped_text (gboolean value)
{ {
if (CLUTTER_CONTEXT ()->font_map) if (CLUTTER_CONTEXT ()->font_map)
pango_clutter_font_map_set_use_mipmapping (CLUTTER_CONTEXT ()->font_map, cogl_pango_font_map_set_use_mipmapping (CLUTTER_CONTEXT ()->font_map,
value); value);
} }
@ -2526,12 +2526,12 @@ clutter_set_use_mipmapped_text (gboolean value)
gboolean gboolean
clutter_get_use_mipmapped_text (void) clutter_get_use_mipmapped_text (void)
{ {
PangoClutterFontMap *font_map = NULL; CoglPangoFontMap *font_map = NULL;
font_map = CLUTTER_CONTEXT ()->font_map; font_map = CLUTTER_CONTEXT ()->font_map;
if (font_map) if (G_LIKELY (font_map))
return pango_clutter_font_map_get_use_mipmapping (font_map); return cogl_pango_font_map_get_use_mipmapping (font_map);
return FALSE; return FALSE;
} }
@ -2567,3 +2567,25 @@ clutter_get_input_device_for_id (gint id)
return NULL; return NULL;
} }
/**
* clutter_get_font_map:
*
* Retrieves the #PangoFontMap instance used by Clutter.
* You can use the global font map object with the COGL
* Pango API.
*
* Return value: the #PangoFontMap instance. The returned
* value is owned by Clutter and it should never be
* unreferenced.
*
* Since: 1.0
*/
PangoFontMap *
clutter_get_font_map (void)
{
if (CLUTTER_CONTEXT ()->font_map)
return PANGO_FONT_MAP (CLUTTER_CONTEXT ()->font_map);
return NULL;
}

View File

@ -30,6 +30,7 @@
#include <clutter/clutter-actor.h> #include <clutter/clutter-actor.h>
#include <clutter/clutter-stage.h> #include <clutter/clutter-stage.h>
#include <pango/pango.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -164,6 +165,7 @@ void clutter_grab_pointer_for_device (ClutterActor *actor,
void clutter_ungrab_pointer_for_device (gint id); void clutter_ungrab_pointer_for_device (gint id);
PangoFontMap * clutter_get_font_map (void);
G_END_DECLS G_END_DECLS

View File

@ -45,7 +45,7 @@
#include "clutter-stage-manager.h" #include "clutter-stage-manager.h"
#include "clutter-stage-window.h" #include "clutter-stage-window.h"
#include "clutter-stage.h" #include "clutter-stage.h"
#include "pango/pangoclutter.h" #include "pango/cogl-pango.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -124,7 +124,7 @@ struct _ClutterMainContext
gint fb_r_mask, fb_g_mask, fb_b_mask; gint fb_r_mask, fb_g_mask, fb_b_mask;
gint fb_r_mask_used, fb_g_mask_used, fb_b_mask_used; gint fb_r_mask_used, fb_g_mask_used, fb_b_mask_used;
PangoClutterFontMap *font_map; /* Global font map */ CoglPangoFontMap *font_map; /* Global font map */
GSList *input_devices; /* For extra input devices, i.e GSList *input_devices; /* For extra input devices, i.e
MultiTouch */ MultiTouch */

View File

@ -1,15 +1,18 @@
source_c = pangoclutter-fontmap.c \ source_c = \
pangoclutter-render.c \ cogl-pango-fontmap.c \
pangoclutter-glyph-cache.c cogl-pango-render.c \
cogl-pango-glyph-cache.c
source_h = pangoclutter.h source_h = cogl-pango.h
source_h_priv = pangoclutter-private.h \ source_h_priv = \
pangoclutter-glyph-cache.h cogl-pango-private.h \
cogl-pango-glyph-cache.h
noinst_LTLIBRARIES = libpangoclutter.la noinst_LTLIBRARIES = libcoglpango.la
libpangoclutter_la_SOURCES = $(source_c) \ libcoglpango_la_SOURCES = \
$(source_c) \
$(source_h) \ $(source_h) \
$(source_h_priv) $(source_h_priv)
@ -19,7 +22,9 @@ INCLUDES = \
-DCLUTTER_COMPILATION \ -DCLUTTER_COMPILATION \
-I$(top_srcdir) \ -I$(top_srcdir) \
-I$(top_srcdir)/clutter \ -I$(top_srcdir)/clutter \
-I$(top_builddir)/clutter -I$(top_srcdir)/clutter/cogl \
-I$(top_builddir)/clutter \
-I$(top_builddir)/clutter/cogl
pangoclutterheadersdir = $(includedir)/clutter-@CLUTTER_MAJORMINOR@/clutter coglpangoheadersdir = $(includedir)/clutter-@CLUTTER_MAJORMINOR@/cogl
pangoclutterheaders_HEADERS = $(source_h) coglpangoheaders_HEADERS = $(source_h)

View File

@ -18,9 +18,7 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the * License along with this library. If not, see <http://www.gnu.org/licenses/>.
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -37,21 +35,21 @@
#include <pango/pangocairo.h> #include <pango/pangocairo.h>
#include <pango/pango-renderer.h> #include <pango/pango-renderer.h>
#include "pangoclutter.h" #include "cogl-pango.h"
#include "pangoclutter-private.h" #include "cogl-pango-private.h"
static GQuark pango_clutter_font_map_get_renderer_key (void) G_GNUC_CONST; static GQuark cogl_pango_font_map_get_renderer_key (void) G_GNUC_CONST;
PangoFontMap * PangoFontMap *
pango_clutter_font_map_new (void) cogl_pango_font_map_new (void)
{ {
return pango_cairo_font_map_new (); return pango_cairo_font_map_new ();
} }
PangoContext * PangoContext *
pango_clutter_font_map_create_context (PangoClutterFontMap *fm) cogl_pango_font_map_create_context (CoglPangoFontMap *fm)
{ {
g_return_val_if_fail (PANGO_CLUTTER_IS_FONT_MAP (fm), NULL); g_return_val_if_fail (COGL_PANGO_IS_FONT_MAP (fm), NULL);
/* We can just directly use the pango context from the Cairo font /* We can just directly use the pango context from the Cairo font
map */ map */
@ -59,22 +57,24 @@ pango_clutter_font_map_create_context (PangoClutterFontMap *fm)
} }
PangoRenderer * PangoRenderer *
_pango_clutter_font_map_get_renderer (PangoClutterFontMap *fm) cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm)
{ {
PangoRenderer *renderer; PangoRenderer *renderer;
g_return_val_if_fail (COGL_PANGO_IS_FONT_MAP (fm), NULL);
/* We want to keep a cached pointer to the renderer from the font /* We want to keep a cached pointer to the renderer from the font
map instance but as we don't have a proper subclass we have to map instance but as we don't have a proper subclass we have to
store it in the object data instead */ store it in the object data instead */
renderer = g_object_get_qdata (G_OBJECT (fm), renderer = g_object_get_qdata (G_OBJECT (fm),
pango_clutter_font_map_get_renderer_key ()); cogl_pango_font_map_get_renderer_key ());
if (G_UNLIKELY (renderer == NULL)) if (G_UNLIKELY (renderer == NULL))
{ {
renderer = g_object_new (PANGO_CLUTTER_TYPE_RENDERER, NULL); renderer = g_object_new (COGL_PANGO_TYPE_RENDERER, NULL);
g_object_set_qdata_full (G_OBJECT (fm), g_object_set_qdata_full (G_OBJECT (fm),
pango_clutter_font_map_get_renderer_key (), cogl_pango_font_map_get_renderer_key (),
renderer, renderer,
g_object_unref); g_object_unref);
} }
@ -83,52 +83,52 @@ _pango_clutter_font_map_get_renderer (PangoClutterFontMap *fm)
} }
void void
pango_clutter_font_map_set_resolution (PangoClutterFontMap *font_map, cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
double dpi) double dpi)
{ {
g_return_if_fail (PANGO_CLUTTER_IS_FONT_MAP (font_map)); g_return_if_fail (COGL_PANGO_IS_FONT_MAP (font_map));
pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (font_map), dpi); pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (font_map), dpi);
} }
void void
pango_clutter_font_map_clear_glyph_cache (PangoClutterFontMap *fm) cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *fm)
{ {
PangoRenderer *renderer; PangoRenderer *renderer;
renderer = _pango_clutter_font_map_get_renderer (fm); renderer = cogl_pango_font_map_get_renderer (fm);
_pango_clutter_renderer_clear_glyph_cache (PANGO_CLUTTER_RENDERER (renderer)); _cogl_pango_renderer_clear_glyph_cache (COGL_PANGO_RENDERER (renderer));
} }
void void
pango_clutter_font_map_set_use_mipmapping (PangoClutterFontMap *fm, cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *fm,
gboolean value) gboolean value)
{ {
PangoClutterRenderer *renderer; CoglPangoRenderer *renderer;
renderer = PANGO_CLUTTER_RENDERER (_pango_clutter_font_map_get_renderer (fm)); renderer = COGL_PANGO_RENDERER (cogl_pango_font_map_get_renderer (fm));
_pango_clutter_renderer_set_use_mipmapping (renderer, value); _cogl_pango_renderer_set_use_mipmapping (renderer, value);
} }
gboolean gboolean
pango_clutter_font_map_get_use_mipmapping (PangoClutterFontMap *fm) cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *fm)
{ {
PangoClutterRenderer *renderer; CoglPangoRenderer *renderer;
renderer = PANGO_CLUTTER_RENDERER (_pango_clutter_font_map_get_renderer (fm)); renderer = COGL_PANGO_RENDERER (cogl_pango_font_map_get_renderer (fm));
return _pango_clutter_renderer_get_use_mipmapping (renderer); return _cogl_pango_renderer_get_use_mipmapping (renderer);
} }
static GQuark static GQuark
pango_clutter_font_map_get_renderer_key (void) cogl_pango_font_map_get_renderer_key (void)
{ {
static GQuark renderer_key = 0; static GQuark renderer_key = 0;
if (G_UNLIKELY (renderer_key == 0)) if (G_UNLIKELY (renderer_key == 0))
renderer_key = g_quark_from_static_string ("PangoClutterFontMap"); renderer_key = g_quark_from_static_string ("CoglPangoFontMap");
return renderer_key; return renderer_key;
} }

View File

@ -18,9 +18,7 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the * License along with this library. If not, see <http://www.gnu.org/licenses>.
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -29,8 +27,8 @@
#include <glib.h> #include <glib.h>
#include "pangoclutter-glyph-cache.h" #include "cogl-pango-glyph-cache.h"
#include "cogl/cogl.h" #include "cogl-pango-private.h"
/* Minimum width/height for each texture */ /* Minimum width/height for each texture */
#define MIN_TEXTURE_SIZE 256 #define MIN_TEXTURE_SIZE 256
@ -38,28 +36,28 @@
put in the same band */ put in the same band */
#define BAND_HEIGHT_ROUND 4 #define BAND_HEIGHT_ROUND 4
typedef struct _PangoClutterGlyphCacheKey PangoClutterGlyphCacheKey; typedef struct _CoglPangoGlyphCacheKey CoglPangoGlyphCacheKey;
typedef struct _PangoClutterGlyphCacheTexture PangoClutterGlyphCacheTexture; typedef struct _CoglPangoGlyphCacheTexture CoglPangoGlyphCacheTexture;
typedef struct _PangoClutterGlyphCacheBand PangoClutterGlyphCacheBand; typedef struct _CoglPangoGlyphCacheBand CoglPangoGlyphCacheBand;
struct _PangoClutterGlyphCache struct _CoglPangoGlyphCache
{ {
/* Hash table to quickly check whether a particular glyph in a /* Hash table to quickly check whether a particular glyph in a
particular font is already cached */ particular font is already cached */
GHashTable *hash_table; GHashTable *hash_table;
/* List of textures */ /* List of textures */
PangoClutterGlyphCacheTexture *textures; CoglPangoGlyphCacheTexture *textures;
/* List of horizontal bands of glyphs */ /* List of horizontal bands of glyphs */
PangoClutterGlyphCacheBand *bands; CoglPangoGlyphCacheBand *bands;
/* If TRUE all of the textures will be created with automatic mipmap /* If TRUE all of the textures will be created with automatic mipmap
generation enabled */ generation enabled */
gboolean use_mipmapping; gboolean use_mipmapping;
}; };
struct _PangoClutterGlyphCacheKey struct _CoglPangoGlyphCacheKey
{ {
PangoFont *font; PangoFont *font;
PangoGlyph glyph; PangoGlyph glyph;
@ -68,7 +66,7 @@ struct _PangoClutterGlyphCacheKey
/* Represents one texture that will be used to store glyphs. The /* Represents one texture that will be used to store glyphs. The
texture is divided into horizontal bands which all contain glyphs texture is divided into horizontal bands which all contain glyphs
of approximatly the same height */ of approximatly the same height */
struct _PangoClutterGlyphCacheTexture struct _CoglPangoGlyphCacheTexture
{ {
/* The width and height of the texture which should always be a /* The width and height of the texture which should always be a
power of two. This can vary so that glyphs larger than power of two. This can vary so that glyphs larger than
@ -81,12 +79,12 @@ struct _PangoClutterGlyphCacheTexture
/* The actual texture */ /* The actual texture */
CoglHandle texture; CoglHandle texture;
PangoClutterGlyphCacheTexture *next; CoglPangoGlyphCacheTexture *next;
}; };
/* Represents one horizontal band of a texture. Each band contains /* Represents one horizontal band of a texture. Each band contains
glyphs of a similar height */ glyphs of a similar height */
struct _PangoClutterGlyphCacheBand struct _CoglPangoGlyphCacheBand
{ {
/* The y position of the top of the band */ /* The y position of the top of the band */
int top; int top;
@ -104,28 +102,28 @@ struct _PangoClutterGlyphCacheBand
/* The texture containing this band */ /* The texture containing this band */
CoglHandle texture; CoglHandle texture;
PangoClutterGlyphCacheBand *next; CoglPangoGlyphCacheBand *next;
}; };
static void static void
pango_clutter_glyph_cache_value_free (PangoClutterGlyphCacheValue *value) cogl_pango_glyph_cache_value_free (CoglPangoGlyphCacheValue *value)
{ {
cogl_texture_unref (value->texture); cogl_texture_unref (value->texture);
g_slice_free (PangoClutterGlyphCacheValue, value); g_slice_free (CoglPangoGlyphCacheValue, value);
} }
static void static void
pango_clutter_glyph_cache_key_free (PangoClutterGlyphCacheKey *key) cogl_pango_glyph_cache_key_free (CoglPangoGlyphCacheKey *key)
{ {
g_object_unref (key->font); g_object_unref (key->font);
g_slice_free (PangoClutterGlyphCacheKey, key); g_slice_free (CoglPangoGlyphCacheKey, key);
} }
static guint static guint
pango_clutter_glyph_cache_hash_func (gconstpointer key) cogl_pango_glyph_cache_hash_func (gconstpointer key)
{ {
const PangoClutterGlyphCacheKey *cache_key const CoglPangoGlyphCacheKey *cache_key
= (const PangoClutterGlyphCacheKey *) key; = (const CoglPangoGlyphCacheKey *) key;
/* Generate a number affected by both the font and the glyph /* Generate a number affected by both the font and the glyph
number. We can safely directly compare the pointers because the number. We can safely directly compare the pointers because the
@ -135,13 +133,13 @@ pango_clutter_glyph_cache_hash_func (gconstpointer key)
} }
static gboolean static gboolean
pango_clutter_glyph_cache_equal_func (gconstpointer a, cogl_pango_glyph_cache_equal_func (gconstpointer a,
gconstpointer b) gconstpointer b)
{ {
const PangoClutterGlyphCacheKey *key_a const CoglPangoGlyphCacheKey *key_a
= (const PangoClutterGlyphCacheKey *) a; = (const CoglPangoGlyphCacheKey *) a;
const PangoClutterGlyphCacheKey *key_b const CoglPangoGlyphCacheKey *key_b
= (const PangoClutterGlyphCacheKey *) b; = (const CoglPangoGlyphCacheKey *) b;
/* We can safely directly compare the pointers for the fonts because /* We can safely directly compare the pointers for the fonts because
the key holds a reference to the font so it is not possible that the key holds a reference to the font so it is not possible that
@ -151,45 +149,45 @@ pango_clutter_glyph_cache_equal_func (gconstpointer a,
} }
static void static void
pango_clutter_glyph_cache_free_textures (PangoClutterGlyphCacheTexture *node) cogl_pango_glyph_cache_free_textures (CoglPangoGlyphCacheTexture *node)
{ {
PangoClutterGlyphCacheTexture *next; CoglPangoGlyphCacheTexture *next;
while (node) while (node)
{ {
next = node->next; next = node->next;
cogl_texture_unref (node->texture); cogl_texture_unref (node->texture);
g_slice_free (PangoClutterGlyphCacheTexture, node); g_slice_free (CoglPangoGlyphCacheTexture, node);
node = next; node = next;
} }
} }
static void static void
pango_clutter_glyph_cache_free_bands (PangoClutterGlyphCacheBand *node) cogl_pango_glyph_cache_free_bands (CoglPangoGlyphCacheBand *node)
{ {
PangoClutterGlyphCacheBand *next; CoglPangoGlyphCacheBand *next;
while (node) while (node)
{ {
next = node->next; next = node->next;
cogl_texture_unref (node->texture); cogl_texture_unref (node->texture);
g_slice_free (PangoClutterGlyphCacheBand, node); g_slice_free (CoglPangoGlyphCacheBand, node);
node = next; node = next;
} }
} }
PangoClutterGlyphCache * CoglPangoGlyphCache *
pango_clutter_glyph_cache_new (gboolean use_mipmapping) cogl_pango_glyph_cache_new (gboolean use_mipmapping)
{ {
PangoClutterGlyphCache *cache; CoglPangoGlyphCache *cache;
cache = g_malloc (sizeof (PangoClutterGlyphCache)); cache = g_malloc (sizeof (CoglPangoGlyphCache));
cache->hash_table = g_hash_table_new_full cache->hash_table = g_hash_table_new_full
(pango_clutter_glyph_cache_hash_func, (cogl_pango_glyph_cache_hash_func,
pango_clutter_glyph_cache_equal_func, cogl_pango_glyph_cache_equal_func,
(GDestroyNotify) pango_clutter_glyph_cache_key_free, (GDestroyNotify) cogl_pango_glyph_cache_key_free,
(GDestroyNotify) pango_clutter_glyph_cache_value_free); (GDestroyNotify) cogl_pango_glyph_cache_value_free);
cache->textures = NULL; cache->textures = NULL;
cache->bands = NULL; cache->bands = NULL;
@ -199,42 +197,42 @@ pango_clutter_glyph_cache_new (gboolean use_mipmapping)
} }
void void
pango_clutter_glyph_cache_clear (PangoClutterGlyphCache *cache) cogl_pango_glyph_cache_clear (CoglPangoGlyphCache *cache)
{ {
pango_clutter_glyph_cache_free_textures (cache->textures); cogl_pango_glyph_cache_free_textures (cache->textures);
cache->textures = NULL; cache->textures = NULL;
pango_clutter_glyph_cache_free_bands (cache->bands); cogl_pango_glyph_cache_free_bands (cache->bands);
cache->bands = NULL; cache->bands = NULL;
g_hash_table_remove_all (cache->hash_table); g_hash_table_remove_all (cache->hash_table);
} }
void void
pango_clutter_glyph_cache_free (PangoClutterGlyphCache *cache) cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache)
{ {
pango_clutter_glyph_cache_clear (cache); cogl_pango_glyph_cache_clear (cache);
g_hash_table_unref (cache->hash_table); g_hash_table_unref (cache->hash_table);
g_free (cache); g_free (cache);
} }
PangoClutterGlyphCacheValue * CoglPangoGlyphCacheValue *
pango_clutter_glyph_cache_lookup (PangoClutterGlyphCache *cache, cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
PangoFont *font, PangoFont *font,
PangoGlyph glyph) PangoGlyph glyph)
{ {
PangoClutterGlyphCacheKey key; CoglPangoGlyphCacheKey key;
key.font = font; key.font = font;
key.glyph = glyph; key.glyph = glyph;
return (PangoClutterGlyphCacheValue *) return (CoglPangoGlyphCacheValue *)
g_hash_table_lookup (cache->hash_table, &key); g_hash_table_lookup (cache->hash_table, &key);
} }
PangoClutterGlyphCacheValue * CoglPangoGlyphCacheValue *
pango_clutter_glyph_cache_set (PangoClutterGlyphCache *cache, cogl_pango_glyph_cache_set (CoglPangoGlyphCache *cache,
PangoFont *font, PangoFont *font,
PangoGlyph glyph, PangoGlyph glyph,
gconstpointer pixels, gconstpointer pixels,
@ -245,9 +243,9 @@ pango_clutter_glyph_cache_set (PangoClutterGlyphCache *cache,
int draw_y) int draw_y)
{ {
int band_height; int band_height;
PangoClutterGlyphCacheBand *band; CoglPangoGlyphCacheBand *band;
PangoClutterGlyphCacheKey *key; CoglPangoGlyphCacheKey *key;
PangoClutterGlyphCacheValue *value; CoglPangoGlyphCacheValue *value;
/* Reserve an extra pixel gap around the glyph so that it can pull /* Reserve an extra pixel gap around the glyph so that it can pull
in blank pixels when linear filtering is enabled */ in blank pixels when linear filtering is enabled */
@ -264,7 +262,7 @@ pango_clutter_glyph_cache_set (PangoClutterGlyphCache *cache,
band = band->next); band = band->next);
if (band == NULL) if (band == NULL)
{ {
PangoClutterGlyphCacheTexture *texture; CoglPangoGlyphCacheTexture *texture;
/* Look for a texture with enough vertical space left for a band /* Look for a texture with enough vertical space left for a band
with this height */ with this height */
@ -279,7 +277,7 @@ pango_clutter_glyph_cache_set (PangoClutterGlyphCache *cache,
/* Allocate a new texture that is the nearest power of two /* Allocate a new texture that is the nearest power of two
greater than the band height or the minimum size, greater than the band height or the minimum size,
whichever is lower */ whichever is lower */
texture = g_slice_new (PangoClutterGlyphCacheTexture); texture = g_slice_new (CoglPangoGlyphCacheTexture);
texture->texture_size = MIN_TEXTURE_SIZE; texture->texture_size = MIN_TEXTURE_SIZE;
while (texture->texture_size < band_height while (texture->texture_size < band_height
@ -312,7 +310,7 @@ pango_clutter_glyph_cache_set (PangoClutterGlyphCache *cache,
CGL_LINEAR); CGL_LINEAR);
} }
band = g_slice_new (PangoClutterGlyphCacheBand); band = g_slice_new (CoglPangoGlyphCacheBand);
band->top = texture->texture_size - texture->space_remaining; band->top = texture->texture_size - texture->space_remaining;
band->height = band_height; band->height = band_height;
band->space_remaining = texture->texture_size; band->space_remaining = texture->texture_size;
@ -338,11 +336,11 @@ pango_clutter_glyph_cache_set (PangoClutterGlyphCache *cache,
stride, stride,
pixels); pixels);
key = g_slice_new (PangoClutterGlyphCacheKey); key = g_slice_new (CoglPangoGlyphCacheKey);
key->font = g_object_ref (font); key->font = g_object_ref (font);
key->glyph = glyph; key->glyph = glyph;
value = g_slice_new (PangoClutterGlyphCacheValue); value = g_slice_new (CoglPangoGlyphCacheValue);
value->texture = cogl_texture_ref (band->texture); value->texture = cogl_texture_ref (band->texture);
value->tx1 = COGL_FIXED_FROM_INT (band->space_remaining) value->tx1 = COGL_FIXED_FROM_INT (band->space_remaining)
/ band->texture_size; / band->texture_size;

View File

@ -0,0 +1,78 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
*
* 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 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/>.
*/
#ifndef __COGL_PANGO_GLYPH_CACHE_H__
#define __COGL_PANGO_GLYPH_CACHE_H__
#include <glib.h>
#include <cogl/cogl.h>
#include <pango/pango-font.h>
G_BEGIN_DECLS
typedef struct _CoglPangoGlyphCache CoglPangoGlyphCache;
typedef struct _CoglPangoGlyphCacheValue CoglPangoGlyphCacheValue;
struct _CoglPangoGlyphCacheValue
{
CoglHandle texture;
CoglFixed tx1;
CoglFixed ty1;
CoglFixed tx2;
CoglFixed ty2;
int draw_x;
int draw_y;
int draw_width;
int draw_height;
};
CoglPangoGlyphCache *
cogl_pango_glyph_cache_new (gboolean use_mipmapping);
void
cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache);
CoglPangoGlyphCacheValue *
cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
PangoFont *font,
PangoGlyph glyph);
CoglPangoGlyphCacheValue *
cogl_pango_glyph_cache_set (CoglPangoGlyphCache *cache,
PangoFont *font,
PangoGlyph glyph,
gconstpointer pixels,
int width,
int height,
int stride,
int draw_x,
int draw_y);
void
cogl_pango_glyph_cache_clear (CoglPangoGlyphCache *cache);
G_END_DECLS
#endif /* __COGL_PANGO_GLYPH_CACHE_H__ */

View File

@ -18,26 +18,21 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the * License along with this library. If not, see <http://www.gnu.org/licenses/>.
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/ */
#ifndef _HAVE_PANGO_CLUTTER_PRIVATE_H #ifndef __COGL_PANGO_PRIVATE_H__
#define _HAVE_PANGO_CLUTTER_PRIVATE_H #define __COGL_PANGO_PRIVATE_H__
#include "pangoclutter.h" #include "cogl-pango.h"
G_BEGIN_DECLS G_BEGIN_DECLS
PangoRenderer *_pango_clutter_font_map_get_renderer (PangoClutterFontMap *fm); void _cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer);
void _cogl_pango_renderer_set_use_mipmapping (CoglPangoRenderer *renderer,
void _pango_clutter_renderer_clear_glyph_cache (PangoClutterRenderer *renderer);
void _pango_clutter_renderer_set_use_mipmapping (PangoClutterRenderer *renderer,
gboolean value); gboolean value);
gboolean _pango_clutter_renderer_get_use_mipmapping (PangoClutterRenderer *renderer); gboolean _cogl_pango_renderer_get_use_mipmapping (CoglPangoRenderer *renderer);
G_END_DECLS G_END_DECLS
#endif /* _HAVE_PANGO_CLUTTER_H */ #endif /* __COGL_PANGO_PRIVATE_H__ */

View File

@ -18,9 +18,7 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the * License along with this library. If not, see <http://www.gnu.org/licenses/>.
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -36,13 +34,11 @@
#include <pango/pango-renderer.h> #include <pango/pango-renderer.h>
#include <cairo.h> #include <cairo.h>
#include "pangoclutter.h" #include "cogl-pango-private.h"
#include "pangoclutter-private.h" #include "cogl-pango-glyph-cache.h"
#include "pangoclutter-glyph-cache.h"
#include "../clutter-debug.h" #include "../clutter-debug.h"
#include "cogl/cogl.h"
struct _PangoClutterRenderer struct _CoglPangoRenderer
{ {
PangoRenderer parent_instance; PangoRenderer parent_instance;
@ -51,32 +47,32 @@ struct _PangoClutterRenderer
/* Two caches of glyphs as textures, one with mipmapped textures and /* Two caches of glyphs as textures, one with mipmapped textures and
one without */ one without */
PangoClutterGlyphCache *glyph_cache; CoglPangoGlyphCache *glyph_cache;
PangoClutterGlyphCache *mipmapped_glyph_cache; CoglPangoGlyphCache *mipmapped_glyph_cache;
gboolean use_mipmapping; gboolean use_mipmapping;
}; };
struct _PangoClutterRendererClass struct _CoglPangoRendererClass
{ {
PangoRendererClass class_instance; PangoRendererClass class_instance;
}; };
#define CLUTTER_PANGO_UNIT_TO_FIXED(x) ((x) << (CFX_Q - 10)) #define COGL_PANGO_UNIT_TO_FIXED(x) ((x) << (COGL_FIXED_Q - 10))
static void pango_clutter_renderer_finalize (GObject *object); static void cogl_pango_renderer_finalize (GObject *object);
static void pango_clutter_renderer_draw_glyphs (PangoRenderer *renderer, static void cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
PangoFont *font, PangoFont *font,
PangoGlyphString *glyphs, PangoGlyphString *glyphs,
int x, int x,
int y); int y);
static void pango_clutter_renderer_draw_rectangle (PangoRenderer *renderer, static void cogl_pango_renderer_draw_rectangle (PangoRenderer *renderer,
PangoRenderPart part, PangoRenderPart part,
int x, int x,
int y, int y,
int width, int width,
int height); int height);
static void pango_clutter_renderer_draw_trapezoid (PangoRenderer *renderer, static void cogl_pango_renderer_draw_trapezoid (PangoRenderer *renderer,
PangoRenderPart part, PangoRenderPart part,
double y1, double y1,
double x11, double x11,
@ -87,79 +83,75 @@ static void pango_clutter_renderer_draw_trapezoid (PangoRenderer *renderer,
static GObjectClass *parent_class = NULL; static GObjectClass *parent_class = NULL;
G_DEFINE_TYPE (PangoClutterRenderer, pango_clutter_renderer, G_DEFINE_TYPE (CoglPangoRenderer, cogl_pango_renderer,
PANGO_TYPE_RENDERER); PANGO_TYPE_RENDERER);
static void static void
pango_clutter_renderer_init (PangoClutterRenderer *priv) cogl_pango_renderer_init (CoglPangoRenderer *priv)
{ {
priv->glyph_cache = pango_clutter_glyph_cache_new (FALSE); priv->glyph_cache = cogl_pango_glyph_cache_new (FALSE);
priv->mipmapped_glyph_cache = pango_clutter_glyph_cache_new (TRUE); priv->mipmapped_glyph_cache = cogl_pango_glyph_cache_new (TRUE);
priv->use_mipmapping = FALSE; priv->use_mipmapping = FALSE;
} }
static void static void
pango_clutter_renderer_class_init (PangoClutterRendererClass *klass) cogl_pango_renderer_class_init (CoglPangoRendererClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
PangoRendererClass *renderer_class = PANGO_RENDERER_CLASS (klass); PangoRendererClass *renderer_class = PANGO_RENDERER_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
object_class->finalize = pango_clutter_renderer_finalize; object_class->finalize = cogl_pango_renderer_finalize;
renderer_class->draw_glyphs = pango_clutter_renderer_draw_glyphs; renderer_class->draw_glyphs = cogl_pango_renderer_draw_glyphs;
renderer_class->draw_rectangle = pango_clutter_renderer_draw_rectangle; renderer_class->draw_rectangle = cogl_pango_renderer_draw_rectangle;
renderer_class->draw_trapezoid = pango_clutter_renderer_draw_trapezoid; renderer_class->draw_trapezoid = cogl_pango_renderer_draw_trapezoid;
} }
static void static void
pango_clutter_renderer_finalize (GObject *object) cogl_pango_renderer_finalize (GObject *object)
{ {
PangoClutterRenderer *priv = PANGO_CLUTTER_RENDERER (object); CoglPangoRenderer *priv = COGL_PANGO_RENDERER (object);
pango_clutter_glyph_cache_free (priv->mipmapped_glyph_cache); cogl_pango_glyph_cache_free (priv->mipmapped_glyph_cache);
pango_clutter_glyph_cache_free (priv->glyph_cache); cogl_pango_glyph_cache_free (priv->glyph_cache);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
void void
pango_clutter_render_layout_subpixel (PangoLayout *layout, cogl_pango_render_layout_subpixel (PangoLayout *layout,
int x, int x,
int y, int y,
ClutterColor *color, const CoglColor *color,
int flags) int flags)
{ {
PangoContext *context; PangoContext *context;
PangoFontMap *font_map; PangoFontMap *font_map;
PangoRenderer *renderer; PangoRenderer *renderer;
PangoClutterRenderer *priv; CoglPangoRenderer *priv;
context = pango_layout_get_context (layout); context = pango_layout_get_context (layout);
font_map = pango_context_get_font_map (context); font_map = pango_context_get_font_map (context);
g_return_if_fail (PANGO_CLUTTER_IS_FONT_MAP (font_map)); g_return_if_fail (COGL_PANGO_IS_FONT_MAP (font_map));
renderer = _pango_clutter_font_map_get_renderer renderer = cogl_pango_font_map_get_renderer
(PANGO_CLUTTER_FONT_MAP (font_map)); (COGL_PANGO_FONT_MAP (font_map));
priv = PANGO_CLUTTER_RENDERER (renderer); priv = COGL_PANGO_RENDERER (renderer);
cogl_color_set_from_4ub (&priv->color, priv->color = *color;
color->red,
color->green,
color->blue,
color->alpha);
pango_renderer_draw_layout (renderer, layout, x, y); pango_renderer_draw_layout (renderer, layout, x, y);
} }
void void
pango_clutter_render_layout (PangoLayout *layout, cogl_pango_render_layout (PangoLayout *layout,
int x, int x,
int y, int y,
ClutterColor *color, const CoglColor *color,
int flags) int flags)
{ {
pango_clutter_render_layout_subpixel (layout, cogl_pango_render_layout_subpixel (layout,
x * PANGO_SCALE, x * PANGO_SCALE,
y * PANGO_SCALE, y * PANGO_SCALE,
color, color,
@ -167,65 +159,61 @@ pango_clutter_render_layout (PangoLayout *layout,
} }
void void
pango_clutter_render_layout_line (PangoLayoutLine *line, cogl_pango_render_layout_line (PangoLayoutLine *line,
int x, int x,
int y, int y,
ClutterColor *color) const CoglColor *color)
{ {
PangoContext *context; PangoContext *context;
PangoFontMap *font_map; PangoFontMap *font_map;
PangoRenderer *renderer; PangoRenderer *renderer;
PangoClutterRenderer *priv; CoglPangoRenderer *priv;
context = pango_layout_get_context (line->layout); context = pango_layout_get_context (line->layout);
font_map = pango_context_get_font_map (context); font_map = pango_context_get_font_map (context);
g_return_if_fail (PANGO_CLUTTER_IS_FONT_MAP (font_map)); g_return_if_fail (COGL_PANGO_IS_FONT_MAP (font_map));
renderer = _pango_clutter_font_map_get_renderer renderer = cogl_pango_font_map_get_renderer
(PANGO_CLUTTER_FONT_MAP (font_map)); (COGL_PANGO_FONT_MAP (font_map));
priv = PANGO_CLUTTER_RENDERER (renderer); priv = COGL_PANGO_RENDERER (renderer);
cogl_color_set_from_4ub (&priv->color, priv->color = *color;
color->red,
color->green,
color->blue,
color->alpha);
pango_renderer_draw_layout_line (renderer, line, x, y); pango_renderer_draw_layout_line (renderer, line, x, y);
} }
void void
_pango_clutter_renderer_clear_glyph_cache (PangoClutterRenderer *renderer) _cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer)
{ {
pango_clutter_glyph_cache_clear (renderer->glyph_cache); cogl_pango_glyph_cache_clear (renderer->glyph_cache);
pango_clutter_glyph_cache_clear (renderer->mipmapped_glyph_cache); cogl_pango_glyph_cache_clear (renderer->mipmapped_glyph_cache);
} }
void void
_pango_clutter_renderer_set_use_mipmapping (PangoClutterRenderer *renderer, _cogl_pango_renderer_set_use_mipmapping (CoglPangoRenderer *renderer,
gboolean value) gboolean value)
{ {
renderer->use_mipmapping = value; renderer->use_mipmapping = value;
} }
gboolean gboolean
_pango_clutter_renderer_get_use_mipmapping (PangoClutterRenderer *renderer) _cogl_pango_renderer_get_use_mipmapping (CoglPangoRenderer *renderer)
{ {
return renderer->use_mipmapping; return renderer->use_mipmapping;
} }
static PangoClutterGlyphCacheValue * static CoglPangoGlyphCacheValue *
pango_clutter_renderer_get_cached_glyph (PangoRenderer *renderer, cogl_pango_renderer_get_cached_glyph (PangoRenderer *renderer,
PangoFont *font, PangoFont *font,
PangoGlyph glyph) PangoGlyph glyph)
{ {
PangoClutterRenderer *priv = PANGO_CLUTTER_RENDERER (renderer); CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
PangoClutterGlyphCacheValue *value; CoglPangoGlyphCacheValue *value;
PangoClutterGlyphCache *glyph_cache; CoglPangoGlyphCache *glyph_cache;
glyph_cache = priv->use_mipmapping glyph_cache = priv->use_mipmapping
? priv->mipmapped_glyph_cache : priv->glyph_cache; ? priv->mipmapped_glyph_cache : priv->glyph_cache;
if ((value = pango_clutter_glyph_cache_lookup (glyph_cache, if ((value = cogl_pango_glyph_cache_lookup (glyph_cache,
font, font,
glyph)) == NULL) glyph)) == NULL)
{ {
@ -257,7 +245,7 @@ pango_clutter_renderer_get_cached_glyph (PangoRenderer *renderer,
cairo_surface_flush (surface); cairo_surface_flush (surface);
/* Copy the glyph to the cache */ /* Copy the glyph to the cache */
value = pango_clutter_glyph_cache_set value = cogl_pango_glyph_cache_set
(glyph_cache, font, glyph, (glyph_cache, font, glyph,
cairo_image_surface_get_data (surface), cairo_image_surface_get_data (surface),
cairo_image_surface_get_width (surface), cairo_image_surface_get_width (surface),
@ -276,7 +264,7 @@ pango_clutter_renderer_get_cached_glyph (PangoRenderer *renderer,
} }
void void
pango_clutter_ensure_glyph_cache_for_layout (PangoLayout *layout) cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout)
{ {
PangoContext *context; PangoContext *context;
PangoFontMap *fontmap; PangoFontMap *fontmap;
@ -287,9 +275,9 @@ pango_clutter_ensure_glyph_cache_for_layout (PangoLayout *layout)
context = pango_layout_get_context (layout); context = pango_layout_get_context (layout);
fontmap = pango_context_get_font_map (context); fontmap = pango_context_get_font_map (context);
g_return_if_fail (PANGO_CLUTTER_IS_FONT_MAP (fontmap)); g_return_if_fail (COGL_PANGO_IS_FONT_MAP (fontmap));
renderer = _pango_clutter_font_map_get_renderer renderer = cogl_pango_font_map_get_renderer
(PANGO_CLUTTER_FONT_MAP (fontmap)); (COGL_PANGO_FONT_MAP (fontmap));
if ((iter = pango_layout_get_iter (layout)) == NULL) if ((iter = pango_layout_get_iter (layout)) == NULL)
return; return;
@ -311,7 +299,7 @@ pango_clutter_ensure_glyph_cache_for_layout (PangoLayout *layout)
{ {
PangoGlyphInfo *gi = &glyphs->glyphs[i]; PangoGlyphInfo *gi = &glyphs->glyphs[i];
pango_clutter_renderer_get_cached_glyph (renderer, cogl_pango_renderer_get_cached_glyph (renderer,
run->item->analysis.font, run->item->analysis.font,
gi->glyph); gi->glyph);
} }
@ -323,84 +311,84 @@ pango_clutter_ensure_glyph_cache_for_layout (PangoLayout *layout)
} }
static void static void
pango_clutter_renderer_set_color_for_part (PangoRenderer *renderer, cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
PangoRenderPart part) PangoRenderPart part)
{ {
PangoColor *pango_color = pango_renderer_get_color (renderer, part); PangoColor *pango_color = pango_renderer_get_color (renderer, part);
PangoClutterRenderer *priv = PANGO_CLUTTER_RENDERER (renderer); CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
CoglColor clutter_color; CoglColor color;
if (pango_color) if (pango_color)
{ {
cogl_color_set_from_4ub (&clutter_color, cogl_color_set_from_4ub (&color,
pango_color->red >> 8, pango_color->red >> 8,
pango_color->green >> 8, pango_color->green >> 8,
pango_color->blue >> 8, pango_color->blue >> 8,
cogl_color_get_alpha_byte (&priv->color)); cogl_color_get_alpha_byte (&priv->color));
} }
else else
clutter_color = priv->color; color = priv->color;
cogl_color (&clutter_color); cogl_color (&color);
} }
static void static void
pango_clutter_renderer_draw_box (int x, int y, cogl_pango_renderer_draw_box (int x, int y,
int width, int height) int width, int height)
{ {
cogl_path_rectangle (CLUTTER_INT_TO_FIXED (x), cogl_path_rectangle (COGL_FIXED_FROM_INT (x),
CLUTTER_INT_TO_FIXED (y - height), COGL_FIXED_FROM_INT (y - height),
CLUTTER_INT_TO_FIXED (width), COGL_FIXED_FROM_INT (width),
CLUTTER_INT_TO_FIXED (height)); COGL_FIXED_FROM_INT (height));
cogl_path_stroke (); cogl_path_stroke ();
} }
static void static void
pango_clutter_renderer_get_device_units (PangoRenderer *renderer, cogl_pango_renderer_get_device_units (PangoRenderer *renderer,
int xin, int xin,
int yin, int yin,
ClutterFixed *xout, CoglFixed *xout,
ClutterFixed *yout) CoglFixed *yout)
{ {
const PangoMatrix *matrix; const PangoMatrix *matrix;
if ((matrix = pango_renderer_get_matrix (renderer))) if ((matrix = pango_renderer_get_matrix (renderer)))
{ {
/* Convert user-space coords to device coords */ /* Convert user-space coords to device coords */
*xout = CLUTTER_FLOAT_TO_FIXED ((xin * matrix->xx + yin * matrix->xy) *xout = COGL_FIXED_FROM_FLOAT ((xin * matrix->xx + yin * matrix->xy)
/ PANGO_SCALE + matrix->x0); / PANGO_SCALE + matrix->x0);
*yout = CLUTTER_FLOAT_TO_FIXED ((yin * matrix->yy + xin * matrix->yx) *yout = COGL_FIXED_FROM_FLOAT ((yin * matrix->yy + xin * matrix->yx)
/ PANGO_SCALE + matrix->y0); / PANGO_SCALE + matrix->y0);
} }
else else
{ {
*xout = CLUTTER_PANGO_UNIT_TO_FIXED (xin); *xout = COGL_PANGO_UNIT_TO_FIXED (xin);
*yout = CLUTTER_PANGO_UNIT_TO_FIXED (yin); *yout = COGL_PANGO_UNIT_TO_FIXED (yin);
} }
} }
static void static void
pango_clutter_renderer_draw_rectangle (PangoRenderer *renderer, cogl_pango_renderer_draw_rectangle (PangoRenderer *renderer,
PangoRenderPart part, PangoRenderPart part,
int x, int x,
int y, int y,
int width, int width,
int height) int height)
{ {
ClutterFixed x1, x2, y1, y2; CoglFixed x1, x2, y1, y2;
pango_clutter_renderer_set_color_for_part (renderer, part); cogl_pango_renderer_set_color_for_part (renderer, part);
pango_clutter_renderer_get_device_units (renderer, x, y, cogl_pango_renderer_get_device_units (renderer, x, y,
&x1, &y1); &x1, &y1);
pango_clutter_renderer_get_device_units (renderer, x + width, y + height, cogl_pango_renderer_get_device_units (renderer, x + width, y + height,
&x2, &y2); &x2, &y2);
cogl_rectanglex (x1, y1, x2 - x1, y2 - y1); cogl_rectanglex (x1, y1, x2 - x1, y2 - y1);
} }
static void static void
pango_clutter_renderer_draw_trapezoid (PangoRenderer *renderer, cogl_pango_renderer_draw_trapezoid (PangoRenderer *renderer,
PangoRenderPart part, PangoRenderPart part,
double y1, double y1,
double x11, double x11,
@ -409,41 +397,42 @@ pango_clutter_renderer_draw_trapezoid (PangoRenderer *renderer,
double x12, double x12,
double x22) double x22)
{ {
ClutterFixed points[8]; CoglFixed points[8];
points[0] = CLUTTER_FLOAT_TO_FIXED (x11); points[0] = COGL_FIXED_FROM_FLOAT (x11);
points[1] = CLUTTER_FLOAT_TO_FIXED (y1); points[1] = COGL_FIXED_FROM_FLOAT (y1);
points[2] = CLUTTER_FLOAT_TO_FIXED (x12); points[2] = COGL_FIXED_FROM_FLOAT (x12);
points[3] = CLUTTER_FLOAT_TO_FIXED (y2); points[3] = COGL_FIXED_FROM_FLOAT (y2);
points[4] = CLUTTER_FLOAT_TO_FIXED (x22); points[4] = COGL_FIXED_FROM_FLOAT (x22);
points[5] = points[3]; points[5] = points[3];
points[6] = CLUTTER_FLOAT_TO_FIXED (x21); points[6] = COGL_FIXED_FROM_FLOAT (x21);
points[7] = points[1]; points[7] = points[1];
pango_clutter_renderer_set_color_for_part (renderer, part); cogl_pango_renderer_set_color_for_part (renderer, part);
cogl_path_polygon (points, 4); cogl_path_polygon (points, 4);
cogl_path_fill (); cogl_path_fill ();
} }
static void static void
pango_clutter_renderer_draw_glyphs (PangoRenderer *renderer, cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
PangoFont *font, PangoFont *font,
PangoGlyphString *glyphs, PangoGlyphString *glyphs,
int xi, int xi,
int yi) int yi)
{ {
PangoClutterGlyphCacheValue *cache_value; CoglPangoGlyphCacheValue *cache_value;
int i; int i;
pango_clutter_renderer_set_color_for_part (renderer, cogl_pango_renderer_set_color_for_part (renderer,
PANGO_RENDER_PART_FOREGROUND); PANGO_RENDER_PART_FOREGROUND);
for (i = 0; i < glyphs->num_glyphs; i++) for (i = 0; i < glyphs->num_glyphs; i++)
{ {
PangoGlyphInfo *gi = glyphs->glyphs + i; PangoGlyphInfo *gi = glyphs->glyphs + i;
ClutterFixed x, y; CoglFixed x, y;
pango_clutter_renderer_get_device_units (renderer, cogl_pango_renderer_get_device_units (renderer,
xi + gi->geometry.x_offset, xi + gi->geometry.x_offset,
yi + gi->geometry.y_offset, yi + gi->geometry.y_offset,
&x, &y); &x, &y);
@ -452,16 +441,18 @@ pango_clutter_renderer_draw_glyphs (PangoRenderer *renderer,
{ {
PangoFontMetrics *metrics; PangoFontMetrics *metrics;
if (font == NULL if (font == NULL ||
|| (metrics = pango_font_get_metrics (font, NULL)) == NULL) (metrics = pango_font_get_metrics (font, NULL)) == NULL)
pango_clutter_renderer_draw_box (CLUTTER_FIXED_TO_INT (x), {
CLUTTER_FIXED_TO_INT (y), cogl_pango_renderer_draw_box (COGL_FIXED_TO_INT (x),
COGL_FIXED_TO_INT (y),
PANGO_UNKNOWN_GLYPH_WIDTH, PANGO_UNKNOWN_GLYPH_WIDTH,
PANGO_UNKNOWN_GLYPH_HEIGHT); PANGO_UNKNOWN_GLYPH_HEIGHT);
}
else else
{ {
pango_clutter_renderer_draw_box (CLUTTER_FIXED_TO_INT (x), cogl_pango_renderer_draw_box (COGL_FIXED_TO_INT (x),
CLUTTER_FIXED_TO_INT (y), COGL_FIXED_TO_INT (y),
metrics->approximate_char_width metrics->approximate_char_width
/ PANGO_SCALE, / PANGO_SCALE,
metrics->ascent / PANGO_SCALE); metrics->ascent / PANGO_SCALE);
@ -473,26 +464,30 @@ pango_clutter_renderer_draw_glyphs (PangoRenderer *renderer,
{ {
/* Get the texture containing the glyph. This will create /* Get the texture containing the glyph. This will create
the cache entry if there isn't already one */ the cache entry if there isn't already one */
cache_value cache_value =
= pango_clutter_renderer_get_cached_glyph (renderer, font, cogl_pango_renderer_get_cached_glyph (renderer,
font,
gi->glyph); gi->glyph);
if (cache_value == NULL) if (cache_value == NULL)
pango_clutter_renderer_draw_box (CLUTTER_FIXED_TO_INT (x), cogl_pango_renderer_draw_box (COGL_FIXED_TO_INT (x),
CLUTTER_FIXED_TO_INT (y), COGL_FIXED_TO_INT (y),
PANGO_UNKNOWN_GLYPH_WIDTH, PANGO_UNKNOWN_GLYPH_WIDTH,
PANGO_UNKNOWN_GLYPH_HEIGHT); PANGO_UNKNOWN_GLYPH_HEIGHT);
else else
{ {
x += CLUTTER_INT_TO_FIXED (cache_value->draw_x); CoglFixed width, height;
y += CLUTTER_INT_TO_FIXED (cache_value->draw_y);
x += COGL_FIXED_FROM_INT (cache_value->draw_x);
y += COGL_FIXED_FROM_INT (cache_value->draw_y);
width = x + COGL_FIXED_FROM_INT (cache_value->draw_width);
height = y + COGL_FIXED_FROM_INT (cache_value->draw_height);
/* Render the glyph from the texture */ /* Render the glyph from the texture */
cogl_texture_rectangle (cache_value->texture, x, y, cogl_texture_rectangle (cache_value->texture,
x + CLUTTER_INT_TO_FIXED (cache_value x, y,
->draw_width), width, height,
y + CLUTTER_INT_TO_FIXED (cache_value
->draw_height),
cache_value->tx1, cache_value->ty1, cache_value->tx1, cache_value->ty1,
cache_value->tx2, cache_value->ty2); cache_value->tx2, cache_value->ty2);
} }

View File

@ -0,0 +1,84 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
*
* 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 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/>.
*/
#ifndef __PANGO_CLUTTER_H__
#define __PANGO_CLUTTER_H__
#include <glib-object.h>
#include <pango/pangocairo.h>
#include <cogl/cogl.h>
G_BEGIN_DECLS
/* It's too difficult to actually subclass the pango cairo font
* map. Instead we just make a fake set of macros that actually just
* directly use the original type
*/
#define COGL_PANGO_TYPE_FONT_MAP PANGO_TYPE_CAIRO_FONT_MAP
#define COGL_PANGO_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COGL_PANGO_TYPE_FONT_MAP, CoglPangoFontMap))
#define COGL_PANGO_IS_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COGL_PANGO_TYPE_FONT_MAP))
typedef PangoCairoFontMap CoglPangoFontMap;
PangoFontMap * cogl_pango_font_map_new (void);
PangoContext * cogl_pango_font_map_create_context (CoglPangoFontMap *fm);
void cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
double dpi);
void cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *fm);
void cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout);
void cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *fm,
gboolean value);
gboolean cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *fm);
PangoRenderer *cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm);
#define COGL_PANGO_TYPE_RENDERER (cogl_pango_renderer_get_type ())
#define COGL_PANGO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COGL_PANGO_TYPE_RENDERER, CoglPangoRenderer))
#define COGL_PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COGL_PANGO_TYPE_RENDERER, CoglPangoRendererClass))
#define COGL_PANGO_IS_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COGL_PANGO_TYPE_RENDERER))
#define COGL_PANGO_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COGL_PANGO_TYPE_RENDERER))
#define COGL_PANGO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), COGL_PANGO_TYPE_RENDERER, CoglPangoRendererClass))
/* opaque types */
typedef struct _CoglPangoRenderer CoglPangoRenderer;
typedef struct _CoglPangoRendererClass CoglPangoRendererClass;
GType cogl_pango_renderer_get_type (void) G_GNUC_CONST;
void cogl_pango_render_layout_subpixel (PangoLayout *layout,
int x,
int y,
const CoglColor *color,
int flags);
void cogl_pango_render_layout (PangoLayout *layout,
int x,
int y,
const CoglColor *color,
int flags);
void cogl_pango_render_layout_line (PangoLayoutLine *line,
int x,
int y,
const CoglColor *color);
G_END_DECLS
#endif /* __PANGO_CLUTTER_H__ */

View File

@ -1,69 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
*
* 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 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _HAVE_PANGO_CLUTTER_GLYPH_CACHE_H
#define _HAVE_PANGO_CLUTTER_GLYPH_CACHE_H
#include <glib.h>
#include <cogl/cogl.h>
#include <pango/pango-font.h>
G_BEGIN_DECLS
typedef struct _PangoClutterGlyphCache PangoClutterGlyphCache;
typedef struct _PangoClutterGlyphCacheValue PangoClutterGlyphCacheValue;
struct _PangoClutterGlyphCacheValue
{
CoglHandle texture;
CoglFixed tx1, ty1, tx2, ty2;
int draw_x, draw_y, draw_width, draw_height;
};
PangoClutterGlyphCache *pango_clutter_glyph_cache_new (gboolean use_mipmapping);
void pango_clutter_glyph_cache_free (PangoClutterGlyphCache *cache);
PangoClutterGlyphCacheValue *
pango_clutter_glyph_cache_lookup (PangoClutterGlyphCache *cache,
PangoFont *font,
PangoGlyph glyph);
PangoClutterGlyphCacheValue *
pango_clutter_glyph_cache_set (PangoClutterGlyphCache *cache,
PangoFont *font,
PangoGlyph glyph,
gconstpointer pixels,
int width,
int height,
int stride,
int draw_x,
int draw_y);
void pango_clutter_glyph_cache_clear (PangoClutterGlyphCache *cache);
G_END_DECLS
#endif /* _HAVE_PANGO_CLUTTER_GLYPH_CACHE_H */

View File

@ -1,110 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
*
* 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 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _HAVE_PANGO_CLUTTER_H
#define _HAVE_PANGO_CLUTTER_H
#include <glib-object.h>
#include <pango/pangocairo.h>
#include <clutter/clutter-color.h>
G_BEGIN_DECLS
/* It's too difficult to actually subclass the pango cairo font
map. Instead we just make a fake set of macros that actually just
directly use the original type */
#define PANGO_CLUTTER_TYPE_FONT_MAP PANGO_TYPE_CAIRO_FONT_MAP
#define PANGO_CLUTTER_FONT_MAP(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
PANGO_CLUTTER_TYPE_FONT_MAP, \
PangoClutterFontMap))
#define PANGO_CLUTTER_IS_FONT_MAP(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
PANGO_CLUTTER_TYPE_FONT_MAP))
typedef PangoCairoFontMap PangoClutterFontMap;
PangoFontMap *pango_clutter_font_map_new (void);
PangoContext *pango_clutter_font_map_create_context (PangoClutterFontMap *fm);
void pango_clutter_font_map_set_resolution (PangoClutterFontMap *font_map,
double dpi);
void pango_clutter_font_map_clear_glyph_cache (PangoClutterFontMap *fm);
void pango_clutter_font_map_set_use_mipmapping (PangoClutterFontMap *fm,
gboolean value);
gboolean pango_clutter_font_map_get_use_mipmapping (PangoClutterFontMap *fm);
void pango_clutter_ensure_glyph_cache_for_layout (PangoLayout *layout);
#define PANGO_CLUTTER_TYPE_RENDERER (pango_clutter_renderer_get_type ())
#define PANGO_CLUTTER_RENDERER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
PANGO_CLUTTER_TYPE_RENDERER, \
PangoClutterRenderer))
#define PANGO_CLUTTER_RENDERER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
PANGO_CLUTTER_TYPE_RENDERER, \
PangoClutterRendererClass))
#define PANGO_CLUTTER_IS_RENDERER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
PANGO_CLUTTER_TYPE_RENDERER))
#define PANGO_CLUTTER_IS_RENDERER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
PANGO_CLUTTER_TYPE_RENDERER))
#define PANGO_CLUTTER_RENDERER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
PANGO_CLUTTER_TYPE_RENDERER, \
PangoClutterRendererClass))
typedef struct _PangoClutterRenderer PangoClutterRenderer;
typedef struct _PangoClutterRendererClass PangoClutterRendererClass;
GType pango_clutter_renderer_get_type (void) G_GNUC_CONST;
void pango_clutter_render_layout_subpixel (PangoLayout *layout,
int x,
int y,
ClutterColor *color,
int flags);
void pango_clutter_render_layout (PangoLayout *layout,
int x,
int y,
ClutterColor *color,
int flags);
void pango_clutter_render_layout_line (PangoLayoutLine *line,
int x,
int y,
ClutterColor *color);
G_END_DECLS
#endif /* _HAVE_PANGO_CLUTTER_H */