-
Notifications
You must be signed in to change notification settings - Fork 44
/
pdf_parse_font.go
44 lines (37 loc) · 916 Bytes
/
pdf_parse_font.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
package pdft
import "io"
// PDFParseFont parse font
func PDFParseFont(path string, name string) (*PDFFontData, error) {
var fontData PDFFontData
fontData.init()
err := pdfParseFont(path, name, &fontData)
if err != nil {
return nil, err
}
return &fontData, nil
}
func pdfParseFont(path string, name string, outFontData *PDFFontData) error {
err := outFontData.setTTFPath(path)
if err != nil {
return err
}
outFontData.setFontName(name)
return nil
}
func PDFParseFontReader(reader io.Reader, name string) (*PDFFontData, error) {
var fontData PDFFontData
fontData.init()
err := pdfParseFontReader(reader, name, &fontData)
if err != nil {
return nil, err
}
return &fontData, nil
}
func pdfParseFontReader(reader io.Reader, name string, outFontData *PDFFontData) error {
err := outFontData.setTTFReader(reader)
if err != nil {
return err
}
outFontData.setFontName(name)
return nil
}