summaryrefslogtreecommitdiff
path: root/rules/rules.go
blob: 4a86820ce99a36aaa89400ffd9cf917138d66adf (plain)
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
// The rules package of PrintDraftFast provides the tools around configuration of how a draft should look. The default should work but can be adjusted for a personal touch..
package rules

type Format struct {
	Right   float64
	Left    float64
	Font    string
	Style   string
	Size    float64
	Hide    bool
	Align   string
	Prefix  string
	Postfix string
}

type Set map[string]Format

func (s Set) Get(style string) (f Format) {
	f, ok := s[style]
	if !ok {
		f = s["default"]
		f.Hide = true
	}
	if f.Font == "" {
		f.Font = "CourierPrime"
	}
	if f.Size == 0 {
		f.Size = 12
	}
	if f.Align == "" {
		f.Align = "L"
	}
	return f
}

var Default = Set{
	"default": {
		Left:  1.5,
		Right: 1,
	},
	"h1": {
		Size: 2,
	},
	"center": {
		Left:  1.5,
		Right: 1,
		Align: "C",
	},
}