summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--font.go11
-rw-r--r--fpdf.go13
-rw-r--r--fpdf_test.go4
-rw-r--r--makefont/makefont.go10
4 files changed, 22 insertions, 16 deletions
diff --git a/font.go b/font.go
index 102efa5..35f59f1 100644
--- a/font.go
+++ b/font.go
@@ -374,10 +374,13 @@ func makeDefinitionFile(fileStr, tpStr, encodingFileStr string, embed bool, encL
// gofpdf generates. See the makefont utility in the gofpdf package for a
// command line interface to this function.
//
-// fontFileStr is the name of the TrueType (or OpenType based on TrueType,
-// extension .ttf) or binary Type1 file (extension .pfb) from which to generate
-// a definition file. If a Type1 file is specified, a metric file with the same
-// pathname except with the extension .afm must be present.
+// fontFileStr is the name of the TrueType file (extension .ttf), OpenType file
+// (extension .otf) or binary Type1 file (extension .pfb) from which to
+// generate a definition file. If an OpenType file is specified, it must be one
+// that is based on TrueType outlines, not PostScript outlines; this cannot be
+// determined from the file extension alone. If a Type1 file is specified, a
+// metric file with the same pathname except with the extension .afm must be
+// present.
//
// encodingFileStr is the name of the encoding file that corresponds to the
// font.
diff --git a/fpdf.go b/fpdf.go
index 470a81b..d77fd4b 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -2359,15 +2359,10 @@ func (f *Fpdf) RegisterImage(fileStr, tp string) (info *ImageInfoType) {
}
// GetImageInfo returns information about the registered image specified by
-// imageStr. If the image has not been registered, an empty structure followed
-// by false is returned. The internal error is not modified by this method.
-func (f *Fpdf) GetImageInfo(imageStr string) (info ImageInfoType, ok bool) {
- var infoPtr *ImageInfoType
- infoPtr, ok = f.images[imageStr]
- if ok {
- info = *infoPtr
- }
- return
+// imageStr. If the image has not been registered, nil is returned. The
+// internal error is not modified by this method.
+func (f *Fpdf) GetImageInfo(imageStr string) (info *ImageInfoType) {
+ return f.images[imageStr]
}
// GetXY returns the abscissa and ordinate of the current position.
diff --git a/fpdf_test.go b/fpdf_test.go
index b556713..71aa0d2 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -1086,8 +1086,8 @@ func ExampleFpdf_RegisterImage() {
// Test the image information retrieval method
infoShow := func(imageStr string) {
imageStr = imageFile(imageStr)
- info, ok := pdf.GetImageInfo(imageStr)
- if ok {
+ info := pdf.GetImageInfo(imageStr)
+ if info != nil {
if info.Width() > 0.0 {
fmt.Printf("Image %s is registered\n", imageStr)
} else {
diff --git a/makefont/makefont.go b/makefont/makefont.go
index d3ea19f..eb2993e 100644
--- a/makefont/makefont.go
+++ b/makefont/makefont.go
@@ -14,7 +14,15 @@ func errPrintf(fmtStr string, args ...interface{}) {
func showHelp() {
errPrintf("Usage: %s [options] font_file [font_file...]\n", os.Args[0])
flag.PrintDefaults()
- errPrintf("Example: %s --embed --enc=../font/cp1252.map --dst=../font calligra.ttf /opt/font/symbol.pfb\n", os.Args[0])
+ fmt.Fprintln(os.Stderr, "\n"+
+ "font_file is the name of the TrueType file (extension .ttf), OpenType file\n"+
+ "(extension .otf) or binary Type1 file (extension .pfb) from which to\n"+
+ "generate a definition file. If an OpenType file is specified, it must be one\n"+
+ "that is based on TrueType outlines, not PostScript outlines; this cannot be\n"+
+ "determined from the file extension alone. If a Type1 file is specified, a\n"+
+ "metric file with the same pathname except with the extension .afm must be\n"+
+ "present.")
+ errPrintf("\nExample: %s --embed --enc=../font/cp1252.map --dst=../font calligra.ttf /opt/font/symbol.pfb\n", os.Args[0])
}
func tutorialSummary(f *gofpdf.Fpdf, fileStr string) {