Hello Alexei, > You probably mean the slight "pulsing" inside. You are right, it > should not happen. It might be the same effect as the one apparent on > the miter line, or I am just seeing things.
Yes, it's kind of like discontinuities in the distances. I'll share a screenshot once I subdivide the conic curve. > The 8x8 neighborhood has larger distances diagonally than vertically > or horizontally so they (like all distances) have to be clamped > accordingly. You should probably also preset (memset) the grid to the > same cutoff value with appropriate sign for the outside. Keep in mind > that orientations are different for TrueType and Type1/CFF. Yeah, I was not clamping them before. Now it looks good apart from the sign. > Even if you preset the field to an appropriately signed cutoff, there > might still be unvisited inside regions of opposite signs. Those can > be found by one pass over looking for large discontinuities, easily > fixable by flipping the sign. Yeah, even I was thinking of doing a single pass of all the rows from left to right, flipping the distances as I go along. So I will try to implement it next. The corner checking still stands, it can't be avoided because at corners two lines give opposite signs, so to resolve this the corner checking has to be done. >> Lastly, instead of checking the 8x8 neighborhood of the line segments, I calculated the >> bounding box of the line, increased it by 8 in the x and y direction and used that to >> calculate the distances. It is still very fast and doesn't result in that hard edge (https://i.imgur.com/24Rz8eV.png). >> We can even align the bounding box along the line and create a pretty tight space. I >> think it is worth giving it a try as well. > > Sure, I like it. This is a good test if splitting is worth anything. Meanwhile here is the performance of using bounding box: So, I generated 100 glyphs with a pixel size of 256 (which in my opinion is more than enough for SDF) using a spread of 16: * the previous method (checking all grid points): took 18.296 seconds for all glyphs ( ~182 ms average ) * the bounding box method: took 1.487 seconds for all glyphs ( ~14.8 ms average ) [I did the test on a ttf font so it only contains lines and conic curves] They look exactly the same. Moreover the bounding box method can be made even faster by aligning it properly. So, the next thing I'll do is the single pass phase to determine the sign of unchecked grid points, and then I'll try the subdividing. The code is a little messed up right now, so I'll probably push it in 2-3 days. Also, I was working on the integration part today. I added functionality to set renderer properties (namely the `spread' parameter). So, there is API for this `FT_Property_Set' and `FT_Property_Get'. Is there any similar API for setting the renderer specific modes which is defined by the `FT_Renderer_SetModeFunc' function, or do I get the module from `FT_Get_Module' (`FT_Get_Renderer' will not return `sdf' renderer because it has same glyph format as the `smooth' renderer) and then call the function manually ? Thanks for your comments
