-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstyle2.go
70 lines (56 loc) · 1.11 KB
/
style2.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package view
import (
"github.com/sesteel/go-view/color"
)
type BorderColors struct {
Top, Bottom, Left, Right color.RGBA
}
type BorderWidths struct {
Top, Bottom, Left, Right float64
}
type CornerRadiuses struct {
TopLeft, TopRight, BottomLeft, BottomRight float64
}
type Paddings struct {
Top, Bottom, Left, Right float64
}
type OverflowX int
const (
OVERFLOW_X_NONE OverflowX = iota
OVERFLOW_X_SCROLL
OVERFLOW_X_WRAP
)
type OverflowY int
const (
OVERFLOW_Y_NONE OverflowY = iota
OVERFLOW_Y_SCROLL
)
// type TabWidth int
type TextAlignment int
const (
STYLE_TEXT_LEFT TextAlignment = iota
STYLE_TEXT_CENTERED
STYLE_TEXT_RIGHT
STYLE_TEXT_JUSTIFIED
)
type Font struct {
Name string
Weight int
Slant int
Size float64
}
// NewFont returns the a Font which contains the
// default font style information. You may modify
// the returned font to a style suiting your needs.
func NewFont() *Font {
return &Font{
"Sans",
FONT_WEIGHT_NORMAL,
FONT_SLANT_NORMAL,
14,
}
}
func (self *Font) Configure(s *Surface) {
s.SelectFontFace(self.Name, self.Slant, self.Weight)
s.SetFontSize(self.Size)
}