luigi.font
- interface
Font
;
- An abstract interface for any font rendering tech that wants to be used by Luigi
- abstract float
draw_char
(dchar c);
- Draw a character using OpenGL commands at position (0,0,0) in current
OpenGL coordinates.
Return the number of units along the baseline to advance.
- abstract float
draw_string
(char[] str);
- Draw a string using OpenGL commands at position (0,0,0) in current
OpenGL coordinates.
Return the number of units along the baseline to advance.
A mixin is available to provide a default implementation of this based
on draw_char.
- abstract Rect
string_rect
(char[] str);
- Return the bounding box of the string assuming it will be drawn at
location (0,0).
Thus the x,y positions tell you about the leading and descender.
+--------------------+
| <--w--> | ^
| | |
(0,0) | | h
+------|--------------------|-|----
|(x,y) | v
+--------------------+
- abstract float
height
();
- Return the basic
height
of the font
- abstract float
width
();
- Return
width
if font is fixed-
width
, or -1 if the font is proportional
- abstract Size
origin
();
- Returns the location of the
origin
relative to a character's bounding box
top-left corner. Below this would be something like (ox,oy)==(-5,7).
Put another way, in order for the top left corner to appear at some (x,y)
you should call draw_string with the coordinates set to (x+ox, y+oy)
(0,0)+------------+
| |
| |
(ox,oy) | |
+------|------------|----
| |
+------------+
|