From 346513dca19c8878aead24b20bb4990b461dd367 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 13 Dec 2016 13:24:17 +0100 Subject: [PATCH] canvas input: retreive font-size from css --- src/browser/js/jquery/jquery.fake-input.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/browser/js/jquery/jquery.fake-input.js b/src/browser/js/jquery/jquery.fake-input.js index 1c3f99c6..64873447 100644 --- a/src/browser/js/jquery/jquery.fake-input.js +++ b/src/browser/js/jquery/jquery.fake-input.js @@ -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