From 70127eba31f1d3f43f7ffe7e25ad871c58784507 Mon Sep 17 00:00:00 2001 From: Stani Date: Sun, 12 Jul 2015 19:45:10 +0200 Subject: GetFontDesc returns the current font descriptor if familyStr is empty --- fpdf.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'fpdf.go') diff --git a/fpdf.go b/fpdf.go index fd0c91f..c909c19 100644 --- a/fpdf.go +++ b/fpdf.go @@ -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 } -- cgit v1.2.1-24-ge1ad