Added FontName to FontDescriptor when loading TrueType based fonts from file

This commit is contained in:
Peter Williams 2018-09-07 21:43:39 +10:00
parent 4d5156c4a0
commit bb709b4381
2 changed files with 2 additions and 0 deletions

View File

@ -472,6 +472,7 @@ func NewCompositePdfFontFromTTFFile(filePath string) (*PdfFont, error) {
// Make the font descriptor.
descriptor := &PdfFontDescriptor{}
descriptor.FontName = core.MakeName(ttf.PostScriptName)
descriptor.Ascent = core.MakeFloat(k * float64(ttf.TypoAscender))
descriptor.Descent = core.MakeFloat(k * float64(ttf.TypoDescender))
descriptor.CapHeight = core.MakeFloat(k * float64(ttf.CapHeight))

View File

@ -377,6 +377,7 @@ func NewPdfFontFromTTFFile(filePath string) (*PdfFont, error) {
truefont.Encoding = core.MakeName("WinAnsiEncoding")
descriptor := &PdfFontDescriptor{}
descriptor.FontName = core.MakeName(ttf.PostScriptName)
descriptor.Ascent = core.MakeFloat(k * float64(ttf.TypoAscender))
descriptor.Descent = core.MakeFloat(k * float64(ttf.TypoDescender))
descriptor.CapHeight = core.MakeFloat(k * float64(ttf.CapHeight))