summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-11-19 22:57:11 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-11-19 22:57:11 +0000
commit25eb23b0c27d6c447240fcf8505ad35a2a5a5d93 (patch)
tree52bcfb8069fb7bdfe31b0537da68f1f4338637ee
parentcb18309673f263d54eba9c312ab5802b4a6beb70 (diff)
downloadpango-25eb23b0c27d6c447240fcf8505ad35a2a5a5d93.tar.gz
Remove color_set() virtual function ... it's not absolutely necessary for
Fri Nov 19 17:44:33 2004 Owen Taylor <otaylor@redhat.com> * pango/pango-renderer.[ch]: Remove color_set() virtual function ... it's not absolutely necessary for chaining renderers, and it's not clear that chaining renderers is actually useful, anyways. * pango/pango-renderer.[ch] (pango_renderer_set_color): Constify color argument. * pango/pango-render.c: Fix various bugs. * pango/pango-attributes.[ch] (pango_attr_shape_new_with_data): Add the ability to create a shape attribute with user data. * pango/pango-renderer.[ch] (PangoRendererClass): Add a draw_shape virtual function, to draw content for PangoAttrShape. * pango/pangoxft-fontmap.c (pango_xft_shutdown_display): Add note to docs that XCloseDisplay() will automatically take care of releasing Pango's allocated resources for the display. * docs/Makefile.am (SCAN_OPTIONS): Add the appropriate --deprecated-guards option. * docs/tmpl/xft-fonts.sgml: Add long description. * docs/tmpl/x-fonts.sgml: Document as dead.
-rw-r--r--ChangeLog29
-rw-r--r--ChangeLog.pre-1-1029
-rw-r--r--ChangeLog.pre-1-829
-rw-r--r--docs/Makefile.am2
-rw-r--r--docs/pango-docs.sgml2
-rw-r--r--docs/pango-sections.txt3
-rw-r--r--docs/tmpl/text-attributes.sgml25
-rw-r--r--docs/tmpl/x-fonts.sgml11
-rw-r--r--docs/tmpl/xft-fonts.sgml29
-rw-r--r--pango/pango-attributes.c69
-rw-r--r--pango/pango-attributes.h16
-rw-r--r--pango/pango-renderer.c98
-rw-r--r--pango/pango-renderer.h25
-rw-r--r--pango/pango.def1
-rw-r--r--pango/pangoxft-fontmap.c4
-rw-r--r--pango/pangoxft-render.c3
-rw-r--r--pango/pangoxft-render.h6
17 files changed, 305 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index 937e541c..d84c2cc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+Fri Nov 19 17:44:33 2004 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-renderer.[ch]: Remove color_set() virtual
+ function ... it's not absolutely necessary for chaining
+ renderers, and it's not clear that chaining renderers
+ is actually useful, anyways.
+
+ * pango/pango-renderer.[ch] (pango_renderer_set_color): Constify
+ color argument.
+
+ * pango/pango-render.c: Fix various bugs.
+
+ * pango/pango-attributes.[ch] (pango_attr_shape_new_with_data):
+ Add the ability to create a shape attribute with user data.
+
+ * pango/pango-renderer.[ch] (PangoRendererClass): Add a draw_shape
+ virtual function, to draw content for PangoAttrShape.
+
+ * pango/pangoxft-fontmap.c (pango_xft_shutdown_display):
+ Add note to docs that XCloseDisplay() will automatically take care
+ of releasing Pango's allocated resources for the display.
+
+ * docs/Makefile.am (SCAN_OPTIONS): Add the appropriate
+ --deprecated-guards option.
+
+ * docs/tmpl/xft-fonts.sgml: Add long description.
+
+ * docs/tmpl/x-fonts.sgml: Document as dead.
+
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* docs/tmpl/text-attributes.sgml: Document PANGO_UNDERLINE_ERROR
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 937e541c..d84c2cc7 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,32 @@
+Fri Nov 19 17:44:33 2004 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-renderer.[ch]: Remove color_set() virtual
+ function ... it's not absolutely necessary for chaining
+ renderers, and it's not clear that chaining renderers
+ is actually useful, anyways.
+
+ * pango/pango-renderer.[ch] (pango_renderer_set_color): Constify
+ color argument.
+
+ * pango/pango-render.c: Fix various bugs.
+
+ * pango/pango-attributes.[ch] (pango_attr_shape_new_with_data):
+ Add the ability to create a shape attribute with user data.
+
+ * pango/pango-renderer.[ch] (PangoRendererClass): Add a draw_shape
+ virtual function, to draw content for PangoAttrShape.
+
+ * pango/pangoxft-fontmap.c (pango_xft_shutdown_display):
+ Add note to docs that XCloseDisplay() will automatically take care
+ of releasing Pango's allocated resources for the display.
+
+ * docs/Makefile.am (SCAN_OPTIONS): Add the appropriate
+ --deprecated-guards option.
+
+ * docs/tmpl/xft-fonts.sgml: Add long description.
+
+ * docs/tmpl/x-fonts.sgml: Document as dead.
+
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* docs/tmpl/text-attributes.sgml: Document PANGO_UNDERLINE_ERROR
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 937e541c..d84c2cc7 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,32 @@
+Fri Nov 19 17:44:33 2004 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-renderer.[ch]: Remove color_set() virtual
+ function ... it's not absolutely necessary for chaining
+ renderers, and it's not clear that chaining renderers
+ is actually useful, anyways.
+
+ * pango/pango-renderer.[ch] (pango_renderer_set_color): Constify
+ color argument.
+
+ * pango/pango-render.c: Fix various bugs.
+
+ * pango/pango-attributes.[ch] (pango_attr_shape_new_with_data):
+ Add the ability to create a shape attribute with user data.
+
+ * pango/pango-renderer.[ch] (PangoRendererClass): Add a draw_shape
+ virtual function, to draw content for PangoAttrShape.
+
+ * pango/pangoxft-fontmap.c (pango_xft_shutdown_display):
+ Add note to docs that XCloseDisplay() will automatically take care
+ of releasing Pango's allocated resources for the display.
+
+ * docs/Makefile.am (SCAN_OPTIONS): Add the appropriate
+ --deprecated-guards option.
+
+ * docs/tmpl/xft-fonts.sgml: Add long description.
+
+ * docs/tmpl/x-fonts.sgml: Document as dead.
+
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* docs/tmpl/text-attributes.sgml: Document PANGO_UNDERLINE_ERROR
diff --git a/docs/Makefile.am b/docs/Makefile.am
index aefc843f..e04dfaed 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -9,7 +9,7 @@ DOC_MODULE=pango
DOC_MAIN_SGML_FILE=pango-docs.sgml
# Extra options to supply to gtkdoc-scan
-SCAN_OPTIONS=
+SCAN_OPTIONS=--deprecated-guards="PANGO_DISABLE_DEPRECATED"
# The directory containing the source code. Relative to $(srcdir)
DOC_SOURCE_DIR=../pango
diff --git a/docs/pango-docs.sgml b/docs/pango-docs.sgml
index ea014a5e..21498e6e 100644
--- a/docs/pango-docs.sgml
+++ b/docs/pango-docs.sgml
@@ -45,10 +45,10 @@
<chapter id="rendering">
<title>Rendering with Pango</title>
- &pango-X-Fonts-and-Rendering;
&pango-Win32-Fonts-and-Rendering;
&pango-FreeType-Fonts-and-Rendering;
&pango-Xft-Fonts-and-Rendering;
+ &pango-X-Fonts-and-Rendering;
</chapter>
<chapter id="lowlevel">
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index d0e9c938..939952c2 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -307,6 +307,8 @@ pango_attr_underline_new
PangoUnderline
PANGO_TYPE_UNDERLINE
pango_attr_shape_new
+pango_attr_shape_new_with_data
+PangoAttrDataCopyFunc
pango_attr_scale_new
pango_attr_fallback_new
PANGO_SCALE_XX_SMALL
@@ -728,6 +730,7 @@ pango_xft_font_get_glyph
pango_xft_font_get_unknown_glyph
PangoXftRenderer
PangoXftRendererClass
+
pango_xft_renderer_new
pango_xft_renderer_set_draw
pango_xft_renderer_set_default_color
diff --git a/docs/tmpl/text-attributes.sgml b/docs/tmpl/text-attributes.sgml
index 7072b0f0..5aee1e0a 100644
--- a/docs/tmpl/text-attributes.sgml
+++ b/docs/tmpl/text-attributes.sgml
@@ -143,6 +143,9 @@ impose shape restrictions.
@attr: the common portion of the attribute
@ink_rect: the ink rectangle to restrict to
@logical_rect: the logical rectangle to restrict to
+@data:
+@copy_func:
+@destroy_func:
<!-- ##### FUNCTION pango_parse_markup ##### -->
<para>
@@ -347,6 +350,28 @@ The GObject type for #PangoUnderline.
@Returns:
+<!-- ##### FUNCTION pango_attr_shape_new_with_data ##### -->
+<para>
+
+</para>
+
+@ink_rect:
+@logical_rect:
+@data:
+@copy_func:
+@destroy_func:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION PangoAttrDataCopyFunc ##### -->
+<para>
+
+</para>
+
+@data:
+@Returns:
+
+
<!-- ##### FUNCTION pango_attr_scale_new ##### -->
<para>
diff --git a/docs/tmpl/x-fonts.sgml b/docs/tmpl/x-fonts.sgml
index 161040f6..bd5a9a6d 100644
--- a/docs/tmpl/x-fonts.sgml
+++ b/docs/tmpl/x-fonts.sgml
@@ -1,14 +1,15 @@
<!-- ##### SECTION Title ##### -->
-X Fonts and Rendering
+Deprecated X font backend
<!-- ##### SECTION Short_Description ##### -->
-Functions for shape engines to manipulate X fonts
+Font handling and rendering with the deprecated X font backend
<!-- ##### SECTION Long_Description ##### -->
<para>
-The functions and macros in this section are used by shape
-engines to look up glyphs for particular character
-sets within an #PangoFont for the X rendering system.
+The functions and macros in this section are for use with the old
+X font backend which used server-side bitmap fonts. This font backend
+is no longer supported, and attempts to use it will produce
+unpredictable results. Use the <link linkend="pango-Xft-Fonts-and-Rendering">Xft backend</link> instead.
</para>
<!-- ##### SECTION See_Also ##### -->
diff --git a/docs/tmpl/xft-fonts.sgml b/docs/tmpl/xft-fonts.sgml
index 00c7090c..50a6e02a 100644
--- a/docs/tmpl/xft-fonts.sgml
+++ b/docs/tmpl/xft-fonts.sgml
@@ -2,11 +2,36 @@
Xft Fonts and Rendering
<!-- ##### SECTION Short_Description ##### -->
-Functions for shape engines to manipulate Xft fonts
+Font handling and rendering with the Xft backend
<!-- ##### SECTION Long_Description ##### -->
<para>
-
+The Xft library is a library for displaying fonts on the X window
+system; internally it uses the fontconfig library to locate font
+files, and the FreeType library to load and render fonts. The
+Xft backend is the recommended Pango font backend for screen
+display with X.
+</para>
+<para>
+Using the Xft backend is generally straightforward;
+pango_xft_get_context() creates a context for a specified display
+and screen. You can then create a #PangoLayout with that context
+and render it with pango_xft_render_layout(). At a more advanced
+level, the lowlevel fontconfig options used for rendering fonts
+can be affected using pango_xft_set_default_substitute(), and
+pango_xft_substitute_changed().
+</para>
+<para>
+A range of functions for drawing pieces of a layout, such as
+individual layout lines and glyphs strings are provided. You can also
+directly create a #PangoXftRenderer. Finally, in some advanced cases, it
+is useful to derive from #PangoXftRenderer. Deriving from
+#PangoXftRenderer is useful for two reasons. One reason is be to
+support custom attributes by overriding #PangoRendererClass virtual
+functions like 'prepare_run' or 'draw_shape'. The reason is to
+customize exactly how the final bits are drawn to the destination by
+overring the #PangoXftRendererClass virtual functions
+'composite_glyphs' and 'composite_trapezoids'.
</para>
<!-- ##### SECTION See_Also ##### -->
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index fd5be6fb..276f7acd 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -697,13 +697,25 @@ static PangoAttribute *
pango_attr_shape_copy (const PangoAttribute *attr)
{
const PangoAttrShape *shape_attr = (PangoAttrShape *)attr;
+ gpointer data;
+
+ if (shape_attr->copy_func)
+ data = shape_attr->copy_func (shape_attr->data);
+ else
+ data = shape_attr->data;
- return pango_attr_shape_new (&shape_attr->ink_rect, &shape_attr->logical_rect);
+ return pango_attr_shape_new_with_data (&shape_attr->ink_rect, &shape_attr->logical_rect,
+ data, shape_attr->copy_func, shape_attr->destroy_func);
}
static void
pango_attr_shape_destroy (PangoAttribute *attr)
{
+ const PangoAttrShape *shape_attr = (PangoAttrShape *)attr;
+
+ if (shape_attr->destroy_func)
+ shape_attr->destroy_func (shape_attr->data);
+
g_free (attr);
}
@@ -713,7 +725,7 @@ pango_attr_shape_equal (const PangoAttribute *attr1,
{
const PangoAttrShape *shape_attr1 = (const PangoAttrShape *)attr1;
const PangoAttrShape *shape_attr2 = (const PangoAttrShape *)attr2;
-
+
return (shape_attr1->logical_rect.x == shape_attr2->logical_rect.x &&
shape_attr1->logical_rect.y == shape_attr2->logical_rect.y &&
shape_attr1->logical_rect.width == shape_attr2->logical_rect.width &&
@@ -721,24 +733,35 @@ pango_attr_shape_equal (const PangoAttribute *attr1,
shape_attr1->ink_rect.x == shape_attr2->ink_rect.x &&
shape_attr1->ink_rect.y == shape_attr2->ink_rect.y &&
shape_attr1->ink_rect.width == shape_attr2->ink_rect.width &&
- shape_attr1->ink_rect.height == shape_attr2->ink_rect.height);
+ shape_attr1->ink_rect.height == shape_attr2->ink_rect.height &&
+ shape_attr1->data == shape_attr2->data);
}
/**
- * pango_attr_shape_new:
+ * pango_attr_shape_new_with_data:
* @ink_rect: ink rectangle to assign to each character
* @logical_rect: logical rectangle assign to each character
+ * @data: user data pointer
+ * @copy_func: function to copy @data when the attribute
+ * is copied. If %NULL, @data is simply copied
+ * as a pointer.
+ * @destroy_func: function to free @data when the attribute
+ * is freed, or %NULL.
*
- * Create a new shape attribute. A shape is used to impose a
- * particular ink and logical rect on the result of shaping a
- * particular glyph. This might be used, for instance, for
- * embedding a picture or a widget inside a PangoLayout.
+ * Like pango_attr_shape_new(), but a user data pointer is also
+ * provided; this pointer can be accessed when rendering later
+ * rendering the glyph.
*
* Return value: the newly created attribute
+ *
+ * Since: 1.8
**/
PangoAttribute *
-pango_attr_shape_new (const PangoRectangle *ink_rect,
- const PangoRectangle *logical_rect)
+pango_attr_shape_new_with_data (const PangoRectangle *ink_rect,
+ const PangoRectangle *logical_rect,
+ gpointer data,
+ PangoAttrDataCopyFunc copy_func,
+ GDestroyNotify destroy_func)
{
static const PangoAttrClass klass = {
PANGO_ATTR_SHAPE,
@@ -756,10 +779,36 @@ pango_attr_shape_new (const PangoRectangle *ink_rect,
result->attr.klass = &klass;
result->ink_rect = *ink_rect;
result->logical_rect = *logical_rect;
+ result->data = data;
+ result->copy_func = copy_func;
+ result->destroy_func = destroy_func;
return (PangoAttribute *)result;
}
+/**
+ * pango_attr_shape_new:
+ * @ink_rect: ink rectangle to assign to each character
+ * @logical_rect: logical rectangle assign to each character
+ *
+ * Create a new shape attribute. A shape is used to impose a
+ * particular ink and logical rect on the result of shaping a
+ * particular glyph. This might be used, for instance, for
+ * embedding a picture or a widget inside a PangoLayout.
+ *
+ * Return value: the newly created attribute
+ **/
+PangoAttribute *
+pango_attr_shape_new (const PangoRectangle *ink_rect,
+ const PangoRectangle *logical_rect)
+{
+ g_return_val_if_fail (ink_rect != NULL, NULL);
+ g_return_val_if_fail (logical_rect != NULL, NULL);
+
+ return pango_attr_shape_new_with_data (ink_rect, logical_rect,
+ NULL, NULL, NULL);
+}
+
GType
pango_attr_list_get_type (void)
{
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index 04086c4e..643d15e8 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -103,6 +103,8 @@ struct _PangoAttribute
typedef gboolean (*PangoAttrFilterFunc) (PangoAttribute *attribute,
gpointer data);
+typedef gpointer (*PangoAttrDataCopyFunc) (gconstpointer data);
+
struct _PangoAttrClass
{
/*< public >*/
@@ -147,6 +149,10 @@ struct _PangoAttrShape
PangoAttribute attr;
PangoRectangle ink_rect;
PangoRectangle logical_rect;
+
+ gpointer data;
+ PangoAttrDataCopyFunc copy_func;
+ GDestroyNotify destroy_func;
};
struct _PangoAttrFontDesc
@@ -179,12 +185,18 @@ PangoAttribute *pango_attr_font_desc_new (const PangoFontDescription *desc);
PangoAttribute *pango_attr_underline_new (PangoUnderline underline);
PangoAttribute *pango_attr_strikethrough_new (gboolean strikethrough);
PangoAttribute *pango_attr_rise_new (int rise);
-PangoAttribute *pango_attr_shape_new (const PangoRectangle *ink_rect,
- const PangoRectangle *logical_rect);
PangoAttribute *pango_attr_scale_new (double scale_factor);
PangoAttribute *pango_attr_fallback_new (gboolean enable_fallback);
PangoAttribute *pango_attr_letter_spacing_new (int letter_spacing);
+PangoAttribute *pango_attr_shape_new (const PangoRectangle *ink_rect,
+ const PangoRectangle *logical_rect);
+PangoAttribute *pango_attr_shape_new_with_data (const PangoRectangle *ink_rect,
+ const PangoRectangle *logical_rect,
+ gpointer data,
+ PangoAttrDataCopyFunc copy_func,
+ GDestroyNotify destroy_func);
+
GType pango_attr_list_get_type (void) G_GNUC_CONST;
PangoAttrList * pango_attr_list_new (void);
void pango_attr_list_ref (PangoAttrList *list);
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 252a8d79..cbdadb46 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -196,8 +196,11 @@ draw_underline (PangoRenderer *renderer,
LineState *state)
{
PangoRectangle *rect = &state->underline_rect;
+ PangoUnderline underline = state->underline;
- switch (state->underline)
+ state->underline = PANGO_UNDERLINE_NONE;
+
+ switch (underline)
{
case PANGO_UNDERLINE_NONE:
break;
@@ -226,8 +229,6 @@ draw_underline (PangoRenderer *renderer,
3 * rect->height);
break;
}
-
- state->underline = PANGO_UNDERLINE_NONE;
}
static void
@@ -235,16 +236,17 @@ draw_strikethrough (PangoRenderer *renderer,
LineState *state)
{
PangoRectangle *rect = &state->strikethrough_rect;
+ gboolean strikethrough = state->strikethrough;
- if (state->strikethrough)
+ state->strikethrough = FALSE;
+
+ if (strikethrough)
pango_renderer_draw_rectangle (renderer,
PANGO_RENDER_PART_STRIKETHROUGH,
rect->x,
rect->y,
rect->width,
rect->height);
-
- state->strikethrough = FALSE;
}
static void
@@ -264,6 +266,7 @@ handle_line_state_change (PangoRenderer *renderer,
draw_underline (renderer, state);
state->underline = renderer->underline;
rect->x = state->logical_rect_end;
+ rect->width = 0;
}
if (part == PANGO_RENDER_PART_STRIKETHROUGH &&
@@ -275,6 +278,7 @@ handle_line_state_change (PangoRenderer *renderer,
draw_underline (renderer, state);
state->underline = renderer->underline;
rect->x = state->logical_rect_end;
+ rect->width = 0;
}
}
@@ -381,19 +385,17 @@ add_strikethrough (PangoRenderer *renderer,
}
static void
-get_item_properties (PangoItem *item,
- gint *rise,
- gboolean *shape_set,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+get_item_properties (PangoItem *item,
+ gint *rise,
+ PangoAttrShape **shape_attr)
{
GSList *l;
if (rise)
*rise = 0;
- if (shape_set)
- *shape_set = FALSE;
+ if (shape_attr)
+ *shape_attr = NULL;
for (l = item->analysis.extra_attrs; l; l = l->next)
{
@@ -402,12 +404,8 @@ get_item_properties (PangoItem *item,
switch (attr->klass->type)
{
case PANGO_ATTR_SHAPE:
- if (shape_set)
- *shape_set = TRUE;
- if (logical_rect)
- *logical_rect = ((PangoAttrShape *)attr)->logical_rect;
- if (ink_rect)
- *ink_rect = ((PangoAttrShape *)attr)->ink_rect;
+ if (shape_attr)
+ *shape_attr = (PangoAttrShape *)attr;
break;
case PANGO_ATTR_RISE:
@@ -421,6 +419,29 @@ get_item_properties (PangoItem *item,
}
}
+static void
+draw_shaped_glyphs (PangoRenderer *renderer,
+ PangoGlyphString *glyphs,
+ PangoAttrShape *attr,
+ int x,
+ int y)
+{
+ PangoRendererClass *class = PANGO_RENDERER_GET_CLASS (renderer);
+ int i;
+
+ if (!class->draw_shape)
+ return;
+
+ for (i = 0; i < glyphs->num_glyphs; i++)
+ {
+ PangoGlyphInfo *gi = &glyphs->glyphs[i];
+
+ class->draw_shape (renderer, attr, x, y);
+
+ x += gi->geometry.width;
+ }
+}
+
/**
* pango_renderer_draw_layout_line:
* @renderer: a #PangoRenderer
@@ -470,17 +491,20 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer,
PangoFontMetrics *metrics;
gint rise;
PangoLayoutRun *run = l->data;
+ PangoAttrShape *shape_attr;
PangoRectangle logical_rect;
PangoRectangle ink_rect;
- gboolean shape_set;
pango_renderer_prepare_run (renderer, run);
- get_item_properties (run->item,
- &rise,
- &shape_set, &ink_rect, &logical_rect);
+ get_item_properties (run->item, &rise, &shape_attr);
- if (!shape_set)
+ if (shape_attr)
+ {
+ ink_rect = shape_attr->ink_rect;
+ logical_rect = shape_attr->logical_rect;
+ }
+ else
{
if (renderer->underline != PANGO_UNDERLINE_NONE ||
renderer->strikethrough)
@@ -491,7 +515,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer,
NULL, &logical_rect);
}
- state.logical_rect_end = x_off + logical_rect.x + logical_rect.width;
+ state.logical_rect_end = x + x_off + logical_rect.x + logical_rect.width;
if (renderer->priv->color_set[PANGO_RENDER_PART_BACKGROUND])
{
@@ -509,19 +533,16 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer,
overall_rect.height);
}
- if (!shape_set)
+ if (shape_attr)
{
- pango_renderer_draw_glyphs (renderer,
- run->item->analysis.font, run->glyphs,
- x + x_off, y - rise);
+ draw_shaped_glyphs (renderer, run->glyphs, shape_attr, x + x_off, y - rise);
}
-#if 0
else
{
- pango_renderer_draw_shaped (renderer,
+ pango_renderer_draw_glyphs (renderer,
+ run->item->analysis.font, run->glyphs,
x + x_off, y - rise);
}
-#endif
if (renderer->underline != PANGO_UNDERLINE_NONE ||
renderer->strikethrough)
@@ -1015,15 +1036,13 @@ pango_renderer_deactivate (PangoRenderer *renderer)
* Since: 1.8
**/
void
-pango_renderer_set_color (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoColor *color)
+pango_renderer_set_color (PangoRenderer *renderer,
+ PangoRenderPart part,
+ const PangoColor *color)
{
g_return_if_fail (PANGO_IS_RENDERER (renderer));
g_return_if_fail (IS_VALID_PART (part));
- pango_renderer_part_changed (renderer, part);
-
if ((!color && !renderer->priv->color_set[part]) ||
(color && renderer->priv->color_set[part] &&
renderer->priv->color[part].red == color->red &&
@@ -1031,6 +1050,8 @@ pango_renderer_set_color (PangoRenderer *renderer,
renderer->priv->color[part].blue == color->blue))
return;
+ pango_renderer_part_changed (renderer, part);
+
if (color)
{
renderer->priv->color_set[part] = TRUE;
@@ -1040,9 +1061,6 @@ pango_renderer_set_color (PangoRenderer *renderer,
{
renderer->priv->color_set[part] = FALSE;
}
-
- if (PANGO_RENDERER_GET_CLASS (renderer)->color_set)
- PANGO_RENDERER_GET_CLASS (renderer)->color_set (renderer, part, color);
}
/**
diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h
index 5c587f85..eace2967 100644
--- a/pango/pango-renderer.h
+++ b/pango/pango-renderer.h
@@ -91,12 +91,13 @@ struct _PangoRenderer
* @draw_error_underline: draws a squiggly line that approximately
* covers the given rectangle in the style of an underline used to
* indicate a spelling error.
+ * @draw_shape: draw content for a glyph shaped with #PangoAttrShape.
+ * @x, @y are the coordinates of the left edge of the baseline,
+ * in user coordinates.
* @draw_trapezoid: draws a trapezoidal filled area
* @draw_glyph: draws a single glyph
* @part_changed: do renderer specific processing when rendering
* attributes change
- * @color_set: updates the renderer when a color has changed.
- * if @color is %NULL, means that the color has been unset
* @begin: Do renderer-specific initialization before drawing
* @end: Do renderer-specific cleanup after drawing
* @prepare_run: updates the renderer for a new run
@@ -133,6 +134,12 @@ struct _PangoRendererClass
int width,
int height);
+ /* Nothing is drawn for shaped glyphs unless this is implemented */
+ void (*draw_shape) (PangoRenderer *renderer,
+ PangoAttrShape *attr,
+ int x,
+ int y);
+
/* These two must be implemented and take coordinates in
* device space as doubles.
*/
@@ -154,9 +161,6 @@ struct _PangoRendererClass
*/
void (*part_changed) (PangoRenderer *renderer,
PangoRenderPart part);
- void (*color_set) (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoColor *color);
/* Paired around drawing operations
*/
@@ -222,11 +226,12 @@ void pango_renderer_deactivate (PangoRenderer *renderer);
void pango_renderer_part_changed (PangoRenderer *renderer,
PangoRenderPart part);
-void pango_renderer_set_color (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoColor *color);
-PangoColor *pango_renderer_get_color (PangoRenderer *renderer,
- PangoRenderPart part);
+
+void pango_renderer_set_color (PangoRenderer *renderer,
+ PangoRenderPart part,
+ const PangoColor *color);
+PangoColor *pango_renderer_get_color (PangoRenderer *renderer,
+ PangoRenderPart part);
void pango_renderer_set_matrix (PangoRenderer *renderer,
const PangoMatrix *matrix);
diff --git a/pango/pango.def b/pango/pango.def
index 1c62ea5b..5b9f2e1a 100644
--- a/pango/pango.def
+++ b/pango/pango.def
@@ -28,6 +28,7 @@ EXPORTS
pango_attr_rise_new
pango_attr_scale_new
pango_attr_shape_new
+ pango_attr_shape_new_with_data
pango_attr_size_new
pango_attr_stretch_new
pango_attr_strikethrough_new
diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c
index cc3f62b5..c7af76a1 100644
--- a/pango/pangoxft-fontmap.c
+++ b/pango/pangoxft-fontmap.c
@@ -213,7 +213,9 @@ pango_xft_get_font_map (Display *display,
* @screen: the screen number of a screen within @display
*
* Release any resources that have been cached for the
- * combination of @display and @screen.
+ * combination of @display and @screen. Note that when the
+ * X display is closed, resources are released automatically,
+ * without needing to call this function.
*
* Since: 1.2
**/
diff --git a/pango/pangoxft-render.c b/pango/pangoxft-render.c
index 145b6f59..1c156405 100644
--- a/pango/pangoxft-render.c
+++ b/pango/pangoxft-render.c
@@ -777,7 +777,8 @@ pango_xft_picture_render (Display *display,
* @screen: the index of the screen for @display to which rendering will be done
*
* Create a new #PangoXftRenderer to allow rendering Pango objects
- * with the Xft library.
+ * with the Xft library. You must call pango_xft_renderer_set_draw() before
+ * using the renderer.
*
* Return value: the newly created #PangoXftRenderer object. Unref
* with g_object_unref() when you are finished with it.
diff --git a/pango/pangoxft-render.h b/pango/pangoxft-render.h
index 00390928..2d12df05 100644
--- a/pango/pangoxft-render.h
+++ b/pango/pangoxft-render.h
@@ -73,10 +73,10 @@ struct _PangoXftRenderer
* @composite_trapezoids: draw the specified trapezoids using
* the current color and other attributes for @part
* @composite_glyphs: draw the specified glyphs using
- * the current color and other attributes for @part
+ * the current foreground color and other foreground
+ * attributes
*
- * #PangoXftRenderer is a subclass of #PangoRenderer used for rendering
- * Renders a #PangoGlyphString onto an Xrender <type>Picture</type> object.
+ * The class structure for #PangoXftRenderer
*
* Since: 1.8
*/