Skip to content
This repository was archived by the owner on Jul 7, 2020. It is now read-only.

Adding GetPlainText methods, fixing charmap #17

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Add space when get text from Content()
    Based on pull request of #8
    but never merged. So I need it :(
ledongthuc committed Jun 19, 2017
commit 4ff10c65aed6fff2bf0eda2611c97e990caa6377
15 changes: 6 additions & 9 deletions page.go
Original file line number Diff line number Diff line change
@@ -474,17 +474,14 @@ func (p Page) Content() Content {
Trm := matrix{{g.Tfs * g.Th, 0, 0}, {0, g.Tfs, 0}, {0, g.Trise, 1}}.mul(g.Tm).mul(g.CTM)
w0 := g.Tf.Width(int(s[n]))
n++
if ch != ' ' {
f := g.Tf.BaseFont()
if i := strings.Index(f, "+"); i >= 0 {
f = f[i+1:]
}
text = append(text, Text{f, Trm[0][0], Trm[2][0], Trm[2][1], w0 / 1000 * Trm[0][0], string(ch)})

f := g.Tf.BaseFont()
if i := strings.Index(f, "+"); i >= 0 {
f = f[i+1:]
}
text = append(text, Text{f, Trm[0][0], Trm[2][0], Trm[2][1], w0 / 1000 * Trm[0][0], string(ch)})

tx := w0/1000*g.Tfs + g.Tc
if ch == ' ' {
tx += g.Tw
}
tx *= g.Th
g.Tm = matrix{{1, 0, 0}, {0, 1, 0}, {tx, 0, 1}}.mul(g.Tm)
}