[pango/line-breaker: 40/41] The big rename, part 3
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/line-breaker: 40/41] The big rename, part 3
- Date: Sat, 22 Jan 2022 17:52:26 +0000 (UTC)
commit 6cdf9eed4718913d7675d18f99b563ac39c7edce
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 21 13:57:00 2022 -0500
The big rename, part 3
line iter -> layout iter
pango/meson.build | 4 +-
pango/pango-attributes.c | 4 +-
pango/pango-layout-iter-private.h | 5 +
pango/{pango-line-iter.c => pango-layout-iter.c} | 168 +++++++++++------------
pango/pango-layout-iter.h | 79 +++++++++++
pango/pango-layout-iterc | 0
pango/pango-line-iter-private.h | 5 -
pango/pango-line-iter.h | 79 -----------
pango/pango-lines.c | 8 +-
pango/pango-lines.h | 4 +-
pango/pango.h | 2 +-
tests/test-bidi.c | 18 +--
tests/testiter.c | 28 ++--
tests/testmisc.c | 26 ++--
utils/viewer-pangocairo.c | 56 ++++----
15 files changed, 243 insertions(+), 243 deletions(-)
---
diff --git a/pango/meson.build b/pango/meson.build
index 4972b4dd..f92e35dc 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -34,7 +34,7 @@ pango_sources = [
'pango-line.c',
'pango-line-breaker.c',
'pango-lines.c',
- 'pango-line-iter.c',
+ 'pango-layout-iter.c',
]
pango_headers = [
@@ -58,7 +58,7 @@ pango_headers = [
'pango-language.h',
'pango-line.h',
'pango-line-breaker.h',
- 'pango-line-iter.h',
+ 'pango-layout-iter.h',
'pango-lines.h',
'pango-layout.h',
'pango-matrix.h',
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 5ecb9215..871cc550 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1511,7 +1511,7 @@ pango_attr_overline_color_new (guint16 red,
*
* This affects the values returned by
* [method Pango Line.get_extents] and
- * [method@Pango.LineIter.get_line_extents].
+ * [method@Pango.LayoutIter.get_line_extents].
*
*
* Since: 1.50
@@ -1537,7 +1537,7 @@ pango_attr_line_height_new (double factor)
*
* This affects the values returned by
* [method Pango Line.get_extents],
- * [method@Pango.LineIter.get_line_extents].
+ * [method@Pango.LayoutIter.get_line_extents].
*
* Since: 1.50
*/
diff --git a/pango/pango-layout-iter-private.h b/pango/pango-layout-iter-private.h
new file mode 100644
index 00000000..7cf69b30
--- /dev/null
+++ b/pango/pango-layout-iter-private.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "pango-layout-iter.h"
+
+PangoLayoutIter * pango_layout_iter_new (PangoLines *lines);
diff --git a/pango/pango-line-iter.c b/pango/pango-layout-iter.c
similarity index 82%
rename from pango/pango-line-iter.c
rename to pango/pango-layout-iter.c
index ab20d5fc..d738288a 100644
--- a/pango/pango-line-iter.c
+++ b/pango/pango-layout-iter.c
@@ -1,12 +1,12 @@
#include "config.h"
-#include "pango-line-iter-private.h"
+#include "pango-layout-iter-private.h"
#include "pango-lines-private.h"
#include "pango-line-private.h"
-/* {{{ PangoLineIter implementation */
+/* {{{ PangoLayoutIter implementation */
-struct _PangoLineIter
+struct _PangoLayoutIter
{
PangoLines *lines;
guint serial;
@@ -35,8 +35,8 @@ struct _PangoLineIter
int character_position;
};
-G_DEFINE_BOXED_TYPE (PangoLineIter, pango_line_iter,
- pango_line_iter_copy, pango_line_iter_free);
+G_DEFINE_BOXED_TYPE (PangoLayoutIter, pango_layout_iter,
+ pango_layout_iter_copy, pango_layout_iter_free);
/* }}} */
@@ -45,7 +45,7 @@ G_DEFINE_BOXED_TYPE (PangoLineIter, pango_line_iter,
#define ITER_IS_VALID(iter) ((iter)->serial == (iter)->lines->serial)
static gboolean
-line_is_terminated (PangoLineIter *iter)
+line_is_terminated (PangoLayoutIter *iter)
{
if (iter->line_no + 1 < pango_lines_get_line_count (iter->lines))
return pango_line_ends_paragraph (iter->line);
@@ -97,7 +97,7 @@ cluster_width (PangoGlyphString *glyphs,
* is the byte index of the cluster start relative to the run.
*/
static void
-update_cluster (PangoLineIter *iter,
+update_cluster (PangoLayoutIter *iter,
int cluster_start_index)
{
char *cluster_text;
@@ -149,14 +149,14 @@ update_cluster (PangoLineIter *iter,
* is considered non-empty.
*/
static gboolean
-next_nonempty_line (PangoLineIter *iter,
+next_nonempty_line (PangoLayoutIter *iter,
gboolean include_terminators)
{
gboolean result;
while (TRUE)
{
- result = pango_line_iter_next_line (iter);
+ result = pango_layout_iter_next_line (iter);
if (!result)
break;
@@ -175,14 +175,14 @@ next_nonempty_line (PangoLineIter *iter,
* paragraph separator is considered non-empty.
*/
static gboolean
-next_nonempty_run (PangoLineIter *iter,
+next_nonempty_run (PangoLayoutIter *iter,
gboolean include_terminators)
{
gboolean result;
while (TRUE)
{
- result = pango_line_iter_next_run (iter);
+ result = pango_layout_iter_next_run (iter);
if (!result)
break;
@@ -201,7 +201,7 @@ next_nonempty_run (PangoLineIter *iter,
* (But not positions introduced by line wrapping).
*/
static gboolean
-next_cluster_internal (PangoLineIter *iter,
+next_cluster_internal (PangoLayoutIter *iter,
gboolean include_terminators)
{
if (iter->run == NULL)
@@ -222,7 +222,7 @@ next_cluster_internal (PangoLineIter *iter,
}
static void
-update_run (PangoLineIter *iter,
+update_run (PangoLayoutIter *iter,
int start_index)
{
if (iter->run_link == iter->line->runs)
@@ -270,15 +270,15 @@ update_run (PangoLineIter *iter,
/* }}} */
/* {{{ Private API */
-PangoLineIter *
-pango_line_iter_new (PangoLines *lines)
+PangoLayoutIter *
+pango_layout_iter_new (PangoLines *lines)
{
- PangoLineIter *iter;
+ PangoLayoutIter *iter;
int run_start_index;
g_return_val_if_fail (PANGO_IS_LINES (lines), NULL);
- iter = g_new0 (PangoLineIter, 1);
+ iter = g_new0 (PangoLayoutIter, 1);
iter->lines = g_object_ref (lines);
iter->serial = pango_lines_get_serial (lines);
@@ -306,36 +306,36 @@ pango_line_iter_new (PangoLines *lines)
/* {{{ Public API */
/**
- * pango_line_iter_copy:
- * @iter: (nullable): a `PangoLineIter`
+ * pango_layout_iter_copy:
+ * @iter: (nullable): a `PangoLayoutIter`
*
- * Copies a `PangoLineIter`.
+ * Copies a `PangoLayoutIter`.
*
- * Return value: (nullable): the newly allocated `PangoLineIter`
+ * Return value: (nullable): the newly allocated `PangoLayoutIter`
*/
-PangoLineIter *
-pango_line_iter_copy (PangoLineIter *iter)
+PangoLayoutIter *
+pango_layout_iter_copy (PangoLayoutIter *iter)
{
- PangoLineIter *copy;
+ PangoLayoutIter *copy;
if (iter == NULL)
return NULL;
- copy = g_new0 (PangoLineIter, 1);
- memcpy (iter, copy, sizeof (PangoLineIter));
+ copy = g_new0 (PangoLayoutIter, 1);
+ memcpy (iter, copy, sizeof (PangoLayoutIter));
g_object_ref (copy->lines);
return copy;
}
/**
- * pango_line_iter_free:
- * @iter: (nullable): a `PangoLineIter`
+ * pango_layout_iter_free:
+ * @iter: (nullable): a `PangoLayoutIter`
*
* Frees an iterator that's no longer in use.
*/
void
-pango_line_iter_free (PangoLineIter *iter)
+pango_layout_iter_free (PangoLayoutIter *iter)
{
if (iter == NULL)
return;
@@ -345,29 +345,29 @@ pango_line_iter_free (PangoLineIter *iter)
}
/**
- * pango_line_iter_get_lines:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_lines:
+ * @iter: a `PangoLayoutIter`
*
- * Gets the `PangoLines` object associated with a `PangoLineIter`.
+ * Gets the `PangoLines` object associated with a `PangoLayoutIter`.
*
* Return value: (transfer none): the lines associated with @iter
*/
PangoLines *
-pango_line_iter_get_lines (PangoLineIter *iter)
+pango_layout_iter_get_lines (PangoLayoutIter *iter)
{
return iter->lines;
}
/**
- * pango_line_iter_get_line:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_line:
+ * @iter: a `PangoLayoutIter`
*
* Gets the current line.
*
* Return value: (transfer none): the current line
*/
PangoLine *
-pango_line_iter_get_line (PangoLineIter *iter)
+pango_layout_iter_get_line (PangoLayoutIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), NULL);
@@ -375,15 +375,15 @@ pango_line_iter_get_line (PangoLineIter *iter)
}
/**
- * pango_line_iter_at_last_line:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_at_last_line:
+ * @iter: a `PangoLayoutIter`
*
* Determines whether @iter is on the last line.
*
* Return value: %TRUE if @iter is on the last line
*/
gboolean
-pango_line_iter_at_last_line (PangoLineIter *iter)
+pango_layout_iter_at_last_line (PangoLayoutIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), FALSE);
@@ -391,8 +391,8 @@ pango_line_iter_at_last_line (PangoLineIter *iter)
}
/**
- * pango_line_iter_get_run:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_run:
+ * @iter: a `PangoLayoutIter`
*
* Gets the current run.
*
@@ -404,7 +404,7 @@ pango_line_iter_at_last_line (PangoLineIter *iter)
* Return value: (transfer none) (nullable): the current run
*/
PangoGlyphItem *
-pango_line_iter_get_run (PangoLineIter *iter)
+pango_layout_iter_get_run (PangoLayoutIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), NULL);
@@ -412,8 +412,8 @@ pango_line_iter_get_run (PangoLineIter *iter)
}
/**
- * pango_line_iter_get_index:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_index:
+ * @iter: a `PangoLayoutIter`
*
* Gets the current byte index.
*
@@ -423,12 +423,12 @@ pango_line_iter_get_run (PangoLineIter *iter)
* Note that iterating forward by char moves in visual order,
* not logical order, so indexes may not be sequential. Also,
* the index may be equal to the length of the text in the
- * layout, if on the %NULL run (see [method@Pango.LineIter.get_run]).
+ * layout, if on the %NULL run (see [method@Pango.LayoutIter.get_run]).
*
* Return value: current byte index
*/
int
-pango_line_iter_get_index (PangoLineIter *iter)
+pango_layout_iter_get_index (PangoLayoutIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), 0);
@@ -436,8 +436,8 @@ pango_line_iter_get_index (PangoLineIter *iter)
}
/**
- * pango_line_iter_next_line:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_next_line:
+ * @iter: a `PangoLayoutIter`
*
* Moves @iter forward to the start of the next line.
*
@@ -446,7 +446,7 @@ pango_line_iter_get_index (PangoLineIter *iter)
* Return value: whether motion was possible
*/
gboolean
-pango_line_iter_next_line (PangoLineIter *iter)
+pango_layout_iter_next_line (PangoLayoutIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), FALSE);
@@ -467,8 +467,8 @@ pango_line_iter_next_line (PangoLineIter *iter)
}
/**
- * pango_line_iter_next_run:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_next_run:
+ * @iter: a `PangoLayoutIter`
*
* Moves @iter forward to the next run in visual order.
*
@@ -477,14 +477,14 @@ pango_line_iter_next_line (PangoLineIter *iter)
* Return value: whether motion was possible
*/
gboolean
-pango_line_iter_next_run (PangoLineIter *iter)
+pango_layout_iter_next_run (PangoLayoutIter *iter)
{
int run_start_index;
g_return_val_if_fail (ITER_IS_VALID (iter), FALSE);
if (iter->run == NULL)
- return pango_line_iter_next_line (iter);
+ return pango_layout_iter_next_line (iter);
iter->run_link = iter->run_link->next;
if (iter->run_link == NULL)
@@ -504,8 +504,8 @@ pango_line_iter_next_run (PangoLineIter *iter)
}
/**
- * pango_line_iter_next_cluster:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_next_cluster:
+ * @iter: a `PangoLayoutIter`
*
* Moves @iter forward to the next cluster in visual order.
*
@@ -514,7 +514,7 @@ pango_line_iter_next_run (PangoLineIter *iter)
* Return value: whether motion was possible
*/
gboolean
-pango_line_iter_next_cluster (PangoLineIter *iter)
+pango_layout_iter_next_cluster (PangoLayoutIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), FALSE);
@@ -522,8 +522,8 @@ pango_line_iter_next_cluster (PangoLineIter *iter)
}
/**
- * pango_line_iter_next_char:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_next_char:
+ * @iter: a `PangoLayoutIter`
*
* Moves @iter forward to the next character in visual order.
*
@@ -532,7 +532,7 @@ pango_line_iter_next_cluster (PangoLineIter *iter)
* Return value: whether motion was possible
*/
gboolean
-pango_line_iter_next_char (PangoLineIter *iter)
+pango_layout_iter_next_char (PangoLayoutIter *iter)
{
const char *text;
@@ -568,7 +568,7 @@ pango_line_iter_next_char (PangoLineIter *iter)
}
static inline void
-offset_line (PangoLineIter *iter,
+offset_line (PangoLayoutIter *iter,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect)
{
@@ -585,7 +585,7 @@ offset_line (PangoLineIter *iter,
}
static inline void
-offset_run (PangoLineIter *iter,
+offset_run (PangoLayoutIter *iter,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect)
{
@@ -596,8 +596,8 @@ offset_run (PangoLineIter *iter,
}
/**
- * pango_line_iter_get_line_extents:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_line_extents:
+ * @iter: a `PangoLayoutIter`
* @ink_rect: (out) (optional): rectangle to fill with ink extents
* @logical_rect: (out) (optional): rectangle to fill with logical extents
*
@@ -615,7 +615,7 @@ offset_run (PangoLineIter *iter,
* [method Pango Line.get_trimmed_extents].
*/
void
-pango_line_iter_get_line_extents (PangoLineIter *iter,
+pango_layout_iter_get_line_extents (PangoLayoutIter *iter,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect)
{
@@ -626,7 +626,7 @@ pango_line_iter_get_line_extents (PangoLineIter *iter,
}
void
-pango_line_iter_get_trimmed_line_extents (PangoLineIter *iter,
+pango_layout_iter_get_trimmed_line_extents (PangoLayoutIter *iter,
PangoLeadingTrim trim,
PangoRectangle *logical_rect)
{
@@ -637,8 +637,8 @@ pango_line_iter_get_trimmed_line_extents (PangoLineIter *iter,
}
/**
- * pango_line_iter_get_run_extents:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_run_extents:
+ * @iter: a `PangoLayoutIter`
* @ink_rect: (out) (optional): rectangle to fill with ink extents
* @logical_rect: (out) (optional): rectangle to fill with logical extents
*
@@ -651,7 +651,7 @@ pango_line_iter_get_trimmed_line_extents (PangoLineIter *iter,
* [method@Pango.GlyphItem.get_extents].
*/
void
-pango_line_iter_get_run_extents (PangoLineIter *iter,
+pango_layout_iter_get_run_extents (PangoLayoutIter *iter,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect)
{
@@ -695,8 +695,8 @@ pango_line_iter_get_run_extents (PangoLineIter *iter,
}
/**
- * pango_line_iter_get_cluster_extents:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_cluster_extents:
+ * @iter: a `PangoLayoutIter`
* @ink_rect: (out) (optional): rectangle to fill with ink extents
* @logical_rect: (out) (optional): rectangle to fill with logical extents
*
@@ -705,7 +705,7 @@ pango_line_iter_get_run_extents (PangoLineIter *iter,
* Layout coordinates have the origin at the top left of the entire `PangoLines`.
*/
void
-pango_line_iter_get_cluster_extents (PangoLineIter *iter,
+pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect)
{
@@ -714,7 +714,7 @@ pango_line_iter_get_cluster_extents (PangoLineIter *iter,
if (iter->run == NULL)
{
/* When on the NULL run, all extents are the same */
- pango_line_iter_get_run_extents (iter, ink_rect, logical_rect);
+ pango_layout_iter_get_run_extents (iter, ink_rect, logical_rect);
return;
}
@@ -741,8 +741,8 @@ pango_line_iter_get_cluster_extents (PangoLineIter *iter,
}
/**
- * pango_line_iter_get_char_extents:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_char_extents:
+ * @iter: a `PangoLayoutIter`
* @logical_rect: (out caller-allocates): rectangle to fill with logical extents
*
* Gets the extents of the current character, in layout coordinates.
@@ -753,7 +753,7 @@ pango_line_iter_get_cluster_extents (PangoLineIter *iter,
* ink extents make sense only down to the level of clusters.
*/
void
-pango_line_iter_get_char_extents (PangoLineIter *iter,
+pango_layout_iter_get_char_extents (PangoLayoutIter *iter,
PangoRectangle *logical_rect)
{
PangoRectangle cluster_rect;
@@ -764,7 +764,7 @@ pango_line_iter_get_char_extents (PangoLineIter *iter,
if (logical_rect == NULL)
return;
- pango_line_iter_get_cluster_extents (iter, NULL, &cluster_rect);
+ pango_layout_iter_get_cluster_extents (iter, NULL, &cluster_rect);
if (iter->run == NULL)
{
@@ -790,8 +790,8 @@ pango_line_iter_get_char_extents (PangoLineIter *iter,
}
/**
- * pango_line_iter_get_line_baseline:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_line_baseline:
+ * @iter: a `PangoLayoutIter`
*
* Gets the Y position of the current line's baseline, in layout
* coordinates.
@@ -801,7 +801,7 @@ pango_line_iter_get_char_extents (PangoLineIter *iter,
* Return value: baseline of current line
*/
int
-pango_line_iter_get_line_baseline (PangoLineIter *iter)
+pango_layout_iter_get_line_baseline (PangoLayoutIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), 0);
@@ -809,8 +809,8 @@ pango_line_iter_get_line_baseline (PangoLineIter *iter)
}
/**
- * pango_line_iter_get_run_baseline:
- * @iter: a `PangoLineIter`
+ * pango_layout_iter_get_run_baseline:
+ * @iter: a `PangoLayoutIter`
*
* Gets the Y position of the current run's baseline, in layout
* coordinates.
@@ -821,14 +821,14 @@ pango_line_iter_get_line_baseline (PangoLineIter *iter)
* example due to superscript or subscript positioning.
*/
int
-pango_line_iter_get_run_baseline (PangoLineIter *iter)
+pango_layout_iter_get_run_baseline (PangoLayoutIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), 0);
if (iter->run)
- return pango_line_iter_get_line_baseline (iter) - iter->run->y_offset;
+ return pango_layout_iter_get_line_baseline (iter) - iter->run->y_offset;
else
- return pango_line_iter_get_line_baseline (iter);
+ return pango_layout_iter_get_line_baseline (iter);
}
/* }}} */
diff --git a/pango/pango-layout-iter.h b/pango/pango-layout-iter.h
new file mode 100644
index 00000000..f1101387
--- /dev/null
+++ b/pango/pango-layout-iter.h
@@ -0,0 +1,79 @@
+#pragma once
+
+#include <glib-object.h>
+
+#include <pango/pango-types.h>
+#include <pango/pango-lines.h>
+#include <pango/pango-glyph-item.h>
+
+G_BEGIN_DECLS
+
+PANGO_AVAILABLE_IN_ALL
+GType pango_layout_iter_get_type (void) G_GNUC_CONST;
+
+PANGO_AVAILABLE_IN_ALL
+PangoLayoutIter * pango_layout_iter_copy (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+void pango_layout_iter_free (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+PangoLines * pango_layout_iter_get_lines (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+PangoLine * pango_layout_iter_get_line (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+gboolean pango_layout_iter_at_last_line (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+PangoGlyphItem * pango_layout_iter_get_run (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+int pango_layout_iter_get_index (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+gboolean pango_layout_iter_next_line (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+gboolean pango_layout_iter_next_run (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+gboolean pango_layout_iter_next_cluster (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+gboolean pango_layout_iter_next_char (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+void pango_layout_iter_get_line_extents (PangoLayoutIter *iter,
+ PangoRectangle *ink_rect,
+ PangoRectangle *logical_rect);
+
+PANGO_AVAILABLE_IN_ALL
+void pango_layout_iter_get_trimmed_line_extents
+ (PangoLayoutIter *iter,
+ PangoLeadingTrim trim,
+ PangoRectangle *logical_rect);
+
+PANGO_AVAILABLE_IN_ALL
+void pango_layout_iter_get_run_extents (PangoLayoutIter *iter,
+ PangoRectangle *ink_rect,
+ PangoRectangle *logical_rect);
+
+PANGO_AVAILABLE_IN_ALL
+void pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter,
+ PangoRectangle *ink_rect,
+ PangoRectangle *logical_rect);
+
+PANGO_AVAILABLE_IN_ALL
+void pango_layout_iter_get_char_extents (PangoLayoutIter *iter,
+ PangoRectangle *logical_rect);
+
+PANGO_AVAILABLE_IN_ALL
+int pango_layout_iter_get_line_baseline (PangoLayoutIter *iter);
+
+PANGO_AVAILABLE_IN_ALL
+int pango_layout_iter_get_run_baseline (PangoLayoutIter *iter);
+
+
+G_END_DECLS
diff --git a/pango/pango-layout-iterc b/pango/pango-layout-iterc
new file mode 100644
index 00000000..e69de29b
diff --git a/pango/pango-lines.c b/pango/pango-lines.c
index a795f7f6..4bd121a9 100644
--- a/pango/pango-lines.c
+++ b/pango/pango-lines.c
@@ -3,7 +3,7 @@
#include "pango-lines-private.h"
#include "pango-line-private.h"
#include "pango-item-private.h"
-#include "pango-line-iter-private.h"
+#include "pango-layout-iter-private.h"
/* {{{ PangoLines implementation */
@@ -207,12 +207,12 @@ pango_lines_add_line (PangoLines *lines,
*
* Note that the iter holds a reference to @lines.
*
- * Return value: the new `PangoLineIter`
+ * Return value: the new `PangoLayoutIter`
*/
-PangoLineIter *
+PangoLayoutIter *
pango_lines_get_iter (PangoLines *lines)
{
- return pango_line_iter_new (lines);
+ return pango_layout_iter_new (lines);
}
/**
diff --git a/pango/pango-lines.h b/pango/pango-lines.h
index 03e4d932..11c07838 100644
--- a/pango/pango-lines.h
+++ b/pango/pango-lines.h
@@ -12,7 +12,7 @@ G_BEGIN_DECLS
PANGO_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (PangoLines, pango_lines, PANGO, LINES, GObject);
-typedef struct _PangoLineIter PangoLineIter;
+typedef struct _PangoLayoutIter PangoLayoutIter;
PANGO_AVAILABLE_IN_ALL
PangoLines * pango_lines_new (void);
@@ -36,7 +36,7 @@ PangoLine * pango_lines_get_line (PangoLines *lines,
int *line_y);
PANGO_AVAILABLE_IN_ALL
-PangoLineIter * pango_lines_get_iter (PangoLines *lines);
+PangoLayoutIter * pango_lines_get_iter (PangoLines *lines);
PANGO_AVAILABLE_IN_ALL
void pango_lines_get_extents (PangoLines *lines,
diff --git a/pango/pango.h b/pango/pango.h
index 8a19fb47..37678dd9 100644
--- a/pango/pango.h
+++ b/pango/pango.h
@@ -44,7 +44,7 @@
#include <pango/pango-layout.h>
#include <pango/pango-line.h>
#include <pango/pango-line-breaker.h>
-#include <pango/pango-line-iter.h>
+#include <pango/pango-layout-iter.h>
#include <pango/pango-lines.h>
#include <pango/pango-matrix.h>
#include <pango/pango-markup.h>
diff --git a/tests/test-bidi.c b/tests/test-bidi.c
index 489d59ef..b0aca810 100644
--- a/tests/test-bidi.c
+++ b/tests/test-bidi.c
@@ -362,7 +362,7 @@ test_move_cursor_para (void)
PangoLine *line;
PangoRectangle ext;
PangoLines *lines;
- PangoLineIter *iter;
+ PangoLayoutIter *iter;
PangoLine *new_line;
layout = pango_layout_new (context);
@@ -389,10 +389,10 @@ test_move_cursor_para (void)
break;
iter = pango_lines_get_iter (lines);
- while (pango_line_iter_get_line (iter) != line)
- pango_line_iter_next_line (iter);
- pango_line_iter_get_line_extents (iter, NULL, &ext);
- pango_line_iter_free (iter);
+ while (pango_layout_iter_get_line (iter) != line)
+ pango_layout_iter_next_line (iter);
+ pango_layout_iter_get_line_extents (iter, NULL, &ext);
+ pango_layout_iter_free (iter);
pango_lines_move_cursor(lines, TRUE,
NULL,
@@ -433,10 +433,10 @@ test_move_cursor_para (void)
pango_lines_index_to_line (lines, index, &line, NULL, NULL, NULL);
g_assert_nonnull (line);
iter = pango_lines_get_iter (lines);
- while (pango_line_iter_get_line (iter) != line)
- pango_line_iter_next_line (iter);
- pango_line_iter_get_line_extents (iter, NULL, &ext);
- pango_line_iter_free (iter);
+ while (pango_layout_iter_get_line (iter) != line)
+ pango_layout_iter_next_line (iter);
+ pango_layout_iter_get_line_extents (iter, NULL, &ext);
+ pango_layout_iter_free (iter);
pango_lines_move_cursor (lines, TRUE,
NULL,
diff --git a/tests/testiter.c b/tests/testiter.c
index db79c268..276410a7 100644
--- a/tests/testiter.c
+++ b/tests/testiter.c
@@ -80,7 +80,7 @@ static void
iter_char_test (PangoLayout *layout)
{
PangoRectangle extents, run_extents;
- PangoLineIter *iter;
+ PangoLayoutIter *iter;
PangoGlyphItem *run;
int num_chars;
int i, index, offset;
@@ -99,19 +99,19 @@ iter_char_test (PangoLayout *layout)
gchar *char_str;
g_assert (iter_next_ok);
- index = pango_line_iter_get_index (iter);
+ index = pango_layout_iter_get_index (iter);
ptr = text + index;
char_str = g_strndup (ptr, g_utf8_next_char (ptr) - ptr);
verbose ("i=%d (visual), index = %d '%s':\n",
i, index, char_str);
g_free (char_str);
- pango_line_iter_get_char_extents (iter, &extents);
+ pango_layout_iter_get_char_extents (iter, &extents);
verbose (" char extents: x=%d,y=%d w=%d,h=%d\n",
extents.x, extents.y,
extents.width, extents.height);
- run = pango_line_iter_get_run (iter);
+ run = pango_layout_iter_get_run (iter);
if (run)
{
@@ -119,7 +119,7 @@ iter_char_test (PangoLayout *layout)
char *str;
/* Get needed data for the GlyphString */
- pango_line_iter_get_run_extents (iter, NULL, &run_extents);
+ pango_layout_iter_get_run_extents (iter, NULL, &run_extents);
offset = run->item->offset;
rtl = run->item->analysis.level%2;
desc = pango_font_describe (run->item->analysis.font);
@@ -153,7 +153,7 @@ iter_char_test (PangoLayout *layout)
/* We're on a line terminator */
}
- iter_next_ok = pango_line_iter_next_char (iter);
+ iter_next_ok = pango_layout_iter_next_char (iter);
verbose ("more to go? %d\n", iter_next_ok);
}
@@ -161,14 +161,14 @@ iter_char_test (PangoLayout *layout)
* input string */
g_assert (!iter_next_ok);
- pango_line_iter_free (iter);
+ pango_layout_iter_free (iter);
}
static void
iter_cluster_test (PangoLayout *layout)
{
PangoRectangle extents;
- PangoLineIter *iter;
+ PangoLayoutIter *iter;
int index;
gboolean iter_next_ok;
PangoLine *last_line = NULL;
@@ -179,16 +179,16 @@ iter_cluster_test (PangoLayout *layout)
while (iter_next_ok)
{
- PangoLine *line = pango_line_iter_get_line (iter);
+ PangoLine *line = pango_layout_iter_get_line (iter);
/* Every cluster is part of a run */
- g_assert (pango_line_iter_get_run (iter));
+ g_assert (pango_layout_iter_get_run (iter));
- index = pango_line_iter_get_index (iter);
+ index = pango_layout_iter_get_index (iter);
- pango_line_iter_get_cluster_extents (iter, NULL, &extents);
+ pango_layout_iter_get_cluster_extents (iter, NULL, &extents);
- iter_next_ok = pango_line_iter_next_cluster (iter);
+ iter_next_ok = pango_layout_iter_next_cluster (iter);
verbose ("index = %d:\n", index);
verbose (" cluster extents: x=%d,y=%d w=%d,h=%d\n",
@@ -210,7 +210,7 @@ iter_cluster_test (PangoLayout *layout)
g_assert (!iter_next_ok);
- pango_line_iter_free (iter);
+ pango_layout_iter_free (iter);
}
static void
diff --git a/tests/testmisc.c b/tests/testmisc.c
index a4183478..f1e892e8 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -178,7 +178,7 @@ test_run_height (void)
{
PangoContext *context;
PangoLayout *layout;
- PangoLineIter *iter;
+ PangoLayoutIter *iter;
PangoRectangle logical1, logical2;
if (strcmp (G_OBJECT_TYPE_NAME (pango_cairo_font_map_get_default ()), "PangoCairoCoreTextFontMap") == 0)
@@ -192,14 +192,14 @@ test_run_height (void)
pango_layout_set_text (layout, "one", -1);
iter = pango_lines_get_iter (pango_layout_get_lines (layout));
- pango_line_iter_get_run_extents (iter, NULL, &logical1);
- pango_line_iter_free (iter);
+ pango_layout_iter_get_run_extents (iter, NULL, &logical1);
+ pango_layout_iter_free (iter);
pango_layout_set_text (layout, "", -1);
iter = pango_lines_get_iter (pango_layout_get_lines (layout));
- pango_line_iter_get_run_extents (iter, NULL, &logical2);
- pango_line_iter_free (iter);
+ pango_layout_iter_get_run_extents (iter, NULL, &logical2);
+ pango_layout_iter_free (iter);
g_assert_cmpint (logical1.height, ==, logical2.height);
@@ -581,7 +581,7 @@ test_extents (void)
{
PangoLayout *layout;
PangoLines *lines;
- PangoLineIter *iter;
+ PangoLayoutIter *iter;
PangoRectangle layout_extents;
PangoRectangle line_extents;
PangoRectangle run_extents;
@@ -602,11 +602,11 @@ test_extents (void)
do
{
- pango_line_iter_get_line_extents (iter, NULL, &line_extents);
- pango_line_iter_get_run_extents (iter, NULL, &run_extents);
- pango_line_iter_get_cluster_extents (iter, NULL, &cluster_extents);
- pango_line_iter_get_char_extents (iter, &char_extents);
- index = pango_line_iter_get_index (iter);
+ pango_layout_iter_get_line_extents (iter, NULL, &line_extents);
+ pango_layout_iter_get_run_extents (iter, NULL, &run_extents);
+ pango_layout_iter_get_cluster_extents (iter, NULL, &cluster_extents);
+ pango_layout_iter_get_char_extents (iter, &char_extents);
+ index = pango_layout_iter_get_index (iter);
pango_lines_index_to_pos (lines, NULL, index, &pos);
if (pos.width < 0)
{
@@ -624,9 +624,9 @@ test_extents (void)
g_assert_true (pango_rectangle_contains (&line_extents, &strong));
g_assert_true (pango_rectangle_contains (&line_extents, &weak));
}
- while (pango_line_iter_next_char (iter));
+ while (pango_layout_iter_next_char (iter));
- pango_line_iter_free (iter);
+ pango_layout_iter_free (iter);
g_object_unref (layout);
}
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index 5d639409..d80a9f0b 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -202,7 +202,7 @@ render_callback (PangoLayout *layout,
cairo_pattern_t *pattern;
PangoRectangle ink, logical;
double lw = cairo_get_line_width (cr);
- PangoLineIter *iter;
+ PangoLayoutIter *iter;
pango_lines_get_extents (pango_layout_get_lines (layout), &ink, &logical);
@@ -282,10 +282,10 @@ render_callback (PangoLayout *layout,
iter = pango_lines_get_iter (pango_layout_get_lines (layout));
do
{
- PangoLine *line = pango_line_iter_get_line (iter);
+ PangoLine *line = pango_layout_iter_get_line (iter);
double width = (double)logical.width / PANGO_SCALE;
- y = pango_line_iter_get_line_baseline (iter);
+ y = pango_layout_iter_get_line_baseline (iter);
cairo_save (cr);
cairo_translate (cr,
(double)logical.x / PANGO_SCALE + width * 0.5,
@@ -303,8 +303,8 @@ render_callback (PangoLayout *layout,
cairo_fill (cr);
cairo_restore (cr);
}
- while (pango_line_iter_next_line (iter));
- pango_line_iter_free (iter);
+ while (pango_layout_iter_next_line (iter));
+ pango_layout_iter_free (iter);
cairo_restore (cr);
}
@@ -345,7 +345,7 @@ render_callback (PangoLayout *layout,
{
PangoRectangle rect;
- pango_line_iter_get_line_extents (iter, NULL, &rect);
+ pango_layout_iter_get_line_extents (iter, NULL, &rect);
cairo_rectangle (cr,
(double)rect.x / PANGO_SCALE - lw / 2,
(double)rect.y / PANGO_SCALE - lw / 2,
@@ -353,8 +353,8 @@ render_callback (PangoLayout *layout,
(double)rect.height / PANGO_SCALE + lw);
cairo_stroke (cr);
}
- while (pango_line_iter_next_line (iter));
- pango_line_iter_free (iter);
+ while (pango_layout_iter_next_line (iter));
+ pango_layout_iter_free (iter);
cairo_restore (cr);
}
@@ -370,11 +370,11 @@ render_callback (PangoLayout *layout,
PangoGlyphItem *run;
PangoRectangle rect;
- run = pango_line_iter_get_run (iter);
+ run = pango_layout_iter_get_run (iter);
if (!run)
continue;
- pango_line_iter_get_run_extents (iter, NULL, &rect);
+ pango_layout_iter_get_run_extents (iter, NULL, &rect);
cairo_rectangle (cr,
(double)rect.x / PANGO_SCALE - lw / 2,
(double)rect.y / PANGO_SCALE - lw / 2,
@@ -382,8 +382,8 @@ render_callback (PangoLayout *layout,
(double)rect.height / PANGO_SCALE + lw);
cairo_stroke (cr);
}
- while (pango_line_iter_next_run (iter));
- pango_line_iter_free (iter);
+ while (pango_layout_iter_next_run (iter));
+ pango_layout_iter_free (iter);
cairo_restore (cr);
}
@@ -398,7 +398,7 @@ render_callback (PangoLayout *layout,
{
PangoRectangle rect;
- pango_line_iter_get_cluster_extents (iter, NULL, &rect);
+ pango_layout_iter_get_cluster_extents (iter, NULL, &rect);
cairo_rectangle (cr,
(double)rect.x / PANGO_SCALE - lw / 2,
(double)rect.y / PANGO_SCALE - lw / 2,
@@ -406,8 +406,8 @@ render_callback (PangoLayout *layout,
(double)rect.height / PANGO_SCALE + lw);
cairo_stroke (cr);
}
- while (pango_line_iter_next_cluster (iter));
- pango_line_iter_free (iter);
+ while (pango_layout_iter_next_cluster (iter));
+ pango_layout_iter_free (iter);
cairo_restore (cr);
}
@@ -422,7 +422,7 @@ render_callback (PangoLayout *layout,
{
PangoRectangle rect;
- pango_line_iter_get_char_extents (iter, &rect);
+ pango_layout_iter_get_char_extents (iter, &rect);
cairo_rectangle (cr,
(double)rect.x / PANGO_SCALE - lw / 2,
(double)rect.y / PANGO_SCALE - lw / 2,
@@ -430,8 +430,8 @@ render_callback (PangoLayout *layout,
(double)rect.height / PANGO_SCALE + lw);
cairo_stroke (cr);
}
- while (pango_line_iter_next_cluster (iter));
- pango_line_iter_free (iter);
+ while (pango_layout_iter_next_cluster (iter));
+ pango_layout_iter_free (iter);
cairo_restore (cr);
}
@@ -448,14 +448,14 @@ render_callback (PangoLayout *layout,
PangoRectangle rect;
int x_pos, y_pos;
- run = pango_line_iter_get_run (iter);
+ run = pango_layout_iter_get_run (iter);
if (!run)
continue;
- pango_line_iter_get_run_extents (iter, NULL, &rect);
+ pango_layout_iter_get_run_extents (iter, NULL, &rect);
x_pos = rect.x;
- y_pos = pango_line_iter_get_run_baseline (iter);
+ y_pos = pango_layout_iter_get_run_baseline (iter);
for (int i = 0; i < run->glyphs->num_glyphs; i++)
{
@@ -486,8 +486,8 @@ render_callback (PangoLayout *layout,
x_pos += run->glyphs->glyphs[i].geometry.width;
}
}
- while (pango_line_iter_next_run (iter));
- pango_line_iter_free (iter);
+ while (pango_layout_iter_next_run (iter));
+ pango_layout_iter_free (iter);
cairo_restore (cr);
}
@@ -513,8 +513,8 @@ render_callback (PangoLayout *layout,
int x, y;
gboolean trailing;
- pango_line_iter_get_run_extents (iter, NULL, &rect);
- run = pango_line_iter_get_run (iter);
+ pango_layout_iter_get_run_extents (iter, NULL, &rect);
+ run = pango_layout_iter_get_run (iter);
if (!run)
continue;
@@ -524,7 +524,7 @@ render_callback (PangoLayout *layout,
offset = g_utf8_strlen (text, start - text);
- y = pango_line_iter_get_run_baseline (iter);
+ y = pango_layout_iter_get_run_baseline (iter);
trailing = FALSE;
p = start;
@@ -564,8 +564,8 @@ render_callback (PangoLayout *layout,
}
}
- while (pango_line_iter_next_run (iter));
- pango_line_iter_free (iter);
+ while (pango_layout_iter_next_run (iter));
+ pango_layout_iter_free (iter);
cairo_restore (cr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]