diff options
author | Stani <spe.stani.be@gmail.com> | 2015-07-12 19:45:10 +0200 |
---|---|---|
committer | Stani <spe.stani.be@gmail.com> | 2015-07-12 19:45:10 +0200 |
commit | 70127eba31f1d3f43f7ffe7e25ad871c58784507 (patch) | |
tree | 19cb28e2c19267b6873ae47db24fdc83ac413c6d | |
parent | 0fc3e570463d3cbe35071b0dc71e3f63c074f7d1 (diff) |
GetFontDesc returns the current font descriptor if familyStr is empty
-rw-r--r-- | fpdf.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1435,10 +1435,14 @@ func (f *Fpdf) AddFontFromReader(familyStr, styleStr string, r io.Reader) { } // GetFontDesc returns the font descriptor, which can be used for -// example to find the baseline of a font. See FontDescType for -// documentation about the font descriptor. +// example to find the baseline of a font. If familyStr is empty +// current font descriptor will be returned. +// See FontDescType for documentation about the font descriptor. // See AddFont for details about familyStr and styleStr. func (f *Fpdf) GetFontDesc(familyStr, styleStr string) FontDescType { + if familyStr == "" { + return f.currentFont.Desc + } return f.fonts[getFontKey(familyStr, styleStr)].Desc } |