annotate font/font_peer.h @ 54:d7cde171a1de

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