summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-06-20 23:09:14 -0700
committerMatthias Clasen <mclasen@redhat.com>2022-06-22 13:57:26 -0400
commit2341e70115597ce603014833276c93b7c205b850 (patch)
tree4a8c8b6b4e14cad09f02d4ed1e7b09cb976da03f /pango
parenta3fee262270c34ff455788d5e89e1161ea52a0a0 (diff)
downloadpango-2341e70115597ce603014833276c93b7c205b850.tar.gz
Make PangoGlyphItem private
Diffstat (limited to 'pango')
-rw-r--r--pango/ellipsize.c3
-rw-r--r--pango/glyphstring.c3
-rw-r--r--pango/meson.build2
-rw-r--r--pango/pango-glyph-item-private.h (renamed from pango/pango-glyph-item.h)0
-rw-r--r--pango/pango-glyph-item.c4
-rw-r--r--pango/pango-glyph-iter-private.h (renamed from pango/pango-glyph-iter.h)2
-rw-r--r--pango/pango-line-iter.h1
-rw-r--r--pango/pango-line-private.h2
-rw-r--r--pango/pango-line.c1
-rw-r--r--pango/pango-renderer.c65
-rw-r--r--pango/pango-renderer.h9
-rw-r--r--pango/pango-run-private.h2
-rw-r--r--pango/pango.h2
-rw-r--r--pango/pangocairo-render.c519
-rw-r--r--pango/pangocairo-render.h4
15 files changed, 307 insertions, 312 deletions
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index 97d78c74..d9f2d994 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -23,7 +23,8 @@
#include <string.h>
#include "pango-item-private.h"
-#include "pango-glyph-item.h"
+#include "pango-glyph-item-private.h"
+#include "pango-glyph-iter-private.h"
#include "pango-font-private.h"
#include "pango-attributes-private.h"
#include "pango-attr-private.h"
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index 00a93c19..70331d59 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -24,6 +24,7 @@
#include "pango-glyph.h"
#include "pango-font.h"
#include "pango-item-private.h"
+#include "pango-glyph-item-private.h"
#include "pango-impl-utils.h"
#include <hb-ot.h>
@@ -325,8 +326,6 @@ pango_glyph_string_get_width (PangoGlyphString *glyphs)
*
* When multiple characters compose a single cluster, the width of the
* entire cluster is divided equally among the characters.
- *
- * See also [method@Pango.GlyphItem.get_logical_widths].
*/
void
pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
diff --git a/pango/meson.build b/pango/meson.build
index 7e89d46d..8ff603cb 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -69,8 +69,6 @@ pango_headers = [
'pango-fontset.h',
'pango-generic-family.h',
'pango-glyph.h',
- 'pango-glyph-item.h',
- 'pango-glyph-iter.h',
'pango-gravity.h',
'pango-item.h',
'pango-language.h',
diff --git a/pango/pango-glyph-item.h b/pango/pango-glyph-item-private.h
index 82e5dca4..82e5dca4 100644
--- a/pango/pango-glyph-item.h
+++ b/pango/pango-glyph-item-private.h
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c
index 9e4bdb09..553bc5f1 100644
--- a/pango/pango-glyph-item.c
+++ b/pango/pango-glyph-item.c
@@ -22,8 +22,8 @@
#include "config.h"
#include <string.h>
-#include "pango-glyph-item.h"
-#include "pango-glyph-iter.h"
+#include "pango-glyph-item-private.h"
+#include "pango-glyph-iter-private.h"
#include "pango-item-private.h"
#include "pango-impl-utils.h"
#include "pango-attr-list-private.h"
diff --git a/pango/pango-glyph-iter.h b/pango/pango-glyph-iter-private.h
index ef0df5fb..c07d7306 100644
--- a/pango/pango-glyph-iter.h
+++ b/pango/pango-glyph-iter-private.h
@@ -19,7 +19,7 @@
#pragma once
-#include <pango/pango-glyph-item.h>
+#include <pango/pango-glyph-item-private.h>
G_BEGIN_DECLS
diff --git a/pango/pango-line-iter.h b/pango/pango-line-iter.h
index 33efeacf..244f1e21 100644
--- a/pango/pango-line-iter.h
+++ b/pango/pango-line-iter.h
@@ -23,7 +23,6 @@
#include <pango/pango-types.h>
#include <pango/pango-lines.h>
-#include <pango/pango-glyph-item.h>
G_BEGIN_DECLS
diff --git a/pango/pango-line-private.h b/pango/pango-line-private.h
index 058f0a18..deb04e8a 100644
--- a/pango/pango-line-private.h
+++ b/pango/pango-line-private.h
@@ -22,7 +22,7 @@
#include "pango-line.h"
#include "pango-break.h"
#include "pango-attributes.h"
-#include "pango-glyph-item.h"
+#include "pango-glyph-item-private.h"
typedef struct _LineData LineData;
diff --git a/pango/pango-line.c b/pango/pango-line.c
index 64b10867..bff853bb 100644
--- a/pango/pango-line.c
+++ b/pango/pango-line.c
@@ -9,6 +9,7 @@
#include "pango-attr-list-private.h"
#include "pango-attr-iterator-private.h"
#include "pango-item-private.h"
+#include "pango-glyph-iter-private.h"
#include "pango-run-private.h"
#include "pango-font-metrics-private.h"
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index f857bd78..03e24bb6 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -29,6 +29,7 @@
#include "pango-run-private.h"
#include "pango-line-private.h"
#include "pango-attributes-private.h"
+#include "pango-glyph-item-private.h"
#define N_RENDER_PARTS 5
@@ -84,9 +85,9 @@ static void pango_renderer_default_draw_glyphs (PangoRenderer *rende
PangoGlyphString *glyphs,
int x,
int y);
-static void pango_renderer_default_draw_glyph_item (PangoRenderer *renderer,
+static void pango_renderer_default_draw_run (PangoRenderer *renderer,
const char *text,
- PangoGlyphItem *glyph_item,
+ PangoRun *run,
int x,
int y);
static void pango_renderer_default_draw_rectangle (PangoRenderer *renderer,
@@ -133,7 +134,7 @@ pango_renderer_class_init (PangoRendererClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
klass->draw_glyphs = pango_renderer_default_draw_glyphs;
- klass->draw_glyph_item = pango_renderer_default_draw_glyph_item;
+ klass->draw_run = pango_renderer_default_draw_run;
klass->draw_rectangle = pango_renderer_default_draw_rectangle;
klass->draw_error_underline = pango_renderer_default_draw_error_underline;
klass->prepare_run = pango_renderer_default_prepare_run;
@@ -698,15 +699,15 @@ pango_renderer_draw_runs (PangoRenderer *renderer,
{
PangoFontMetrics *metrics;
PangoRun *run = l->data;
- PangoGlyphItem *glyph_item = l->data;
- PangoItem *item = glyph_item->item;
- PangoGlyphString *glyphs = glyph_item->glyphs;
+ PangoGlyphItem *glyph_item = pango_run_get_glyph_item (run);
+ PangoItem *item = pango_run_get_item (run);
+ PangoGlyphString *glyphs = pango_run_get_glyphs (run);
PangoRectangle ink_rect, *ink = NULL;
PangoRectangle logical_rect, *logical = NULL;
ItemProperties properties;
int y_off;
- if (glyph_item->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ if (item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
logical = &logical_rect;
pango_renderer_prepare_run (renderer, run);
@@ -779,7 +780,7 @@ pango_renderer_draw_runs (PangoRenderer *renderer,
if (properties.shape)
draw_shaped_glyphs (renderer, glyphs, properties.shape, x + x_off, y - y_off);
else
- pango_renderer_draw_glyph_item (renderer, text, glyph_item, x + x_off, y - y_off);
+ pango_renderer_draw_run (renderer, text, run, x + x_off, y - y_off);
if (priv->underline != PANGO_LINE_STYLE_NONE ||
priv->overline != PANGO_LINE_STYLE_NONE ||
@@ -879,28 +880,28 @@ pango_renderer_default_draw_glyphs (PangoRenderer *renderer,
}
/**
- * pango_renderer_draw_glyph_item:
+ * pango_renderer_draw_run:
* @renderer: a `PangoRenderer`
* @text: (nullable): the UTF-8 text that @glyph_item refers to
- * @glyph_item: a `PangoGlyphItem`
+ * @run: a `PangoRun`
* @x: X position of left edge of baseline, in user space coordinates
* in Pango units
* @y: Y position of left edge of baseline, in user space coordinates
* in Pango units
*
- * Draws the glyphs in @glyph_item with the specified `PangoRenderer`,
+ * Draws the glyphs in @run with the specified `PangoRenderer`,
* embedding the text associated with the glyphs in the output if the
* output format supports it.
*
* This is useful for rendering text in PDF.
*
- * Note that this method does not handle attributes in @glyph_item.
+ * Note that this method does not handle attributes in @run.
* If you want colors, shapes and lines handled automatically according
* to those attributes, you need to use [method@Pango.Renderer.draw_line]
* or [method@Pango.Renderer.draw_lines].
*
* Note that @text is the start of the text for layout, which is then
- * indexed by `glyph_item->item->offset`.
+ * indexed by `run->item->offset`.
*
* If @text is %NULL, this simply calls [method@Pango.Renderer.draw_glyphs].
*
@@ -908,18 +909,18 @@ pango_renderer_default_draw_glyphs (PangoRenderer *renderer,
* [method@Pango.Renderer.draw_glyphs].
*/
void
-pango_renderer_draw_glyph_item (PangoRenderer *renderer,
- const char *text,
- PangoGlyphItem *glyph_item,
- int x,
- int y)
+pango_renderer_draw_run (PangoRenderer *renderer,
+ const char *text,
+ PangoRun *run,
+ int x,
+ int y)
{
if (!text)
{
- pango_renderer_draw_glyphs (renderer,
- glyph_item->item->analysis.font,
- glyph_item->glyphs,
- x, y);
+ PangoItem *item = pango_run_get_item (run);
+ PangoGlyphString *glyphs = pango_run_get_glyphs (run);
+
+ pango_renderer_draw_glyphs (renderer, item->analysis.font, glyphs, x, y);
return;
}
@@ -927,22 +928,22 @@ pango_renderer_draw_glyph_item (PangoRenderer *renderer,
pango_renderer_activate (renderer);
- PANGO_RENDERER_GET_CLASS (renderer)->draw_glyph_item (renderer, text, glyph_item, x, y);
+ PANGO_RENDERER_GET_CLASS (renderer)->draw_run (renderer, text, run, x, y);
pango_renderer_deactivate (renderer);
}
static void
-pango_renderer_default_draw_glyph_item (PangoRenderer *renderer,
- const char *text G_GNUC_UNUSED,
- PangoGlyphItem *glyph_item,
- int x,
- int y)
+pango_renderer_default_draw_run (PangoRenderer *renderer,
+ const char *text G_GNUC_UNUSED,
+ PangoRun *run,
+ int x,
+ int y)
{
- pango_renderer_draw_glyphs (renderer,
- glyph_item->item->analysis.font,
- glyph_item->glyphs,
- x, y);
+ PangoItem *item = pango_run_get_item (run);
+ PangoGlyphString *glyphs = pango_run_get_glyphs (run);
+
+ pango_renderer_draw_glyphs (renderer, item->analysis.font, glyphs, x, y);
}
/**
diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h
index 347cebd9..dfde0167 100644
--- a/pango/pango-renderer.h
+++ b/pango/pango-renderer.h
@@ -22,7 +22,6 @@
#include <pango/pango-layout.h>
#include <pango/pango-lines.h>
#include <pango/pango-glyph.h>
-#include <pango/pango-glyph-item.h>
G_BEGIN_DECLS
@@ -157,9 +156,9 @@ struct _PangoRendererClass
void (*prepare_run) (PangoRenderer *renderer,
PangoRun *run);
- void (*draw_glyph_item) (PangoRenderer *renderer,
+ void (*draw_run) (PangoRenderer *renderer,
const char *text,
- PangoGlyphItem *glyph_item,
+ PangoRun *run,
int x,
int y);
@@ -190,9 +189,9 @@ void pango_renderer_draw_glyphs (PangoRenderer *renderer,
int x,
int y);
PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_glyph_item (PangoRenderer *renderer,
+void pango_renderer_draw_run (PangoRenderer *renderer,
const char *text,
- PangoGlyphItem *glyph_item,
+ PangoRun *run,
int x,
int y);
PANGO_AVAILABLE_IN_ALL
diff --git a/pango/pango-run-private.h b/pango/pango-run-private.h
index 08a5d9cd..6fa31db7 100644
--- a/pango/pango-run-private.h
+++ b/pango/pango-run-private.h
@@ -22,7 +22,7 @@
#include "config.h"
#include "pango-run.h"
-#include "pango-glyph-item.h"
+#include "pango-glyph-item-private.h"
#include "pango-item-private.h"
diff --git a/pango/pango.h b/pango/pango.h
index 8b0c36c1..75dc9b83 100644
--- a/pango/pango.h
+++ b/pango/pango.h
@@ -38,8 +38,6 @@
#include <pango/pango-fontset.h>
#include <pango/pango-generic-family.h>
#include <pango/pango-glyph.h>
-#include <pango/pango-glyph-item.h>
-#include <pango/pango-glyph-iter.h>
#include <pango/pango-gravity.h>
#include <pango/pango-hbface.h>
#include <pango/pango-hbfont.h>
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index ae21807a..2a76a161 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -10,7 +10,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -26,7 +26,9 @@
#include "pango-item-private.h"
#include "pango-font-private.h"
#include "pangocairo-private.h"
-#include "pango-glyph-item.h"
+#include "pango-glyph-item-private.h"
+#include "pango-glyph-iter-private.h"
+#include "pango-run-private.h"
#include "pango-impl-utils.h"
#include "pango-hbfont-private.h"
@@ -59,7 +61,7 @@ G_DEFINE_TYPE (PangoCairoRenderer, pango_cairo_renderer, PANGO_TYPE_RENDERER)
static void
set_color (PangoCairoRenderer *crenderer,
- PangoRenderPart part)
+ PangoRenderPart part)
{
PangoColor *color = pango_renderer_get_color ((PangoRenderer *) (crenderer), part);
double red, green, blue, alpha;
@@ -95,12 +97,12 @@ set_color (PangoCairoRenderer *crenderer,
/* note: modifies crenderer->cr without doing cairo_save/restore() */
static void
_pango_cairo_renderer_draw_frame (PangoCairoRenderer *crenderer,
- double x,
- double y,
- double width,
- double height,
- double line_width,
- gboolean invalid)
+ double x,
+ double y,
+ double width,
+ double height,
+ double line_width,
+ gboolean invalid)
{
cairo_t *cr = crenderer->cr;
@@ -121,61 +123,61 @@ _pango_cairo_renderer_draw_frame (PangoCairoRenderer *crenderer,
/* inner */
if (invalid)
{
- /* delicacies of computing the joint... this is REALLY slow */
-
- double alpha, tan_alpha2, cos_alpha;
- double sx, sy;
-
- alpha = atan2 (height, width);
-
- tan_alpha2 = tan (alpha * .5);
- if (tan_alpha2 < 1e-5 || (sx = d2 / tan_alpha2, 2. * sx > width - d))
- sx = (width - d) * .5;
-
- cos_alpha = cos (alpha);
- if (cos_alpha < 1e-5 || (sy = d2 / cos_alpha, 2. * sy > height - d))
- sy = (height - d) * .5;
-
- /* top triangle */
- cairo_new_sub_path (cr);
- cairo_line_to (cr, x+width-sx, y+d2);
- cairo_line_to (cr, x+sx, y+d2);
- cairo_line_to (cr, x+.5*width, y+.5*height-sy);
- cairo_close_path (cr);
-
- /* bottom triangle */
- cairo_new_sub_path (cr);
- cairo_line_to (cr, x+width-sx, y+height-d2);
- cairo_line_to (cr, x+.5*width, y+.5*height+sy);
- cairo_line_to (cr, x+sx, y+height-d2);
- cairo_close_path (cr);
-
-
- alpha = G_PI_2 - alpha;
- tan_alpha2 = tan (alpha * .5);
- if (tan_alpha2 < 1e-5 || (sy = d2 / tan_alpha2, 2. * sy > height - d))
- sy = (height - d) * .5;
-
- cos_alpha = cos (alpha);
- if (cos_alpha < 1e-5 || (sx = d2 / cos_alpha, 2. * sx > width - d))
- sx = (width - d) * .5;
-
- /* left triangle */
- cairo_new_sub_path (cr);
- cairo_line_to (cr, x+d2, y+sy);
- cairo_line_to (cr, x+d2, y+height-sy);
- cairo_line_to (cr, x+.5*width-sx, y+.5*height);
- cairo_close_path (cr);
-
- /* right triangle */
- cairo_new_sub_path (cr);
- cairo_line_to (cr, x+width-d2, y+sy);
- cairo_line_to (cr, x+.5*width+sx, y+.5*height);
- cairo_line_to (cr, x+width-d2, y+height-sy);
- cairo_close_path (cr);
- }
+ /* delicacies of computing the joint... this is REALLY slow */
+
+ double alpha, tan_alpha2, cos_alpha;
+ double sx, sy;
+
+ alpha = atan2 (height, width);
+
+ tan_alpha2 = tan (alpha * .5);
+ if (tan_alpha2 < 1e-5 || (sx = d2 / tan_alpha2, 2. * sx > width - d))
+ sx = (width - d) * .5;
+
+ cos_alpha = cos (alpha);
+ if (cos_alpha < 1e-5 || (sy = d2 / cos_alpha, 2. * sy > height - d))
+ sy = (height - d) * .5;
+
+ /* top triangle */
+ cairo_new_sub_path (cr);
+ cairo_line_to (cr, x+width-sx, y+d2);
+ cairo_line_to (cr, x+sx, y+d2);
+ cairo_line_to (cr, x+.5*width, y+.5*height-sy);
+ cairo_close_path (cr);
+
+ /* bottom triangle */
+ cairo_new_sub_path (cr);
+ cairo_line_to (cr, x+width-sx, y+height-d2);
+ cairo_line_to (cr, x+.5*width, y+.5*height+sy);
+ cairo_line_to (cr, x+sx, y+height-d2);
+ cairo_close_path (cr);
+
+
+ alpha = G_PI_2 - alpha;
+ tan_alpha2 = tan (alpha * .5);
+ if (tan_alpha2 < 1e-5 || (sy = d2 / tan_alpha2, 2. * sy > height - d))
+ sy = (height - d) * .5;
+
+ cos_alpha = cos (alpha);
+ if (cos_alpha < 1e-5 || (sx = d2 / cos_alpha, 2. * sx > width - d))
+ sx = (width - d) * .5;
+
+ /* left triangle */
+ cairo_new_sub_path (cr);
+ cairo_line_to (cr, x+d2, y+sy);
+ cairo_line_to (cr, x+d2, y+height-sy);
+ cairo_line_to (cr, x+.5*width-sx, y+.5*height);
+ cairo_close_path (cr);
+
+ /* right triangle */
+ cairo_new_sub_path (cr);
+ cairo_line_to (cr, x+width-d2, y+sy);
+ cairo_line_to (cr, x+.5*width+sx, y+.5*height);
+ cairo_line_to (cr, x+width-d2, y+height-sy);
+ cairo_close_path (cr);
+ }
else
- cairo_rectangle (cr, x+width-d2, y+d2, - (width-d), height-d);
+ cairo_rectangle (cr, x+width-d2, y+d2, - (width-d), height-d);
}
else
{
@@ -183,18 +185,18 @@ _pango_cairo_renderer_draw_frame (PangoCairoRenderer *crenderer,
if (invalid)
{
- /* draw an X */
+ /* draw an X */
- cairo_new_sub_path (cr);
- cairo_move_to (cr, x, y);
- cairo_rel_line_to (cr, width, height);
+ cairo_new_sub_path (cr);
+ cairo_move_to (cr, x, y);
+ cairo_rel_line_to (cr, width, height);
- cairo_new_sub_path (cr);
- cairo_move_to (cr, x + width, y);
- cairo_rel_line_to (cr, -width, height);
+ cairo_new_sub_path (cr);
+ cairo_move_to (cr, x + width, y);
+ cairo_rel_line_to (cr, -width, height);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
- }
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+ }
cairo_set_line_width (cr, line_width);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
@@ -205,30 +207,30 @@ _pango_cairo_renderer_draw_frame (PangoCairoRenderer *crenderer,
static void
_pango_cairo_renderer_draw_box_glyph (PangoCairoRenderer *crenderer,
- PangoGlyphInfo *gi,
- double cx,
- double cy,
- gboolean invalid)
+ PangoGlyphInfo *gi,
+ double cx,
+ double cy,
+ gboolean invalid)
{
cairo_save (crenderer->cr);
_pango_cairo_renderer_draw_frame (crenderer,
- cx + 1.5,
- cy + 1.5 - PANGO_UNKNOWN_GLYPH_HEIGHT,
- (double)gi->geometry.width / PANGO_SCALE - 3.0,
- PANGO_UNKNOWN_GLYPH_HEIGHT - 3.0,
- 1.0,
- invalid);
+ cx + 1.5,
+ cy + 1.5 - PANGO_UNKNOWN_GLYPH_HEIGHT,
+ (double)gi->geometry.width / PANGO_SCALE - 3.0,
+ PANGO_UNKNOWN_GLYPH_HEIGHT - 3.0,
+ 1.0,
+ invalid);
cairo_restore (crenderer->cr);
}
static void
_pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
- PangoFont *font,
- PangoGlyphInfo *gi,
- double cx,
- double cy)
+ PangoFont *font,
+ PangoGlyphInfo *gi,
+ double cx,
+ double cy)
{
char buf[7];
double x0, y0;
@@ -358,12 +360,12 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
lsb = floor (lsb / hbi->pad_x) * hbi->pad_x;
_pango_cairo_renderer_draw_frame (crenderer,
- cx + lsb + .5 * hbi->pad_x,
- cy + hbi->box_descent - hbi->box_height + hbi->pad_y * 0.5,
- width - hbi->pad_x,
- (hbi->box_height - hbi->pad_y),
- hbi->line_width,
- invalid_input);
+ cx + lsb + .5 * hbi->pad_x,
+ cy + hbi->box_descent - hbi->box_height + hbi->pad_y * 0.5,
+ width - hbi->pad_x,
+ (hbi->box_height - hbi->pad_y),
+ hbi->line_width,
+ invalid_input);
if (invalid_input)
goto done;
@@ -375,21 +377,21 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
{
double y = y0 - (rows - 1 - row) * (hbi->digit_height + hbi->pad_y);
for (col = 0; col < cols; col++, p++)
- {
- double x = x0 + col * (hbi->digit_width + hbi->pad_x);
+ {
+ double x = x0 + col * (hbi->digit_width + hbi->pad_x);
if (!p)
goto done;
- cairo_move_to (crenderer->cr, x, y);
+ cairo_move_to (crenderer->cr, x, y);
hexbox_string[0] = p[0];
- if (crenderer->do_path)
- cairo_text_path (crenderer->cr, hexbox_string);
- else
- cairo_show_text (crenderer->cr, hexbox_string);
- }
+ if (crenderer->do_path)
+ cairo_text_path (crenderer->cr, hexbox_string);
+ else
+ cairo_show_text (crenderer->cr, hexbox_string);
+ }
}
done:
@@ -404,15 +406,15 @@ done:
static void
pango_cairo_renderer_show_text_glyphs (PangoRenderer *renderer,
- const char *text,
- int text_len,
- PangoGlyphString *glyphs,
- cairo_text_cluster_t *clusters,
- int num_clusters,
- gboolean backward,
- PangoFont *font,
- int x,
- int y)
+ const char *text,
+ int text_len,
+ PangoGlyphString *glyphs,
+ cairo_text_cluster_t *clusters,
+ int num_clusters,
+ gboolean backward,
+ PangoFont *font,
+ int x,
+ int y)
{
PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
@@ -430,20 +432,20 @@ pango_cairo_renderer_show_text_glyphs (PangoRenderer *renderer,
if (!_pango_cairo_font_install (font, crenderer->cr))
{
for (i = 0; i < glyphs->num_glyphs; i++)
- {
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ {
+ PangoGlyphInfo *gi = &glyphs->glyphs[i];
- if (gi->glyph != PANGO_GLYPH_EMPTY)
- {
- double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
- double cy = gi->geometry.y_offset == 0 ?
- base_y :
- base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE;
+ if (gi->glyph != PANGO_GLYPH_EMPTY)
+ {
+ double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
+ double cy = gi->geometry.y_offset == 0 ?
+ base_y :
+ base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE;
- _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
- }
- x_position += gi->geometry.width;
- }
+ _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
+ }
+ x_position += gi->geometry.width;
+ }
goto done;
}
@@ -459,27 +461,27 @@ pango_cairo_renderer_show_text_glyphs (PangoRenderer *renderer,
PangoGlyphInfo *gi = &glyphs->glyphs[i];
if (gi->glyph != PANGO_GLYPH_EMPTY)
- {
- double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
- double cy = gi->geometry.y_offset == 0 ?
- base_y :
- base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE;
+ {
+ double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
+ double cy = gi->geometry.y_offset == 0 ?
+ base_y :
+ base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE;
- if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
if (gi->glyph == (0x20 | PANGO_GLYPH_UNKNOWN_FLAG))
; /* no hex boxes for space, please */
else
- _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
+ _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
}
- else
- {
- cairo_glyphs[count].index = gi->glyph;
- cairo_glyphs[count].x = cx;
- cairo_glyphs[count].y = cy;
- count++;
- }
- }
+ else
+ {
+ cairo_glyphs[count].index = gi->glyph;
+ cairo_glyphs[count].x = cx;
+ cairo_glyphs[count].y = cy;
+ count++;
+ }
+ }
x_position += gi->geometry.width;
}
@@ -488,10 +490,10 @@ pango_cairo_renderer_show_text_glyphs (PangoRenderer *renderer,
else
if (G_UNLIKELY (clusters))
cairo_show_text_glyphs (crenderer->cr,
- text, text_len,
- cairo_glyphs, count,
- clusters, num_clusters,
- backward ? CAIRO_TEXT_CLUSTER_FLAG_BACKWARD : 0);
+ text, text_len,
+ cairo_glyphs, count,
+ clusters, num_clusters,
+ backward ? CAIRO_TEXT_CLUSTER_FLAG_BACKWARD : 0);
else
cairo_show_glyphs (crenderer->cr, cairo_glyphs, count);
@@ -504,34 +506,34 @@ done:
static void
pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y)
+ PangoFont *font,
+ PangoGlyphString *glyphs,
+ int x,
+ int y)
{
pango_cairo_renderer_show_text_glyphs (renderer,
- NULL, 0,
- glyphs,
- NULL, 0,
- FALSE,
- font,
- x, y);
+ NULL, 0,
+ glyphs,
+ NULL, 0,
+ FALSE,
+ font,
+ x, y);
}
static void
-pango_cairo_renderer_draw_glyph_item (PangoRenderer *renderer,
- const char *text,
- PangoGlyphItem *glyph_item,
- int x,
- int y)
+pango_cairo_renderer_draw_run (PangoRenderer *renderer,
+ const char *text,
+ PangoRun *run,
+ int x,
+ int y)
{
PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
- PangoFont *font = glyph_item->item->analysis.font;
- PangoGlyphString *glyphs = glyph_item->glyphs;
- PangoItem *item = glyph_item->item;
- gboolean backward = (item->analysis.level & 1) != 0;
-
- PangoGlyphItemIter iter;
+ PangoItem *item = pango_run_get_item (run);
+ PangoGlyphString *glyphs = pango_run_get_glyphs (run);
+ PangoFont *font = item->analysis.font;
+ gboolean backward = (item->analysis.level & 1) != 0;
+ PangoGlyphItem *glyph_item = pango_run_get_glyph_item (run);
+ PangoGlyphItemIter iter;
cairo_text_cluster_t *cairo_clusters;
cairo_text_cluster_t stack_clusters[STACK_ARRAY_LENGTH (cairo_text_cluster_t)];
int num_clusters;
@@ -539,12 +541,12 @@ pango_cairo_renderer_draw_glyph_item (PangoRenderer *renderer,
if (!crenderer->has_show_text_glyphs || crenderer->do_path)
{
pango_cairo_renderer_show_text_glyphs (renderer,
- NULL, 0,
- glyphs,
- NULL, 0,
- FALSE,
- font,
- x, y);
+ NULL, 0,
+ glyphs,
+ NULL, 0,
+ FALSE,
+ font,
+ x, y);
return;
}
@@ -562,22 +564,22 @@ pango_cairo_renderer_draw_glyph_item (PangoRenderer *renderer,
num_bytes = iter.end_index - iter.start_index;
num_glyphs = backward ? iter.start_glyph - iter.end_glyph : iter.end_glyph - iter.start_glyph;
- if (num_bytes < 1)
- g_warning ("pango_cairo_renderer_draw_glyph_item: bad cluster has num_bytes %d", num_bytes);
- if (num_glyphs < 1)
- g_warning ("pango_cairo_renderer_draw_glyph_item: bad cluster has num_glyphs %d", num_glyphs);
+ if (num_bytes < 1)
+ g_warning ("pango_cairo_renderer_draw_glyph_item: bad cluster has num_bytes %d", num_bytes);
+ if (num_glyphs < 1)
+ g_warning ("pango_cairo_renderer_draw_glyph_item: bad cluster has num_glyphs %d", num_glyphs);
- /* Discount empty and unknown glyphs */
- for (i = MIN (iter.start_glyph, iter.end_glyph+1);
- i < MAX (iter.start_glyph+1, iter.end_glyph);
- i++)
- {
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ /* Discount empty and unknown glyphs */
+ for (i = MIN (iter.start_glyph, iter.end_glyph+1);
+ i < MAX (iter.start_glyph+1, iter.end_glyph);
+ i++)
+ {
+ PangoGlyphInfo *gi = &glyphs->glyphs[i];
- if (gi->glyph == PANGO_GLYPH_EMPTY ||
- gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- num_glyphs--;
- }
+ if (gi->glyph == PANGO_GLYPH_EMPTY ||
+ gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ num_glyphs--;
+ }
cairo_clusters[num_clusters].num_bytes = num_bytes;
cairo_clusters[num_clusters].num_glyphs = num_glyphs;
@@ -586,12 +588,12 @@ pango_cairo_renderer_draw_glyph_item (PangoRenderer *renderer,
}
pango_cairo_renderer_show_text_glyphs (renderer,
- text + item->offset, item->length,
- glyphs,
- cairo_clusters, num_clusters,
- backward,
- font,
- x, y);
+ text + item->offset, item->length,
+ glyphs,
+ cairo_clusters, num_clusters,
+ backward,
+ font,
+ x, y);
if (cairo_clusters != stack_clusters)
g_free (cairo_clusters);
@@ -599,11 +601,11 @@ pango_cairo_renderer_draw_glyph_item (PangoRenderer *renderer,
static void
pango_cairo_renderer_draw_rectangle (PangoRenderer *renderer,
- PangoRenderPart part,
- int x,
- int y,
- int width,
- int height)
+ PangoRenderPart part,
+ int x,
+ int y,
+ int width,
+ int height)
{
PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
@@ -615,9 +617,9 @@ pango_cairo_renderer_draw_rectangle (PangoRenderer *renderer,
}
cairo_rectangle (crenderer->cr,
- crenderer->x_offset + (double)x / PANGO_SCALE,
- crenderer->y_offset + (double)y / PANGO_SCALE,
- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
+ crenderer->x_offset + (double)x / PANGO_SCALE,
+ crenderer->y_offset + (double)y / PANGO_SCALE,
+ (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
if (!crenderer->do_path)
{
@@ -629,13 +631,13 @@ pango_cairo_renderer_draw_rectangle (PangoRenderer *renderer,
static void
pango_cairo_renderer_draw_trapezoid (PangoRenderer *renderer,
- PangoRenderPart part,
- double y1_,
- double x11,
- double x21,
- double y2,
- double x12,
- double x22)
+ PangoRenderPart part,
+ double y1_,
+ double x11,
+ double x21,
+ double y2,
+ double x12,
+ double x22)
{
PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
cairo_t *cr;
@@ -688,10 +690,10 @@ pango_cairo_renderer_draw_trapezoid (PangoRenderer *renderer,
static void
draw_error_underline (cairo_t *cr,
- double x,
- double y,
- double width,
- double height)
+ double x,
+ double y,
+ double width,
+ double height)
{
double square = height / HEIGHT_SQUARES;
double unit_width = (HEIGHT_SQUARES - 1) * square;
@@ -741,10 +743,10 @@ draw_error_underline (cairo_t *cr,
static void
pango_cairo_renderer_draw_error_underline (PangoRenderer *renderer,
- int x,
- int y,
- int width,
- int height)
+ int x,
+ int y,
+ int width,
+ int height)
{
PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
cairo_t *cr = crenderer->cr;
@@ -759,9 +761,9 @@ pango_cairo_renderer_draw_error_underline (PangoRenderer *renderer,
}
draw_error_underline (cr,
- crenderer->x_offset + (double)x / PANGO_SCALE,
- crenderer->y_offset + (double)y / PANGO_SCALE,
- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
+ crenderer->x_offset + (double)x / PANGO_SCALE,
+ crenderer->y_offset + (double)y / PANGO_SCALE,
+ (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
if (!crenderer->do_path)
{
@@ -782,7 +784,7 @@ pango_cairo_renderer_class_init (PangoCairoRendererClass *klass)
PangoRendererClass *renderer_class = PANGO_RENDERER_CLASS (klass);
renderer_class->draw_glyphs = pango_cairo_renderer_draw_glyphs;
- renderer_class->draw_glyph_item = pango_cairo_renderer_draw_glyph_item;
+ renderer_class->draw_run = pango_cairo_renderer_draw_run;
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;
@@ -800,9 +802,9 @@ acquire_renderer (void)
{
if (G_UNLIKELY (!cached_renderer))
{
- cached_renderer = g_object_new (PANGO_TYPE_CAIRO_RENDERER, NULL);
- cached_renderer->is_cached_renderer = TRUE;
- }
+ cached_renderer = g_object_new (PANGO_TYPE_CAIRO_RENDERER, NULL);
+ cached_renderer->is_cached_renderer = TRUE;
+ }
renderer = cached_renderer;
}
@@ -857,9 +859,9 @@ restore_current_point (PangoCairoRenderer *renderer)
static void
_pango_cairo_do_glyph_string (cairo_t *cr,
- PangoFont *font,
- PangoGlyphString *glyphs,
- gboolean do_path)
+ PangoFont *font,
+ PangoGlyphString *glyphs,
+ gboolean do_path)
{
PangoCairoRenderer *crenderer = acquire_renderer ();
PangoRenderer *renderer = (PangoRenderer *) crenderer;
@@ -896,10 +898,10 @@ _pango_cairo_do_glyph_string (cairo_t *cr,
}
static void
-_pango_cairo_do_glyph_item (cairo_t *cr,
- const char *text,
- PangoGlyphItem *glyph_item,
- gboolean do_path)
+_pango_cairo_do_run (cairo_t *cr,
+ const char *text,
+ PangoRun *run,
+ gboolean do_path)
{
PangoCairoRenderer *crenderer = acquire_renderer ();
PangoRenderer *renderer = (PangoRenderer *) crenderer;
@@ -923,12 +925,10 @@ _pango_cairo_do_glyph_item (cairo_t *cr,
pango_renderer_set_color (renderer, PANGO_RENDER_PART_OVERLINE, NULL);
}
- pango_renderer_draw_glyph_item (renderer, text, glyph_item, 0, 0);
+ pango_renderer_draw_run (renderer, text, run, 0, 0);
if (!do_path)
- {
- pango_renderer_deactivate (renderer);
- }
+ pango_renderer_deactivate (renderer);
restore_current_point (crenderer);
@@ -975,8 +975,8 @@ _pango_cairo_do_lines (cairo_t *cr,
static void
_pango_cairo_do_layout (cairo_t *cr,
- PangoLayout *layout,
- gboolean do_path)
+ PangoLayout *layout,
+ gboolean do_path)
{
PangoCairoRenderer *crenderer = acquire_renderer ();
PangoRenderer *renderer = (PangoRenderer *) crenderer;
@@ -994,11 +994,11 @@ _pango_cairo_do_layout (cairo_t *cr,
static void
_pango_cairo_do_error_underline (cairo_t *cr,
- double x,
- double y,
- double width,
- double height,
- gboolean do_path)
+ double x,
+ double y,
+ double width,
+ double height,
+ gboolean do_path)
{
/* We don't use a renderer here, for a simple reason:
* the only renderer we can get is the default renderer, that
@@ -1032,8 +1032,8 @@ _pango_cairo_do_error_underline (cairo_t *cr,
*/
void
pango_cairo_show_glyph_string (cairo_t *cr,
- PangoFont *font,
- PangoGlyphString *glyphs)
+ PangoFont *font,
+ PangoGlyphString *glyphs)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (glyphs != NULL);
@@ -1043,13 +1043,12 @@ pango_cairo_show_glyph_string (cairo_t *cr,
/**
- * pango_cairo_show_glyph_item:
+ * pango_cairo_show_run:
* @cr: a Cairo context
- * @text: the UTF-8 text that @glyph_item refers to
- * @glyph_item: a `PangoGlyphItem`
- *
- * Draws the glyphs in @glyph_item in the specified cairo context,
+ * @text: the UTF-8 text that @run refers to
+ * @run: a `PangoRun`
*
+ * Draws the glyphs in @run in the specified cairo context,
* embedding the text associated with the glyphs in the output if the
* output format supports it (PDF for example), otherwise it acts
* similar to [func@Pango.cairo_show_glyph_string].
@@ -1058,18 +1057,18 @@ pango_cairo_show_glyph_string (cairo_t *cr,
* be drawn at the current point of the cairo context.
*
* Note that @text is the start of the text for layout, which is then
- * indexed by `glyph_item->item->offset`.
+ * indexed by `run->item->offset`.
*/
void
-pango_cairo_show_glyph_item (cairo_t *cr,
- const char *text,
- PangoGlyphItem *glyph_item)
+pango_cairo_show_run (cairo_t *cr,
+ const char *text,
+ PangoRun *run)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (text != NULL);
- g_return_if_fail (glyph_item != NULL);
+ g_return_if_fail (run != NULL);
- _pango_cairo_do_glyph_item (cr, text, glyph_item, FALSE);
+ _pango_cairo_do_run (cr, text, run, FALSE);
}
/**
@@ -1124,7 +1123,7 @@ pango_cairo_show_lines (cairo_t *cr,
*/
void
pango_cairo_show_layout (cairo_t *cr,
- PangoLayout *layout)
+ PangoLayout *layout)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (PANGO_IS_LAYOUT (layout));
@@ -1150,10 +1149,10 @@ pango_cairo_show_layout (cairo_t *cr,
*/
void
pango_cairo_show_error_underline (cairo_t *cr,
- double x,
- double y,
- double width,
- double height)
+ double x,
+ double y,
+ double width,
+ double height)
{
g_return_if_fail (cr != NULL);
g_return_if_fail ((width >= 0) && (height >= 0));
@@ -1175,8 +1174,8 @@ pango_cairo_show_error_underline (cairo_t *cr,
*/
void
pango_cairo_glyph_string_path (cairo_t *cr,
- PangoFont *font,
- PangoGlyphString *glyphs)
+ PangoFont *font,
+ PangoGlyphString *glyphs)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (glyphs != NULL);
@@ -1217,7 +1216,7 @@ pango_cairo_line_path (cairo_t *cr,
*/
void
pango_cairo_layout_path (cairo_t *cr,
- PangoLayout *layout)
+ PangoLayout *layout)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (PANGO_IS_LAYOUT (layout));
@@ -1263,10 +1262,10 @@ pango_cairo_lines_path (cairo_t *cr,
*/
void
pango_cairo_error_underline_path (cairo_t *cr,
- double x,
- double y,
- double width,
- double height)
+ double x,
+ double y,
+ double width,
+ double height)
{
g_return_if_fail (cr != NULL);
g_return_if_fail ((width >= 0) && (height >= 0));
diff --git a/pango/pangocairo-render.h b/pango/pangocairo-render.h
index aadb831e..45ca44ae 100644
--- a/pango/pangocairo-render.h
+++ b/pango/pangocairo-render.h
@@ -30,9 +30,9 @@ void pango_cairo_show_glyph_string (cairo_t *cr,
PangoGlyphString *glyphs);
PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_glyph_item (cairo_t *cr,
+void pango_cairo_show_run (cairo_t *cr,
const char *text,
- PangoGlyphItem *glyph_item);
+ PangoRun *run);
PANGO_AVAILABLE_IN_ALL
void pango_cairo_show_line (cairo_t *cr,
PangoLine *line);