blob: 66cd69b3e0daf8368bb10d7b894018d795bc5d6f (
plain)
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
|
#ifndef DL_PKFONT_HH__
#define DL_PKFONT_HH__
#include "dl-loader.hh"
#include "dl-refcounted.hh"
#include "dl-font.hh"
#include <vector>
#include <map>
namespace DviLib {
class RleContext;
enum CountType {
RUN_COUNT,
REPEAT_COUNT
};
class PkChar : public AbstractCharacter {
uint dyn_f;
bool first_is_black; // if first run count is black or white
int character_code;
int tfm_width; // in what units? FIXME
uint dx; // escapement - what is this? FIXME
uint dy;
uint width; // in pixels
uint height; // in pixels
int hoffset;
int voffset;
bool unpacked;
union {
unsigned char *bitmap; // 32 bit/pixel ARGB format
unsigned char *packed;
} data;
CountType get_count (RleContext& nr, uint *count);
void unpack_rle (RleContext& nr);
void unpack_bitmap (void);
void unpack (void);
public:
PkChar (AbstractLoader &l);
virtual void paint (DviRuntime &runtime);
const unsigned char *get_bitmap (void)
{
if (!unpacked)
unpack ();
return data.bitmap;
}
uint get_width (void)
{
return width;
}
uint get_height (void)
{
return height;
}
virtual int get_tfm_width (void)
{
return tfm_width;
}
int get_hoffset (void)
{
return hoffset;
}
int get_voffset (void)
{
return voffset;
}
int get_character_code (void) { return character_code; }
};
class PkFont : public AbstractFont {
AbstractLoader& loader;
uint id;
string comment;
uint design_size;
uint checksum;
uint hppp; /* horizontal pixels per point */
uint vppp; /* vertical pixels per point */
map <uint, PkChar *> chars;
int at_size;
void load (void);
public:
PkFont (AbstractLoader& l);
PkFont (AbstractLoader& l, int at_size);
virtual PkChar *get_char (int ccode)
{
return chars[ccode];
}
virtual int get_design_size (void)
{
return design_size;
}
virtual int get_at_size (void)
{
return at_size;
}
virtual ~PkFont () {}
};
}
#endif /* DL_PKFONT_HH__ */
|