Mercurial > otakunoraifu
annotate font/font.h @ 57:6d9146f56ccf
* Move some opcodes
* Merge last changes from xclannad
author | Thibaut GIRKA <thib@sitedethib.com> |
---|---|
date | Sat, 14 Nov 2009 23:31:51 +0100 |
parents | ddbcbd000206 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (c) 2004 Kazunori "jagarl" Ueno | |
3 * Copyright (c) 2000, 2001 Yuki Sawada | |
4 * All rights reserved. | |
5 * | |
6 * Redistribution and use in source and binary forms, with or without | |
7 * modification, are permitted provided that the following conditions | |
8 * are met: | |
9 * 1. Redistributions of source code must retain the above copyright | |
52 | 10 * notice, this list of conditions and the following disclaimer. |
0 | 11 * 2. Redistributions in binary form must reproduce the above copyright |
52 | 12 * notice, this list of conditions and the following disclaimer in the |
13 * documentation and/or other materials provided with the distribution. | |
0 | 14 * 3. The name of the author may not be used to endorse or promote products |
52 | 15 * derived from this software without specific prior written permission. |
0 | 16 * |
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 */ | |
28 | |
29 #ifndef __FONT_TYPES_H__ | |
30 #define __FONT_TYPES_H__ | |
31 | |
32 #ifdef HAVE_CONFIG_H | |
33 # include "config.h" | |
34 #endif | |
35 | |
52 | 36 #include <vector> |
0 | 37 |
38 class TextHorizLayout; | |
39 class TextStream; | |
40 class TextGlyphStream; | |
41 | |
42 namespace XKFont { | |
52 | 43 class Font; |
44 class Face; | |
45 class Peer; | |
46 class Glyph; | |
47 class Cache; | |
0 | 48 |
52 | 49 struct Font { |
50 public: | |
51 Font(const char* fontname, int size); | |
52 ~Font(); | |
53 Face* FaceLoad(double scale); | |
54 int vsize; | |
55 private: | |
56 class FontImpl* pimpl; | |
57 }; | |
0 | 58 |
52 | 59 struct Face { |
60 public: | |
61 Face(const char *name, int index, int hsize, int vsize); | |
62 ~Face(); | |
63 Glyph* GlyphLoad(unsigned int code); | |
0 | 64 |
52 | 65 private: |
66 Cache* cache; | |
67 typedef std::vector<Peer*>::iterator iterator; | |
68 std::vector<Peer*> peer; | |
69 }; | |
0 | 70 |
52 | 71 struct Peer { |
72 public: | |
73 Peer(void) {} | |
74 virtual ~Peer() {}; | |
75 virtual bool GlyphCreate(unsigned int code, Glyph* glyph) = 0; | |
76 }; | |
0 | 77 |
52 | 78 struct Glyph { |
79 public: | |
80 struct _bitmap { | |
81 int width; | |
82 int rows; | |
83 unsigned char *buffer; | |
84 _bitmap() : buffer(0) {} | |
85 ~_bitmap() { delete[] buffer;} | |
86 } bitmap; | |
0 | 87 #if 0 |
52 | 88 struct _metrics { |
89 int ascender; | |
90 int descender; | |
91 } metrics; | |
0 | 92 #endif |
52 | 93 struct _advance { |
94 int x; | |
95 int y; | |
96 } advance; | |
97 | |
98 Glyph() : bitmap() {} | |
99 ~Glyph() {} | |
100 int bitmap_left; | |
101 int bitmap_top; | |
102 }; | |
0 | 103 |
52 | 104 struct HorizLayout { |
105 public: | |
106 HorizLayout(const char* fontname, int size); | |
107 ~HorizLayout(); | |
108 void Layout(::TextStream& stream, ::TextGlyphStream& glyph, std::vector<int>& lineheights, int width); | |
109 ::TextGlyphStream Layout(const char* str, int width, int r=0xff, int g=0xff, int b=0xff); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
110 ::TextGlyphStream Layout(TextStream ts, int width); |
52 | 111 private: |
112 Font* font; | |
113 class ::TextHorizLayout* pimpl; | |
114 }; | |
0 | 115 |
52 | 116 } /* end of namespace XKFont */ |
0 | 117 |
118 #endif |