1 | /* Pango |
2 | * |
3 | * Copyright (C) 2021 Matthias Clasen |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Library General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Library General Public |
16 | * License along with this library; if not, write to the |
17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | * Boston, MA 02111-1307, USA. |
19 | */ |
20 | |
21 | #ifndef __PANGO_ITEM_PRIVATE_H__ |
22 | #define __PANGO_ITEM_PRIVATE_H__ |
23 | |
24 | #include <pango/pango-item.h> |
25 | #include <pango/pango-break.h> |
26 | |
27 | G_BEGIN_DECLS |
28 | |
29 | /** |
30 | * We have to do some extra work for adding the char_offset field |
31 | * to PangoItem to preserve ABI in the face of pango's open-coded |
32 | * structs. |
33 | * |
34 | * Internally, pango uses the PangoItemPrivate type, and we use |
35 | * a bit in the PangoAnalysis flags to indicate whether we are |
36 | * dealing with a PangoItemPrivate struct or not. |
37 | */ |
38 | |
39 | #define PANGO_ANALYSIS_FLAG_HAS_CHAR_OFFSET (1 << 7) |
40 | |
41 | typedef struct _PangoAnalysisPrivate PangoAnalysisPrivate; |
42 | |
43 | struct _PangoAnalysisPrivate |
44 | { |
45 | gpointer reserved; |
46 | PangoFont *size_font; |
47 | PangoFont *font; |
48 | |
49 | guint8 level; |
50 | guint8 gravity; |
51 | guint8 flags; |
52 | |
53 | guint8 script; |
54 | PangoLanguage *language; |
55 | |
56 | GSList *; |
57 | }; |
58 | |
59 | typedef struct _PangoItemPrivate PangoItemPrivate; |
60 | |
61 | #if defined(__x86_64__) && !defined(__ILP32__) |
62 | |
63 | struct _PangoItemPrivate |
64 | { |
65 | int offset; |
66 | int length; |
67 | int num_chars; |
68 | int char_offset; |
69 | PangoAnalysis analysis; |
70 | }; |
71 | |
72 | #else |
73 | |
74 | struct _PangoItemPrivate |
75 | { |
76 | int offset; |
77 | int length; |
78 | int num_chars; |
79 | PangoAnalysis analysis; |
80 | int char_offset; |
81 | }; |
82 | |
83 | #endif |
84 | |
85 | G_STATIC_ASSERT (offsetof (PangoItem, offset) == offsetof (PangoItemPrivate, offset)); |
86 | G_STATIC_ASSERT (offsetof (PangoItem, length) == offsetof (PangoItemPrivate, length)); |
87 | G_STATIC_ASSERT (offsetof (PangoItem, num_chars) == offsetof (PangoItemPrivate, num_chars)); |
88 | G_STATIC_ASSERT (offsetof (PangoItem, analysis) == offsetof (PangoItemPrivate, analysis)); |
89 | |
90 | void pango_analysis_collect_features (const PangoAnalysis *analysis, |
91 | hb_feature_t *features, |
92 | guint length, |
93 | guint *num_features); |
94 | |
95 | void pango_analysis_set_size_font (PangoAnalysis *analysis, |
96 | PangoFont *font); |
97 | PangoFont * pango_analysis_get_size_font (const PangoAnalysis *analysis); |
98 | |
99 | GList * pango_itemize_with_font (PangoContext *context, |
100 | PangoDirection base_dir, |
101 | const char *text, |
102 | int start_index, |
103 | int length, |
104 | PangoAttrList *attrs, |
105 | PangoAttrIterator *cached_iter, |
106 | const PangoFontDescription *desc); |
107 | |
108 | GList * pango_itemize_post_process_items (PangoContext *context, |
109 | const char *text, |
110 | PangoLogAttr *log_attrs, |
111 | GList *items); |
112 | |
113 | void pango_item_unsplit (PangoItem *orig, |
114 | int split_index, |
115 | int split_offset); |
116 | |
117 | |
118 | G_END_DECLS |
119 | |
120 | #endif /* __PANGO_ITEM_PRIVATE_H__ */ |
121 | |