]> icculus.org git repositories - dana/openbox.git/blob - render2/font.c
improve expose handling for alpha children
[dana/openbox.git] / render2 / font.c
1 #include "render.h"
2 #include "instance.h"
3 #include "font.h"
4 #include <stdlib.h>
5 #include <string.h>
6
7 struct RrFont *RrFontOpen(struct RrInstance *inst, const char *fontstring)
8 {
9     struct RrFont *font;
10
11     font = malloc(sizeof(struct RrFont));
12     font->inst = inst;
13     font->font = GlftFontOpen(RrDisplay(inst), RrScreen(inst), fontstring);
14     return font;
15 }
16
17 void RrFontClose(struct RrFont *font)
18 {
19     if (font) {
20         GlftFontClose(font->font);
21         free(font);
22     }
23 }
24
25 int RrFontMeasureString(struct RrFont *font, const char *string)
26 {
27     int w, h;
28     GlftMeasureString(font->font, string, strlen(string), &w, &h);
29     return w;
30 }
31
32 int RrFontHeight(struct RrFont *font)
33 {
34     return GlftFontHeight(font->font);
35 }
36
37 int RrFontMaxCharWidth(struct RrFont *font)
38 {
39     return GlftFontMaxCharWidth(font->font);
40 }