-
Notifications
You must be signed in to change notification settings - Fork 3
/
options.go
51 lines (44 loc) · 1 KB
/
options.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
/*
* Copyright © 2021 A Bunch Tell LLC.
*
* This file is part of text-pic.
*
* text-pic is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, included
* in the LICENSE file in this source code package.
*/
package textpic
var fonts = map[string]string{
"norm": "Lora",
"serif": "Lora",
"sans": "OpenSans",
"mono": "Hack",
"wrap": "Hack",
}
type ContentOptions struct {
// Author information
Instance string
Username string
// Write.as-only option
IsSubdomain bool // UNIMPLEMENTED
// Content
UserFont string
Content string
}
func NewContentOptions(instance, username string, isSubdomain bool, font, content string) *ContentOptions {
opt := &ContentOptions{
Instance: instance,
Username: username,
IsSubdomain: isSubdomain,
UserFont: font,
Content: content,
}
if opt.Content == "" {
opt.Content = "Hello, world!"
}
return opt
}
func IsValidFont(f string) bool {
_, valid := fonts[f]
return valid
}