-
|
I see that the coordinates in the font files generated by soft mask are all decimals, with 0.5 decimals, while the text coordinates of bmfont are all integers. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
It is this way to make sure that neighboring glyphs don't bleed into the displayed one in case bilinear filtering is used (without the need to make the border 2px). If you use nearest-neighbor filtering and need integer coordinates, then you can enlarge both |
Beta Was this translation helpful? Give feedback.
Integer texture coordinates correspond to halway-points between pixels, while values ending in .5 are the actual centers of pixels. For example, if you have a tiny 2x2 texture, centers of pixels are at [0.5, 0.5], [0.5, 1.5], etc., While the coordinate [1, 1] is exactly in-between the four pixels. Therefore, using .5 texture coordinates makes sure that pure pixel colors are at the perimeter of the quad, which is more important when the texture is being upscaled (typical for SDF). If you wanted to avoid bilinear filter bleed from neighboring glyphs while keeping integer coordinates, the atlas would have to have 2 pixels thick border between glyphs, so that the integer coordinate can be set…