In my previous post, I requested a monospaced font to play Hangman with my players, but it didn't get enough traction.
So, I wrote a Python script that outputs dashes and letters correctly spaced so that Arial font behaves like a monospaced font.
Currently, the script works only for capital letters and numbers.
To use it, copy and paste the output to the Roll20 battle map.
I used Hair width, Narrow width, and normal Space to generate white space.
If you encounter any issues, you can replace the spaces in the variables
wids, Hair, Narrow, and Space from here
I am a self-taught coder, so those of you with more programming experience might be able to create a cleaner solution.
PS. All the value of wids were generated by generating checking the change in width of text box in inspect element at 100% zoom. If you want to new characters, follow the following stesp
- Set zoom to 100%
Add a textbox with Arial font 40 with text 'asdf'
Start inspect element and locate the chat box
Locate the element of the previously added text box
Ensure that the texteditor_outline has a width of 140 px (see image below)
If you get the width as 140 px, then all other values should be in wids should be same
If not, then add 1 character at a time and see what is the new width (Note, do not delete the asdf)
Note the new width value, character width is the new value - 140
Update wids with this new information
Update wrd variable with text you want to be monospaced
Run the code
Copy paste the output
You can change font size to whatever you like
Notes
- I had trouble with the special spaces with python, so I chose use print function seems to work fine for me (see second image below)
- With grid snapping ON, there is small offset between the dashes and letters, just hold the alt key and use arrow keys to adjust position
- Seems to do a decent enough job to serve my purpose
- I know it is boxing and not woxing
Sorry if I have missed any steps