]> git.decadent.org.uk Git - ion3.git/blob - de/font.h
1b3774c08c816bd25a4b076b21b16496ec65ecca
[ion3.git] / de / font.h
1 /*
2  * ion/de/font.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2008. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #ifndef ION_DE_FONT_H
10 #define ION_DE_FONT_H
11
12 #include <ioncore/common.h>
13 #include <ioncore/gr.h>
14
15 INTRSTRUCT(DEFont);
16
17 #include "brush.h"
18 #include "colour.h"
19 #include "style.h"
20
21 #define DE_RESET_FONT_EXTENTS(FNTE) \
22    {(FNTE)->max_height=0; (FNTE)->max_width=0; (FNTE)->baseline=0;}
23
24 DECLSTRUCT(DEFont){
25     char *pattern;
26     int refcount;
27     XFontSet fontset;
28     XFontStruct *fontstruct;
29     DEFont *next, *prev;
30 };
31
32 extern bool de_load_font_for_style(DEStyle *style, const char *fontname);
33 extern bool de_set_font_for_style(DEStyle *style, DEFont *font);
34 extern DEFont *de_load_font(const char *fontname);
35 extern void de_free_font(DEFont *font);
36
37 extern void debrush_draw_string(DEBrush *brush, int x, int y,
38                                 const char *str, int len, bool needfill);
39 extern void debrush_do_draw_string(DEBrush *brush, int x, int y,
40                                    const char *str, int len, bool needfill, 
41                                    DEColourGroup *colours);
42 extern void debrush_do_draw_string_default(DEBrush *brush, int x, int y,
43                                            const char *str, int len, 
44                                            bool needfill, 
45                                            DEColourGroup *colours);
46
47 extern void debrush_get_font_extents(DEBrush *brush, GrFontExtents *fnte);
48
49 extern uint debrush_get_text_width(DEBrush *brush, const char *text, uint len);
50
51 extern uint defont_get_text_width(DEFont *font, const char *text, uint len);
52 extern void defont_get_font_extents(DEFont *font, GrFontExtents *fnte);
53
54 #endif /* ION_DE_FONT_H */