1 /* Header for FreeType 2 and UTF-8 encoding support for
5 #ifndef DP_FREETYPE2_H__
6 #define DP_FREETYPE2_H__
10 // types for unicode strings
11 // let them be 32 bit for now
12 // normally, whcar_t is 16 or 32 bit, 16 on linux I think, 32 on haiku and maybe windows
15 typedef __int32 U_int32;
17 typedef int32_t U_int32;
20 // Uchar, a wide character
21 typedef U_int32 Uchar;
23 size_t u8_strlen(const char*);
24 Uchar u8_getchar(const char*, const char**);
25 int u8_fromchar(Uchar, char*, size_t);
26 size_t u8_wcstombs(char*, const Uchar*, size_t);
29 * From http://www.unicode.org/Public/UNIDATA/Blocks.txt
31 * E000..F8FF; Private Use Area
32 * F0000..FFFFF; Supplementary Private Use Area-A
36 * Contains the non-FreeType2 version of characters.
39 typedef struct ft2_font_map_s ft2_font_map_t;
40 typedef struct ft2_attachment_s ft2_attachment_t;
42 typedef float ft2_kernvec[2];
43 typedef struct ft2_kerning_s
45 ft2_kernvec kerning[256][256]; /* kerning[left char][right char] */
48 typedef struct ft2_font_s
56 // TODO: clean this up and do not expose everything.
62 // an ordered linked list of glyph maps
63 ft2_font_map_t *font_map;
64 // contains the kerning information for the first 256 characters
65 // for the other characters, we will lookup the kerning information
66 ft2_kerning_t kerning;
67 // size factor to convert from freetype units
71 size_t attachmentcount;
72 ft2_attachment_t *attachments;
75 void Font_CloseLibrary(void);
77 qboolean Font_OpenLibrary(void);
78 ft2_font_t* Font_Alloc(void);
79 void Font_UnloadFont(ft2_font_t *font);
80 qboolean Font_LoadFont(const char *name, int size, ft2_font_t *font);
81 qboolean Font_GetKerning(ft2_font_t *font, Uchar left, Uchar right, float *outx, float *outy);
83 float Font_DrawString_Font(
84 float startx, float starty,
85 const char *text, size_t maxlen,
86 float width, float height,
87 float basered, float basegreen, float baseblue, float basealpha,
88 int flags, int *outcolor, qboolean ignorecolorcodes,
90 float Font_DrawString(
91 float startx, float starty,
92 const char *text, size_t maxlen,
93 float width, float height,
94 float basered, float basegreen, float baseblue, float basealpha,
95 int flags, int *outcolor, qboolean ignorecolorcodes);
97 #endif // DP_FREETYPE2_H__