зеркало из https://github.com/stride3d/freetype.git
[base] Fortify emboldening code against egregious distortions.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Threshold emboldening strength when it leads to segment collapse.
This commit is contained in:
Родитель
48ce226ae3
Коммит
dd5718c7d6
|
@ -1,3 +1,10 @@
|
|||
2012-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
[base] Fortify emboldening code against egregious distortions.
|
||||
|
||||
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Threshold emboldening
|
||||
strength when it leads to segment collapse.
|
||||
|
||||
2012-11-03 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
[base] Clean up emboldening code and improve comments there.
|
||||
|
|
|
@ -922,7 +922,7 @@
|
|||
for ( c = 0; c < outline->n_contours; c++ )
|
||||
{
|
||||
FT_Vector in, out, shift;
|
||||
FT_Fixed l_in, l_out, d;
|
||||
FT_Fixed l_in, l_out, l, q, d;
|
||||
int last = outline->contours[c];
|
||||
|
||||
|
||||
|
@ -962,8 +962,22 @@
|
|||
else
|
||||
shift.y = -shift.y;
|
||||
|
||||
shift.x = FT_MulDiv( shift.x, xstrength, d );
|
||||
shift.y = FT_MulDiv( shift.y, ystrength, d );
|
||||
/* threshold strength to better handle collapsing segments */
|
||||
l = FT_MIN( l_in, l_out );
|
||||
q = out.x * in.y - out.y * in.x;
|
||||
if ( orientation == FT_ORIENTATION_TRUETYPE )
|
||||
q = -q;
|
||||
|
||||
if ( xstrength * q < d * l )
|
||||
shift.x = FT_MulDiv( shift.x, xstrength, d );
|
||||
else
|
||||
shift.x = FT_MulDiv( shift.x, l, q );
|
||||
|
||||
|
||||
if ( ystrength * q < d * l )
|
||||
shift.y = FT_MulDiv( shift.y, ystrength, d );
|
||||
else
|
||||
shift.y = FT_MulDiv( shift.y, l, q );
|
||||
}
|
||||
else
|
||||
shift.x = shift.y = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче