This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
font.h
188 lines (171 loc) · 7.31 KB
/
font.h
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* -*- C -*-
* Copyright (c) 1997-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef EB_FONT_H
#define EB_FONT_H
#include <sys/types.h>
#include "defs.h"
/*
* Font types.
*/
#define EB_FONT_16 0
#define EB_FONT_24 1
#define EB_FONT_30 2
#define EB_FONT_48 3
#define EB_FONT_INVALID -1
/*
* Font sizes.
*/
#define EB_SIZE_NARROW_FONT_16 16
#define EB_SIZE_WIDE_FONT_16 32
#define EB_SIZE_NARROW_FONT_24 48
#define EB_SIZE_WIDE_FONT_24 72
#define EB_SIZE_NARROW_FONT_30 60
#define EB_SIZE_WIDE_FONT_30 120
#define EB_SIZE_NARROW_FONT_48 144
#define EB_SIZE_WIDE_FONT_48 288
/*
* Font width.
*/
#define EB_WIDTH_NARROW_FONT_16 8
#define EB_WIDTH_WIDE_FONT_16 16
#define EB_WIDTH_NARROW_FONT_24 16
#define EB_WIDTH_WIDE_FONT_24 24
#define EB_WIDTH_NARROW_FONT_30 16
#define EB_WIDTH_WIDE_FONT_30 32
#define EB_WIDTH_NARROW_FONT_48 24
#define EB_WIDTH_WIDE_FONT_48 48
/*
* Font height.
*/
#define EB_HEIGHT_FONT_16 16
#define EB_HEIGHT_FONT_24 24
#define EB_HEIGHT_FONT_30 30
#define EB_HEIGHT_FONT_48 48
/*
* Bitmap image sizes.
*/
#define EB_SIZE_NARROW_FONT_16_XBM 184
#define EB_SIZE_WIDE_FONT_16_XBM 284
#define EB_SIZE_NARROW_FONT_16_XPM 266
#define EB_SIZE_WIDE_FONT_16_XPM 395
#define EB_SIZE_NARROW_FONT_16_GIF 186
#define EB_SIZE_WIDE_FONT_16_GIF 314
#define EB_SIZE_NARROW_FONT_16_BMP 126
#define EB_SIZE_WIDE_FONT_16_BMP 126
#define EB_SIZE_NARROW_FONT_16_PNG 131
#define EB_SIZE_WIDE_FONT_16_PNG 147
#define EB_SIZE_NARROW_FONT_24_XBM 383
#define EB_SIZE_WIDE_FONT_24_XBM 533
#define EB_SIZE_NARROW_FONT_24_XPM 555
#define EB_SIZE_WIDE_FONT_24_XPM 747
#define EB_SIZE_NARROW_FONT_24_GIF 450
#define EB_SIZE_WIDE_FONT_24_GIF 642
#define EB_SIZE_NARROW_FONT_24_BMP 158
#define EB_SIZE_WIDE_FONT_24_BMP 158
#define EB_SIZE_NARROW_FONT_24_PNG 171
#define EB_SIZE_WIDE_FONT_24_PNG 195
#define EB_SIZE_NARROW_FONT_30_XBM 458
#define EB_SIZE_WIDE_FONT_30_XBM 833
#define EB_SIZE_NARROW_FONT_30_XPM 675
#define EB_SIZE_WIDE_FONT_30_XPM 1155
#define EB_SIZE_NARROW_FONT_30_GIF 552
#define EB_SIZE_WIDE_FONT_30_GIF 1032
#define EB_SIZE_NARROW_FONT_30_BMP 182
#define EB_SIZE_WIDE_FONT_30_BMP 182
#define EB_SIZE_NARROW_FONT_30_PNG 189
#define EB_SIZE_WIDE_FONT_30_PNG 249
#define EB_SIZE_NARROW_FONT_48_XBM 983
#define EB_SIZE_WIDE_FONT_48_XBM 1883
#define EB_SIZE_NARROW_FONT_48_XPM 1419
#define EB_SIZE_WIDE_FONT_48_XPM 2571
#define EB_SIZE_NARROW_FONT_48_GIF 1242
#define EB_SIZE_WIDE_FONT_48_GIF 2394
#define EB_SIZE_NARROW_FONT_48_BMP 254
#define EB_SIZE_WIDE_FONT_48_BMP 446
#define EB_SIZE_NARROW_FONT_48_PNG 291
#define EB_SIZE_WIDE_FONT_48_PNG 435
#define EB_SIZE_FONT_IMAGE EB_SIZE_WIDE_FONT_48_XPM
/*
* Function declarations.
*/
/* bitmap.c */
EB_Error_Code eb_narrow_font_xbm_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_xpm_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_gif_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_bmp_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_png_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_xbm_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_xpm_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_gif_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_bmp_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_png_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_bitmap_to_xbm(const char *bitmap, int width, int height,
char *xbm, size_t *xbm_length);
EB_Error_Code eb_bitmap_to_xpm(const char *bitmap, int width, int height,
char *xpm, size_t *xpm_length);
EB_Error_Code eb_bitmap_to_gif(const char *bitmap, int width, int height,
char *gif, size_t *gif_length);
EB_Error_Code eb_bitmap_to_bmp(const char *bitmap, int width, int height,
char *bmp, size_t *bmp_length);
EB_Error_Code eb_bitmap_to_png(const char *bitmap, int width, int height,
char *png, size_t *png_length);
/* font.c */
EB_Error_Code eb_font(EB_Book *book, EB_Font_Code *font_code);
EB_Error_Code eb_set_font(EB_Book *book, EB_Font_Code font_code);
void eb_unset_font(EB_Book *book);
EB_Error_Code eb_font_list(EB_Book *book, EB_Font_Code *font_list,
int *font_count);
int eb_have_font(EB_Book *book, EB_Font_Code font_code);
EB_Error_Code eb_font_height(EB_Book *book, int *height);
EB_Error_Code eb_font_height2(EB_Font_Code font_code, int *height);
/* narwfont.c */
int eb_have_narrow_font(EB_Book *book);
EB_Error_Code eb_narrow_font_width(EB_Book *book, int *width);
EB_Error_Code eb_narrow_font_width2(EB_Font_Code font_code, int *width);
EB_Error_Code eb_narrow_font_size(EB_Book *book, size_t *size);
EB_Error_Code eb_narrow_font_size2(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_start(EB_Book *book, int *start);
EB_Error_Code eb_narrow_font_end(EB_Book *book, int *end);
EB_Error_Code eb_narrow_font_character_bitmap(EB_Book *book, int, char *);
EB_Error_Code eb_forward_narrow_font_character(EB_Book *book, int, int *);
EB_Error_Code eb_backward_narrow_font_character(EB_Book *book, int, int *);
/* widefont.c */
int eb_have_wide_font(EB_Book *book);
EB_Error_Code eb_wide_font_width(EB_Book *book, int *width);
EB_Error_Code eb_wide_font_width2(EB_Font_Code font_code, int *width);
EB_Error_Code eb_wide_font_size(EB_Book *book, size_t *size);
EB_Error_Code eb_wide_font_size2(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_start(EB_Book *book, int *start);
EB_Error_Code eb_wide_font_end(EB_Book *book, int *end);
EB_Error_Code eb_wide_font_character_bitmap(EB_Book *book,
int character_number, char *bitmap);
EB_Error_Code eb_forward_wide_font_character(EB_Book *book, int n,
int *character_number);
EB_Error_Code eb_backward_wide_font_character(EB_Book *book, int n,
int *character_number);
#endif /* not EB_FONT_H */