Fix typo in the Gentoo initscript.
[fbsplash.git] / core / src / ttf.h
blob5463deb2dc3eef198addb56cbf4a1381e25d6ee4
1 #ifndef _TTF_H
2 #define _TTF_H
3 #include <ft2build.h>
4 #include <freetype/ftoutln.h>
5 #include <freetype/ttnameid.h>
7 #define CACHED_METRICS 0x10
8 #define CACHED_BITMAP 0x01
9 #define CACHED_PIXMAP 0x02
11 #define TTF_STYLE_NORMAL 0x00
12 #define TTF_STYLE_BOLD 0x01
13 #define TTF_STYLE_ITALIC 0x02
14 #define TTF_STYLE_UNDERLINE 0x04
16 /* Handy routines for converting from fixed point */
17 #define FT_FLOOR(X) ((X & -64) / 64)
18 #define FT_CEIL(X) (((X + 63) & -64) / 64)
20 /* Cached glyph information */
21 typedef struct cached_glyph {
22 int stored;
23 FT_UInt index;
24 FT_Bitmap bitmap;
25 FT_Bitmap pixmap;
26 int minx;
27 int maxx;
28 int miny;
29 int maxy;
30 int yoffset;
31 int advance;
32 unsigned short cached;
33 } c_glyph;
35 struct _TTF_Font {
36 /* Freetype2 maintains all sorts of useful info itself */
37 FT_Face face;
39 /* We'll cache these ourselves */
40 int height;
41 int ascent;
42 int descent;
43 int lineskip;
45 /* The font style */
46 int style;
48 /* Extra width in glyph bounds for text styles */
49 int glyph_overhang;
50 float glyph_italics;
52 /* Information in the font for underlining */
53 int underline_offset;
54 int underline_height;
56 /* Cache for style-transformed glyphs */
57 c_glyph *current;
58 c_glyph cache[256];
59 c_glyph scratch;
62 typedef struct _TTF_Font TTF_Font;
64 int TTF_Init(void);
65 void TTF_Quit(void);
67 struct fbspl_theme;
68 struct text;
70 void text_render(struct fbspl_theme *theme, struct text *ct, rect *re, u8 *target);
71 void text_prerender(struct fbspl_theme *theme, struct text *ct, bool force);
72 void text_bnd(struct fbspl_theme *theme, struct text *ct, rect *bnd);
74 int load_fonts(struct fbspl_theme *theme);
75 int free_fonts(struct fbspl_theme *theme);
77 #endif