how to shrink the sapce between characters ?
this screenshot from rado1 ZGEBox2DTestbed example . i just tried to to make the text more compact by removing the spaces between the characters . but seems no options for that .
thanks
how to remove space between characters
Moderator: Moderators
how to remove space between characters
- Attachments
-
- Untitled.jpg (22.13 KiB) Viewed 5549 times
Re: how to remove space between characters
Hi airpas,
In order to adjust the letter spacing for text that uses Left alignment, set the RenderCharExpression property to the following expression.
And for text that uses Center alignment, use this instead.
Or in case you want to support both, you can use the following.
Simply set the spacing constant to the value of you choice ( letter spacing is halved when it's set to 0.5 and doubled when set to 2 ).
K
There is currently no property for that. Fortunately it can be "hacked" in using a expression.airpas wrote:how to shrink the space between characters?
In order to adjust the letter spacing for text that uses Left alignment, set the RenderCharExpression property to the following expression.
Code: Select all
const float spacing = 0.5;
if(CharI)CharX -= spacing;
Code: Select all
const float spacing = 0.5;
CharX -= CharI ? spacing : length(this.Text)*-0.5*spacing;
Code: Select all
const float spacing = 0.5;
if(this.Align)
{
if(CharI)CharX -= spacing;
}
else
{
CharX -= CharI ? spacing : length(this.Text)*-0.5*spacing;
}
K
In some of my projects I also used proportional character spacing. The trick is to store width of characters in a separate persistent array. I usually use the CBFG (Codehead's Bitmap Font Generator) which is able to produce such a list of character width values. Loading to excel, transpose the table, copy and paste to ZGE's array... that's it.
See the attached screenshot. In this concrete case I used the RenderCharExpression like this:
this.CharX -= this.CharI > 0 ? (64 - CharacterWidth[ord(substr(this.Text, this.CharI-1, 1)) - 32]) * 0.015 : 0;
Of course if you will try it, you can use different constants for different fonts.
See the attached screenshot. In this concrete case I used the RenderCharExpression like this:
this.CharX -= this.CharI > 0 ? (64 - CharacterWidth[ord(substr(this.Text, this.CharI-1, 1)) - 32]) * 0.015 : 0;
Of course if you will try it, you can use different constants for different fonts.
- Attachments
-
- screenshot with proportional texts
- scr.png (133.14 KiB) Viewed 5531 times