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
|
.TH LIBPARSEPCF_GET_SWIDTHS 3 LIBPARSEPCF
.SH NAME
libparsepcf_get_swidths \- Get em-width of glyphs
.SH SYNOPSIS
.nf
#include <libparsepcf.h>
#define LIBPARSEPCF_SWIDTHS /* value omitted */
int libparsepcf_get_swidth_count(const void *\fIdata\fP, size_t \fIsize\fP,
const struct libparsepcf_table *\fItable\fP,
size_t *\fIcount_out\fP);
int libparsepcf_get_swidths(const void *\fIdata\fP, size_t \fIsize\fP,
const struct libparsepcf_table *\fItable\fP,
int32_t *\fIwidths_out\fP,
size_t \fIfirst\fP, size_t \fIcount\fP);
.fi
.PP
Link with
.IR -lparsepcf .
.SH DESCRIPTION
If the so called scaleable widths of the glyphs
in a PCF font file is recorded in the file, they
are recorded in the table with the type
.B LIBPARSEPCF_SWIDTHS
retrieved with the
.BR libparsepcf_get_tables (3)
function.
.PP
The \(dqscaleable width\(dq of a glyph is the
width measured in a relative unit, in the case
of PCF files, milli-ems.
.PP
Once the
.B LIBPARSEPCF_SWIDTHS
table has been identified, it can be passed as
the third argument
.RI ( table )
to the
.BR libparsepcf_get_swidth_count ()
function along with the font file contents
in the
.I data
argument and size, in bytes, of the file in the
.I size
argument. The
.BR libparsepcf_get_swidth_count ()
function will store the number of available
glyphs in
.IR *count_out ,
which shall be used to check that all glyphs
have a width recorded.
.PP
Then the
.BR libparsepcf_get_swidths ()
function can be used to get the width, in
milli-ems, of each glyph. The first three
arguments shall be the same as with
.BR libparsepcf_get_swidth_count ().
.I first
shall be the index of the glyph with the lowest
index of the glyph the function shall get the
width for, and
.I count
shall be the number of consecutive glyphs
(including the first glyph) to get this information
for. For each queried glyph with index
.IR i ,
the width will be stored in
.IR widths_out[i-first] .
.PP
The application shall ensure that
.IR "first + count <= *count_out" .
.PP
Note that glyph indices are not the same as character
codepoints. See
.BR libparsepcf_get_encoding (3)
for details about mapping characters to glyphs.
.SH RETURN VALUE
The
.BR libparsepcf_get_swidth_count ()
and
.BR libparsepcf_get_swidths ()
functions return 0 upon successful completion.
On failure, -1 is returned and
.I errno
is set appropriately to indicate the error.
.SH ERRORS
The
.BR libparsepcf_get_swidth_count ()
and
.BR libparsepcf_get_swidths ()
functions fail if:
.TP
.B EBFONT
The font file is corrupt or unsupported.
.SH SEE ALSO
.BR libparsepcf (7),
.BR libparsepcf_preparse_font (3)
|