0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Add scripting for bus insurance.

This commit is contained in:
David Bolack
2025-05-10 12:26:26 -05:00
parent 26a5cb9fab
commit 6aa35de27e
3 changed files with 208 additions and 0 deletions

View File

@@ -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

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="512"
height="512"
viewBox="0 0 512 512"
version="1.1"
id="svg3"
sodipodi:docname="d10-MASTER.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs3" />
<sodipodi:namedview
id="namedview3"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="4.1653009"
inkscape:cx="228.91503"
inkscape:cy="271.76908"
inkscape:window-width="1920"
inkscape:window-height="1043"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g3"
showguides="true">
<sodipodi:guide
position="17.993424,6.4935368"
orientation="1,0"
id="guide1"
inkscape:locked="false" />
<sodipodi:guide
position="7.4802719,16.934859"
orientation="0,-1"
id="guide2"
inkscape:locked="false" />
<sodipodi:guide
position="25.045076,13.723415"
orientation="0,-1"
id="guide3"
inkscape:locked="false" />
<sodipodi:guide
position="0.57343132,10.715071"
orientation="0,-1"
id="guide4"
inkscape:locked="false" />
<sodipodi:guide
position="3.7273102,12.977341"
orientation="0,-1"
id="guide5"
inkscape:locked="false" />
<sodipodi:guide
position="242.35194,339.72103"
orientation="1,0"
id="guide6"
inkscape:locked="false" />
<sodipodi:guide
position="106.10728,195.7901"
orientation="0,-1"
id="guide7"
inkscape:locked="false" />
</sodipodi:namedview>
<title
id="title1">d10-0</title>
<g
fill-rule="evenodd"
id="g3">
<g
fill-rule="nonzero"
id="g2"
transform="matrix(14.207425,0,0,14.207425,-13.206104,0.25304363)">
<path
d="m 17.5,33.518 v -5.653 l -11.47,-4.81 -2.9,1.611 z m 1,0.615 0.024,0.016 a 1,1 0 1 1 -1.048,1.702 l -16,-9.855 A 1,1 0 0 1 1,25.145 V 25.01 A 0.5,0.5 0 0 1 1,24.99 V 14 a 1,1 0 0 1 0.37,-0.776 l 16,-13 a 1,1 0 1 1 1.26,1.552 l -0.898,0.73 -11.023,19.75 11.484,4.816 a 0.5,0.5 0 0 1 0.307,0.46 z M 15.636,4.21 3,14.476 v 9.119 L 5.633,22.132 15.636,4.209 Z"
id="path1" />
<path
d="M 20.364,4.209 30.367,22.132 33,23.595 V 14.476 Z M 18.268,2.506 17.369,1.776 a 1.0001685,1.0001685 0 1 1 1.262,-1.552 l 16,13 A 1,1 0 0 1 35,14 v 10.99 a 0.5,0.5 0 0 1 0,0.02 v 0.135 a 1,1 0 0 1 -0.476,0.851 l -16,9.855 A 1,1 0 1 1 17.476,34.149 L 17.5,34.133 v -6.6 a 0.5,0.5 0 0 1 0.307,-0.461 l 11.484,-4.817 z m 0.232,31.012 14.37,-8.852 -2.9,-1.611 -11.47,4.81 z"
id="path2" />
</g>
<text
xml:space="preserve"
style="font-size:144px;line-height:125%;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, ';text-align:center;letter-spacing:-1.25px;word-spacing:0px;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
x="242.98399"
y="314.78174"
id="text1"><tspan
sodipodi:role="line"
id="tspan1"
x="242.35899"
y="314.78174"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:144px;font-family:'Kremlin Minister';-inkscape-font-specification:'Kremlin Minister Bold';letter-spacing:-1.25px;word-spacing:0px;fill:#000000;stroke:#000000;stroke-width:0;stroke-dasharray:none"
rotate="0 0 0 0 0 0">AAAAA</tspan></text>
</g>
<metadata
id="metadata3">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:title>d10-0</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -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.