canvas input: retreive font-size from css

This commit is contained in:
jean-emmanuel 2016-12-13 13:24:17 +01:00
parent cf8130e589
commit 346513dca1

View file

@ -33,6 +33,7 @@
if (!self.visible || checkColors) {
self.color = getComputedStyle(canvas[0]).getPropertyValue("--color-text")
self.fontSize = parseInt(getComputedStyle(canvas[0]).getPropertyValue("font-size"))
}
self.val(self.value)
@ -46,7 +47,7 @@
if (!self.height || !self.width || (self.height==100 && self.width==100)) return
ctx.clearRect(0,0,self.width,self.height)
ctx.font = PXSCALE * 2 * 12 + 'px Droid Sans'
ctx.font = PXSCALE * 2 * self.fontSize + 'px Droid Sans'
ctx.textBaseline = "middle"
ctx.fillStyle = self.color