diff options
author | Kurt Jung <kurt.w.jung@gmail.com> | 2015-07-23 12:50:56 -0400 |
---|---|---|
committer | Kurt Jung <kurt.w.jung@gmail.com> | 2015-07-23 12:50:56 -0400 |
commit | 02abbc901712fc28375ea19b4dcb5d6ef3af0bb2 (patch) | |
tree | 1482e974275408bb9fd14e5e21d76aca9a7f51a8 /fpdf_test.go | |
parent | a66d421172b03aa66a20d1a76e40d9b5e2f2798e (diff) |
Add a sample Type1 font and metric file pair for testing purposes
Diffstat (limited to 'fpdf_test.go')
-rw-r--r-- | fpdf_test.go | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/fpdf_test.go b/fpdf_test.go index 63d4655..57a2dd4 100644 --- a/fpdf_test.go +++ b/fpdf_test.go @@ -605,21 +605,28 @@ func ExampleFpdf_SetAcceptPageBreakFunc() { // This examples tests corner cases as reported by the gocov tool. func ExampleFpdf_SetKeywords() { - gofpdf.MakeFont(fontFile("calligra.ttf"), fontFile("cp1252.map"), - cnFontDir, nil, true) - pdf := gofpdf.New("", "", "", "") - pdf.SetFontLocation(cnFontDir) - pdf.SetTitle("世界", true) - pdf.SetAuthor("世界", true) - pdf.SetSubject("世界", true) - pdf.SetCreator("世界", true) - pdf.SetKeywords("世界", true) - pdf.AddFont("Calligrapher", "", "calligra.json") - pdf.AddPage() - pdf.SetFont("Calligrapher", "", 16) - pdf.Writef(5, "\x95 %s \x95", pdf) + var err error fileStr := exampleFilename("Fpdf_SetKeywords") - err := pdf.OutputFileAndClose(fileStr) + err = gofpdf.MakeFont(fontFile("CalligrapherRegular.pfb"), + fontFile("cp1252.map"), cnFontDir, nil, true) + if err == nil { + err = gofpdf.MakeFont(fontFile("calligra.ttf"), + fontFile("cp1252.map"), cnFontDir, nil, true) + if err == nil { + pdf := gofpdf.New("", "", "", "") + pdf.SetFontLocation(cnFontDir) + pdf.SetTitle("世界", true) + pdf.SetAuthor("世界", true) + pdf.SetSubject("世界", true) + pdf.SetCreator("世界", true) + pdf.SetKeywords("世界", true) + pdf.AddFont("Calligrapher", "", "CalligrapherRegular.json") + pdf.AddPage() + pdf.SetFont("Calligrapher", "", 16) + pdf.Writef(5, "\x95 %s \x95", pdf) + err = pdf.OutputFileAndClose(fileStr) + } + } summary(err, fileStr) // Output: // Successfully generated pdf/Fpdf_SetKeywords.pdf |