[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] smooth_malloc 819d73f65 3/4: [smooth] Limit acceptable glyph
From: |
Werner Lemberg |
Subject: |
[freetype2] smooth_malloc 819d73f65 3/4: [smooth] Limit acceptable glyph complexity. |
Date: |
Mon, 9 Oct 2023 22:45:49 -0400 (EDT) |
branch: smooth_malloc
commit 819d73f6581174353b4853393ee346639ed2cd27
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Limit acceptable glyph complexity.
* src/smooth/ftgrays.c (gray_convert_glyph): Do not attempt to draw
glyphs with taxicab:cbox perimeter ratio above 20.
---
src/smooth/ftgrays.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 404acae50..201b730b3 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -2011,9 +2011,20 @@ typedef ptrdiff_t FT_PtrDist;
int continued = 0;
- size = gray_taxi( RAS_VAR ) +
- height * sizeof ( PCell ) / sizeof ( TCell ) +
- 9; /* empirical extra for local extrema */
+ size = gray_taxi( RAS_VAR );
+
+ /* taxicab perimeters in excess of 20 CBox perimeters are */
+ /* not drawn unless in direct mode with possible clipping */
+ if ( !ras.render_span &&
+ size > 20 * 2 * ( ras.max_ex - ras.min_ex + height ) )
+ {
+ FT_TRACE5(( "Blanking on taxi:cbox = %.2lf\n",
+ 0.5 * size / ( ras.max_ex - ras.min_ex + height ) ));
+ return FT_THROW( Ok );
+ }
+
+ size += height * sizeof ( PCell ) / sizeof ( TCell ) +
+ 9; /* empirical extra for local extrema */
if ( FT_QNEW_ARRAY( buffer, size ) )
return error;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] smooth_malloc 819d73f65 3/4: [smooth] Limit acceptable glyph complexity.,
Werner Lemberg <=