0
|
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
|
52
|
9 * notice, this list of conditions and the following disclaimer.
|
0
|
10 * 2. Redistributions in binary form must reproduce the above copyright
|
52
|
11 * notice, this list of conditions and the following disclaimer in the
|
|
12 * documentation and/or other materials provided with the distribution.
|
0
|
13 * 3. The name of the author may not be used to endorse or promote products
|
52
|
14 * derived from this software without specific prior written permission.
|
0
|
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
|
52
|
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 };
|
0
|
43
|
|
44 }
|
|
45
|
|
46 #include <ft2build.h>
|
|
47 #include FT_FREETYPE_H
|
|
48
|
|
49 namespace XKFont {
|
52
|
50
|
|
51 typedef unsigned int (*FontCodeConverter)(unsigned int);
|
|
52
|
|
53 class PeerFt2 : public Peer {
|
|
54 public:
|
|
55 PeerFt2(const char *name, int index, int hsize, int vsize);
|
|
56 ~PeerFt2();
|
|
57 bool GlyphCreate(unsigned int code, Glyph* glyph);
|
|
58 private:
|
|
59 FT_Face face;
|
|
60 FontCodeConverter conv_func;
|
|
61 };
|
0
|
62
|
|
63 }
|
|
64
|
|
65 #if USE_X11
|
|
66 #include <X11/Xlib.h>
|
|
67 #include <X11/extensions/XShm.h>
|
|
68
|
|
69 namespace XKFont {
|
52
|
70 class PeerX11 : public Peer {
|
|
71 public:
|
|
72 PeerX11(const char *name, int index, int hsize, int vsize);
|
|
73 ~PeerX11();
|
|
74 bool GlyphCreate(unsigned int code, Glyph* g);
|
|
75 static void InitDisplay(Display*);
|
|
76 static void OpenDisplay(void);
|
|
77 private:
|
|
78 static Display* display;
|
0
|
79
|
52
|
80 XFontSet fontset;
|
|
81 GC gc;
|
|
82 Visual* visual;
|
|
83 unsigned long white, black;
|
|
84 Pixmap canvas;
|
|
85 XShmSegmentInfo x_shm_info;
|
|
86 bool use_shm;
|
|
87 XImage* image;
|
|
88 int width, height, ascent;
|
|
89 int mask, shift;
|
|
90 int* colortable;
|
|
91 };
|
0
|
92
|
|
93 }; /* namespace XKFont */
|
|
94 #endif /* USE_X11 */
|
|
95
|
|
96 #endif /* __FONT_PEER_H__ */
|