summaryrefslogtreecommitdiff
path: root/pango/pango-lines.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/pango-lines.c')
-rw-r--r--pango/pango-lines.c194
1 files changed, 97 insertions, 97 deletions
diff --git a/pango/pango-lines.c b/pango/pango-lines.c
index 195524bc..663f0581 100644
--- a/pango/pango-lines.c
+++ b/pango/pango-lines.c
@@ -1,16 +1,16 @@
#include "config.h"
#include "pango-lines-private.h"
-#include "pango-line-private.h"
+#include "pango-layout-line-private.h"
#include "pango-item-private.h"
-#include "pango-line-iter-private.h"
+#include "pango-layout-iter-private.h"
/* {{{ PangoLines implementation */
typedef struct _Line Line;
struct _Line
{
- PangoLine *line;
+ PangoLayoutLine *line;
int x, y;
};
@@ -71,8 +71,8 @@ compare_cursor (gconstpointer v1,
}
static void
-pango_line_get_cursors (PangoLines *lines,
- PangoLine *line,
+pango_layout_line_get_cursors (PangoLines *lines,
+ PangoLayoutLine *line,
gboolean strong,
GArray *cursors)
{
@@ -111,7 +111,7 @@ pango_line_get_cursors (PangoLines *lines,
{
CursorPos cursor;
- pango_line_get_cursor_pos (line, idx,
+ pango_layout_line_get_cursor_pos (line, idx,
strong ? &pos : NULL,
strong ? NULL : &pos);
@@ -167,7 +167,7 @@ pango_lines_get_serial (PangoLines *lines)
/**
* pango_lines_add_line:
* @lines: a `PangoLines`
- * @line: (transfer full): the `PangoLine` to add
+ * @line: (transfer full): the `PangoLayoutLine` to add
* @line_x: X coordinate of the position
* @line_y: Y coordinate of the position
*
@@ -179,10 +179,10 @@ pango_lines_get_serial (PangoLines *lines)
* Note that this function takes ownership of the line.
*/
void
-pango_lines_add_line (PangoLines *lines,
- PangoLine *line,
- int x_line,
- int y_line)
+pango_lines_add_line (PangoLines *lines,
+ PangoLayoutLine *line,
+ int x_line,
+ int y_line)
{
Line l;
@@ -209,12 +209,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);
}
/**
@@ -242,7 +242,7 @@ pango_lines_get_line_count (PangoLines *lines)
*
* Returns: (transfer none) (nullable): the line that was found
*/
-PangoLine *
+PangoLayoutLine *
pango_lines_get_line (PangoLines *lines,
int num,
int *line_x,
@@ -318,7 +318,7 @@ pango_lines_wrapped (PangoLines *lines)
for (int i = 0; i < lines->lines->len; i++)
{
Line *l = &g_array_index (lines->lines, Line, i);
- if (pango_line_wrapped (l->line))
+ if (pango_layout_line_wrapped (l->line))
return TRUE;
}
@@ -339,7 +339,7 @@ pango_lines_ellipsized (PangoLines *lines)
for (int i = 0; i < lines->lines->len; i++)
{
Line *l = &g_array_index (lines->lines, Line, i);
- if (pango_line_ellipsized (l->line))
+ if (pango_layout_line_ellipsized (l->line))
return TRUE;
}
@@ -360,7 +360,7 @@ pango_lines_hyphenated (PangoLines *lines)
for (int i = 0; i < lines->lines->len; i++)
{
Line *l = &g_array_index (lines->lines, Line, i);
- if (pango_line_hyphenated (l->line))
+ if (pango_layout_line_hyphenated (l->line))
return TRUE;
}
@@ -398,7 +398,7 @@ pango_lines_get_extents (PangoLines *lines,
PangoRectangle line_ink;
PangoRectangle line_logical;
- pango_line_get_extents (l->line, &line_ink, &line_logical);
+ pango_layout_line_get_extents (l->line, &line_ink, &line_logical);
line_ink.x += l->x;
line_ink.y += l->y;
line_logical.x += l->x;
@@ -492,14 +492,14 @@ pango_lines_get_baseline (PangoLines *lines)
/**
* pango_layout_lines_get_x_ranges:
* @lines: a `PangoLines` object
- * @line: the `PangoLine` in @lines whose x ranges will be reported
- * @start_line: (nullable): `PangoLine` wrt to which @start_index is
+ * @line: the `PangoLayoutLine` in @lines whose x ranges will be reported
+ * @start_line: (nullable): `PangoLayoutLine` wrt to which @start_index is
* interpreted or `NULL` for the first matching line
* @start_index: Start byte index of the logical range. If this value
* is less than the start index for the line, then the first range
* will extend all the way to the leading edge of the layout. Otherwise,
* it will start at the leading edge of the first character.
- * @end_line: (nullable): `PangoLine` wrt to which @end_index is
+ * @end_line: (nullable): `PangoLayoutLine` wrt to which @end_index is
* interpreted or `NULL` for the first matching line
* @end_index: Ending byte index of the logical range. If this value is
* greater than the end index for the line, then the last range will
@@ -521,14 +521,14 @@ pango_lines_get_baseline (PangoLines *lines)
* layout, not with respect to the line.
*/
void
-pango_lines_get_x_ranges (PangoLines *lines,
- PangoLine *line,
- PangoLine *start_line,
- int start_index,
- PangoLine *end_line,
- int end_index,
- int **ranges,
- int *n_ranges)
+pango_lines_get_x_ranges (PangoLines *lines,
+ PangoLayoutLine *line,
+ PangoLayoutLine *start_line,
+ int start_index,
+ PangoLayoutLine *end_line,
+ int end_index,
+ int **ranges,
+ int *n_ranges)
{
int x_offset;
int line_no, start_line_no, end_line_no;
@@ -539,10 +539,10 @@ pango_lines_get_x_ranges (PangoLines *lines,
int accumulated_width;
g_return_if_fail (PANGO_IS_LINES (lines));
- g_return_if_fail (PANGO_IS_LINE (line));
- g_return_if_fail (start_line == NULL || PANGO_IS_LINE (start_line));
+ g_return_if_fail (PANGO_IS_LAYOUT_LINE (line));
+ g_return_if_fail (start_line == NULL || PANGO_IS_LAYOUT_LINE (start_line));
g_return_if_fail (start_index >= 0);
- g_return_if_fail (end_line == NULL || PANGO_IS_LINE (end_line));
+ g_return_if_fail (end_line == NULL || PANGO_IS_LAYOUT_LINE (end_line));
g_return_if_fail (end_index >= 0);
g_return_if_fail (ranges != NULL);
g_return_if_fail (n_ranges != NULL);
@@ -572,7 +572,7 @@ pango_lines_get_x_ranges (PangoLines *lines,
*ranges = g_new (int, 2 * (2 + g_slist_length (line->runs)));
range_count = 0;
- dir = pango_line_get_resolved_direction (line);
+ dir = pango_layout_line_get_resolved_direction (line);
if (x_offset > 0 &&
((dir == PANGO_DIRECTION_LTR && start_line_no < line_no) ||
@@ -585,7 +585,7 @@ pango_lines_get_x_ranges (PangoLines *lines,
}
accumulated_width = 0;
- for (GSList *l = pango_line_get_runs (line); l; l = l->next)
+ for (GSList *l = pango_layout_line_get_runs (line); l; l = l->next)
{
PangoGlyphItem *run = l->data;
@@ -636,7 +636,7 @@ pango_lines_get_x_ranges (PangoLines *lines,
accumulated_width += pango_glyph_string_get_width (run->glyphs);
}
- pango_line_get_extents (line, NULL, &ext);
+ pango_layout_line_get_extents (line, NULL, &ext);
pango_lines_get_size (lines, &width, NULL);
if (x_offset + ext.width < width &&
@@ -678,12 +678,12 @@ pango_lines_get_x_ranges (PangoLines *lines,
* as *@line and use this function to find the line at @idx.
*/
void
-pango_lines_index_to_line (PangoLines *lines,
- int idx,
- PangoLine **line,
- int *line_no,
- int *x_offset,
- int *y_offset)
+pango_lines_index_to_line (PangoLines *lines,
+ int idx,
+ PangoLayoutLine **line,
+ int *line_no,
+ int *x_offset,
+ int *y_offset)
{
Line *found = NULL;
int num;
@@ -740,12 +740,12 @@ pango_lines_index_to_line (PangoLines *lines,
* Returns: (transfer none) (nullable): the line that was found
*/
-PangoLine *
-pango_lines_pos_to_line (PangoLines *lines,
- int x,
- int y,
- int *line_x,
- int *line_y)
+PangoLayoutLine *
+pango_lines_pos_to_line (PangoLines *lines,
+ int x,
+ int y,
+ int *line_x,
+ int *line_y)
{
g_return_val_if_fail (PANGO_IS_LINES (lines), FALSE);
@@ -754,7 +754,7 @@ pango_lines_pos_to_line (PangoLines *lines,
Line *l = &g_array_index (lines->lines, Line, i);
PangoRectangle ext;
- pango_line_get_extents (l->line, NULL, &ext);
+ pango_layout_line_get_extents (l->line, NULL, &ext);
ext.x += l->x;
ext.y += l->y;
@@ -782,12 +782,12 @@ pango_lines_pos_to_line (PangoLines *lines,
/**
* pango_lines_index_to_pos:
* @lines: a `PangoLines` object
- * @line: (nullable): `PangoLine` wrt to which @idx is interpreted
+ * @line: (nullable): `PangoLayoutLine` wrt to which @idx is interpreted
* or `NULL` for the first matching line
* @idx: byte index within @line
* @pos: (out): rectangle in which to store the position of the grapheme
*
- * Converts from an index within a `PangoLine` to the
+ * Converts from an index within a `PangoLayoutLine` to the
* position corresponding to the grapheme at that index.
*
* The return value is represented as rectangle. Note that `pos->x`
@@ -799,15 +799,15 @@ pango_lines_pos_to_line (PangoLines *lines,
* for the position off the end of the last line.
*/
void
-pango_lines_index_to_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *pos)
+pango_lines_index_to_pos (PangoLines *lines,
+ PangoLayoutLine *line,
+ int idx,
+ PangoRectangle *pos)
{
int x_offset, y_offset;
g_return_if_fail (PANGO_IS_LINES (lines));
- g_return_if_fail (line == NULL || PANGO_IS_LINE (line));
+ g_return_if_fail (line == NULL || PANGO_IS_LAYOUT_LINE (line));
g_return_if_fail (idx >= 0);
g_return_if_fail (pos != NULL);
@@ -815,7 +815,7 @@ pango_lines_index_to_pos (PangoLines *lines,
g_return_if_fail (line != NULL);
- pango_line_index_to_pos (line, idx, pos);
+ pango_layout_line_index_to_pos (line, idx, pos);
pos->x += x_offset;
pos->y += y_offset;
}
@@ -836,14 +836,14 @@ pango_lines_index_to_pos (PangoLines *lines,
*
* Returns: (transfer none) (nullable): the line that was found
*/
-PangoLine *
-pango_lines_pos_to_index (PangoLines *lines,
- int x,
- int y,
- int *idx,
- int *trailing)
+PangoLayoutLine *
+pango_lines_pos_to_index (PangoLines *lines,
+ int x,
+ int y,
+ int *idx,
+ int *trailing)
{
- PangoLine *line;
+ PangoLayoutLine *line;
int x_offset;
g_return_val_if_fail (PANGO_IS_LINES (lines), FALSE);
@@ -852,7 +852,7 @@ pango_lines_pos_to_index (PangoLines *lines,
line = pango_lines_pos_to_line (lines, x, y, &x_offset, NULL);
if (line)
- pango_line_x_to_index (line, x - x_offset, idx, trailing);
+ pango_layout_line_x_to_index (line, x - x_offset, idx, trailing);
return line;
}
@@ -863,7 +863,7 @@ pango_lines_pos_to_index (PangoLines *lines,
/**
* pango_lines_get_cursor_pos:
* @lines: a `PangoLines` object
- * @line: (nullable): `PangoLine` wrt to which @idx is interpreted
+ * @line: (nullable): `PangoLayoutLine` wrt to which @idx is interpreted
* or `NULL` for the first matching line
* @idx: the byte index of the cursor
* @strong_pos: (out) (optional): location to store the strong cursor position
@@ -901,17 +901,17 @@ pango_lines_pos_to_index (PangoLines *lines,
* will insert it at the end.
*/
void
-pango_lines_get_cursor_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos)
+pango_lines_get_cursor_pos (PangoLines *lines,
+ PangoLayoutLine *line,
+ int idx,
+ PangoRectangle *strong_pos,
+ PangoRectangle *weak_pos)
{
int x_offset, y_offset;
- PangoLine *l;
+ PangoLayoutLine *l;
g_return_if_fail (PANGO_IS_LINES (lines));
- g_return_if_fail (line == NULL || PANGO_IS_LINE (line));
+ g_return_if_fail (line == NULL || PANGO_IS_LAYOUT_LINE (line));
l = line;
pango_lines_index_to_line (lines, idx, &l, NULL, &x_offset, &y_offset);
@@ -921,7 +921,7 @@ pango_lines_get_cursor_pos (PangoLines *lines,
line = l;
- pango_line_get_cursor_pos (line, idx, strong_pos, weak_pos);
+ pango_layout_line_get_cursor_pos (line, idx, strong_pos, weak_pos);
if (strong_pos)
{
@@ -938,7 +938,7 @@ pango_lines_get_cursor_pos (PangoLines *lines,
/**
* pango_lines_get_caret_pos:
* @lines: a `PangoLines` object
- * @line: (nullable): `PangoLine` wrt to which @idx is interpreted
+ * @line: (nullable): `PangoLayoutLine` wrt to which @idx is interpreted
* or `NULL` for the first matching line
* @idx: the byte index of the cursor
* @strong_pos: (out) (optional): location to store the strong cursor position
@@ -960,22 +960,22 @@ pango_lines_get_cursor_pos (PangoLines *lines,
* </picture>
*/
void
-pango_lines_get_caret_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos)
+pango_lines_get_caret_pos (PangoLines *lines,
+ PangoLayoutLine *line,
+ int idx,
+ PangoRectangle *strong_pos,
+ PangoRectangle *weak_pos)
{
int x_offset, y_offset;
g_return_if_fail (PANGO_IS_LINES (lines));
- g_return_if_fail (line == NULL || PANGO_IS_LINE (line));
+ g_return_if_fail (line == NULL || PANGO_IS_LAYOUT_LINE (line));
pango_lines_index_to_line (lines, idx, &line, NULL, &x_offset, &y_offset);
g_return_if_fail (line != NULL);
- pango_line_get_caret_pos (line, idx, strong_pos, weak_pos);
+ pango_layout_line_get_caret_pos (line, idx, strong_pos, weak_pos);
if (strong_pos)
{
@@ -995,7 +995,7 @@ pango_lines_get_caret_pos (PangoLines *lines,
* @strong: whether the moving cursor is the strong cursor or the
* weak cursor. The strong cursor is the cursor corresponding
* to text insertion in the base direction for the layout.
- * @line: (nullable): `PangoLine` wrt to which @idx is interpreted
+ * @line: (nullable): `PangoLayoutLine` wrt to which @idx is interpreted
* or `NULL` for the first matching line
* @idx: the byte index of the current cursor position
* @trailing: if 0, the cursor was at the leading edge of the
@@ -1003,7 +1003,7 @@ pango_lines_get_caret_pos (PangoLines *lines,
* was at the trailing edge.
* @direction: direction to move cursor. A negative
* value indicates motion to the left
- * @new_line: `PangoLine` wrt to which @new_idx is interpreted
+ * @new_line: `PangoLayoutLine` wrt to which @new_idx is interpreted
* @new_idx: (out): location to store the new cursor byte index
* A value of -1 indicates that the cursor has been moved off the
* beginning of the layout. A value of %G_MAXINT indicates that
@@ -1032,15 +1032,15 @@ pango_lines_get_caret_pos (PangoLines *lines,
* when multiple characters combine to form a single grapheme.
*/
void
-pango_lines_move_cursor (PangoLines *lines,
- gboolean strong,
- PangoLine *line,
- int idx,
- int trailing,
- int direction,
- PangoLine **new_line,
- int *new_idx,
- int *new_trailing)
+pango_lines_move_cursor (PangoLines *lines,
+ gboolean strong,
+ PangoLayoutLine *line,
+ int idx,
+ int trailing,
+ int direction,
+ PangoLayoutLine **new_line,
+ int *new_idx,
+ int *new_trailing)
{
int line_no;
GArray *cursors;
@@ -1073,7 +1073,7 @@ pango_lines_move_cursor (PangoLines *lines,
idx = line->start_index + line->length;
cursors = g_array_new (FALSE, FALSE, sizeof (CursorPos));
- pango_line_get_cursors (lines, line, strong, cursors);
+ pango_layout_line_get_cursors (lines, line, strong, cursors);
pango_lines_get_cursor_pos (lines, line, idx, strong ? &pos : NULL, strong ? NULL : &pos);
@@ -1125,7 +1125,7 @@ pango_lines_move_cursor (PangoLines *lines,
if (off_start)
{
- PangoLine *prev_line;
+ PangoLayoutLine *prev_line;
prev_line = pango_lines_get_line (lines, line_no - 1, NULL, NULL);
if (!prev_line)
@@ -1143,7 +1143,7 @@ pango_lines_move_cursor (PangoLines *lines,
}
else
{
- PangoLine *next_line;
+ PangoLayoutLine *next_line;
next_line = pango_lines_get_line (lines, line_no + 1, NULL, NULL);
if (!next_line)
@@ -1160,7 +1160,7 @@ pango_lines_move_cursor (PangoLines *lines,
}
g_array_set_size (cursors, 0);
- pango_line_get_cursors (lines, line, strong, cursors);
+ pango_layout_line_get_cursors (lines, line, strong, cursors);
n_vis = cursors->len;