From 02f1d55a023eeab52b20cb5db6428f8ff40b9459 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 5 Dec 2022 14:02:59 +0000 Subject: js: Allow CSS to set the font used by the puzzle This means that the calculated font properties of the HTML canvas now control what font is used. The size is overridden, and for monospaced text so is the family. I'd like to be able to also specify the monospaced font, maybe using a CSS variable, but that looks like being quite a lot of extra complexity. My experience when testing this was that constructing a valid "font" string for a canvas context is prone to breakage, but broke in a way that left the font unchanged, so we always set a simple specification first before trying to construct one from CSS. --- html/jspage.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'html') diff --git a/html/jspage.pl b/html/jspage.pl index 0174fe1..de70b30 100755 --- a/html/jspage.pl +++ b/html/jspage.pl @@ -305,6 +305,7 @@ main { #puzzlecanvas { display: block; width: 100%; + /* This sets the font that will be used in the puzzle. */ font-family: sans-serif; } -- cgit v1.1