File: font.h

package info (click to toggle)
libucimf 2.3.7-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,912 kB
  • ctags: 708
  • sloc: sh: 10,568; cpp: 3,769; ansic: 789; makefile: 63
file content (132 lines) | stat: -rw-r--r-- 2,896 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 *   Copyright © 2008-2009 dragchan <zgchan317@gmail.com>
 *   This file is part of FbTerm.
 *
 *   Extended modification: Chun-Yu Lee (Mat) <matlinuxer2@gmail.com> 
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation; either version 2
 *   of the License, or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

#ifndef FONT_H
#define FONT_H

//#include "type.h"
typedef char s8;
typedef short s16;
typedef int s32;
typedef long long s64;

typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;



#ifdef __cplusplus

//#include "instance.h"
#define DECLARE_INSTANCE(classname) \
public: \
	static classname *instance(); \
	static void uninstance(); \
protected: \
	classname(); \
	virtual ~classname(); \
private: \
	static classname *createInstance(); \
	static classname *mp##classname;

#define DEFINE_INSTANCE(classname) \
classname *classname::mp##classname = 0; \
 \
classname *classname::instance() \
{ \
	if (!mp##classname) { \
		mp##classname = createInstance(); \
	} \
	 \
	return mp##classname; \
} \
 \
void classname::uninstance() \
{ \
	if (mp##classname) { \
		delete mp##classname; \
		mp##classname = 0; \
	} \
}

#define DEFINE_INSTANCE_DEFAULT(classname) \
DEFINE_INSTANCE(classname) \
 \
classname *classname::createInstance() \
{ \
	return new classname(); \
}


class Font {
	DECLARE_INSTANCE(Font)
public:
	struct Glyph {
		s16 pitch, width, height;
		s16 left, top;
		u8 pixmap[0];
	};

	Glyph *getGlyph(u32 unicode);
	u32 width() {
		return mWidth;
	}
	u32 height() {
		return mHeight;
	}
	void showInfo(bool verbose);
	void setInfo( const s8* font_names, const s32 font_size, const s32 font_width );

private:
	u32 mWidth, mHeight;
	static s8  mFontNames[64];
	static u32 mFontSize;
	static s32 mFontWidth;
};

#endif //__cplusplus


#ifdef __cplusplus
extern "C" {
#endif

typedef struct the_Font_Glyph {
	s16 pitch, width, height;
	s16 left, top;
	u8 pixmap[0];
} struct_Font_Glyph;

struct_Font_Glyph *call_Font_getGlyph(u32 unicode);
u32 call_Font_width();
u32 call_Font_height();
void call_Font_showInfo();
void call_Font_setInfo( const s8* font_names, const s32 font_size, const s32 font_width );

#ifdef __cplusplus                                                                                  
}
#endif


#endif