Package: cairo

CStruct cairo:glyph-t

Declaration

(cffi:defcstruct glyph-t
  (index :ulong)
  (x :double)
  (y :double))  

Values

index
Glyph index in the font. The exact interpretation of the glyph index depends on the font technology being used.
x
The offset in the x direction between the origin used for drawing or measuring the string and the origin of this glyph.
y
The offset in the y direction between the origin used for drawing or measuring the string and the origin of this glyph.

Details

The cairo:glyph-t 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 does not 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.

Notes

In the Lisp API, this structure is only used to implement functions that work with glyphs and accept or return a glyph or an array of glyphs. In the Lisp implementation a glyph is represented as a list:
(list index x y)    
An array of glyphs is represented as a list:
(list (list index1 x1 y1) (list index2 x2 y2) ... )    
 

See also

2025-1-29