Glyph Storage
Structures for storing information about glyphs
pango_shape() produces a string of glyphs which
can be measured or drawn to the screen. The following
structures are used to store information about
glyphs.
The %PANGO_SCALE macro represents the scale between dimensions used
for Pango distances and device units. (The definition of device
units is dependent on the output device; it will typically be pixels
for a screen, and points for a printer.) %PANGO_SCALE is currently
1024, but this may be changed in the future.
When setting font sizes, device units are always considered to be
points (as in "12 point font"), rather than pixels.
Converts a dimension to device units by rounding.
@d: a dimension in Pango units.
@Returns: rounded dimension in device units.
Converts a dimension to device units by flooring.
@d: a dimension in Pango units.
@Returns: floored dimension in device units.
@Since: 1.14
Converts a dimension to device units by ceiling.
@d: a dimension in Pango units.
@Returns: ceiled dimension in device units.
@Since: 1.14
Rounds a dimension to whole device units, but does not
convert it to device units.
@d: a dimension in Pango units.
@Returns: rounded dimension in Pango units.
@Since: 1.18
@i:
@Returns:
@d:
@Returns:
The #PangoRectangle structure represents a rectangle. It is frequently
used to represent the logical or ink extents of a single glyph or section
of text. (See, for instance, pango_font_get_glyph_extents())
@x: X coordinate of the left side of the rectangle.
@y: Y coordinate of the the top side of the rectangle.
@width: width of the rectangle.
@height: height of the rectangle.
Extracts the ascent from a #PangoRectangle
representing glyph extents. The ascent is the distance from the
baseline to the highest point of the character. This is positive if the
glyph ascends above the baseline.
@rect: a #PangoRectangle
Extracts the descent from a #PangoRectangle
representing glyph extents. The descent is the distance from the
baseline to the lowest point of the character. This is positive if the
glyph descends below the baseline.
@rect: a #PangoRectangle
Extracts the left bearing from a #PangoRectangle
representing glyph extents. The left bearing is the distance from the
horizontal origin to the farthest left point of the character.
This is positive for characters drawn completely to the right of the
glyph origin.
@rect: a #PangoRectangle
Extracts the right bearing from a #PangoRectangle
representing glyph extents. The right bearing is the distance from the
horizontal origin to the farthest right point of the character.
This is positive except for characters drawn completely to the left of the
horizontal origin.
@rect: a #PangoRectangle
@inclusive:
@nearest:
@xx:
@xy:
@yx:
@yy:
@x0:
@y0:
@matrix:
@Returns:
@matrix:
@matrix:
@tx:
@ty:
@matrix:
@scale_x:
@scale_y:
@matrix:
@degrees:
@matrix:
@new_matrix:
@matrix:
@x:
@y:
@matrix:
@dx:
@dy:
@matrix:
@rect:
@matrix:
@rect:
@matrix:
@Returns:
A #PangoGlyph represents a single glyph in the output form of a string.
The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
special meaning, which is a zero-width empty glyph. This is useful for
example in shaper modules, to use as the glyph for various zero-width
Unicode characters (those passing pango_is_zero_width()).
The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
special meaning of invalid input. #PangoLayout produces one such glyph
per invalid input UTF-8 byte and such a glyph is rendered as a crossed
box.
Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
on.
@Since: 1.20
The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to
a #gunichar value of a valid Unicode character, to produce a #PangoGlyph
value, representing an unknown-character glyph for the respective #gunichar.
Returns a #PangoGlyph value that means no glyph was found for @wc.
The way this unknown glyphs are rendered is backend specific. For example,
a box with the hexadecimal Unicode code-point of the character written in it
is what is done in the most common backends.
@wc: a Unicode character
The #PangoGlyphInfo structure represents a single glyph together with
positioning information and visual attributes.
It contains the following fields.
@glyph: the glyph itself.
@geometry: the positional information about the glyph.
@attr: the visual attributes of the glyph.
The #PangoGlyphGeometry structure contains width and positioning
information for a single glyph.
@width: the logical width to use for the the character.
@x_offset: horizontal offset from nominal character position.
@y_offset: vertical offset from nominal character position.
The #PangoGlyphUnit type is used to store dimensions within
Pango. Dimensions are stored in 1/%PANGO_SCALE of a device unit.
(A device unit might be a pixel for screen display, or
a point on a printer.) %PANGO_SCALE is currently 1024, and
may change in the future (unlikely though), but you should not
depend on its exact value. The PANGO_PIXELS() macro can be used
to convert from glyph units into device units with correct rounding.
The PangoGlyphVisAttr is used to communicate information between
the shaping phase and the rendering phase. More attributes may be
added in the future.
@is_cluster_start: set for the first logical glyph in each cluster. (Clusters
are stored in visual order, within the cluster, glyphs
are always ordered in logical order, since visual
order is meaningless; that is, in Arabic text, accent glyphs
follow the glyphs for the base character.)
The #PangoGlyphString structure is used to store strings
of glyphs with geometry and visual attribute information.
The storage for the glyph information is owned
by the structure which simplifies memory management.
@num_glyphs: the number of glyphs in the string.
@glyphs: an array of #PangoGlyphInfo structures of length num_glyphs.
@log_clusters: for each glyph, byte index of the starting character for the
cluster. The indices are relative to the start of the text
corresponding to the PangoGlyphString.
A #PangoGlyphItem is a pair of a #PangoItem and the glyphs
resulting from shaping the text corresponding to an item.
As an example of the usage of #PangoGlyphItem, the results
of shaping text with #PangoLayout is a list of #PangoLayoutLine,
each of which contains a list of #PangoGlyphItem.
@item: a #PangoItem structure that provides information
about a segment of text.
@glyphs: the glyphs obtained by shaping the text
corresponding to @item.
A #PangoGlyphItemIter is an iterator over the clusters in a
#PangoGlyphItem. The forward direction of the
iterator is the logical direction of text. That is, with increasing
@start_index and @start_char values. If @glyph_item is right-to-left
(that is, if @glyph_item->item->analysis.level is odd),
then @start_glyph decreases as the iterator moves forward. Moreover,
in right-to-left cases, @start_glyph is greater than @end_glyph.
An iterator should be initialized using either of
pango_glyph_item_iter_init_start() and
pango_glyph_item_iter_init_end(), for forward and backward iteration
respectively, and walked over using any desired mixture of
pango_glyph_item_iter_next_cluster() and
pango_glyph_item_iter_prev_cluster(). A common idiom for doing a
forward iteration over the clusters is:
PangoGlyphItemIter cluster_iter;
gboolean have_cluster;
for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter,
glyph_item, text);
have_cluster;
have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter))
{
...
}
Note that @text is the start of the text for layout, which is then
indexed by @glyph_item->item->offset to get to the
text of @glyph_item. The @start_index and @end_index values can directly
index into @text. The @start_glyph, @end_glyph, @start_char, and @end_char
values however are zero-based for the @glyph_item. For each cluster, the
item pointed at by the start variables is included in the cluster while
the one pointed at by end variables is not.
None of the members of a #PangoGlyphItemIter should be modified manually.
@glyph_item: the #PangoGlyphItem this iterator iterates over
@text: the UTF-8 text that @glyph_item refers to
@start_glyph: starting glyph of the cluster
@start_index: starting text index of the cluster
@start_char: starting number of characters of the cluster
@end_glyph: ending glyph of the cluster
@end_index: ending text index of the cluster
@end_char: ending number of characters of the cluster
@Since: 1.22
The #GObject type for #PangoGlyphString.
@void:
@Returns:
@string:
@Returns:
@string:
@new_len:
@string:
@glyphs:
@font:
@ink_rect:
@logical_rect:
@glyphs:
@start:
@end:
@font:
@ink_rect:
@logical_rect:
@glyphs:
@Returns:
@glyphs:
@text:
@length:
@analysis:
@index_:
@trailing:
@x_pos:
@glyphs:
@text:
@length:
@analysis:
@x_pos:
@index_:
@trailing:
@glyphs:
@text:
@length:
@embedding_level:
@logical_widths:
The #GObject type for #PangoGlyphItem.
@Since: 1.20
@orig:
@Returns:
@glyph_item:
@orig:
@text:
@split_index:
@Returns:
@glyph_item:
@text:
@list:
@Returns:
@glyph_item:
@text:
@log_attrs:
@letter_spacing:
@glyph_item:
@text:
@logical_widths:
The #GObject type for #PangoGlyphItemIter.
@Since: 1.22
@orig:
@Returns:
@iter:
@iter:
@glyph_item:
@text:
@Returns:
@iter:
@glyph_item:
@text:
@Returns:
@iter:
@Returns:
@iter:
@Returns: