Description Methods and Functions Detailed Description Structures Enums and Flags Author(s) References
Rendering text and glyphs
cairoSelectFontFace(cr, family, slant, weight)
cairoSetFontSize(cr, size)
cairoSetFontMatrix(cr, matrix)
cairoGetFontMatrix(cr, matrix)
cairoSetFontOptions(cr, options)
cairoGetFontOptions(cr)
cairoSetFontFace(cr, font.face)
cairoGetFontFace(cr)
cairoSetScaledFont(cr, scaled.font)
cairoGetScaledFont(cr)
cairoShowText(cr, utf8)
cairoShowGlyphs(cr, glyphs, num.glyphs)
cairoShowTextGlyphs(cr, utf8, glyphs, clusters, cluster.flags)
cairoFontExtents(cr)
cairoTextExtents(cr, utf8)
cairoGlyphExtents(cr, glyphs)
cairoToyFontFaceCreate(family, slant, weight)
cairoToyFontFaceGetFamily(font.face)
cairoToyFontFaceGetSlant(font.face)
cairoToyFontFaceGetWeight(font.face)
Cairo has two sets of text rendering capabilities:
CairoGlyph
The CairoGlyph
structure holds information about a single glyph
when drawing or measuring text. A font is (in simple terms) a
collection of shapes used to draw text. A glyph is one of these
shapes. There can be multiple glyphs for a single character
(alternates to be used in different contexts, for example), or a
glyph can be a ligature of multiple
characters. Cairo doesn't expose any way of converting input text
into glyphs, so in order to use the Cairo interfaces that take
arrays of glyphs, you must directly access the appropriate
underlying font system.
Note that the offsets given by x
and y
are not cumulative. When
drawing or measuring text, each glyph is individually positioned
with respect to the overall origin
CairoGlyph
is a transparent-type.
index
[numeric] glyph index in the font. The exact interpretation of the glyph index depends on the font technology being used.
x
[numeric] the offset in the X direction between the origin used for drawing or measuring the string and the origin of this glyph.
y
[numeric] the offset in the Y direction between the origin used for drawing or measuring the string and the origin of this glyph.
CairoTextCluster
The CairoTextCluster
structure holds information about a single
text cluster. A text cluster is a minimal
mapping of some glyphs corresponding to some UTF-8 text.
For a cluster to be valid, both num.bytes
and num.glyphs
should
be non-negative, and at least one should be non-zero.
Note that clusters with zero glyphs are not as well supported as
normal clusters. For example, PDF rendering applications typically
ignore those clusters when PDF text is being selected.
See cairoShowTextGlyphs
for how clusters are used in advanced
text operations.
Since 1.8
CairoTextCluster
is a transparent-type.
numBytes
[integer] the number of bytes of UTF-8 text covered by cluster
numGlyphs
[integer] the number of glyphs covered by cluster
CairoFontSlant
Specifies variants of a font face based on their slant.
normal
Upright font style
italic
Italic font style
oblique
Oblique font style
CairoFontWeight
Specifies variants of a font face based on their weight.
normal
Normal font weight
bold
Bold font weight
CairoTextClusterFlags
Specifies properties of a text cluster mapping. Since 1.8
backward
The clusters in the cluster list map to glyphs in the glyph list from end to start.
Derived by RGtkGen from GTK+ documentation
http://www.cairographics.org/manual/cairo-text.html
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.