pango-Glyph-Storage: Glyph Storage

Description Methods and Functions Detailed Description Structures Author(s) References

Description

Structures for storing information about glyphs

Methods and Functions

pangoUnitsToDouble(i)
pangoUnitsFromDouble(d)
pangoExtentsToPixels(inclusive, nearest)
pangoMatrixCopy(object)
pangoMatrixTranslate(object, tx, ty)
pangoMatrixScale(object, scale.x, scale.y)
pangoMatrixRotate(object, degrees)
pangoMatrixConcat(object, new.matrix)
pangoMatrixTransformPoint(object, x, y)
pangoMatrixTransformDistance(object, dx, dy)
pangoMatrixTransformRectangle(object, rect)
pangoMatrixTransformPixelRectangle(object, rect)
pangoMatrixGetFontScaleFactor(object)
pangoGlyphStringNew()
pangoGlyphStringCopy(object)
pangoGlyphStringSetSize(object, new.len)
pangoGlyphStringExtents(object, font)
pangoGlyphStringExtentsRange(object, start, end, font)
pangoGlyphStringGetWidth(object)
pangoGlyphStringIndexToX(object, text, analysis, index, trailing)
pangoGlyphStringXToIndex(object, text, analysis, x.pos)
pangoGlyphStringGetLogicalWidths(object, text, embedding.level)
pangoGlyphItemSplit(orig, text, split.index)
pangoGlyphItemApplyAttrs(glyph.item, text, list)
pangoGlyphItemLetterSpace(glyph.item, text, log.attrs)
pangoGlyphItemGetLogicalWidths(glyph.item, text)
pangoGlyphItemIterInitStart(object, glyph.item, text)
pangoGlyphItemIterInitEnd(object, glyph.item, text)
pangoGlyphItemIterNextCluster(object)
pangoGlyphItemIterPrevCluster(object)

Detailed Description

pangoShape produces a string of glyphs which can be measured or drawn to the screen. The following structures are used to store information about glyphs.

Structures

PangoRectangle

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, pangoFontGetGlyphExtents) PangoRectangle is a transparent-type.

x

[integer] X coordinate of the left side of the rectangle.

y

[integer] Y coordinate of the the top side of the rectangle.

width

[integer] width of the rectangle.

height

[integer] height of the rectangle.

PangoMatrix

A structure specifying a transformation between user-space coordinates and device coordinates. The transformation is given by

x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0;
y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;

Since 1.6

xx

[numeric] 1st component of the transformation matrix

xy

[numeric] 2nd component of the transformation matrix

yx

[numeric] 3rd component of the transformation matrix

yy

[numeric] 4th component of the transformation matrix

x0

[numeric] x translation

y0

[numeric] y translation

PangoGlyphInfo

The PangoGlyphInfo structure represents a single glyph together with positioning information and visual attributes. It contains the following fields.

glyph

[numeric] the glyph itself.

geometry

[PangoGlyphGeometry] the positional information about the glyph.

attr

[PangoGlyphVisAttr] the visual attributes of the glyph.

PangoGlyphGeometry

The PangoGlyphGeometry structure contains width and positioning information for a single glyph.

width

[integer] the logical width to use for the the character.

xOffset

[integer] horizontal offset from nominal character position.

yOffset

[integer] vertical offset from nominal character position.

PangoGlyphVisAttr

The PangoGlyphVisAttr is used to communicate information between the shaping phase and the rendering phase. More attributes may be added in the future.

isClusterStart

[numeric] 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.)

PangoGlyphString

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.

numGlyphs

[integer] the number of glyphs in the string.

glyphs

[PangoGlyphInfo] a list of PangoGlyphInfo structures of length num_glyphs.

logClusters

[integer] 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.

PangoGlyphItem

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

[PangoItem] a PangoItem structure that provides information about a segment of text.

glyphs

[PangoGlyphString] the glyphs obtained by shaping the text corresponding to item.

PangoGlyphItemIter

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 pangoGlyphItemIterInitStart and pangoGlyphItemIterInitEnd, for forward and backward iteration respectively, and walked over using any desired mixture of pangoGlyphItemIterNextCluster and pangoGlyphItemIterPrevCluster. 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. Since 1.22

glyph_item

[PangoGlyphItem] the PangoGlyphItem this iterator iterates over

text

[character] the UTF-8 text that glyph.item refers to

start_glyph

[integer] starting glyph of the cluster

start_index

[integer] starting text index of the cluster

start_char

[integer] starting number of characters of the cluster

end_glyph

[integer] ending glyph of the cluster

end_index

[integer] ending text index of the cluster

end_char

[integer] ending number of characters of the cluster

Author(s)

Derived by RGtkGen from GTK+ documentation

References

https://developer.gnome.org/pango/stable/pango-Glyph-Storage.html


RGtk2 documentation built on Oct. 14, 2021, 5:08 p.m.