1/* Pango
2 * pango-item.h: Structure for storing run information
3 *
4 * Copyright (C) 2000 Red Hat Software
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22#ifndef __PANGO_ITEM_H__
23#define __PANGO_ITEM_H__
24
25#include <pango/pango-types.h>
26#include <pango/pango-attributes.h>
27
28G_BEGIN_DECLS
29
30typedef struct _PangoAnalysis PangoAnalysis;
31typedef struct _PangoItem PangoItem;
32
33/**
34 * PANGO_ANALYSIS_FLAG_CENTERED_BASELINE:
35 *
36 * Whether the segment should be shifted to center around the baseline.
37 *
38 * This is mainly used in vertical writing directions.
39 *
40 * Since: 1.16
41 */
42#define PANGO_ANALYSIS_FLAG_CENTERED_BASELINE (1 << 0)
43
44/**
45 * PANGO_ANALYSIS_FLAG_IS_ELLIPSIS:
46 *
47 * Whether this run holds ellipsized text.
48 *
49 * Since: 1.36.7
50 */
51#define PANGO_ANALYSIS_FLAG_IS_ELLIPSIS (1 << 1)
52
53/**
54 * PANGO_ANALYSIS_FLAG_NEED_HYPHEN:
55 *
56 * Whether to add a hyphen at the end of the run during shaping.
57 *
58 * Since: 1.44
59 */
60#define PANGO_ANALYSIS_FLAG_NEED_HYPHEN (1 << 2)
61
62/**
63 * PangoAnalysis:
64 * @shape_engine: unused, reserved
65 * @lang_engine: unused, reserved
66 * @font: the font for this segment.
67 * @level: the bidirectional level for this segment.
68 * @gravity: the glyph orientation for this segment (A `PangoGravity`).
69 * @flags: boolean flags for this segment (Since: 1.16).
70 * @script: the detected script for this segment (A `PangoScript`) (Since: 1.18).
71 * @language: the detected language for this segment.
72 * @extra_attrs: extra attributes for this segment.
73 *
74 * The `PangoAnalysis` structure stores information about
75 * the properties of a segment of text.
76 */
77struct _PangoAnalysis
78{
79#ifndef __GI_SCANNER__
80 PangoEngineShape *shape_engine;
81 PangoEngineLang *lang_engine;
82#else
83 gpointer shape_engine;
84 gpointer lang_engine;
85#endif
86 PangoFont *font;
87
88 guint8 level;
89 guint8 gravity;
90 guint8 flags;
91
92 guint8 script;
93 PangoLanguage *language;
94
95 GSList *extra_attrs;
96};
97
98/**
99 * PangoItem:
100 * @offset: byte offset of the start of this item in text.
101 * @length: length of this item in bytes.
102 * @num_chars: number of Unicode characters in the item.
103 * @char_offset: character offset of the start of this item in text. Since 1.50
104 * @analysis: analysis results for the item.
105 *
106 * The `PangoItem` structure stores information about a segment of text.
107 *
108 * You typically obtain `PangoItems` by itemizing a piece of text
109 * with [func@itemize].
110 */
111struct _PangoItem
112{
113 int offset;
114 int length;
115 int num_chars;
116 PangoAnalysis analysis;
117};
118
119#define PANGO_TYPE_ITEM (pango_item_get_type ())
120
121PANGO_AVAILABLE_IN_ALL
122GType pango_item_get_type (void) G_GNUC_CONST;
123
124PANGO_AVAILABLE_IN_ALL
125PangoItem * pango_item_new (void);
126PANGO_AVAILABLE_IN_ALL
127PangoItem * pango_item_copy (PangoItem *item);
128PANGO_AVAILABLE_IN_ALL
129void pango_item_free (PangoItem *item);
130
131PANGO_AVAILABLE_IN_ALL
132PangoItem * pango_item_split (PangoItem *orig,
133 int split_index,
134 int split_offset);
135
136PANGO_AVAILABLE_IN_1_44
137void pango_item_apply_attrs (PangoItem *item,
138 PangoAttrIterator *iter);
139
140PANGO_AVAILABLE_IN_ALL
141GList * pango_reorder_items (GList *items);
142
143/* Itemization */
144
145PANGO_AVAILABLE_IN_ALL
146GList * pango_itemize (PangoContext *context,
147 const char *text,
148 int start_index,
149 int length,
150 PangoAttrList *attrs,
151 PangoAttrIterator *cached_iter);
152
153PANGO_AVAILABLE_IN_1_4
154GList * pango_itemize_with_base_dir (PangoContext *context,
155 PangoDirection base_dir,
156 const char *text,
157 int start_index,
158 int length,
159 PangoAttrList *attrs,
160 PangoAttrIterator *cached_iter);
161
162
163G_END_DECLS
164
165#endif /* __PANGO_ITEM_H__ */
166

source code of include/pango-1.0/pango/pango-item.h