1 /***************************************************************************/ |
1 /**************************************************************************** |
2 /* */ |
2 * |
3 /* afwarp.c */ |
3 * afwarp.c |
4 /* */ |
4 * |
5 /* Auto-fitter warping algorithm (body). */ |
5 * Auto-fitter warping algorithm (body). |
6 /* */ |
6 * |
7 /* Copyright 2006-2018 by */ |
7 * Copyright (C) 2006-2019 by |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
8 * David Turner, Robert Wilhelm, and Werner Lemberg. |
9 /* */ |
9 * |
10 /* This file is part of the FreeType project, and may only be used, */ |
10 * This file is part of the FreeType project, and may only be used, |
11 /* modified, and distributed under the terms of the FreeType project */ |
11 * modified, and distributed under the terms of the FreeType project |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute |
13 /* this file you indicate that you have read the license and */ |
13 * this file you indicate that you have read the license and |
14 /* understand and accept it fully. */ |
14 * understand and accept it fully. |
15 /* */ |
15 * |
16 /***************************************************************************/ |
16 */ |
17 |
17 |
18 |
18 |
19 /* |
19 /* |
20 * The idea of the warping code is to slightly scale and shift a glyph |
20 * The idea of the warping code is to slightly scale and shift a glyph |
21 * within a single dimension so that as much of its segments are aligned |
21 * within a single dimension so that as much of its segments are aligned |
22 * (more or less) on the grid. To find out the optimal scaling and |
22 * (more or less) on the grid. To find out the optimal scaling and |
23 * shifting value, various parameter combinations are tried and scored. |
23 * shifting value, various parameter combinations are tried and scored. |
24 */ |
24 */ |
25 |
25 |
26 #include "afwarp.h" |
26 #include "afwarp.h" |
27 |
27 |
28 #ifdef AF_CONFIG_OPTION_USE_WARPER |
28 #ifdef AF_CONFIG_OPTION_USE_WARPER |
29 |
29 |
30 /*************************************************************************/ |
30 /************************************************************************** |
31 /* */ |
31 * |
32 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
32 * The macro FT_COMPONENT is used in trace mode. It is an implicit |
33 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
33 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log |
34 /* messages during execution. */ |
34 * messages during execution. |
35 /* */ |
35 */ |
36 #undef FT_COMPONENT |
36 #undef FT_COMPONENT |
37 #define FT_COMPONENT trace_afwarp |
37 #define FT_COMPONENT afwarp |
38 |
38 |
39 |
39 |
40 /* The weights cover the range 0/64 - 63/64 of a pixel. Obviously, */ |
40 /* The weights cover the range 0/64 - 63/64 of a pixel. Obviously, */ |
41 /* values around a half pixel (which means exactly between two grid */ |
41 /* values around a half pixel (which means exactly between two grid */ |
42 /* lines) gets the worst weight. */ |
42 /* lines) gets the worst weight. */ |