-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfontdescriptor_obj.go
58 lines (44 loc) · 1.08 KB
/
fontdescriptor_obj.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
package gopdf
import (
"bytes"
)
type FontDescriptorObj struct {
buffer bytes.Buffer
font IFont
fontFileObjRelate string
}
func (f *FontDescriptorObj) init(funcGetRoot func() *GoPdf) {
}
func (f *FontDescriptorObj) build(objID int) error {
f.buffer.WriteString("<</Type /FontDescriptor /FontName /" + f.font.GetName() + " ")
descs := f.font.GetDesc()
i := 0
max := len(descs)
for i < max {
f.buffer.WriteString("/" + descs[i].Key + " " + descs[i].Val + " ")
i++
}
if f.getType() == "Type1" {
f.buffer.WriteString("/FontFile ")
} else {
f.buffer.WriteString("/FontFile2 ")
}
f.buffer.WriteString(f.fontFileObjRelate)
f.buffer.WriteString(">>\n")
return nil
}
func (f *FontDescriptorObj) getType() string {
return "FontDescriptor"
}
func (f *FontDescriptorObj) getObjBuff() *bytes.Buffer {
return &(f.buffer)
}
func (f *FontDescriptorObj) SetFont(font IFont) {
f.font = font
}
func (f *FontDescriptorObj) GetFont() IFont {
return f.font
}
func (f *FontDescriptorObj) SetFontFileObjRelate(relate string) {
f.fontFileObjRelate = relate
}