cli padding option seems to have no effect
numberoverzero opened this issue · 4 comments
First, thanks for the great tool! Nice and easy to set up and it does almost exactly what I need.
I'm looking for an option to add a 1 px padding to each character. From the cli options, I expected the -p
or --texture-padding
option to handle this. However, I'm seeing no difference in the rendered texture.
The description seems to match what I'd expect for fontPadding
, that is padding between each character in the texture, but the full name maps to texturePadding
. When I inspected the output .json, ["info"]["padding"]
is always [0, 0, 0, 0]
regardless of the value I use. Additionally, this doesn't seem to pad the inside of the texture or each glyph. Looking through the generateBMFont
method of index.js
I see two options being loaded, and at least opt.texturePadding
is passed to MaxRectsPacker
.
Should I be specifying something else? Is there a way to repeat the last 1px of each character when rendering to the .png? Is the option exposed but not hooked up?
I'm running this with:
msdf-bmfont -o "FONT.png" -m 256,256 -s 32 -r 5 -p 1 -f json -t msdf "FONT.ttf"
Thanks again!
Sorry for the miss-leading option name, never had a deep thought on that.
Actually this option -p
or --texture-padding
is for padding each generated msdf glyph in the final atlas, not the padding of font metrics.
Text characters padding should be done in bitmap font rendering phrase. If any engine parser can read padding value in .fnt
file, you can try play with the value in .fnt
file directly.
Thanks for the quick response. I just re-ran and noticed that the -p option is padding each glyph as I expected; I was looking at the image from an earlier run and the other pages were generated next to it.
Since the image is being generated correctly, I imagine the x, y offsets are for the character without padding, correct? If so is there any use for the padding
value in the output json? I'd expect that to always be 0 and I could ignore it.
x, y offset define the bounding box bias from origin (x-advance, baseline)
.
As far as I can tell, none of the bmfont parsers use padding value from .fnt
file, just ignore it.
Thanks for the info!