summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
Diffstat (limited to 'pdf')
-rw-r--r--pdf/create.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/pdf/create.go b/pdf/create.go
index 69126c6..69712d6 100644
--- a/pdf/create.go
+++ b/pdf/create.go
@@ -4,12 +4,11 @@ package pdf
import (
"github.com/lapingvino/lexington/lex"
"github.com/lapingvino/lexington/rules"
+ "github.com/lapingvino/lexington/font"
- "github.com/jung-kurt/gofpdf"
+ "github.com/phpdave11/gofpdf"
)
-var tr func(string) string
-
type Tree struct {
PDF *gofpdf.Fpdf
Rules rules.Set
@@ -48,12 +47,15 @@ func (t Tree) Render() {
func line(pdf *gofpdf.Fpdf, format rules.Format, text string) {
pdf.SetFont(format.Font, format.Style, format.Size)
pdf.SetX(format.Left)
- pdf.MultiCell(format.Width, 0.19, tr(text), "", format.Align, false)
+ pdf.MultiCell(format.Width, 0.19, text, "", format.Align, false)
}
func Create(file string, format rules.Set, contents lex.Screenplay) {
pdf := gofpdf.New("P", "in", "Letter", "")
- tr = pdf.UnicodeTranslatorFromDescriptor("")
+ pdf.AddUTF8FontFromBytes("CourierPrime", "", font.MustAsset("CourierPrime-Regular.ttf"))
+ pdf.AddUTF8FontFromBytes("CourierPrime", "B", font.MustAsset("CourierPrime-Bold.ttf"))
+ pdf.AddUTF8FontFromBytes("CourierPrime", "I", font.MustAsset("CourierPrime-Italic.ttf"))
+ pdf.AddUTF8FontFromBytes("CourierPrime", "BI", font.MustAsset("CourierPrime-BoldItalic.ttf"))
pdf.AddPage()
pdf.SetMargins(1, 1, 1)
pdf.SetXY(1, 1)