-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext_multi_format_creator.go
127 lines (113 loc) · 3.77 KB
/
text_multi_format_creator.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package pdflexgo
import (
"github.com/kjk/flex"
)
type TextMultiFormatCreator struct {
element *TextMultiFormatElement
}
func TextMultiFormat() *TextMultiFormatCreator {
return &TextMultiFormatCreator{
element: &TextMultiFormatElement{
lineHeight: nil,
size: -1,
parts: []*textMultiFormatPart{},
},
}
}
func (constructor *TextMultiFormatCreator) Create() *TextMultiFormatElement {
constructor.element.addPart()
config := flex.NewConfig()
config.UseWebDefaults = true
node := flex.NewNodeWithConfig(config)
element := constructor.element
element.abstractElement.flexNode = node
return constructor.element
}
func (creator *TextMultiFormatCreator) LineHeight(height float64) *TextMultiFormatCreator {
creator.element.lineHeight = &height
return creator
}
func (creator *TextMultiFormatCreator) Size(size float64) *TextMultiFormatCreator {
creator.element.size = size
return creator
}
func (creator *TextMultiFormatCreator) Color(red int, green int, blue int, alpha ...float64) *TextMultiFormatCreator {
creator.element.color = getRgba(red, green, blue, alpha...)
return creator
}
func (creator *TextMultiFormatCreator) FontFamily(family string) *TextMultiFormatCreator {
creator.element.fontFamily = family
return creator
}
func (creator *TextMultiFormatCreator) Thin() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleThin
return creator
}
func (creator *TextMultiFormatCreator) ExtraLight() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleExtraLight
return creator
}
func (creator *TextMultiFormatCreator) Light() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleLight
return creator
}
func (creator *TextMultiFormatCreator) Regular() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleRegular
return creator
}
func (creator *TextMultiFormatCreator) Medium() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleMedium
return creator
}
func (creator *TextMultiFormatCreator) SemiBold() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleSemiBold
return creator
}
func (creator *TextMultiFormatCreator) Bold() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleBold
return creator
}
func (creator *TextMultiFormatCreator) ExtraBold() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleExtraBold
return creator
}
func (creator *TextMultiFormatCreator) Black() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleBlack
return creator
}
func (creator *TextMultiFormatCreator) ThinItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleThinItalic
return creator
}
func (creator *TextMultiFormatCreator) ExtraLightItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleExtraLightItalic
return creator
}
func (creator *TextMultiFormatCreator) LightItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleLightItalic
return creator
}
func (creator *TextMultiFormatCreator) RegularItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleRegularItalic
return creator
}
func (creator *TextMultiFormatCreator) MediumItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleMediumItalic
return creator
}
func (creator *TextMultiFormatCreator) SemiBoldItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleSemiBoldItalic
return creator
}
func (creator *TextMultiFormatCreator) BoldItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleBoldItalic
return creator
}
func (creator *TextMultiFormatCreator) ExtraBoldItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleExtraBoldItalic
return creator
}
func (creator *TextMultiFormatCreator) BlackItalic() *TextMultiFormatCreator {
creator.element.fontStyle = FontStyleBlackItalic
return creator
}