Transparency and descender? #59
-
Hi, one very last thing before I go on my merry way. I'm using ImmediateAtlasGenerator<float, 4, mtsdfGenerator, BitmapAtlasStorage<byte, 4>> generator(width, height);
// ...
auto atlas = generator.atlasStorage();
msdfgen::BitmapRef<byte, 4> ref = atlas; It does have black parts, and when I try to clip them in my shader code (clipping should work, it works with my other textures), it seems that those black parts that should be transparent as it is in the saved png, don't have the alpha channel set to 0. On another note, I'm trying to add descender values for each glyph (so I can properly position certain glyphs like q, g, p, ...), and it works... just really scuffed and only works on certain fonts, on other it's totally messed up; obviously I'm not doing it right, so I was wondering if there's a way to get the value for each glyph, but the glyph's don't store the descender value anywhere. I'm sure I actually have to do math which is what I was doing before, but I'm not doing it right. Edit1*: Just for more information, yes, I am setting my Vulkan format to Edit2*: Testing the FontMetrics descenderY, and it seems to be correct (at least for this font's testing), but of course, it effects all glyphs rn. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Although in the end, I need to divide it by some arbitrary value instead of based on the glyph's size (which I could change), so right now I divide by either 90/100... on some fonts like DIN Regular, it looks fine, than on other fonts it looks weird, and on other font it's too much or too little. Everytime I get close to getting the descender to work properly, it breaks at different text sizes (text size is a value in my program, not in msdfgen). If I only use the size to correct the descender value, it works, but it's way bigger than expected. Do I just divide before the size multiplication by some arbitrary value? Because I've tried similar things but they break with different fonts. |
Beta Was this translation helpful? Give feedback.
-
Okay, I think I got the descender working. I still have some things to work out but I'm still stuck on why ref.pixels either doesn't contain the alpha channel, or isn't being set by the generator properly. Edit*: Answer is in replies. |
Beta Was this translation helpful? Give feedback.
Okay, I think I got the descender working. I still have some things to work out but I'm still stuck on why ref.pixels either doesn't contain the alpha channel, or isn't being set by the generator properly.
Edit*: Answer is in replies.