freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] stroker fixes - documentation


From: David Bevan
Subject: Re: [ft-devel] stroker fixes - documentation
Date: Fri, 1 Jul 2011 06:55:58 -0400

Werner,

I think only the documentation for FT_Stroker_LineJoin will need updating to 
match the new ftstroker.h.

Perhaps this happens automatically.

David %^>


-----Original Message-----
From: David Bevan 
Sent: 01 July 2011 11:40
To: 'Werner LEMBERG'; address@hidden; address@hidden
Subject: stroker fixes


Werner,

Please find attached a major revision of ftstroke.c/h.

The changes address the following issues:


1. If FT_STROKER_LINEJOIN_BEVEL was specified, unlimited miter joins (not bevel 
joins) were generated. Indeed, the meanings of "miter" and "bevel" were 
incorrectly reversed (consistently) in both the code and comments.


2. The way bevel joins were constructed (whether specified explicitly, or 
created as a result of exceeding the miter limit) did not match what is 
required for stroked text in PostScript or PDF.


The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected.

   *     Used to render beveled line joins.  The outer corner of
   *     the joined lines is filled by enclosing the triangular
   *     region of the corner with a straight line between the
   *     outer corners of each stroke.

A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been introduced to 
support PostScript / PDF miter joins.

   *     Used to render mitered line joins, with fixed bevels if the
   *     miter limit is exceeded.  The outer edges of the strokes
   *     for the two segments are extended until they meet at an
   *     angle.  If the segments meet at too sharp an angle (such
   *     that the miter would extend from the intersection of the 
   *     segments a distance greater than the product of the miter 
   *     limit value and the border radius), then a bevel join (see 
   *     above) is used instead.  This prevents long spikes being 
   *     created.  FT_STROKER_LINEJOIN_MITER_FIXED generates a miter 
   *     line join as used in PostScript and PDF.

FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an alias for 
FT_STROKER_LINEJOIN_MITER.

   *     Used to render mitered line joins, with variable bevels if
   *     the miter limit is exceeded.  The intersection of the 
   *     strokes is clipped at a line perpendicular to the bisector 
   *     of the angle between the strokes, at the distance from the 
   *     intersection of the segments equal to the product of the 
   *     miter limit value and the border radius.  This prevents 
   *     long spikes being created.  
   *     FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line 
   *     join as used in XPS.  FT_STROKER_LINEJOIN_MITER is an alias 
   *     for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for 
   *     backwards compatibility.


3. A variety of stroking errors have been fixed.

These would cause various "artefacts" (including points 'at infinity'), 
especially when stroking poor quality fonts.

In remedying these, I have worked with the attached CFF font and the 16 fonts 
in the two downloads at http://code.google.com/p/libass/issues/detail?id=2 
(which is linked to from 
http://lists.nongnu.org/archive/html/freetype-devel/2009-08/msg00022.html). The 
FT stroker now produces results very similar to that produced by GhostScript 
and Distiller for these fonts.

The following problems have been resolved:

3a. Inside corners could be generated incorrectly. Intersecting the inside 
corner could cause a missing triangular area and other effects. See the 
attached insidecorner.pdf for an example.

The intersection point can only be used if the join is between two lines and 
both lines are long enough. The "optimisation" condition in ft_stroker_inside() 
has been corrected; this requires the line length to be passed into various 
functions and stored in FT_StrokerRec.

3b. Incorrect cubic curves could be generated. The angle calculations in  
FT_Stroker_CubicTo() have been corrected to handle the case of the curve 
crossing the +/-PI direction.

3c. If the border radius was greater than the radius of curvature of a curve, 
then the negative sector would end up outside (not inside) the border. See the 
attached widestroke.pdf. This situation is now recognised and the negative 
sector is circumnavigated in the opposite direction. (If round line joins are 
being used, this code is disabled because the line join will always cover the 
negative sector.)

3d. When a curve is split, the arcs may not join smoothly (especially if the 
curve turns sharply back on itself). Changes in direction between adjacent arcs 
were not handled. A round corner is now added if the deviation from one arc to 
the next is greater than a suitable threshold.

3e. The current direction wasn't retained if a the outline contained a zero 
length lineto or a curve that was determined to be "basically a point". This 
could cause a spurious join to be added.

3f. Cubics with close control points could be mishandled. All eight cases are 
now distinguished correctly.


4. Borders for cubic curves could be too 'flat'. FT_SMALL_CUBIC_THRESHOLD has 
been reduced a little to prevent this. See the attached CubicLimit.pdf.


5. The handling/use of movable points has been simplified a little.


6. Various values are now computed only if the results are actually needed.


7. The directions of the outer and inner borders have been swapped, as 
recommended by Graham Asher.


I will send proposed changes to the FT online documentation separately.


Thanks.

David %^>
________________________________
David Bevan
Development Manager
Pitney Bowes Emtex Software
Tel: +44 (0)1923 279300
address@hidden



reply via email to

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