bbcode - bbcodehtml/font.go
1 package bbcodehtml
2
3 import (
4 "strings"
5 )
6
7 var (
8 georgia = []byte("Georgia, serif")
9 times = []byte("\\\"Times New Roman\\\", Times, serif")
10 arial = []byte("Arial, Helvetica, sans-serif")
11 arialBlack = []byte("\\\"Arial Black\\\", Gadget, sans-serif")
12 comicSans = []byte("\\\"Comic Sans MS\\\", cursive, sans-serif")
13 impact = []byte("Impact, Charcoal, sans-serif")
14 verdana = []byte("Verdana, Geneva, sans-serif")
15 courier = []byte("\\\"Courier New\\\", Courier, monospace")
16 lucida = []byte("\\\"Lucida Console\\\", Monaco, monospace")
17 sansSerif = impact[18:]
18 serif = sansSerif[5:]
19 monospace = courier[26:]
20 )
21
22 // Fonts is a map of font names and their css expansion for use as an
23 // attribute filter for bbcode.AttributeTag
24 var Fonts = fonts{
25 "georgia": georgia,
26 "times": times,
27 "times new roman": times,
28 "arial": arial,
29 "arial black": arialBlack,
30 "comic sans ms": comicSans,
31 "comic sans": comicSans,
32 "impact": impact,
33 "verdana": verdana,
34 "courier": courier,
35 "lucida console": lucida,
36 "serif": serif,
37 "sans serif": sansSerif,
38 "monospace": monospace,
39 }
40
41 type fonts map[string][]byte
42
43 func (f fonts) AttrFilter(attr string) []byte {
44 if font, ok := f[strings.ToLower(attr)]; ok {
45 return font
46 }
47 return nil
48 }
49