Mercurial > otakunoraifu
comparison font/font_peer.h @ 0:223b71206888
Initial import
author | thib |
---|---|
date | Fri, 01 Aug 2008 16:32:45 +0000 |
parents | |
children | 15a18fbe6f21 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:223b71206888 |
---|---|
1 /* | |
2 * Copyright (c) 2004 Kazunori "jagarl" Ueno | |
3 * All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. The name of the author may not be used to endorse or promote products | |
14 * derived from this software without specific prior written permission. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 */ | |
27 | |
28 #ifndef __FONT_PEER_H__ | |
29 #define __FONT_PEER_H__ | |
30 | |
31 #include "font.h" | |
32 | |
33 namespace XKFont { | |
34 | |
35 class PeerFn : public Peer { | |
36 public: | |
37 PeerFn(const char* name, int index, int hsize, int vsize); | |
38 ~PeerFn(); | |
39 bool GlyphCreate(unsigned int code, Glyph* g); | |
40 private: | |
41 unsigned char *buffer; | |
42 }; | |
43 | |
44 } | |
45 | |
46 #include <ft2build.h> | |
47 #include FT_FREETYPE_H | |
48 | |
49 namespace XKFont { | |
50 typedef unsigned int (*FontCodeConverter)(unsigned int); | |
51 class PeerFt2 : public Peer { | |
52 public: | |
53 PeerFt2(const char *name, int index, int hsize, int vsize); | |
54 ~PeerFt2(); | |
55 bool GlyphCreate(unsigned int code, Glyph* glyph); | |
56 private: | |
57 FT_Face face; | |
58 FontCodeConverter conv_func; | |
59 }; | |
60 | |
61 } | |
62 | |
63 #if USE_X11 | |
64 #include <X11/Xlib.h> | |
65 #include <X11/extensions/XShm.h> | |
66 | |
67 namespace XKFont { | |
68 class PeerX11 : public Peer { | |
69 public: | |
70 PeerX11(const char *name, int index, int hsize, int vsize); | |
71 ~PeerX11(); | |
72 bool GlyphCreate(unsigned int code, Glyph* g); | |
73 static void InitDisplay(Display*); | |
74 static void OpenDisplay(void); | |
75 private: | |
76 static Display* display; | |
77 | |
78 XFontSet fontset; | |
79 GC gc; | |
80 Visual* visual; | |
81 unsigned long white, black; | |
82 Pixmap canvas; | |
83 XShmSegmentInfo x_shm_info; | |
84 bool use_shm; | |
85 XImage* image; | |
86 int width, height, ascent; | |
87 int mask, shift; | |
88 int* colortable; | |
89 }; | |
90 | |
91 }; /* namespace XKFont */ | |
92 #endif /* USE_X11 */ | |
93 | |
94 #endif /* __FONT_PEER_H__ */ |