simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sat Dec 10 18:00:42 GMT 2022


TL;DR:
  02f1d55 js: Allow CSS to set the font used by the puzzle
  14eb35d js: Set the default colour from the CSS background of the canvas

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Ben Harris <bjh21 at bjh21.me.uk>
Date:           2022-12-10 18:00:42

commit 02f1d55a023eeab52b20cb5db6428f8ff40b9459
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=02f1d55a023eeab52b20cb5db6428f8ff40b9459;hp=a3310ab857f088489b35ebf10733ba284a24d27f
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Dec 5 14:02:59 2022 +0000

    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.

 emcc.c         | 15 ++++++---------
 emcclib.js     | 28 +++++++++++++++-------------
 emccpre.js     | 16 ++++++++++++++++
 html/jspage.pl |  1 +
 4 files changed, 38 insertions(+), 22 deletions(-)

commit 14eb35da4aa8a66a05012af9860a7088dbf21c6d
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=14eb35da4aa8a66a05012af9860a7088dbf21c6d;hp=02f1d55a023eeab52b20cb5db6428f8ff40b9459
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Dec 10 17:49:49 2022 +0000

    js: Set the default colour from the CSS background of the canvas
    
    This allows the HTML/CSS to decide that it would like a different
    background colour without the need to recompile.  The default if the CSS
    specifies no colour (and hence the canvas is transparent) is the same
    grey as before.

 emcc.c     |  6 ++++--
 emcclib.js | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)



More information about the tartarus-commits mailing list