|
From: | Graham Asher |
Subject: | Re: [ft-devel] "Inside the fastest font renderer in the world" - first C version attached |
Date: | Fri, 19 Aug 2016 09:27:53 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
This isn't the final version; as
always, after releasing a piece of code into the wild, one sees
problems and omissions. Some notes:
1. My code does clipping, so that you can happily draw lines outside the raster. That isn't quite right yet - I need to make a simple change. 2. I am using a different winding rule from Raph. I will also fix that. Raph, can you comment on your winding-rule code? It takes the absolute value of the coverage then clamps it to 0...1 in your code; that seems to implement the non-zero winding rule. 3. It would be great to get Raph's comments on my cubic-spline code, built on the analogy of his quadratic code; and on the use of the magic constants 0.333 and 3.0 in determining the number of iterations when splitting a curve, and on the taking of a fourth root. 4. Raph's code uses 32-bit floating point numbers (float); it might be better to use 64-bit (double), because I believe that C always calculates to double-precision in any case, and so there is a conversion cost. I believe Raph uses float because floats are handled faster than doubles by hardware-accelerated SIMD code; but if not using SIMD, double may be better. There is also the raster working data size question. I use rasterization for large shapes in maps: a 1000 x 1000 pixel display needs 4Mb of working data in this system, with floats, and 8Mb with doubles. Not really a problem nowadays, but much larger than the typical FreeType rasterizer's render pool. I'll report back when I've tried it in CartoType. Note that my code runs fastest when formatted in Whitesmith's style ;-) Any attempt at reformatting will be stoutly resisted. - Graham On 19/08/2016 06:16, Werner LEMBERG wrote: I have successfully converted part of Raph Levien's code - that is, the floating-point rasterizer, not the TTF parser - into C, and it seems to work well, although I have run only a few small tests so far and have not yet benchmarked the speed.A big thank you, Graham! Very much appreciated. I don't know yet, however, when I will find some time to work on it. In case you want to do further integration into FreeType, please post your results here :-)One point that I may have to address is that there are declarations after statements, which seems to be OK in C nowadays, but wasn't formerly, I know; but that can be fixed trivially.OK.The code is attached. Naturally I have credited Raph and used the same license. There are documentation comments in the source.Regarding the license: Raph, would it be possible to add dual-licensing with GPL2 to the C code, or to change the C code to the two licenses that come with FreeType? Reason is that Apache 2.0 is not compatible with GPL2. Werner _______________________________________________ Freetype-devel mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/freetype-devel |
[Prev in Thread] | Current Thread | [Next in Thread] |