]> git.decadent.org.uk Git - ion3.git/blob - de/font.h
7e40121a2c65fca82da316af5085b2f5b1faa78f
[ion3.git] / de / font.h
1 /*
2  * ion/de/font.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2007. 
5  *
6  * Ion is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  */
11
12 #ifndef ION_DE_FONT_H
13 #define ION_DE_FONT_H
14
15 #include <ioncore/common.h>
16 #include <ioncore/gr.h>
17
18 INTRSTRUCT(DEFont);
19
20 #include "brush.h"
21 #include "colour.h"
22 #include "style.h"
23
24 #define DE_RESET_FONT_EXTENTS(FNTE) \
25    {(FNTE)->max_height=0; (FNTE)->max_width=0; (FNTE)->baseline=0;}
26
27 DECLSTRUCT(DEFont){
28     char *pattern;
29     int refcount;
30     XFontSet fontset;
31     XFontStruct *fontstruct;
32     DEFont *next, *prev;
33 };
34
35 extern bool de_load_font_for_style(DEStyle *style, const char *fontname);
36 extern bool de_set_font_for_style(DEStyle *style, DEFont *font);
37 extern DEFont *de_load_font(const char *fontname);
38 extern void de_free_font(DEFont *font);
39
40 extern void debrush_draw_string(DEBrush *brush, int x, int y,
41                                 const char *str, int len, bool needfill);
42 extern void debrush_do_draw_string(DEBrush *brush, int x, int y,
43                                    const char *str, int len, bool needfill, 
44                                    DEColourGroup *colours);
45 extern void debrush_do_draw_string_default(DEBrush *brush, int x, int y,
46                                            const char *str, int len, 
47                                            bool needfill, 
48                                            DEColourGroup *colours);
49
50 extern void debrush_get_font_extents(DEBrush *brush, GrFontExtents *fnte);
51
52 extern uint debrush_get_text_width(DEBrush *brush, const char *text, uint len);
53
54 extern uint defont_get_text_width(DEFont *font, const char *text, uint len);
55 extern void defont_get_font_extents(DEFont *font, GrFontExtents *fnte);
56
57 #endif /* ION_DE_FONT_H */