Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
pango-glyph.h
Go to the documentation of this file.
1/* Pango
2 * pango-glyph.h: Glyph storage
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_GLYPH_H__
23#define __PANGO_GLYPH_H__
24
25#include <pango/pango-types.h>
26#include <pango/pango-item.h>
27#include <pango/pango-break.h>
28
30
35
36/* 1024ths of a device unit */
37/**
38 * PangoGlyphUnit:
39 *
40 * The `PangoGlyphUnit` type is used to store dimensions within
41 * Pango.
42 *
43 * Dimensions are stored in 1/PANGO_SCALE of a device unit.
44 * (A device unit might be a pixel for screen display, or
45 * a point on a printer.) PANGO_SCALE is currently 1024, and
46 * may change in the future (unlikely though), but you should not
47 * depend on its exact value.
48 *
49 * The PANGO_PIXELS() macro can be used to convert from glyph units
50 * into device units with correct rounding.
51 */
53
54/* Positioning information about a glyph
55 */
56/**
57 * PangoGlyphGeometry:
58 * @width: the logical width to use for the the character.
59 * @x_offset: horizontal offset from nominal character position.
60 * @y_offset: vertical offset from nominal character position.
61 *
62 * The `PangoGlyphGeometry` structure contains width and positioning
63 * information for a single glyph.
64 *
65 * Note that @width is not guaranteed to be the same as the glyph
66 * extents. Kerning and other positioning applied during shaping will
67 * affect both the @width and the @x_offset for the glyphs in the
68 * glyph string that results from shaping.
69 *
70 * The information in this struct is intended for rendering the glyphs,
71 * as follows:
72 *
73 * 1. Assume the current point is (x, y)
74 * 2. Render the current glyph at (x + x_offset, y + y_offset),
75 * 3. Advance the current point to (x + width, y)
76 * 4. Render the next glyph
77 */
84
85/* Visual attributes of a glyph
86 */
87/**
88 * PangoGlyphVisAttr:
89 * @is_cluster_start: set for the first logical glyph in each cluster.
90 * @is_color: set if the the font will render this glyph with color. Since 1.50
91 *
92 * A `PangoGlyphVisAttr` structure communicates information between
93 * the shaping and rendering phases.
94 *
95 * Currently, it contains cluster start and color information.
96 * More attributes may be added in the future.
97 *
98 * Clusters are stored in visual order, within the cluster, glyphs
99 * are always ordered in logical order, since visual order is meaningless;
100 * that is, in Arabic text, accent glyphs follow the glyphs for the
101 * base character.
102 */
108
109/* A single glyph
110 */
111/**
112 * PangoGlyphInfo:
113 * @glyph: the glyph itself.
114 * @geometry: the positional information about the glyph.
115 * @attr: the visual attributes of the glyph.
116 *
117 * A `PangoGlyphInfo` structure represents a single glyph with
118 * positioning information and visual attributes.
119 */
126
127/**
128 * PangoGlyphString:
129 * @num_glyphs: number of glyphs in this glyph string
130 * @glyphs: (array length=num_glyphs): array of glyph information
131 * @log_clusters: logical cluster info, indexed by the byte index
132 * within the text corresponding to the glyph string
133 *
134 * A `PangoGlyphString` is used to store strings of glyphs with geometry
135 * and visual attribute information.
136 *
137 * The storage for the glyph information is owned by the structure
138 * which simplifies memory management.
139 */
142
145
146 /*< private >*/
147 int space;
148};
149
150#define PANGO_TYPE_GLYPH_STRING (pango_glyph_string_get_type ())
151
154
159 int new_len);
160
165
168 PangoFont *font,
169 PangoRectangle *ink_rect,
170 PangoRectangle *logical_rect);
173
176 int start,
177 int end,
178 PangoFont *font,
179 PangoRectangle *ink_rect,
180 PangoRectangle *logical_rect);
181
184 const char *text,
185 int length,
186 int embedding_level,
187 int *logical_widths);
188
191 const char *text,
192 int length,
193 PangoAnalysis *analysis,
194 int index_,
195 gboolean trailing,
196 int *x_pos);
199 const char *text,
200 int length,
201 PangoAnalysis *analysis,
202 int x_pos,
203 int *index_,
204 int *trailing);
205
208 const char *text,
209 int length,
210 PangoAnalysis *analysis,
211 PangoLogAttr *attrs,
212 int index_,
213 gboolean trailing,
214 int *x_pos);
215
216/* Shaping */
217
218/**
219 * PangoShapeFlags:
220 * @PANGO_SHAPE_NONE: Default value
221 * @PANGO_SHAPE_ROUND_POSITIONS: Round glyph positions and widths to whole device units
222 * This option should be set if the target renderer can't do subpixel positioning of glyphs
223 *
224 * Flags influencing the shaping process.
225 *
226 * `PangoShapeFlags` can be passed to [func@Pango.shape_with_flags].
227 *
228 * Since: 1.44
229 */
234
236void pango_shape (const char *text,
237 int length,
238 const PangoAnalysis *analysis,
239 PangoGlyphString *glyphs);
240
242void pango_shape_full (const char *item_text,
243 int item_length,
244 const char *paragraph_text,
245 int paragraph_length,
246 const PangoAnalysis *analysis,
247 PangoGlyphString *glyphs);
248
250void pango_shape_with_flags (const char *item_text,
251 int item_length,
252 const char *paragraph_text,
253 int paragraph_length,
254 const PangoAnalysis *analysis,
255 PangoGlyphString *glyphs,
256 PangoShapeFlags flags);
257
258
261 const char *paragraph_text,
262 int paragraph_length,
263 PangoLogAttr *log_attrs,
264 PangoGlyphString *glyphs,
265 PangoShapeFlags flags);
266
267
269
270#endif /* __PANGO_GLYPH_H__ */
signed int gint32
Definition glibconfig.h:56
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_CONST
Definition gmacros.h:637
gsize GType
Definition gtype.h:427
gint gboolean
Definition gtypes.h:56
unsigned int guint
Definition gtypes.h:61
PANGO_AVAILABLE_IN_1_44 void pango_shape_with_flags(const char *item_text, int item_length, const char *paragraph_text, int paragraph_length, const PangoAnalysis *analysis, PangoGlyphString *glyphs, PangoShapeFlags flags)
PANGO_AVAILABLE_IN_ALL PangoGlyphString * pango_glyph_string_copy(PangoGlyphString *string)
PANGO_AVAILABLE_IN_ALL void pango_glyph_string_x_to_index(PangoGlyphString *glyphs, const char *text, int length, PangoAnalysis *analysis, int x_pos, int *index_, int *trailing)
PANGO_AVAILABLE_IN_ALL PangoGlyphString * pango_glyph_string_new(void)
typedefG_BEGIN_DECLS struct _PangoGlyphGeometry PangoGlyphGeometry
Definition pango-glyph.h:31
PANGO_AVAILABLE_IN_ALL void pango_glyph_string_free(PangoGlyphString *string)
PANGO_AVAILABLE_IN_ALL void pango_glyph_string_extents_range(PangoGlyphString *glyphs, int start, int end, PangoFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect)
gint32 PangoGlyphUnit
Definition pango-glyph.h:52
PANGO_AVAILABLE_IN_ALL void pango_shape(const char *text, int length, const PangoAnalysis *analysis, PangoGlyphString *glyphs)
PANGO_AVAILABLE_IN_ALL void pango_glyph_string_index_to_x(PangoGlyphString *glyphs, const char *text, int length, PangoAnalysis *analysis, int index_, gboolean trailing, int *x_pos)
PANGO_AVAILABLE_IN_1_50 void pango_shape_item(PangoItem *item, const char *paragraph_text, int paragraph_length, PangoLogAttr *log_attrs, PangoGlyphString *glyphs, PangoShapeFlags flags)
PANGO_AVAILABLE_IN_1_32 void pango_shape_full(const char *item_text, int item_length, const char *paragraph_text, int paragraph_length, const PangoAnalysis *analysis, PangoGlyphString *glyphs)
PANGO_AVAILABLE_IN_1_50 void pango_glyph_string_index_to_x_full(PangoGlyphString *glyphs, const char *text, int length, PangoAnalysis *analysis, PangoLogAttr *attrs, int index_, gboolean trailing, int *x_pos)
PangoShapeFlags
@ PANGO_SHAPE_ROUND_POSITIONS
@ PANGO_SHAPE_NONE
PANGO_AVAILABLE_IN_ALL void pango_glyph_string_set_size(PangoGlyphString *string, int new_len)
PANGO_AVAILABLE_IN_1_14 int pango_glyph_string_get_width(PangoGlyphString *glyphs)
PANGO_AVAILABLE_IN_ALL void pango_glyph_string_get_logical_widths(PangoGlyphString *glyphs, const char *text, int length, int embedding_level, int *logical_widths)
PANGO_AVAILABLE_IN_ALL GType pango_glyph_string_get_type(void) G_GNUC_CONST
PANGO_AVAILABLE_IN_ALL void pango_glyph_string_extents(PangoGlyphString *glyphs, PangoFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect)
typedefG_BEGIN_DECLS struct _PangoAnalysis PangoAnalysis
Definition pango-item.h:30
typedefG_BEGIN_DECLS struct _PangoLogAttr PangoLogAttr
Definition pango-types.h:32
guint32 PangoGlyph
Definition pango-types.h:54
#define PANGO_AVAILABLE_IN_1_44
#define PANGO_AVAILABLE_IN_1_32
#define PANGO_AVAILABLE_IN_1_50
#define PANGO_AVAILABLE_IN_1_14
#define PANGO_AVAILABLE_IN_ALL
PangoGlyphUnit width
Definition pango-glyph.h:80
PangoGlyphUnit x_offset
Definition pango-glyph.h:81
PangoGlyphUnit y_offset
Definition pango-glyph.h:82
PangoGlyphVisAttr attr
PangoGlyphGeometry geometry
PangoGlyph glyph
PangoGlyphInfo * glyphs