-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathhersheyfont.h
68 lines (56 loc) · 1.89 KB
/
hersheyfont.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
//
// hersheyfont.h - Copyright (C) 2013 Kamal Mostafa <[email protected]>
//
// 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.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#ifndef HERSHEYFONT_H
#define HERSHEYFONT_H
struct hershey_vertex {
short x;
short y;
};
struct hershey_path {
struct hershey_path *next;
unsigned short nverts;
struct hershey_vertex verts[];
};
struct hershey_glyph {
unsigned int glyphnum;
unsigned short width;
unsigned short npaths;
struct hershey_path *paths;
};
struct hershey_font {
struct hershey_glyph glyphs[256]; /* indexed by ASCII value */
};
//
// Load Hershey fontname (e.g. "rowmans") into a new struct hershey_font.
// The associated .jhf font file will be loaded from .../share/hershey-fonts/.
//
struct hershey_font * hershey_font_load( const char *fontname );
//
// Load a Hershey font .jhf file into a new struct hershey_font.
//
struct hershey_font * hershey_jhf_font_load( const char *jhffile );
//
// Return a pointer to the struct hershey_glyph for ASCII character c.
//
struct hershey_glyph * hershey_font_glyph( struct hershey_font *hf,
unsigned char c );
//
// Free a hershey_font allocated by hershey_font_load or hershey_jhf_font_load.
//
void hershey_font_free( struct hershey_font *hf );
#endif // HERSHEYFONT_H