I was just in the process of adding unicode support for all characters but I've come across a problem. Some characters are reported by PureBasic as zero width which means they are like a diacritic mark that goes over to top of the next character. I can't find any way of supporting these in a sprite system, since PureBasic doesn't render these individually into a sprite. I'm guessing these are displayed when there is a character after them which makes it impossible to create them as a sprite. Some example characters are in Arabic: 1541, 1558, 1559, 1560, 1561, 1562, 1564, 1652.
EDIT: I found a method to do it. If the character has zero width then flag it as diacritic and when creating the sprite add a space after it. Also give it the same width as the height. It doesn't matter if the sprite is too wide, it just has to be wide enough. Then I created a new procedure that draws strings and takes diacritics into account (it will be slightly slower). When drawing a sprite that is a diacritic then don't move to the new position, stay in the same place and then draw the next character.
Font Module for games
Re: Font Module for games
You can avoid this problem, when you use the vector drawing library to render your character sprites.
Here, VectorTextWidth() has the option to give not the text-flow width but the visible width.
Here, VectorTextWidth() has the option to give not the text-flow width but the visible width.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Font Module for games
I think that would be a good option when making a text editor application but for sprites I need to use font files (you can't use RegisterFontFile with the vector library)