Does anyone know off hand if it would be easy to change the LabelAtlas class to facilitate programmatic character spacing and not rely entirely on the itemWidth? My problem is as follows. I have a png with my font and a width of 40 however I also have a version of the font with a width of 48 that has a glow. What I would ideally like to do is have the LabelAtlas load the 48 width characters but only space them apart 40 pixels. Thus reducing the spacing by 8. I tinkered some with the updateAtlasValues method to no avail. Unfortunately I do not understand this stuff very well yet. If I need to provide more detail let me know. I am using .8-rc.
LabelAtlas charMapFile spacing
(5 posts) (2 voices)-
Posted 2 years ago #
-
Ok I made a quick hack that seems to work however it appears there is something wrong with my font png file or I am doing something that isn't supported.
I hacked the updateAtlasValues to the following, you will notice the first itemWidth is replaced by 30 which would eventually be the programmable spacing.
quad.bl.vertices.x = (int) (i * 30);
quad.bl.vertices.y = 0;
quad.bl.vertices.z = 0.0f;
quad.br.vertices.x = (int)(i * 30 + itemWidth);
quad.br.vertices.y = 0;
quad.br.vertices.z = 0.0f;
quad.tl.vertices.x = (int)(i * 30);
quad.tl.vertices.y = (int)(itemHeight);
quad.tl.vertices.z = 0.0f;
quad.tr.vertices.x = (int)(i * 30 + itemWidth);
quad.tr.vertices.y = (int)(itemHeight);
quad.tr.vertices.z = 0.0f;It now correctly spaces my characters however because the png has no background and has a transparent glow around my characters I get weird behavior for each of the various DefaultAlphaPixelFormats.
RGBA8888,4444 virtually eliminates my glow, it is barely visible.
A8 actually works like I would expect but it appears to only support a few colors, most everything is a shade of white.
RGB565 appears to crop a portion of the overlapping characters.
RGB5A1 doesn't appear to support transparency.I am creating my font png in photoshop with a transparent background and a glow effect around my text. I can upload some screenshots if this would help.
Posted 2 years ago # -
I apologize for continuing to respond to my own thread but could it be that I need to look at the blendFunc? Is there a chance that I would need to set it to something different if I want to use the default alpha pixel format?
Posted 2 years ago # -
Actually I made the mistake of only testing in the simulator and on my device it appears as though it might actually be working. Although if someone has any thoughts let me know.
Posted 2 years ago # -
Interesting stuff. If you are able to get it working submit a patch, Im sure other devs could use this too.
Posted 2 years ago #
Reply
You must log in to post.