I am having an issue with orxFontGen setting the size of a character, but making the character itself too small and the rest being padding even though 0 is specified.
Using a mono font I get the following result with these parameters:
-t char.txt -s 40 --font "d.ttf" -o fontout -m -p 0
Which is technically correct. The dimensions between one character an the next is 40 pixels, but I have no padding, yet there is padding.
Comments
eResult = FT_Set_Pixel_Sizes(sstFontGen.pstFontFace, (FT_UInt)orxF2U(sstFontGen.vCharacterSize.fX + 15) - 2, (FT_UInt)orxF2U(sstFontGen.vCharacterSize.fY + 15) - 2) ? orxSTATUS_FAILURE : orxSTATUS_SUCCESS;
And got this result:
Which is the result I am expecting from the tool. From debugging the source, I think all the calculated values from orxFontGen are correct, but I think that the conversion inside freetype is wrong.
Here are some parameters of interest at the point of line 464:
sstFontGen.vCharacterSize.fX: 40
sstFontGen.vCharacterSize.fY: 40
sstFontGen.fPadding: 0
sstFontGen.fFontScale: 0.0416666679
sstFontGen.pstFontFace.available_sizes: 0x0
sstFontGen.pstFontFace.bbox.xMin: -23
sstFontGen.pstFontFace.bbox.yMin: -120
sstFontGen.pstFontFace.bbox.xMax: 521
sstFontGen.pstFontFace.bbox.yMax: 840
sstFontGen.pstFontFace.units_per_EM: 1100
sstFontGen.pstFontFace.ascender: 800
sstFontGen.pstFontFace.descender: 200
sstFontGen.pstFontFace.underline_position: -155
sstFontGen.pstFontFace.max_advance_height: 600
sstFontGen.pstFontFace.max_advance_width: 520
sstFontGen.pstFontFace.height: 600
I did wonder if fFontScale was the culprit, but changing it at this point in the code had no effect.
Hopefully all this helps to pin point if there is an issue. I know the source is old for this tool, but I am pretty sure the fix is quite small.
And I can adjust the mono widths and spacings manually in the ini anyway.
:unsure:
I'd request for a bigger size and put it in the actual size. So if you were to ask for a size 40 + oversize 5, I'd actually request a 45 size but try to fit it in a 40 one.
What do you think?
I do like the idea of allowing a negative padding value as a way of compensating. Might be the cleanest?
I did notice looking at the source that the scaling value is stored in the struct, but isn't used? Anyway just mentioning out of interest.
And yep, the font scaling is an history artefact, before using TrueType2, I was using stb_truetype which was using it. I shall remove it next time I touch that file.