f96e9a61 |
1 | /* |
2 | * Header file for gtkfont.c. Has to be separate from unix.h |
3 | * because it depends on GTK data types, hence can't be included |
4 | * from cross-platform code (which doesn't go near GTK). |
5 | */ |
6 | |
7 | #ifndef PUTTY_GTKFONT_H |
8 | #define PUTTY_GTKFONT_H |
9 | |
10 | /* |
11 | * Exports from gtkfont.c. |
12 | */ |
13 | struct unifont_vtable; /* contents internal to gtkfont.c */ |
14 | typedef struct unifont { |
15 | const struct unifont_vtable *vt; |
16 | /* |
17 | * `Non-static data members' of the `class', accessible to |
18 | * external code. |
19 | */ |
20 | |
21 | /* |
22 | * public_charset is the charset used when the user asks for |
23 | * `Use font encoding'. |
24 | * |
25 | * real_charset is the charset used when translating text into |
26 | * a form suitable for sending to unifont_draw_text(). |
27 | * |
28 | * They can differ. For example, public_charset might be |
29 | * CS_ISO8859_1 while real_charset is CS_ISO8859_1_X11. |
30 | */ |
31 | int public_charset, real_charset; |
32 | |
33 | /* |
34 | * Font dimensions needed by clients. |
35 | */ |
36 | int width, height, ascent, descent; |
37 | } unifont; |
38 | |
39 | unifont *unifont_create(GtkWidget *widget, const char *name, |
40 | int wide, int bold, |
41 | int shadowoffset, int shadowalways); |
42 | void unifont_destroy(unifont *font); |
43 | void unifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font, |
44 | int x, int y, const char *string, int len, |
45 | int wide, int bold, int cellwidth); |
46 | |
47 | /* |
48 | * Unified font selector dialog. I can't be bothered to do a |
49 | * proper GTK subclassing today, so this will just be an ordinary |
50 | * data structure with some useful members. |
51 | * |
52 | * (Of course, these aren't the only members; this structure is |
53 | * contained within a bigger one which holds data visible only to |
54 | * the implementation.) |
55 | */ |
56 | typedef struct unifontsel { |
57 | void *user_data; /* settable by the user */ |
58 | GtkWindow *window; |
59 | GtkWidget *ok_button, *cancel_button; |
60 | } unifontsel; |
61 | |
62 | unifontsel *unifontsel_new(const char *wintitle); |
63 | void unifontsel_destroy(unifontsel *fontsel); |
64 | void unifontsel_set_name(unifontsel *fontsel, const char *fontname); |
65 | char *unifontsel_get_name(unifontsel *fontsel); |
66 | |
67 | #endif /* PUTTY_GTKFONT_H */ |