-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage with Freetype #117
Comments
I believe that |
It seems that your distance field has either too low resolution or that you indeed used a wrong value for the range parameter. You'd have to post the SDF for me to be able to tell. Finally, for the inverted glyphs, this means that the winding is not consistent. You can try fixing it by calling |
I have noticed that there are in general some unpleasant blobs appearing even in the Open Sans font, which on first glance looks fine, but when scaling up shows exactly the thype of blobs one would expect from plain signed distance fields. Is this just the limits of what msdfs can do or am I doing something completely wrong? Would switching to mtsdfs help? Or increasing the resolution? Currently I just use the bounds to determine the bitmap size. |
As I said, you will need to use the Skia geometry preprocessing to resolve the bad shapes (remove self-intersections). Yes, your distance fields are way too small. I would at least double the resolution (in both dimensions). You should try different sizes to find the optimal one. As a rule of thumb, the thinnest line should be at least 2 or 3 pixels across in the SDF (so thin fonts tend to require higher resolutions than thick fonts). You also have some line artifacts because you're sampling the part between individual glyphs, this should be avoided. I tested your fonts with the atlas generator and got good results, so you should be good to go when you resolve these issues. |
First of all, thank you for this great library!
Unfortunately I ran into some alignment and sizing issues that are related to me not correctly understanding all the parameters provided by msdfgen. I first searched the issues and also the msdf-atlas-gen for possible solutions but I wasn't able to find (or understand) the answers.
I am trying to generate a texture containing all glyphs available in the font file. I have already successfully implemented this with FreeType and decided now to upgrade my texture to contain msdfs.
During the upgrade I encountered two issues:
FT_Set_Pixel_Sizes
, which then was the baseline of all the pixel metrics FreeType returned likeface->glyph->bitmap
,face->glyph->bitmap_left
etc. Now that I am handing over FreeType withadoptFreetypeFont
I am no longer callingFT_Set_Pixel_Sizes
since FreeType is no longer doing the rendering and the glyphs are loaded withFT_LOAD_NO_SCALE
but this leaves all the necessary glyph data that I need for text alignment empty. Especiallface->glyph->bitmap_left
that I use for bearing returns 0. So I am trying to figure out what the appropriate way is to use msdfgen to generate the bitmap whilst FreeType provides the necessary metadata about the glyph. Also how do I find out what the baseline size is, now that I am no longer manually setting the size byFT_Set_Pixel_Sizes
?Here is my code:
The text was updated successfully, but these errors were encountered: