[pango/redo-attrs: 8/25] Drop shape attributes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/redo-attrs: 8/25] Drop shape attributes
- Date: Sun, 13 Feb 2022 20:31:44 +0000 (UTC)
commit f9568e765a7407c6f35ad324836442525bc35c73
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 28 20:30:17 2022 -0500
Drop shape attributes
Shape attributes don't fit well with the other
attributes, and user fonts are a better way of
doing custom glyphs.
pango/pango-attributes.c | 158 ---------------------------------------------
pango/pango-attributes.h | 37 -----------
pango/pango-layout.c | 40 ++----------
pango/pango-renderer.c | 100 ++++------------------------
pango/pango-renderer.h | 11 ----
pango/pangocairo-context.c | 87 -------------------------
pango/pangocairo-render.c | 39 -----------
pango/pangocairo.h | 28 --------
pango/serializer.c | 10 ---
tests/test-itemize.c | 1 -
tests/test-shape.c | 1 -
tests/testattributes.c | 5 --
12 files changed, 19 insertions(+), 498 deletions(-)
---
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 60d14706..b3b28f08 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -478,51 +478,6 @@ pango_attr_font_desc_equal (const PangoAttribute *attr1,
pango_font_description_equal (desc_attr1->desc, desc_attr2->desc);
}
/* }}} */
-/* {{{ Shape attribute */
-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_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)
-{
- PangoAttrShape *shape_attr = (PangoAttrShape *)attr;
-
- if (shape_attr->destroy_func)
- shape_attr->destroy_func (shape_attr->data);
-
- g_slice_free (PangoAttrShape, shape_attr);
-}
-
-static gboolean
-pango_attr_shape_equal (const PangoAttribute *attr1,
- const PangoAttribute *attr2)
-{
- 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 &&
- shape_attr1->logical_rect.height == shape_attr2->logical_rect.height &&
- 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->data == shape_attr2->data);
-}
-/* }}} */
/* }}} */
/* {{{ Public API */
@@ -1071,86 +1026,6 @@ pango_attr_letter_spacing_new (int letter_spacing)
return pango_attr_int_new (&klass, letter_spacing);
}
-/**
- * pango_attr_shape_new_with_data:
- * @ink_rect: ink rectangle to assign to each character
- * @logical_rect: logical rectangle to assign to each character
- * @data: user data pointer
- * @copy_func: (nullable): function to copy @data when the
- * attribute is copied. If %NULL, @data is simply copied
- * as a pointer
- * @destroy_func: (nullable): function to free @data when the
- * attribute is freed
- *
- * Creates a new shape attribute.
- *
- * Like [func Pango AttrShape new], but a user data pointer
- * is also provided; this pointer can be accessed when later
- * rendering the glyph.
- *
- * Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
- *
- * Since: 1.8
- */
-PangoAttribute *
-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,
- pango_attr_shape_copy,
- pango_attr_shape_destroy,
- pango_attr_shape_equal
- };
-
- PangoAttrShape *result;
-
- g_return_val_if_fail (ink_rect != NULL, NULL);
- g_return_val_if_fail (logical_rect != NULL, NULL);
-
- result = g_slice_new (PangoAttrShape);
- pango_attribute_init (&result->attr, &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 to assign to each character
- *
- * Create a new shape attribute.
- *
- * A shape is used to impose a particular ink and logical
- * rectangle 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: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
- */
-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);
-}
-
/**
* pango_attr_gravity_new:
* @gravity: the gravity value; should not be %PANGO_GRAVITY_AUTO
@@ -1795,32 +1670,6 @@ pango_attribute_as_language (PangoAttribute *attr)
}
}
-/**
- * pango_attribute_as_shape:
- * @attr: A `PangoAttribute` representing a shape
- *
- * Returns the attribute cast to `PangoAttrShape`.
- *
- * This is mainly useful for language bindings.
- *
- * Returns: (nullable) (transfer none): The attribute as `PangoAttrShape`,
- * or %NULL if it's not a shape attribute
- *
- * Since: 1.50
- */
-PangoAttrShape *
-pango_attribute_as_shape (PangoAttribute *attr)
-{
- switch ((int)attr->klass->type)
- {
- case PANGO_ATTR_SHAPE:
- return (PangoAttrShape *)attr;
-
- default:
- return NULL;
- }
-}
-
/* }}} */
/* {{{ Attribute List */
@@ -2612,7 +2461,6 @@ attr_print (GString *str,
PangoAttrFloat *flt;
PangoAttrFontDesc *font;
PangoAttrColor *color;
- PangoAttrShape *shape;
PangoAttrSize *size;
PangoAttrFontFeatures *features;
@@ -2661,8 +2509,6 @@ attr_print (GString *str,
g_string_append_printf (str, " %s", s);
g_free (s);
}
- else if ((shape = pango_attribute_as_shape (attr)) != NULL)
- g_string_append (str, "shape"); /* FIXME */
else if ((size = pango_attribute_as_size (attr)) != NULL)
g_string_append_printf (str, " %d", size->size);
else if ((features = pango_attribute_as_font_features (attr)) != NULL)
@@ -2942,10 +2788,6 @@ pango_attr_list_from_string (const char *text)
INT_ATTR(rise, int);
break;
- case PANGO_ATTR_SHAPE:
- endp = (char *)p + strcspn (p, ",\n");
- continue; /* FIXME */
-
case PANGO_ATTR_SCALE:
FLOAT_ATTR(scale);
break;
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index 69ff9e52..6ba09154 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -39,7 +39,6 @@ typedef struct _PangoAttrSize PangoAttrSize;
typedef struct _PangoAttrFloat PangoAttrFloat;
typedef struct _PangoAttrColor PangoAttrColor;
typedef struct _PangoAttrFontDesc PangoAttrFontDesc;
-typedef struct _PangoAttrShape PangoAttrShape;
typedef struct _PangoAttrFontFeatures PangoAttrFontFeatures;
/**
@@ -58,7 +57,6 @@ typedef struct _PangoAttrFontFeatures PangoAttrFontFeatures;
* @PANGO_ATTR_UNDERLINE: whether the text has an underline ([struct@Pango.AttrInt])
* @PANGO_ATTR_STRIKETHROUGH: whether the text is struck-through ([struct@Pango.AttrInt])
* @PANGO_ATTR_RISE: baseline displacement ([struct@Pango.AttrInt])
- * @PANGO_ATTR_SHAPE: shape ([struct@Pango.AttrShape])
* @PANGO_ATTR_SCALE: font size scale factor ([struct@Pango.AttrFloat])
* @PANGO_ATTR_FALLBACK: whether fallback is enabled ([struct@Pango.AttrInt])
* @PANGO_ATTR_LETTER_SPACING: letter spacing ([struct@PangoAttrInt])
@@ -105,7 +103,6 @@ typedef enum
PANGO_ATTR_UNDERLINE, /* PangoAttrInt */
PANGO_ATTR_STRIKETHROUGH, /* PangoAttrInt */
PANGO_ATTR_RISE, /* PangoAttrInt */
- PANGO_ATTR_SHAPE, /* PangoAttrShape */
PANGO_ATTR_SCALE, /* PangoAttrFloat */
PANGO_ATTR_FALLBACK, /* PangoAttrInt */
PANGO_ATTR_LETTER_SPACING, /* PangoAttrInt */
@@ -444,29 +441,6 @@ struct _PangoAttrSize
guint absolute : 1;
};
-/**
- * PangoAttrShape:
- * @attr: the common portion of the attribute
- * @ink_rect: the ink rectangle to restrict to
- * @logical_rect: the logical rectangle to restrict to
- * @data: user data set (see [func@Pango.AttrShape.new_with_data])
- * @copy_func: copy function for the user data
- * @destroy_func: destroy function for the user data
- *
- * The `PangoAttrShape` structure is used to represent attributes which
- * impose shape restrictions.
- */
-struct _PangoAttrShape
-{
- PangoAttribute attr;
- PangoRectangle ink_rect;
- PangoRectangle logical_rect;
-
- gpointer data;
- PangoAttrDataCopyFunc copy_func;
- GDestroyNotify destroy_func;
-};
-
/**
* PangoAttrFontDesc:
* @attr: the common portion of the attribute
@@ -566,15 +540,6 @@ PANGO_AVAILABLE_IN_1_4
PangoAttribute * pango_attr_fallback_new (gboolean
enable_fallback);
PANGO_AVAILABLE_IN_1_6
PangoAttribute * pango_attr_letter_spacing_new (int letter_spacing);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_shape_new (const PangoRectangle *ink_rect,
- const PangoRectangle *logical_rect);
-PANGO_AVAILABLE_IN_1_8
-PangoAttribute * pango_attr_shape_new_with_data (const PangoRectangle *ink_rect,
- const PangoRectangle *logical_rect,
- gpointer data,
- PangoAttrDataCopyFunc copy_func,
- GDestroyNotify destroy_func);
PANGO_AVAILABLE_IN_1_16
PangoAttribute * pango_attr_gravity_new (PangoGravity gravity);
PANGO_AVAILABLE_IN_1_16
@@ -625,8 +590,6 @@ PangoAttrColor * pango_attribute_as_color (PangoAttribute
PANGO_AVAILABLE_IN_1_50
PangoAttrFontDesc * pango_attribute_as_font_desc (PangoAttribute *attr);
PANGO_AVAILABLE_IN_1_50
-PangoAttrShape * pango_attribute_as_shape (PangoAttribute *attr);
-PANGO_AVAILABLE_IN_1_50
PangoAttrFontFeatures * pango_attribute_as_font_features (PangoAttribute *attr);
/* Attribute lists */
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 9167883c..7d5ca3cd 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -113,9 +113,6 @@ struct _ItemProperties
guint oline_single : 1;
guint showing_space : 1;
gint letter_spacing;
- gboolean shape_set;
- PangoRectangle *shape_ink_rect;
- PangoRectangle *shape_logical_rect;
double line_height;
int absolute_line_height;
};
@@ -3707,16 +3704,11 @@ shape_run (PangoLayoutLine *line,
if (pango_context_get_round_glyph_positions (layout->context))
shape_flags |= PANGO_SHAPE_ROUND_POSITIONS;
- if (state->properties.shape_set)
- _pango_shape_shape (layout->text + item->offset, item->num_chars,
- state->properties.shape_ink_rect, state->properties.shape_logical_rect,
- glyphs);
- else
- pango_shape_item (item,
- layout->text, layout->length,
- layout->log_attrs + state->start_offset,
- glyphs,
- shape_flags);
+ pango_shape_item (item,
+ layout->text, layout->length,
+ layout->log_attrs + state->start_offset,
+ glyphs,
+ shape_flags);
if (state->properties.letter_spacing)
{
@@ -4006,7 +3998,6 @@ process_item (PangoLayout *layout,
gboolean is_last_item)
{
PangoItem *item = state->items->data;
- gboolean shape_set = FALSE;
int width;
int extra_width;
int orig_extra_width;
@@ -4323,9 +4314,6 @@ retry_break:
state->log_widths_offset += break_num_chars;
- /* Shaped items should never be broken */
- g_assert (!shape_set);
-
DEBUG1 ("some-fit '%.*s', remaining %d",
new_item->length, layout->text + new_item->offset,
state->remaining_width);
@@ -4678,7 +4666,6 @@ affects_itemization (PangoAttribute *attr,
case PANGO_ATTR_FONT_SCALE:
/* These need to be constant across runs */
case PANGO_ATTR_LETTER_SPACING:
- case PANGO_ATTR_SHAPE:
case PANGO_ATTR_RISE:
case PANGO_ATTR_BASELINE_SHIFT:
case PANGO_ATTR_LINE_HEIGHT:
@@ -5625,14 +5612,8 @@ pango_layout_run_get_extents_and_height (PangoLayoutRun *run,
if (!run_logical && line_logical)
run_logical = &logical;
- if (properties.shape_set)
- _pango_shape_get_extents (run->item->num_chars,
- properties.shape_ink_rect,
- properties.shape_logical_rect,
+ pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
run_ink, run_logical);
- else
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- run_ink, run_logical);
if (run_ink && (has_underline || has_overline || properties.strikethrough))
{
@@ -6791,9 +6772,6 @@ pango_layout_get_item_properties (PangoItem *item,
properties->strikethrough = FALSE;
properties->showing_space = FALSE;
properties->letter_spacing = 0;
- properties->shape_set = FALSE;
- properties->shape_ink_rect = NULL;
- properties->shape_logical_rect = NULL;
properties->line_height = 0.0;
properties->absolute_line_height = 0;
@@ -6849,12 +6827,6 @@ pango_layout_get_item_properties (PangoItem *item,
properties->letter_spacing = ((PangoAttrInt *)attr)->value;
break;
- case PANGO_ATTR_SHAPE:
- properties->shape_set = TRUE;
- properties->shape_logical_rect = &((PangoAttrShape *)attr)->logical_rect;
- properties->shape_ink_rect = &((PangoAttrShape *)attr)->ink_rect;
- break;
-
case PANGO_ATTR_LINE_HEIGHT:
properties->line_height = ((PangoAttrFloat *)attr)->value;
break;
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 311c28cd..4e65f489 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -500,56 +500,6 @@ add_strikethrough (PangoRenderer *renderer,
}
}
-static void
-get_item_properties (PangoItem *item,
- PangoAttrShape **shape_attr)
-{
- GSList *l;
-
- if (shape_attr)
- *shape_attr = NULL;
-
- for (l = item->analysis.extra_attrs; l; l = l->next)
- {
- PangoAttribute *attr = l->data;
-
- switch ((int) attr->klass->type)
- {
- case PANGO_ATTR_SHAPE:
- if (shape_attr)
- *shape_attr = (PangoAttrShape *)attr;
- break;
-
- default:
- break;
- }
- }
-}
-
-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`
@@ -608,7 +558,6 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer,
{
PangoFontMetrics *metrics;
PangoLayoutRun *run = l->data;
- PangoAttrShape *shape_attr;
PangoRectangle ink_rect, *ink = NULL;
PangoRectangle logical_rect, *logical = NULL;
int y_off;
@@ -618,36 +567,20 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer,
pango_renderer_prepare_run (renderer, run);
- get_item_properties (run->item, &shape_attr);
-
- if (shape_attr)
+ if (renderer->underline != PANGO_UNDERLINE_NONE ||
+ renderer->priv->overline != PANGO_OVERLINE_NONE ||
+ renderer->strikethrough)
{
ink = &ink_rect;
logical = &logical_rect;
- _pango_shape_get_extents (run->glyphs->num_glyphs,
- &shape_attr->ink_rect,
- &shape_attr->logical_rect,
- ink,
- logical);
- glyph_string_width = logical->width;
}
+ if (G_UNLIKELY (ink || logical))
+ pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
+ ink, logical);
+ if (logical)
+ glyph_string_width = logical_rect.width;
else
- {
- if (renderer->underline != PANGO_UNDERLINE_NONE ||
- renderer->priv->overline != PANGO_OVERLINE_NONE ||
- renderer->strikethrough)
- {
- ink = &ink_rect;
- logical = &logical_rect;
- }
- if (G_UNLIKELY (ink || logical))
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- ink, logical);
- if (logical)
- glyph_string_width = logical_rect.width;
- else
- glyph_string_width = pango_glyph_string_get_width (run->glyphs);
- }
+ glyph_string_width = pango_glyph_string_get_width (run->glyphs);
state.logical_rect_end = x + x_off + glyph_string_width;
@@ -682,17 +615,10 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer,
overall_rect.height);
}
- if (shape_attr)
- {
- draw_shaped_glyphs (renderer, run->glyphs, shape_attr, x + x_off, y - y_off);
- }
- else
- {
- pango_renderer_draw_glyph_item (renderer,
- text,
- run,
- x + x_off, y - y_off);
- }
+ pango_renderer_draw_glyph_item (renderer,
+ text,
+ run,
+ x + x_off, y - y_off);
if (renderer->underline != PANGO_UNDERLINE_NONE ||
renderer->priv->overline != PANGO_OVERLINE_NONE ||
diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h
index 16a1bbd4..20bf59d9 100644
--- a/pango/pango-renderer.h
+++ b/pango/pango-renderer.h
@@ -97,9 +97,6 @@ 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
@@ -116,11 +113,8 @@ struct _PangoRenderer
* - draw_glyphs
* - draw_rectangle
* - draw_error_underline
- * - draw_shape
* - draw_glyph_item
*
- * The default draw_shape implementation draws nothing.
- *
* The following vfuncs take device space coordinates as doubles
* and must be implemented:
* - draw_trapezoid
@@ -152,11 +146,6 @@ struct _PangoRendererClass
int y,
int width,
int height);
- void (*draw_shape) (PangoRenderer *renderer,
- PangoAttrShape *attr,
- int x,
- int y);
-
void (*draw_trapezoid) (PangoRenderer *renderer,
PangoRenderPart part,
double y1_,
diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c
index 08a90678..333ab186 100644
--- a/pango/pangocairo-context.c
+++ b/pango/pangocairo-context.c
@@ -37,10 +37,6 @@ struct _PangoCairoContextInfo
cairo_font_options_t *set_options;
cairo_font_options_t *surface_options;
cairo_font_options_t *merged_options;
-
- PangoCairoShapeRendererFunc shape_renderer_func;
- gpointer shape_renderer_data;
- GDestroyNotify shape_renderer_notify;
};
static void
@@ -53,9 +49,6 @@ free_context_info (PangoCairoContextInfo *info)
if (info->merged_options)
cairo_font_options_destroy (info->merged_options);
- if (info->shape_renderer_notify)
- info->shape_renderer_notify (info->shape_renderer_data);
-
g_slice_free (PangoCairoContextInfo, info);
}
@@ -341,86 +334,6 @@ _pango_cairo_context_get_merged_font_options (PangoContext *context)
return info->merged_options;
}
-/**
- * pango_cairo_context_set_shape_renderer:
- * @context: a `PangoContext`, from a pangocairo font map
- * @func: (nullable): Callback function for rendering attributes of
- * type %PANGO_ATTR_SHAPE, or %NULL to disable shape rendering.
- * @data: (nullable): User data that will be passed to @func.
- * @dnotify: (nullable): Callback that will be called when the
- * context is freed to release @data
- *
- * Sets callback function for context to use for rendering attributes
- * of type %PANGO_ATTR_SHAPE.
- *
- * See `PangoCairoShapeRendererFunc` for details.
- *
- * Since: 1.18
- */
-void
-pango_cairo_context_set_shape_renderer (PangoContext *context,
- PangoCairoShapeRendererFunc func,
- gpointer data,
- GDestroyNotify dnotify)
-{
- PangoCairoContextInfo *info;
-
- g_return_if_fail (PANGO_IS_CONTEXT (context));
-
- info = get_context_info (context, TRUE);
-
- if (info->shape_renderer_notify)
- info->shape_renderer_notify (info->shape_renderer_data);
-
- info->shape_renderer_func = func;
- info->shape_renderer_data = data;
- info->shape_renderer_notify = dnotify;
-}
-
-/**
- * pango_cairo_context_get_shape_renderer: (skip)
- * @context: a `PangoContext`, from a pangocairo font map
- * @data: Pointer to `gpointer` to return user data
- *
- * Sets callback function for context to use for rendering attributes
- * of type %PANGO_ATTR_SHAPE.
- *
- * See `PangoCairoShapeRendererFunc` for details.
- *
- * Retrieves callback function and associated user data for rendering
- * attributes of type %PANGO_ATTR_SHAPE as set by
- * [func@PangoCairo.context_set_shape_renderer], if any.
- *
- * Return value: (transfer none) (nullable): the shape rendering callback
- * previously set on the context, or %NULL if no shape rendering callback
- * have been set.
- *
- * Since: 1.18
- */
-PangoCairoShapeRendererFunc
-pango_cairo_context_get_shape_renderer (PangoContext *context,
- gpointer *data)
-{
- PangoCairoContextInfo *info;
-
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
-
- info = get_context_info (context, FALSE);
-
- if (info)
- {
- if (data)
- *data = info->shape_renderer_data;
- return info->shape_renderer_func;
- }
- else
- {
- if (data)
- *data = NULL;
- return NULL;
- }
-}
-
/**
* pango_cairo_create_context:
* @cr: a Cairo context
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 92546f1b..688137dd 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -774,44 +774,6 @@ pango_cairo_renderer_draw_error_underline (PangoRenderer *renderer,
}
}
-static void
-pango_cairo_renderer_draw_shape (PangoRenderer *renderer,
- PangoAttrShape *attr,
- int x,
- int y)
-{
- PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
- cairo_t *cr = crenderer->cr;
- PangoLayout *layout;
- PangoCairoShapeRendererFunc shape_renderer;
- gpointer shape_renderer_data;
- double base_x, base_y;
-
- layout = pango_renderer_get_layout (renderer);
-
- if (!layout)
- return;
-
- shape_renderer = pango_cairo_context_get_shape_renderer (pango_layout_get_context (layout),
- &shape_renderer_data);
-
- if (!shape_renderer)
- return;
-
- base_x = crenderer->x_offset + (double)x / PANGO_SCALE;
- base_y = crenderer->y_offset + (double)y / PANGO_SCALE;
-
- cairo_save (cr);
- if (!crenderer->do_path)
- set_color (crenderer, PANGO_RENDER_PART_FOREGROUND);
-
- cairo_move_to (cr, base_x, base_y);
-
- shape_renderer (cr, attr, crenderer->do_path, shape_renderer_data);
-
- cairo_restore (cr);
-}
-
static void
pango_cairo_renderer_init (PangoCairoRenderer *renderer G_GNUC_UNUSED)
{
@@ -827,7 +789,6 @@ pango_cairo_renderer_class_init (PangoCairoRendererClass *klass)
renderer_class->draw_rectangle = pango_cairo_renderer_draw_rectangle;
renderer_class->draw_trapezoid = pango_cairo_renderer_draw_trapezoid;
renderer_class->draw_error_underline = pango_cairo_renderer_draw_error_underline;
- renderer_class->draw_shape = pango_cairo_renderer_draw_shape;
}
static PangoCairoRenderer *cached_renderer = NULL; /* MT-safe */
diff --git a/pango/pangocairo.h b/pango/pangocairo.h
index 7e860554..f96ae1f4 100644
--- a/pango/pangocairo.h
+++ b/pango/pangocairo.h
@@ -77,25 +77,6 @@ typedef struct _PangoCairoFontMap PangoCairoFontMap;
#define PANGO_IS_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT_MAP))
#endif
-/**
- * PangoCairoShapeRendererFunc:
- * @cr: a Cairo context with current point set to where the shape should
- * be rendered
- * @attr: the %PANGO_ATTR_SHAPE to render
- * @do_path: whether only the shape path should be appended to current
- * path of @cr and no filling/stroking done. This will be set
- * to %TRUE when called from pango_cairo_layout_path() and
- * pango_cairo_layout_line_path() rendering functions.
- * @data: (closure): user data passed to pango_cairo_context_set_shape_renderer()
- *
- * Function type for rendering attributes of type %PANGO_ATTR_SHAPE
- * with Pango's Cairo renderer.
- */
-typedef void (* PangoCairoShapeRendererFunc) (cairo_t *cr,
- PangoAttrShape *attr,
- gboolean do_path,
- gpointer data);
-
/*
* PangoCairoFontMap
*/
@@ -150,15 +131,6 @@ void pango_cairo_context_set_resolution (PangoContext *c
PANGO_AVAILABLE_IN_1_10
double pango_cairo_context_get_resolution (PangoContext *context);
-PANGO_AVAILABLE_IN_1_18
-void pango_cairo_context_set_shape_renderer (PangoContext *context,
- PangoCairoShapeRendererFunc func,
- gpointer data,
- GDestroyNotify dnotify);
-PANGO_AVAILABLE_IN_1_18
-PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext *context,
- gpointer *data);
-
/* Convenience
*/
PANGO_AVAILABLE_IN_1_22
diff --git a/pango/serializer.c b/pango/serializer.c
index 99352c0d..ddd9de4c 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -178,7 +178,6 @@ static const char *attr_type_names[] = {
"underline",
"strikethrough",
"rise",
- "shape",
"scale",
"fallback",
"letter-spacing",
@@ -395,10 +394,6 @@ add_attribute (GtkJsonPrinter *printer,
gtk_json_printer_add_boolean (printer, "value", ((PangoAttrInt*)attr)->value != 0);
break;
- case PANGO_ATTR_SHAPE:
- gtk_json_printer_add_string (printer, "value", "shape");
- break;
-
case PANGO_ATTR_SCALE:
case PANGO_ATTR_LINE_HEIGHT:
gtk_json_printer_add_number (printer, "value", ((PangoAttrFloat*)attr)->value);
@@ -1021,11 +1016,6 @@ attr_for_type (GtkJsonParser *parser,
attr = pango_attr_rise_new ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_SHAPE:
- /* FIXME */
- attr = pango_attr_shape_new (&(PangoRectangle) { 0, 0, 0, 0}, &(PangoRectangle) { 0, 0, 0, 0});
- break;
-
case PANGO_ATTR_SCALE:
attr = pango_attr_scale_new (gtk_json_parser_get_number (parser));
break;
diff --git a/tests/test-itemize.c b/tests/test-itemize.c
index 279bcb9a..267c1b62 100644
--- a/tests/test-itemize.c
+++ b/tests/test-itemize.c
@@ -76,7 +76,6 @@ affects_itemization (PangoAttribute *attr,
case PANGO_ATTR_FONT_SCALE:
/* These are part of ItemProperties, so need to break runs */
case PANGO_ATTR_LETTER_SPACING:
- case PANGO_ATTR_SHAPE:
case PANGO_ATTR_RISE:
case PANGO_ATTR_BASELINE_SHIFT:
case PANGO_ATTR_LINE_HEIGHT:
diff --git a/tests/test-shape.c b/tests/test-shape.c
index 26dce98c..bbfd91db 100644
--- a/tests/test-shape.c
+++ b/tests/test-shape.c
@@ -80,7 +80,6 @@ affects_itemization (PangoAttribute *attr,
case PANGO_ATTR_GRAVITY:
case PANGO_ATTR_GRAVITY_HINT:
/* These are part of ItemProperties, so need to break runs */
- case PANGO_ATTR_SHAPE:
case PANGO_ATTR_RISE:
case PANGO_ATTR_UNDERLINE:
case PANGO_ATTR_STRIKETHROUGH:
diff --git a/tests/testattributes.c b/tests/testattributes.c
index d396269f..772578de 100644
--- a/tests/testattributes.c
+++ b/tests/testattributes.c
@@ -62,7 +62,6 @@ test_attributes_basic (void)
test_copy (pango_attr_scale_new (2.56));
test_copy (pango_attr_fallback_new (FALSE));
test_copy (pango_attr_letter_spacing_new (1024));
- test_copy (pango_attr_shape_new (&rect, &rect));
test_copy (pango_attr_gravity_new (PANGO_GRAVITY_SOUTH));
test_copy (pango_attr_gravity_hint_new (PANGO_GRAVITY_HINT_STRONG));
test_copy (pango_attr_font_features_new ("csc=1"));
@@ -149,9 +148,6 @@ test_binding (PangoAttribute *attr)
case COLOR:
g_assert_nonnull (pango_attribute_as_color (attr));
break;
- case SHAPE:
- g_assert_nonnull (pango_attribute_as_shape (attr));
- break;
case FLOAT:
g_assert_nonnull (pango_attribute_as_float (attr));
break;
@@ -196,7 +192,6 @@ test_binding_helpers (void)
test_binding (pango_attr_scale_new (2.56));
test_binding (pango_attr_fallback_new (FALSE));
test_binding (pango_attr_letter_spacing_new (1024));
- test_binding (pango_attr_shape_new (&rect, &rect));
test_binding (pango_attr_gravity_new (PANGO_GRAVITY_SOUTH));
test_binding (pango_attr_gravity_hint_new (PANGO_GRAVITY_HINT_STRONG));
test_binding (pango_attr_font_features_new ("csc=1"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]