summaryrefslogtreecommitdiff
path: root/pango/pango-item.h
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-28 09:47:07 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-28 12:53:13 -0400
commita03bf5bc6b07ba6e2442c02d6777978c5cecbd9a (patch)
tree4b6bbb30fe460ef7606ccfa4359c57dc456d58e0 /pango/pango-item.h
parent1fcd5ae9a9dfd3a7c5ccacd11ffd54a3ad93e643 (diff)
downloadpango-a03bf5bc6b07ba6e2442c02d6777978c5cecbd9a.tar.gz
item: Add a char offset
Add a char_offset field to PangoItem, compute it as part of itemization and update it when splitting items. Keeping this number around cuts down on the amount of list and utf8 walking we need to do later. We have to do some extra shenanigans to preserve abi in the face of pango's open-coded structs, so we introduce a PangoItemPrivate type that is used internally. On 64bit, PangoItem has a 4 byte whole, so we can keep the size of PangoItemPrivate the same. No such luck on 32bit.
Diffstat (limited to 'pango/pango-item.h')
-rw-r--r--pango/pango-item.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/pango/pango-item.h b/pango/pango-item.h
index 9e0596f2..8122be19 100644
--- a/pango/pango-item.h
+++ b/pango/pango-item.h
@@ -100,6 +100,7 @@ struct _PangoAnalysis
* @offset: byte offset of the start of this item in text.
* @length: length of this item in bytes.
* @num_chars: number of Unicode characters in the item.
+ * @char_offset: character offset of the start of this item in text. Since 1.50
* @analysis: analysis results for the item.
*
* The `PangoItem` structure stores information about a segment of text.
@@ -109,9 +110,9 @@ struct _PangoAnalysis
*/
struct _PangoItem
{
- gint offset;
- gint length;
- gint num_chars;
+ int offset;
+ int length;
+ int num_chars;
PangoAnalysis analysis;
};