Fix svg text alignment for "middle"
See https://stackoverflow.com/questions/19212498/firefox-support-for-alignment-baseline-property/21373135#21373135
This commit is contained in:
parent
4a339a31db
commit
ec0d24efd2
|
@ -361,10 +361,10 @@ class Boxes:
|
||||||
self.ctx.rectangle(0, 0, self.reference, 10)
|
self.ctx.rectangle(0, 0, self.reference, 10)
|
||||||
if self.reference < 40:
|
if self.reference < 40:
|
||||||
self.text("%.fmm" % self.reference, self.reference + 5, 5,
|
self.text("%.fmm" % self.reference, self.reference + 5, 5,
|
||||||
align="middle left")
|
align="middle left", fontsize=8, color=Color.ETCHING)
|
||||||
else:
|
else:
|
||||||
self.text("%.fmm" % self.reference, self.reference / 2.0, 5,
|
self.text("%.fmm" % self.reference, self.reference / 2.0, 5,
|
||||||
align="middle center")
|
align="middle center", fontsize=8, color=Color.ETCHING)
|
||||||
self.move(10, 10, "up")
|
self.move(10, 10, "up")
|
||||||
self.ctx.stroke()
|
self.ctx.stroke()
|
||||||
|
|
||||||
|
|
|
@ -546,7 +546,7 @@ Creation date: {date}
|
||||||
t.text = text
|
t.text = text
|
||||||
t.set("font-size", f"{params['fs']}px")
|
t.set("font-size", f"{params['fs']}px")
|
||||||
t.set("text-anchor", params.get('align', 'left'))
|
t.set("text-anchor", params.get('align', 'left'))
|
||||||
t.set("alignment-baseline", 'hanging')
|
t.set("dominant-baseline", 'hanging')
|
||||||
else:
|
else:
|
||||||
print("Unknown", c)
|
print("Unknown", c)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue