freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Freetype] [PATCH] Thin polygons saga


From: Giuliano Pochini
Subject: [Freetype] [PATCH] Thin polygons saga
Date: Wed, 16 Jan 2002 19:00:55 +0100 (CET)

Ok, I finally found something. The following patch fixes
the problem I have drawing very thin gliphs. They no
longer look "ripped" here and there.

A poly with these points where dx is a multiple of dy:

(40,512)     (40.5, 512)
         ____
         \   \
          \   \
           \   \
            \___\
(72,508)         (72.5,508) [dx=32, dy=4]

is one of the worst cases. FT 2.0.6 draws this junk:

y=508 [64..64]:09 [65..66]:01 [67..67]:03 [68..68]:05 [69..69]:07 [70..70]:09 
[71..71]:0b [72..72]:04 
y=509 [56..56]:09 [57..58]:01 [59..59]:03 [60..60]:05 [61..61]:07 [62..62]:09 
[63..63]:0b [64..64]:04 
y=510 [48..48]:09 [49..50]:01 [51..51]:03 [52..52]:05 [53..53]:07 [54..54]:09 
[55..55]:0b [56..56]:04 
y=511 [40..40]:09 [41..42]:01 [43..43]:03 [44..44]:05 [45..45]:07 [46..46]:09 
[47..47]:0b [48..48]:04 

While the patched FT does the right thing:

y=508 [64..64]:0c [65..71]:10 [72..72]:04
y=509 [56..56]:0c [57..63]:10 [64..64]:04
y=510 [48..48]:0c [49..55]:10 [56..56]:04
y=511 [40..40]:0c [41..47]:10 [48..48]:04

(look at the attached image)

BUT, the patch seems to affect font rendering :(
Chars have the same height and spacing but they
are slimmer. I definitely need help here.




--- old.c       Wed Jan 16 18:27:1
+++ freetype-2.0.6/src/smooth/ftgrays.c        Wed Jan 16 18:27:58 2002
@@ -553,7 +553,7 @@

     if ( ex1 != ex2 )
     {
-      p     = ONE_PIXEL * ( y2 - y1 );
+      p     = ONE_PIXEL * ( y2 - y1 + delta );
       lift  = p / dx;
       rem   = p % dx;
       if ( rem < 0 )


Bye.

Attachment: test.png
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]