Rendering text
Factor handbook » UI framework » Implementing new gadgets » Customizing gadget appearance » Implementing custom drawing logic

Prev:OpenGL utility words


The ui.text vocabulary provides a cross-platform interface to the operating system's native font rendering engine. Currently, it uses Core Text on Mac OS X, Uniscribe on Windows and Pango on X11.
Fonts

Measuring text:
text-dim ( font text -- dim )

text-width ( font text -- w )

text-height ( font text -- h )

line-metrics ( font string -- metrics )


Converting screen locations to string offsets, and vice versa:
x>offset ( x font string -- n )

offset>x ( n font string -- x )


Rendering text:
draw-text ( font text -- )

string>image ( font string -- image loc )


Low-level text protocol for UI backends:
string-width ( font string -- w )

string-height ( font string -- h )

string-dim ( font string -- dim )

draw-string ( font string -- )