-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglyphmetrics.go
54 lines (44 loc) · 1.23 KB
/
glyphmetrics.go
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
package freetype
/*
#cgo pkg-config: freetype2
#include <ft2build.h>
#include FT_FREETYPE_H
*/
import "C"
type GlyphMetrics struct {
handle C.FT_Glyph_Metrics
}
// The glyph's width.
func (m *GlyphMetrics) Width() int64 {
return int64(m.handle.width)
}
// The glyph's height.
func (m *GlyphMetrics) Height() int64 {
return int64(m.handle.height)
}
// Left side bearing for horizontal layout.
func (m *GlyphMetrics) HoriBearingX() int64 {
return int64(m.handle.horiBearingX)
}
// Top side bearing for horizontal layout.
func (m *GlyphMetrics) HoriBearingY() int64 {
return int64(m.handle.horiBearingY)
}
// Advance width for horizontal layout.
func (m *GlyphMetrics) HoriAdvance() int64 {
return int64(m.handle.horiAdvance)
}
// Left side bearing for vertical layout.
func (m *GlyphMetrics) VertBearingX() int64 {
return int64(m.handle.vertBearingX)
}
// Top side bearing for vertical layout.
// Larger positive values mean further below the vertical glyph origin.
func (m *GlyphMetrics) VertBearingY() int64 {
return int64(m.handle.vertBearingY)
}
// Advance height for vertical layout.
// Positive values mean the glyph has a positive advance downward.
func (m *GlyphMetrics) VertAdvance() int64 {
return int64(m.handle.vertAdvance)
}