15.3.3 Glyphs and Glyphsets

A glyph in XRENDER is an alpha mask and an associated orgin, advancement and numeric id. The application refers to them by the numeric id.

Glyphs are stored in a glyph-set. The client is responsible for making sure the glyphs it uses are stored in the glyph-set, or there will be a Glyph-error.



render-create-glyph-set format &key glyph-set Function
        
format
A picture-format for the alpha masks that this font will use.
glyph-set
An optional glyph-set object to initialize with a server side glyphset resource.

Creates an initially empty glyph-set for the client to use.

Format must be a Direct format. When it contains RGB values, the glyphs are composited using component-alpha True, otherwise they are composited using component-alpha False.



render-reference-glyph-set existing-glyph-set &key glyph-set Function
        
existing-glyph-set
An existing glyph-set
glyph-set
An optional glyph-set, just like in render-create-glyph-set

Creates a new id refering to the existing-glyph-set. The glyph-set itself will not be freed until all ids has been removed.



render-free-glyph-set glyph-set Function
        
glyph-set
A glyphset resource to free

Removes an id to a glyph-set. When all ids have been removed the glyph-set itself is removed.



render-add-glyph glyph-set id &key x-origin y-origin x-advance y-advance data Function
        
glyph-set
A glyph-set
id
card32
x-orgin
int16
y-orgin
int16
x-advance
int16
y-advance
int16
data
An array of card8 bytes.

Associates id with the given description of a glyph. An existing glyph with the same id is replaced.

At the time of writing, only 8bit alpha masks are supported. Experimentation with glyph-sets in other pict-formats needed.



render-add-glyph-from-picture glyph-set picture &key x-origin y-origin x-advance y-advance width height Function
        
glyph-set
glyph-set
picture
picture
x-origin
int16
y-origin
int16
x-advance
int16
y-advance
int16
x
int16
y
int16
width
card16
height
card16
This request add a glyph to glyph-set by copying it from the x,y location in the picture.

Existing glyphs with the same names are replaced. The source picture may be in a different picture-format than glyph-set, in which case the images are converted to the glyph-set's format.



render-free-glyphs glyph-set glyphs Function
        
glyph-set
A glyph-set
glyphs
sequence of card32

This request removes glyphs from glyph-set. Each glyph must exist in glyph-set (else a Match error results).