Hello All, >> One more thing. I think the OpenGL demo is not good for everyone to >> test, so I will working on a demo similar to 'ftview' in my spare >> time. > > Great!
I have created the demo program, it can be used to view raw SDF without any bilinear filtering and there is no way to reconstruct fonts from SDF because again it doesn't have bilinear filtering. I will add that soon. There is a pretty weird issue that I ran into while testing the demo on linux which doesn't happen on windows whatsoever. On linux various computations give wrong output. For example, division of -328032 by 64 gives 1811934202, whereas it should be -5125. Moreover FT_Vector_Length returns negative values even for small vectors. There is no overflow so what am I doing wrong? (One of the places it happens is: https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/sdf/ftsdf.c?h=anuj-distance-field#n1129 where the `factor' is wrong after division with 64). I am using gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2) and GNU Make 4.2.1 to build. If you need more details please let me know. You can check out the demo here: https://github.com/preversewharf45/ft2sdf-demo The build process is the same as ft2-demos. The freetype2 library is added as a submodule so use --recursive. And it only works properly on windows. There is no comments of help screen so I'm attaching a text file for that. Thanks, Anuj
Usage: [ptsize] [font file] Controls: q/Esc : Exit z : Increase Scale by 1 x : Decrease Scale by 1 Up Key : Increase Pt Size by 1 Down Key : Decrease Pt Size by 1 Pg Up Key : Increase Pt Size by 25 Pg Down Key : Decrease Pt Size by 25 w : Increase Spread by 1 s : Decrease Spread by 1 Left Key : Previous Glyph Right Key : Next Glyph