From 6aa35de27e08f0c6c994d3922dc59c3b732141e8 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Sat, 10 May 2025 12:26:26 -0500 Subject: [PATCH] Add scripting for bus insurance. --- .../iconFonts/d100_Sources/buildFont.bash | 68 +++++++++++ .../iconFonts/d100_Sources/d10-MASTER.svg | 112 ++++++++++++++++++ themes/fonts/iconFonts/d100_Sources/readme.md | 28 +++++ 3 files changed, 208 insertions(+) create mode 100644 themes/fonts/iconFonts/d100_Sources/buildFont.bash create mode 100644 themes/fonts/iconFonts/d100_Sources/d10-MASTER.svg create mode 100644 themes/fonts/iconFonts/d100_Sources/readme.md diff --git a/themes/fonts/iconFonts/d100_Sources/buildFont.bash b/themes/fonts/iconFonts/d100_Sources/buildFont.bash new file mode 100644 index 000000000..c1afd7495 --- /dev/null +++ b/themes/fonts/iconFonts/d100_Sources/buildFont.bash @@ -0,0 +1,68 @@ +#!/bin/bash -x + +# If there is no argument, don't recreate the individual dice, only run the final conversion. +if [ "${1}" == "y" ] || [ "${1}" == "n" ]; then + if [ ! -d './rendered-files' ]; then + mkdir rendered-files + fi + rm ./rendered-files/*.svg + # Build 00-99 ( leading zeros ) + for tens in $(echo 0 1 2 3 4 5 6 7 8 9); do + for ones in $(echo 0 1 2 3 4 5 6 7 8 9); do + num=$(echo ${tens}${ones}); + cat d10-MASTER.svg | sed "s/AAAAA/${num}/" > ./rendered-files/10-MASTER-${num}.svg + printf "Rendering d100 - ${num}\r" + # Tweak the individual die + if [ "${1}" == "y" ]; then inkscape ./rendered-files/10-MASTER-${num}.svg; fi + done + done + # Build 0-9, non-leading zero + for ones in $(echo 0 1 2 3 4 5 6 7 8 9); do + num=$(echo ${ones}); + cat d10-MASTER.svg | sed "s/AAAAA/${num}/" > ./rendered-files/10-MASTER-${num}.svg + printf "Rendering d10 - ${num}\r" + # Tweak the individual die + if [ "${1}" == "y" ]; then inkscape ./rendered-files/10-MASTER-${num}.svg; fi + done + # Build the 100 ace + num=100 + cat d10-MASTER.svg | sed "s/AAAAA/${num}/" > ./rendered-files/10-MASTER-${num}.svg + printf "Rendering d100 - ${num}\r" + # Tweak the individual die + if [ "${1}" == "y" ]; then inkscape ./rendered-files/10-MASTER-${num}.svg; fi + printf "\r\n" +fi + +# Convert the Master files for better IcoMoon compatibility +# Mirror this literally +for tens in $(echo 0 1 2 3 4 5 6 7 8 9); do + for ones in $(echo 0 1 2 3 4 5 6 7 8 9); do + num=$(echo ${tens}${ones}) + inkscape --export-text-to-path -o ./rendered-files/dpercent-${num}.svg ./rendered-files/10-MASTER-${num}.svg 2> /dev/null + printf "Rewriting d100 - ${num}\r" + done +done + +# d100 +num=100 +inkscape --export-text-to-path -o ./rendered-files/dpercent-${num}.svg ./rendered-files/10-MASTER-${num}.svg 2> /dev/null +printf "Rewriting d100 - ${num}\r" + +for ones in $(echo 0 1 2 3 4 5 6 7 8 9); do + num=$(echo ${ones}) + inkscape --export-text-to-path -o ./rendered-files/d10-${num}.svg ./rendered-files/10-MASTER-${num}.svg 2> /dev/null + printf "Rewriting d10 - ${num}\r" +done + +# Duplicate the 10 for the d10 set +num=10 +inkscape --export-text-to-path -o ./rendered-files/d10-${num}.svg ./rendered-files/10-MASTER-${num}.svg 2> /dev/null +printf "Rewriting d10 - ${num}\r" + +# Run svgfixer +if [ ! -d './fixed-files' ]; then + mkdir fixed-files +fi + +rm ./fixed-files/*.svg +oslllo-svg-fixer -s ./rendered-files/ -d ./fixed-files diff --git a/themes/fonts/iconFonts/d100_Sources/d10-MASTER.svg b/themes/fonts/iconFonts/d100_Sources/d10-MASTER.svg new file mode 100644 index 000000000..c16ce5002 --- /dev/null +++ b/themes/fonts/iconFonts/d100_Sources/d10-MASTER.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + + d10-0 + + + + + + AAAAA + + + + + d10-0 + + + + diff --git a/themes/fonts/iconFonts/d100_Sources/readme.md b/themes/fonts/iconFonts/d100_Sources/readme.md new file mode 100644 index 000000000..fb06620bf --- /dev/null +++ b/themes/fonts/iconFonts/d100_Sources/readme.md @@ -0,0 +1,28 @@ +# Dicefont extensions + +This folder is setup for building/rebuilding the d10 and d100 (percent representation on a d10 shape) for use with Icomoon. This will, presumably, be a usable workflow with similar tools. + +## Overview + +This script uses the file 10-MASTER.svg as a base, loops through each of the die face numbers needed, creating an SVG per face in `./rendered-files`. Next, it post-processes the files from `./rendered-files/` to be more compatible with IcoMoon and places the results in `./fixed-files`. + +## Usage + +The script runs on three possible paths. + +1. Start from scratch ***and*** open inkscape for each glyph for tweaking. + `bash ./buildFont.bash y` + + On this path, the per-face SVG files are generated and Inkscape is opened on each file for any tweaking to be done. + +2. Start from scratch but ***do not*** tweak each glyph while running. + `bash ./buildFont.bash n` + +3. Process the rendered glyphs for loading into IcoMoon + `bash ./buildFont.bash` + +For most rebuilds, the expectation is that the script will be run once with `n` as the parameter, then some number of files will be manually touched, then the script re-run with no parameters before finally using the results with IcoMoon. + +## Requirements + +This script expects inkscape and [https://docs-oslllo-com.onrender.com/svg-fixer/master/#/getting-started/introduction](svgFixer) to be in the path. The numbering uses the Kremlin Minister Font Family. \ No newline at end of file