|
16 | 16 | #define M_PI 3.14159265358979323846264338328 |
17 | 17 | #endif |
18 | 18 |
|
19 | | -/** |
20 | | - To improve the hinting of the fonts, this code uses a hack |
21 | | - presented here: |
22 | | -
|
23 | | - http://agg.sourceforge.net/antigrain.com/research/font_rasterization/index.html |
24 | | -
|
25 | | - The idea is to limit the effect of hinting in the x-direction, while |
26 | | - preserving hinting in the y-direction. Since freetype does not |
27 | | - support this directly, the dpi in the x-direction is set higher than |
28 | | - in the y-direction, which affects the hinting grid. Then, a global |
29 | | - transform is placed on the font to shrink it back to the desired |
30 | | - size. While it is a bit surprising that the dpi setting affects |
31 | | - hinting, whereas the global transform does not, this is documented |
32 | | - behavior of FreeType, and therefore hopefully unlikely to change. |
33 | | - The FreeType 2 tutorial says: |
34 | | -
|
35 | | - NOTE: The transformation is applied to every glyph that is |
36 | | - loaded through FT_Load_Glyph and is completely independent of |
37 | | - any hinting process. This means that you won't get the same |
38 | | - results if you load a glyph at the size of 24 pixels, or a glyph |
39 | | - at the size at 12 pixels scaled by 2 through a transform, |
40 | | - because the hints will have been computed differently (except |
41 | | - you have disabled hints). |
42 | | - */ |
43 | | - |
44 | 19 | FT_Library _ft2Library; |
45 | 20 |
|
46 | 21 | FT2Image::FT2Image(unsigned long width, unsigned long height) |
|
0 commit comments