summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStani <spe.stani.be@gmail.com>2015-07-12 19:46:18 +0200
committerStani <spe.stani.be@gmail.com>2015-07-12 19:46:18 +0200
commitd74ca8575df7ec44d2bb3357a3f8ecacf3ca8497 (patch)
treea99a8acdc10f465ac5e574e9ecfb32ccb81c95eb
parenta66d421172b03aa66a20d1a76e40d9b5e2f2798e (diff)
parent70127eba31f1d3f43f7ffe7e25ad871c58784507 (diff)
Merge pull request #28 from stanim/current
GetFontDesc returns the current font descriptor if familyStr is empty
-rw-r--r--fpdf.go8
1 files changed, 6 insertions, 2 deletions
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
}