[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [ft] Glitchy stroker output
From: |
Stephan T. Lavavej |
Subject: |
RE: [ft] Glitchy stroker output |
Date: |
Sat, 20 Sep 2008 03:13:40 -0700 |
> Yes. I have to step through the whole code... This may take some
> time.
Let's see if I can save you some time...
I tried to reduce the outline in order to understand what's making
FT_Outline_Render() go bonkers. Here's what I came up with:
http://stl.nuwen.net/pub/freetype/repro4.c
n_contours = 1
n_points = 4
points[0] = (10, 0) on the curve
points[1] = (0, 10) on the curve
points[2] = (-10, 0) on the curve
points[3] = (0, -10) on the curve
contours[0] = 3
flags = 0
coverage 128 | y -10 | x [ -1, 0]
coverage 128 | y -9 | x [ -2, -2]
coverage 255 | y -9 | x [ -1, -1]
coverage 128 | y -9 | x [ 0, 0]
coverage 128 | y -8 | x [ -3, -3]
coverage 255 | y -8 | x [ -2, -1]
coverage 128 | y -8 | x [ 0, 0]
coverage 128 | y -7 | x [ -4, -4]
coverage 255 | y -7 | x [ -3, -1]
coverage 128 | y -7 | x [ 0, 0]
coverage 128 | y -6 | x [ -5, -5]
coverage 255 | y -6 | x [ -4, -1]
coverage 128 | y -6 | x [ 0, 0]
coverage 128 | y -5 | x [ -6, -6]
coverage 255 | y -5 | x [ -5, -1]
coverage 128 | y -5 | x [ 0, 0]
coverage 128 | y -4 | x [ -7, -7]
coverage 255 | y -4 | x [ -6, -1]
coverage 128 | y -4 | x [ 0, 0]
coverage 128 | y -3 | x [ -8, -8]
coverage 255 | y -3 | x [ -7, -1]
coverage 128 | y -3 | x [ 0, 0]
coverage 128 | y -2 | x [ -9, -9]
coverage 255 | y -2 | x [ -8, -1]
coverage 128 | y -2 | x [ 0, 0]
coverage 128 | y -1 | x [-10, -10]
coverage 255 | y -1 | x [ -9, -1]
coverage 128 | y -1 | x [ 0, 0]
coverage 128 | y 0 | x [-10, -10]
coverage 255 | y 0 | x [ -9, -1]
coverage 128 | y 0 | x [ 0, 0]
coverage 128 | y 1 | x [ -9, -9]
coverage 255 | y 1 | x [ -8, -1]
coverage 128 | y 1 | x [ 0, 0]
coverage 128 | y 2 | x [ -8, -8]
coverage 255 | y 2 | x [ -7, -1]
coverage 128 | y 2 | x [ 0, 0]
coverage 128 | y 3 | x [ -7, -7]
coverage 255 | y 3 | x [ -6, -1]
coverage 128 | y 3 | x [ 0, 0]
coverage 128 | y 4 | x [ -6, -6]
coverage 255 | y 4 | x [ -5, -1]
coverage 128 | y 4 | x [ 0, 0]
coverage 128 | y 5 | x [ -5, -5]
coverage 255 | y 5 | x [ -4, -1]
coverage 128 | y 5 | x [ 0, 0]
coverage 128 | y 6 | x [ -4, -4]
coverage 255 | y 6 | x [ -3, -1]
coverage 128 | y 6 | x [ 0, 0]
coverage 128 | y 7 | x [ -3, -3]
coverage 255 | y 7 | x [ -2, -1]
coverage 128 | y 7 | x [ 0, 0]
coverage 128 | y 8 | x [ -2, -2]
coverage 255 | y 8 | x [ -1, -1]
coverage 128 | y 8 | x [ 0, 0]
coverage 128 | y 9 | x [ -1, 0]
The outline is (I think) a diamond centered at (x = 0, y = 0). At y = 0,
the outline should span x = [-9, 9] or [-10, 10] or something like that.
(I'm not exactly sure how the outline coordinates relate to the pixel
coordinates, but it doesn't matter.) Instead, we get:
coverage 128 | y 0 | x [-10, -10]
coverage 255 | y 0 | x [ -9, -1]
coverage 128 | y 0 | x [ 0, 0]
Truncation! I haven't rendered this as a bitmap, but none of the
x-coordinates go beyond 0, so we've clearly got right-side mangling.
Now, let's see what happens when I simply translate the diamond to be
centered at (x = 10, y = 10):
n_contours = 1
n_points = 4
points[0] = (20, 10) on the curve
points[1] = (10, 20) on the curve
points[2] = (0, 10) on the curve
points[3] = (10, 0) on the curve
contours[0] = 3
flags = 0
coverage 128 | y 0 | x [ 9, 10]
coverage 128 | y 1 | x [ 8, 8]
coverage 255 | y 1 | x [ 9, 10]
coverage 128 | y 1 | x [ 11, 11]
coverage 128 | y 2 | x [ 7, 7]
coverage 255 | y 2 | x [ 8, 11]
coverage 128 | y 2 | x [ 12, 12]
coverage 128 | y 3 | x [ 6, 6]
coverage 255 | y 3 | x [ 7, 12]
coverage 128 | y 3 | x [ 13, 13]
coverage 128 | y 4 | x [ 5, 5]
coverage 255 | y 4 | x [ 6, 13]
coverage 128 | y 4 | x [ 14, 14]
coverage 128 | y 5 | x [ 4, 4]
coverage 255 | y 5 | x [ 5, 14]
coverage 128 | y 5 | x [ 15, 15]
coverage 128 | y 6 | x [ 3, 3]
coverage 255 | y 6 | x [ 4, 15]
coverage 128 | y 6 | x [ 16, 16]
coverage 128 | y 7 | x [ 2, 2]
coverage 255 | y 7 | x [ 3, 16]
coverage 128 | y 7 | x [ 17, 17]
coverage 128 | y 8 | x [ 1, 1]
coverage 255 | y 8 | x [ 2, 17]
coverage 128 | y 8 | x [ 18, 18]
coverage 128 | y 9 | x [ 0, 0]
coverage 255 | y 9 | x [ 1, 18]
coverage 128 | y 9 | x [ 19, 19]
coverage 128 | y 10 | x [ 0, 0]
coverage 255 | y 10 | x [ 1, 18]
coverage 128 | y 10 | x [ 19, 19]
coverage 128 | y 11 | x [ 1, 1]
coverage 255 | y 11 | x [ 2, 17]
coverage 128 | y 11 | x [ 18, 18]
coverage 128 | y 12 | x [ 2, 2]
coverage 255 | y 12 | x [ 3, 16]
coverage 128 | y 12 | x [ 17, 17]
coverage 128 | y 13 | x [ 3, 3]
coverage 255 | y 13 | x [ 4, 15]
coverage 128 | y 13 | x [ 16, 16]
coverage 128 | y 14 | x [ 4, 4]
coverage 255 | y 14 | x [ 5, 14]
coverage 128 | y 14 | x [ 15, 15]
coverage 128 | y 15 | x [ 5, 5]
coverage 255 | y 15 | x [ 6, 13]
coverage 128 | y 15 | x [ 14, 14]
coverage 128 | y 16 | x [ 6, 6]
coverage 255 | y 16 | x [ 7, 12]
coverage 128 | y 16 | x [ 13, 13]
coverage 128 | y 17 | x [ 7, 7]
coverage 255 | y 17 | x [ 8, 11]
coverage 128 | y 17 | x [ 12, 12]
coverage 128 | y 18 | x [ 8, 8]
coverage 255 | y 18 | x [ 9, 10]
coverage 128 | y 18 | x [ 11, 11]
coverage 128 | y 19 | x [ 9, 10]
The y = 10 spans are:
coverage 128 | y 10 | x [ 0, 0]
coverage 255 | y 10 | x [ 1, 18]
coverage 128 | y 10 | x [ 19, 19]
Perfect!
Experimenting further:
A diamond centered at (x = 10, y = 0), which would be "FT_Vector points[] =
{ { 1280, 0 }, { 640, 640 }, { 0, 0 }, { 640, -640 } };", which has
non-negative x coordinates and some negative y coordinates, renders
perfectly.
A diamond centered at (x = 0, y = 10), which would be "FT_Vector points[] =
{ { 640, 640 }, { 0, 1280 }, { -640, 640 }, { 0, 0 } };", which has some
negative x coordinates and non-negative y coordinates, experiences
truncation.
A diamond centered at (x = -10, y = 0), which would be "FT_Vector points[] =
{ { 0, 0 }, { -640, 640 }, { -1280, 0 }, { -640, -640 } };", isn't rendered
at all!
Therefore, it appears that negative x coordinates make FT_Outline_Render()
produce mangled spans.
Thanks,
Stephan
- [ft] Glitchy stroker output, Stephan T. Lavavej, 2008/09/15
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/16
- RE: [ft] Glitchy stroker output, Stephan T. Lavavej, 2008/09/17
- RE: [ft] Glitchy stroker output, Stephan T. Lavavej, 2008/09/17
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/17
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/17
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/19
- RE: [ft] Glitchy stroker output, Stephan T. Lavavej, 2008/09/19
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/19
- RE: [ft] Glitchy stroker output, Stephan T. Lavavej, 2008/09/19
- RE: [ft] Glitchy stroker output,
Stephan T. Lavavej <=
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/20
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/20
- RE: [ft] Glitchy stroker output, Stephan T. Lavavej, 2008/09/20
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/21
- RE: [ft] Glitchy stroker output, Stephan T. Lavavej, 2008/09/21
- Re: [ft] Glitchy stroker output, Werner LEMBERG, 2008/09/22