Пример #1
0
func (s *SvgT) Rectangle(coords [][]byte) {
	s.drwpath.Push(fmt.Sprintf("M%s %s V%s H%s V%s H%s Z",
		coords[0], coords[1],
		strm.Add(string(coords[1]), string(coords[3])),
		strm.Add(string(coords[0]), string(coords[2])),
		coords[1], coords[0]))
}
Пример #2
0
func (t *SvgTextT) TShow(a []byte) {
	tx := t.Pdf.ForcedArray(a) // FIXME: Should be "ForcedSimpleArray()"
	for k := range tx {
		if tx[k][0] == '(' || tx[k][0] == '<' {
			part := space_split(ps.String(tx[k]))
			for y := range part {
				tmp, adv := t.Utf8Advance(part[y])
				res := strm.Add(t.x, adv)
				p := 0
				for len(tmp) > p && tmp[p] == 32 {
					p++
				}
				if p > 0 {
					_, ta := t.Utf8Advance(tmp[0:p])
					t.x = strm.Add(t.x, ta)
					tmp = tmp[p:]
				}
				t.Drw.Write.Out(
					"<g transform=\"matrix(%s,%s,%s,%s,%s,%s)\">\n"+
						"<text x=\"%s\" y=\"%s\""+
						" font-size=\"%s\""+
						" style=\"stroke:none;%v\""+
						" fill=\"%s\">%s</text>\n"+
						"</g>\n",
					t.matrix[0], t.matrix[1],
					strm.Neg(t.matrix[2]), strm.Neg(t.matrix[3]),
					t.matrix[4], t.matrix[5],
					t.x, t.y,
					t.Drw.TConfD.FontSize,
					t.Style(t.Drw.TConfD.Font),
					t.Drw.ConfigD.FillColor,
					util.ToXML(tmp))
				t.x = res
			}
		} else {
			t.x = strm.Sub(t.x, strm.Mul(string(tx[k]), "0.01"))
		}
	}
}
Пример #3
0
func (t *SvgTextT) TNextLine() {
	t.x = t.x0
	t.y = strm.Add(t.y, t.Drw.TConfD.Leading)
}
Пример #4
0
func (t *SvgTextT) TMoveTo(s [][]byte) {
	t.x0 = strm.Add(t.x0, string(s[0]))
	t.x = t.x0
	t.y = strm.Sub(t.y, string(s[1]))
}