-
Notifications
You must be signed in to change notification settings - Fork 2
/
glyphcache.h
44 lines (33 loc) · 1.04 KB
/
glyphcache.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef GLYPHCACHE_h
#define GLYPHCACHE_h 1
#include <glib.h>
#include <gtk/gtk.h>
#include <pango/pango.h>
#include <X11/Xft/Xft.h>
typedef struct _TGlyphInfo TGlyphInfo;
typedef struct _TGlyphCache TGlyphCache;
struct _TGlyphInfo {
XftFont *font;
gint x_offset, y_offset;
};
struct _TGlyphCache {
/* these are all private, really. */
GHashTable *hash;
GMemChunk *chunk;
GdkDisplay *display;
GdkScreen *screen;
PangoContext *context;
PangoFontset *font_set;
PangoLanguage *lang;
gint ascent, descent;
gint width, height;
};
#define glyph_cache_font_width(cache) PANGO_PIXELS((cache)->width)
#define glyph_cache_font_ascent(cache) PANGO_PIXELS((cache)->ascent)
#define glyph_cache_font_height(cache) PANGO_PIXELS((cache)->height)
TGlyphCache *glyph_cache_new(GtkWidget *widget,
PangoFontDescription *font_desc);
void glyph_cache_destroy(TGlyphCache *cache);
void glyph_cache_set_font(TGlyphCache *cache, PangoFontDescription *font_desc);
TGlyphInfo *glyph_cache_get_info(TGlyphCache *cache, gunichar glyph);
#endif