2003-06-07 06:02:21 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftstroke.h */
|
|
|
|
/* */
|
|
|
|
/* FreeType path stroker (specification). */
|
|
|
|
/* */
|
2015-01-17 20:41:43 +01:00
|
|
|
/* Copyright 2002-2015 by */
|
2003-06-07 06:02:21 +02:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __FT_STROKE_H__
|
|
|
|
#define __FT_STROKE_H__
|
2002-06-27 00:05:05 +02:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_OUTLINE_H
|
2004-01-16 09:57:05 +01:00
|
|
|
#include FT_GLYPH_H
|
2002-06-27 00:05:05 +02:00
|
|
|
|
2004-07-17 18:45:21 +02:00
|
|
|
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_BEGIN_HEADER
|
|
|
|
|
2004-07-17 18:45:21 +02:00
|
|
|
|
2004-07-15 23:13:54 +02:00
|
|
|
/************************************************************************
|
|
|
|
*
|
2005-10-26 22:08:45 +02:00
|
|
|
* @section:
|
Adding OpenType validation module. The code is based on the
(unfinished) `otlayout' module but has been heavily modified to make
it much more compact.
* src/otvalid/*: New module.
* include/freetype/ftotval.h, src/base/ftotval.c,
include/freetype/internal/services/svotval.h: New files.
* include/freetype/config/ftmodule.h: Add otv_module_class.
* include/freetype/config/ftheader.h (FT_OPENTYPE_VALIDATE_H): New
macro.
* include/freetype/internal/ftserv.h
(FT_SERVICE_OPENTYPE_VALIDATE_H): New macro.
* include/freetype/internal/fttrace.h (otvmodule, otvcommon,
otvbase, otvgdef, otvgpos, otvgsub, otvjstf): New trace components.
* include/freetype/ftchapters.h: Updated.
* src/base/Jamfile (Library), src/base/descrip.mms (OBJS),
src/base/rules.mk (BASE_EXT_SRC): Updated.
* docs/CHANGES: Updated.
2004-09-10 16:39:00 +02:00
|
|
|
* glyph_stroker
|
2004-07-15 23:13:54 +02:00
|
|
|
*
|
2005-10-26 22:08:45 +02:00
|
|
|
* @title:
|
2004-07-15 23:13:54 +02:00
|
|
|
* Glyph Stroker
|
|
|
|
*
|
2005-10-26 22:08:45 +02:00
|
|
|
* @abstract:
|
2004-07-17 18:45:21 +02:00
|
|
|
* Generating bordered and stroked glyphs.
|
2004-07-15 23:13:54 +02:00
|
|
|
*
|
2005-10-26 22:08:45 +02:00
|
|
|
* @description:
|
2004-07-17 18:45:21 +02:00
|
|
|
* This component generates stroked outlines of a given vectorial
|
|
|
|
* glyph. It also allows you to retrieve the `outside' and/or the
|
|
|
|
* `inside' borders of the stroke.
|
2004-07-15 23:13:54 +02:00
|
|
|
*
|
2004-07-17 18:45:21 +02:00
|
|
|
* This can be useful to generate `bordered' glyph, i.e., glyphs
|
|
|
|
* displayed with a coloured (and anti-aliased) border around their
|
2004-07-15 23:13:54 +02:00
|
|
|
* shape.
|
2014-12-02 23:06:04 +01:00
|
|
|
*
|
|
|
|
* @order:
|
|
|
|
* FT_Stroker
|
|
|
|
*
|
|
|
|
* FT_Stroker_LineJoin
|
|
|
|
* FT_Stroker_LineCap
|
|
|
|
* FT_StrokerBorder
|
|
|
|
*
|
|
|
|
* FT_Outline_GetInsideBorder
|
|
|
|
* FT_Outline_GetOutsideBorder
|
|
|
|
*
|
|
|
|
* FT_Glyph_Stroke
|
|
|
|
* FT_Glyph_StrokeBorder
|
|
|
|
*
|
|
|
|
* FT_Stroker_New
|
|
|
|
* FT_Stroker_Set
|
|
|
|
* FT_Stroker_Rewind
|
|
|
|
* FT_Stroker_ParseOutline
|
|
|
|
* FT_Stroker_Done
|
|
|
|
*
|
|
|
|
* FT_Stroker_BeginSubPath
|
|
|
|
* FT_Stroker_EndSubPath
|
|
|
|
*
|
|
|
|
* FT_Stroker_LineTo
|
|
|
|
* FT_Stroker_ConicTo
|
|
|
|
* FT_Stroker_CubicTo
|
|
|
|
*
|
|
|
|
* FT_Stroker_GetBorderCounts
|
|
|
|
* FT_Stroker_ExportBorder
|
|
|
|
* FT_Stroker_GetCounts
|
|
|
|
* FT_Stroker_Export
|
|
|
|
*
|
2004-07-15 23:13:54 +02:00
|
|
|
*/
|
|
|
|
|
2004-07-17 18:45:21 +02:00
|
|
|
|
2004-07-15 23:13:54 +02:00
|
|
|
/**************************************************************
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @type:
|
|
|
|
* FT_Stroker
|
|
|
|
*
|
|
|
|
* @description:
|
2014-12-02 23:06:04 +01:00
|
|
|
* Opaque handle to a path stroker object.
|
2003-12-26 08:26:08 +01:00
|
|
|
*/
|
|
|
|
typedef struct FT_StrokerRec_* FT_Stroker;
|
|
|
|
|
|
|
|
|
2004-07-15 23:13:54 +02:00
|
|
|
/**************************************************************
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_Stroker_LineJoin
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* These values determine how two joining lines are rendered
|
|
|
|
* in a stroker.
|
|
|
|
*
|
|
|
|
* @values:
|
|
|
|
* FT_STROKER_LINEJOIN_ROUND ::
|
|
|
|
* Used to render rounded line joins. Circular arcs are used
|
|
|
|
* to join two lines smoothly.
|
|
|
|
*
|
|
|
|
* FT_STROKER_LINEJOIN_BEVEL ::
|
[ftstroke] Major revision.
The main problems
-----------------
o 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.
o 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 main fixes
--------------
o The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected.
o A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been
introduced to support PostScript and PDF miter joins.
o FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an
alias for FT_STROKER_LINEJOIN_MITER.
Additionally, a variety of stroking errors have been fixed. These
would cause various artifacts (including points `at infinity'),
especially when stroking poor quality fonts.
See
http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html
for example documents. The FreeType stroker now produces results
very similar to that produced by GhostScript and Distiller for these
fonts.
Other problems
--------------
The following problems have been resolved:
o Inside corners could be generated incorrectly. Intersecting the
inside corner could cause a missing triangular area and other
effects.
The intersection point can only be used if the join is between
two lines and both lines are long enough. The `optimization'
condition in `ft_stroker_inside' has been corrected; this
requires the line length to be passed into various functions and
stored in `FT_StrokerRec'.
o 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.
o 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. This situation is now recognized 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.)
o 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.
o 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.
o Cubics with close control points could be mishandled. All eight
cases are now distinguished correctly.
Other improvements
------------------
o Borders for cubic curves could be too `flat'.
FT_SMALL_CUBIC_THRESHOLD has been reduced a little to prevent
this.
o The handling and use of movable points has been simplified a
little.
o Various values are now computed only if the results are actually
needed.
o The directions of the outer and inner borders have been swapped,
as recommended by Graham Asher.
* src/base/ftstroke.c: Revised.
* include/freetype/ftstroke.h: Updated.
2011-07-02 12:09:52 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* FT_STROKER_LINEJOIN_MITER_FIXED ::
|
|
|
|
* 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
|
2012-01-16 18:00:24 +01:00
|
|
|
* 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
|
[ftstroke] Major revision.
The main problems
-----------------
o 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.
o 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 main fixes
--------------
o The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected.
o A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been
introduced to support PostScript and PDF miter joins.
o FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an
alias for FT_STROKER_LINEJOIN_MITER.
Additionally, a variety of stroking errors have been fixed. These
would cause various artifacts (including points `at infinity'),
especially when stroking poor quality fonts.
See
http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html
for example documents. The FreeType stroker now produces results
very similar to that produced by GhostScript and Distiller for these
fonts.
Other problems
--------------
The following problems have been resolved:
o Inside corners could be generated incorrectly. Intersecting the
inside corner could cause a missing triangular area and other
effects.
The intersection point can only be used if the join is between
two lines and both lines are long enough. The `optimization'
condition in `ft_stroker_inside' has been corrected; this
requires the line length to be passed into various functions and
stored in `FT_StrokerRec'.
o 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.
o 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. This situation is now recognized 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.)
o 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.
o 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.
o Cubics with close control points could be mishandled. All eight
cases are now distinguished correctly.
Other improvements
------------------
o Borders for cubic curves could be too `flat'.
FT_SMALL_CUBIC_THRESHOLD has been reduced a little to prevent
this.
o The handling and use of movable points has been simplified a
little.
o Various values are now computed only if the results are actually
needed.
o The directions of the outer and inner borders have been swapped,
as recommended by Graham Asher.
* src/base/ftstroke.c: Revised.
* include/freetype/ftstroke.h: Updated.
2011-07-02 12:09:52 +02:00
|
|
|
* line join as used in PostScript and PDF.
|
|
|
|
*
|
|
|
|
* FT_STROKER_LINEJOIN_MITER_VARIABLE ::
|
2003-12-26 08:26:08 +01:00
|
|
|
* FT_STROKER_LINEJOIN_MITER ::
|
[ftstroke] Major revision.
The main problems
-----------------
o 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.
o 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 main fixes
--------------
o The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected.
o A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been
introduced to support PostScript and PDF miter joins.
o FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an
alias for FT_STROKER_LINEJOIN_MITER.
Additionally, a variety of stroking errors have been fixed. These
would cause various artifacts (including points `at infinity'),
especially when stroking poor quality fonts.
See
http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html
for example documents. The FreeType stroker now produces results
very similar to that produced by GhostScript and Distiller for these
fonts.
Other problems
--------------
The following problems have been resolved:
o Inside corners could be generated incorrectly. Intersecting the
inside corner could cause a missing triangular area and other
effects.
The intersection point can only be used if the join is between
two lines and both lines are long enough. The `optimization'
condition in `ft_stroker_inside' has been corrected; this
requires the line length to be passed into various functions and
stored in `FT_StrokerRec'.
o 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.
o 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. This situation is now recognized 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.)
o 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.
o 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.
o Cubics with close control points could be mishandled. All eight
cases are now distinguished correctly.
Other improvements
------------------
o Borders for cubic curves could be too `flat'.
FT_SMALL_CUBIC_THRESHOLD has been reduced a little to prevent
this.
o The handling and use of movable points has been simplified a
little.
o Various values are now computed only if the results are actually
needed.
o The directions of the outer and inner borders have been swapped,
as recommended by Graham Asher.
* src/base/ftstroke.c: Revised.
* include/freetype/ftstroke.h: Updated.
2011-07-02 12:09:52 +02:00
|
|
|
* Used to render mitered line joins, with variable bevels if
|
2012-01-16 18:00:24 +01:00
|
|
|
* 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
|
[ftstroke] Major revision.
The main problems
-----------------
o 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.
o 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 main fixes
--------------
o The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected.
o A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been
introduced to support PostScript and PDF miter joins.
o FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an
alias for FT_STROKER_LINEJOIN_MITER.
Additionally, a variety of stroking errors have been fixed. These
would cause various artifacts (including points `at infinity'),
especially when stroking poor quality fonts.
See
http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html
for example documents. The FreeType stroker now produces results
very similar to that produced by GhostScript and Distiller for these
fonts.
Other problems
--------------
The following problems have been resolved:
o Inside corners could be generated incorrectly. Intersecting the
inside corner could cause a missing triangular area and other
effects.
The intersection point can only be used if the join is between
two lines and both lines are long enough. The `optimization'
condition in `ft_stroker_inside' has been corrected; this
requires the line length to be passed into various functions and
stored in `FT_StrokerRec'.
o 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.
o 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. This situation is now recognized 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.)
o 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.
o 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.
o Cubics with close control points could be mishandled. All eight
cases are now distinguished correctly.
Other improvements
------------------
o Borders for cubic curves could be too `flat'.
FT_SMALL_CUBIC_THRESHOLD has been reduced a little to prevent
this.
o The handling and use of movable points has been simplified a
little.
o Various values are now computed only if the results are actually
needed.
o The directions of the outer and inner borders have been swapped,
as recommended by Graham Asher.
* src/base/ftstroke.c: Revised.
* include/freetype/ftstroke.h: Updated.
2011-07-02 12:09:52 +02:00
|
|
|
* backwards compatibility.
|
2003-12-26 08:26:08 +01:00
|
|
|
*/
|
2008-05-29 00:17:28 +02:00
|
|
|
typedef enum FT_Stroker_LineJoin_
|
2002-06-27 00:05:05 +02:00
|
|
|
{
|
[ftstroke] Major revision.
The main problems
-----------------
o 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.
o 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 main fixes
--------------
o The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected.
o A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been
introduced to support PostScript and PDF miter joins.
o FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an
alias for FT_STROKER_LINEJOIN_MITER.
Additionally, a variety of stroking errors have been fixed. These
would cause various artifacts (including points `at infinity'),
especially when stroking poor quality fonts.
See
http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html
for example documents. The FreeType stroker now produces results
very similar to that produced by GhostScript and Distiller for these
fonts.
Other problems
--------------
The following problems have been resolved:
o Inside corners could be generated incorrectly. Intersecting the
inside corner could cause a missing triangular area and other
effects.
The intersection point can only be used if the join is between
two lines and both lines are long enough. The `optimization'
condition in `ft_stroker_inside' has been corrected; this
requires the line length to be passed into various functions and
stored in `FT_StrokerRec'.
o 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.
o 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. This situation is now recognized 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.)
o 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.
o 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.
o Cubics with close control points could be mishandled. All eight
cases are now distinguished correctly.
Other improvements
------------------
o Borders for cubic curves could be too `flat'.
FT_SMALL_CUBIC_THRESHOLD has been reduced a little to prevent
this.
o The handling and use of movable points has been simplified a
little.
o Various values are now computed only if the results are actually
needed.
o The directions of the outer and inner borders have been swapped,
as recommended by Graham Asher.
* src/base/ftstroke.c: Revised.
* include/freetype/ftstroke.h: Updated.
2011-07-02 12:09:52 +02:00
|
|
|
FT_STROKER_LINEJOIN_ROUND = 0,
|
|
|
|
FT_STROKER_LINEJOIN_BEVEL = 1,
|
|
|
|
FT_STROKER_LINEJOIN_MITER_VARIABLE = 2,
|
|
|
|
FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE,
|
|
|
|
FT_STROKER_LINEJOIN_MITER_FIXED = 3
|
2002-06-27 01:45:21 +02:00
|
|
|
|
2002-06-27 00:05:05 +02:00
|
|
|
} FT_Stroker_LineJoin;
|
|
|
|
|
|
|
|
|
2004-07-15 23:13:54 +02:00
|
|
|
/**************************************************************
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_Stroker_LineCap
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* These values determine how the end of opened sub-paths are
|
|
|
|
* rendered in a stroke.
|
|
|
|
*
|
|
|
|
* @values:
|
|
|
|
* FT_STROKER_LINECAP_BUTT ::
|
|
|
|
* The end of lines is rendered as a full stop on the last
|
|
|
|
* point itself.
|
|
|
|
*
|
|
|
|
* FT_STROKER_LINECAP_ROUND ::
|
|
|
|
* The end of lines is rendered as a half-circle around the
|
|
|
|
* last point.
|
|
|
|
*
|
|
|
|
* FT_STROKER_LINECAP_SQUARE ::
|
|
|
|
* The end of lines is rendered as a square around the
|
|
|
|
* last point.
|
|
|
|
*/
|
2008-05-29 00:17:28 +02:00
|
|
|
typedef enum FT_Stroker_LineCap_
|
2002-06-27 00:05:05 +02:00
|
|
|
{
|
|
|
|
FT_STROKER_LINECAP_BUTT = 0,
|
|
|
|
FT_STROKER_LINECAP_ROUND,
|
|
|
|
FT_STROKER_LINECAP_SQUARE
|
2002-06-27 01:45:21 +02:00
|
|
|
|
2002-06-27 00:05:05 +02:00
|
|
|
} FT_Stroker_LineCap;
|
|
|
|
|
2002-06-27 01:45:21 +02:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_StrokerBorder
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* These values are used to select a given stroke border
|
|
|
|
* in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
|
|
|
|
*
|
|
|
|
* @values:
|
|
|
|
* FT_STROKER_BORDER_LEFT ::
|
|
|
|
* Select the left border, relative to the drawing direction.
|
|
|
|
*
|
|
|
|
* FT_STROKER_BORDER_RIGHT ::
|
|
|
|
* Select the right border, relative to the drawing direction.
|
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* Applications are generally interested in the `inside' and `outside'
|
2006-05-12 15:55:04 +02:00
|
|
|
* borders. However, there is no direct mapping between these and the
|
|
|
|
* `left' and `right' ones, since this really depends on the glyph's
|
2003-12-26 08:26:08 +01:00
|
|
|
* drawing orientation, which varies between font formats.
|
|
|
|
*
|
|
|
|
* You can however use @FT_Outline_GetInsideBorder and
|
|
|
|
* @FT_Outline_GetOutsideBorder to get these.
|
|
|
|
*/
|
2008-05-29 00:17:28 +02:00
|
|
|
typedef enum FT_StrokerBorder_
|
2003-12-19 22:23:58 +01:00
|
|
|
{
|
|
|
|
FT_STROKER_BORDER_LEFT = 0,
|
|
|
|
FT_STROKER_BORDER_RIGHT
|
2004-01-16 09:57:05 +01:00
|
|
|
|
2003-12-19 22:23:58 +01:00
|
|
|
} FT_StrokerBorder;
|
|
|
|
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Outline_GetInsideBorder
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Retrieve the @FT_StrokerBorder value corresponding to the
|
|
|
|
* `inside' borders of a given outline.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* outline ::
|
|
|
|
* The source outline handle.
|
|
|
|
*
|
|
|
|
* @return:
|
2009-01-18 07:42:59 +01:00
|
|
|
* The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid
|
2003-12-26 08:26:08 +01:00
|
|
|
* outlines.
|
|
|
|
*/
|
2003-12-19 22:23:58 +01:00
|
|
|
FT_EXPORT( FT_StrokerBorder )
|
|
|
|
FT_Outline_GetInsideBorder( FT_Outline* outline );
|
|
|
|
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Outline_GetOutsideBorder
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Retrieve the @FT_StrokerBorder value corresponding to the
|
|
|
|
* `outside' borders of a given outline.
|
|
|
|
*
|
|
|
|
* @input:
|
2006-04-22 14:24:52 +02:00
|
|
|
* outline ::
|
|
|
|
* The source outline handle.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @return:
|
|
|
|
* The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
|
|
|
|
* outlines.
|
|
|
|
*/
|
2003-12-19 22:23:58 +01:00
|
|
|
FT_EXPORT( FT_StrokerBorder )
|
|
|
|
FT_Outline_GetOutsideBorder( FT_Outline* outline );
|
|
|
|
|
2004-01-16 09:57:05 +01:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_New
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Create a new stroker object.
|
|
|
|
*
|
|
|
|
* @input:
|
2006-04-22 14:24:52 +02:00
|
|
|
* library ::
|
2006-05-12 15:55:04 +02:00
|
|
|
* FreeType library handle.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @output:
|
2006-04-22 14:24:52 +02:00
|
|
|
* astroker ::
|
|
|
|
* A new stroker object handle. NULL in case of error.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2006-04-13 18:31:02 +02:00
|
|
|
FT_Stroker_New( FT_Library library,
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_Stroker *astroker );
|
|
|
|
|
2003-12-19 22:23:58 +01:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_Set
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Reset a stroker object's attributes.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* radius ::
|
|
|
|
* The border radius.
|
|
|
|
*
|
|
|
|
* line_cap ::
|
|
|
|
* The line cap style.
|
|
|
|
*
|
|
|
|
* line_join ::
|
|
|
|
* The line join style.
|
|
|
|
*
|
|
|
|
* miter_limit ::
|
[ftstroke] Major revision.
The main problems
-----------------
o 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.
o 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 main fixes
--------------
o The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected.
o A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been
introduced to support PostScript and PDF miter joins.
o FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an
alias for FT_STROKER_LINEJOIN_MITER.
Additionally, a variety of stroking errors have been fixed. These
would cause various artifacts (including points `at infinity'),
especially when stroking poor quality fonts.
See
http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html
for example documents. The FreeType stroker now produces results
very similar to that produced by GhostScript and Distiller for these
fonts.
Other problems
--------------
The following problems have been resolved:
o Inside corners could be generated incorrectly. Intersecting the
inside corner could cause a missing triangular area and other
effects.
The intersection point can only be used if the join is between
two lines and both lines are long enough. The `optimization'
condition in `ft_stroker_inside' has been corrected; this
requires the line length to be passed into various functions and
stored in `FT_StrokerRec'.
o 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.
o 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. This situation is now recognized 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.)
o 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.
o 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.
o Cubics with close control points could be mishandled. All eight
cases are now distinguished correctly.
Other improvements
------------------
o Borders for cubic curves could be too `flat'.
FT_SMALL_CUBIC_THRESHOLD has been reduced a little to prevent
this.
o The handling and use of movable points has been simplified a
little.
o Various values are now computed only if the results are actually
needed.
o The directions of the outer and inner borders have been swapped,
as recommended by Graham Asher.
* src/base/ftstroke.c: Revised.
* include/freetype/ftstroke.h: Updated.
2011-07-02 12:09:52 +02:00
|
|
|
* The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and
|
|
|
|
* FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles,
|
2013-01-13 01:17:05 +01:00
|
|
|
* expressed as 16.16 fixed-point value.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @note:
|
2008-09-16 09:25:31 +02:00
|
|
|
* The radius is expressed in the same units as the outline
|
2003-12-26 08:26:08 +01:00
|
|
|
* coordinates.
|
2014-11-09 23:21:37 +01:00
|
|
|
*
|
|
|
|
* This function calls @FT_Stroker_Rewind automatically.
|
2003-12-26 08:26:08 +01:00
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_Stroker_Set( FT_Stroker stroker,
|
|
|
|
FT_Fixed radius,
|
|
|
|
FT_Stroker_LineCap line_cap,
|
|
|
|
FT_Stroker_LineJoin line_join,
|
|
|
|
FT_Fixed miter_limit );
|
|
|
|
|
2002-06-27 01:45:21 +02:00
|
|
|
|
2004-01-16 09:57:05 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_Rewind
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Reset a stroker object without changing its attributes.
|
2004-01-22 10:07:12 +01:00
|
|
|
* You should call this function before beginning a new
|
|
|
|
* series of calls to @FT_Stroker_BeginSubPath or
|
|
|
|
* @FT_Stroker_EndSubPath.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*/
|
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_Stroker_Rewind( FT_Stroker stroker );
|
|
|
|
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_ParseOutline
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A convenience function used to parse a whole outline with
|
|
|
|
* the stroker. The resulting outline(s) can be retrieved
|
|
|
|
* later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* outline ::
|
|
|
|
* The source outline.
|
|
|
|
*
|
|
|
|
* opened ::
|
2008-06-26 21:56:51 +02:00
|
|
|
* A boolean. If~1, the outline is treated as an open path instead
|
2007-06-11 06:55:58 +02:00
|
|
|
* of a closed one.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @note:
|
2008-06-26 21:56:51 +02:00
|
|
|
* If `opened' is~0 (the default), the outline is treated as a closed
|
2008-09-16 09:25:31 +02:00
|
|
|
* path, and the stroker generates two distinct `border' outlines.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
2008-06-26 21:56:51 +02:00
|
|
|
* If `opened' is~1, the outline is processed as an open path, and the
|
2008-09-16 09:25:31 +02:00
|
|
|
* stroker generates a single `stroke' outline.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2004-01-22 10:07:12 +01:00
|
|
|
* This function calls @FT_Stroker_Rewind automatically.
|
2003-12-26 08:26:08 +01:00
|
|
|
*/
|
2002-06-27 01:45:21 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Stroker_ParseOutline( FT_Stroker stroker,
|
|
|
|
FT_Outline* outline,
|
|
|
|
FT_Bool opened );
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_BeginSubPath
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Start a new sub-path in the stroker.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* to ::
|
|
|
|
* A pointer to the start vector.
|
|
|
|
*
|
|
|
|
* open ::
|
2008-06-26 21:56:51 +02:00
|
|
|
* A boolean. If~1, the sub-path is treated as an open one.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* This function is useful when you need to stroke a path that is
|
2006-05-12 15:55:04 +02:00
|
|
|
* not stored as an @FT_Outline object.
|
2003-12-26 08:26:08 +01:00
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Stroker_BeginSubPath( FT_Stroker stroker,
|
2002-06-27 01:45:21 +02:00
|
|
|
FT_Vector* to,
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_Bool open );
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_EndSubPath
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Close the current sub-path in the stroker.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* You should call this function after @FT_Stroker_BeginSubPath.
|
2008-09-16 09:25:31 +02:00
|
|
|
* If the subpath was not `opened', this function `draws' a
|
2003-12-26 08:26:08 +01:00
|
|
|
* single line segment to the start position when needed.
|
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Stroker_EndSubPath( FT_Stroker stroker );
|
|
|
|
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_LineTo
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* `Draw' a single line segment in the stroker's current sub-path,
|
|
|
|
* from the last position.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* to ::
|
|
|
|
* A pointer to the destination point.
|
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* You should call this function between @FT_Stroker_BeginSubPath and
|
|
|
|
* @FT_Stroker_EndSubPath.
|
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Stroker_LineTo( FT_Stroker stroker,
|
2002-06-27 01:45:21 +02:00
|
|
|
FT_Vector* to );
|
2002-06-27 00:05:05 +02:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_ConicTo
|
|
|
|
*
|
|
|
|
* @description:
|
2006-05-12 16:20:43 +02:00
|
|
|
* `Draw' a single quadratic Bézier in the stroker's current sub-path,
|
2003-12-26 08:26:08 +01:00
|
|
|
* from the last position.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* control ::
|
2006-05-12 16:20:43 +02:00
|
|
|
* A pointer to a Bézier control point.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* to ::
|
|
|
|
* A pointer to the destination point.
|
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* You should call this function between @FT_Stroker_BeginSubPath and
|
|
|
|
* @FT_Stroker_EndSubPath.
|
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Stroker_ConicTo( FT_Stroker stroker,
|
2002-06-27 01:45:21 +02:00
|
|
|
FT_Vector* control,
|
|
|
|
FT_Vector* to );
|
2002-06-27 00:05:05 +02:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_CubicTo
|
|
|
|
*
|
|
|
|
* @description:
|
2006-05-12 16:20:43 +02:00
|
|
|
* `Draw' a single cubic Bézier in the stroker's current sub-path,
|
2003-12-26 08:26:08 +01:00
|
|
|
* from the last position.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* control1 ::
|
2006-05-12 16:20:43 +02:00
|
|
|
* A pointer to the first Bézier control point.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* control2 ::
|
2006-05-12 16:20:43 +02:00
|
|
|
* A pointer to second Bézier control point.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* to ::
|
|
|
|
* A pointer to the destination point.
|
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* You should call this function between @FT_Stroker_BeginSubPath and
|
|
|
|
* @FT_Stroker_EndSubPath.
|
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Stroker_CubicTo( FT_Stroker stroker,
|
2002-06-27 01:45:21 +02:00
|
|
|
FT_Vector* control1,
|
|
|
|
FT_Vector* control2,
|
|
|
|
FT_Vector* to );
|
2002-06-27 00:05:05 +02:00
|
|
|
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_GetBorderCounts
|
|
|
|
*
|
|
|
|
* @description:
|
2006-05-12 15:55:04 +02:00
|
|
|
* Call this function once you have finished parsing your paths
|
2008-09-16 09:25:31 +02:00
|
|
|
* with the stroker. It returns the number of points and
|
2003-12-26 08:26:08 +01:00
|
|
|
* contours necessary to export one of the `border' or `stroke'
|
|
|
|
* outlines generated by the stroker.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* border ::
|
|
|
|
* The border index.
|
|
|
|
*
|
|
|
|
* @output:
|
|
|
|
* anum_points ::
|
|
|
|
* The number of points.
|
|
|
|
*
|
|
|
|
* anum_contours ::
|
|
|
|
* The number of contours.
|
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* When an outline, or a sub-path, is `closed', the stroker generates
|
|
|
|
* two independent `border' outlines, named `left' and `right'.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* When the outline, or a sub-path, is `opened', the stroker merges
|
|
|
|
* the `border' outlines with caps. The `left' border receives all
|
|
|
|
* points, while the `right' border becomes empty.
|
|
|
|
*
|
|
|
|
* Use the function @FT_Stroker_GetCounts instead if you want to
|
|
|
|
* retrieve the counts associated to both borders.
|
|
|
|
*/
|
2003-12-19 22:23:58 +01:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Stroker_GetBorderCounts( FT_Stroker stroker,
|
|
|
|
FT_StrokerBorder border,
|
|
|
|
FT_UInt *anum_points,
|
|
|
|
FT_UInt *anum_contours );
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_ExportBorder
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Call this function after @FT_Stroker_GetBorderCounts to
|
|
|
|
* export the corresponding border to your own @FT_Outline
|
|
|
|
* structure.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2008-09-16 09:25:31 +02:00
|
|
|
* Note that this function appends the border points and
|
|
|
|
* contours to your outline, but does not try to resize its
|
2003-12-26 08:26:08 +01:00
|
|
|
* arrays.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* border ::
|
|
|
|
* The border index.
|
|
|
|
*
|
|
|
|
* outline ::
|
|
|
|
* The target outline handle.
|
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* Always call this function after @FT_Stroker_GetBorderCounts to
|
|
|
|
* get sure that there is enough room in your @FT_Outline object to
|
|
|
|
* receive all new data.
|
|
|
|
*
|
|
|
|
* When an outline, or a sub-path, is `closed', the stroker generates
|
2014-11-09 23:21:37 +01:00
|
|
|
* two independent `border' outlines, named `left' and `right'.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* When the outline, or a sub-path, is `opened', the stroker merges
|
2014-11-09 23:21:37 +01:00
|
|
|
* the `border' outlines with caps. The `left' border receives all
|
2003-12-26 08:26:08 +01:00
|
|
|
* points, while the `right' border becomes empty.
|
|
|
|
*
|
|
|
|
* Use the function @FT_Stroker_Export instead if you want to
|
|
|
|
* retrieve all borders at once.
|
|
|
|
*/
|
2003-12-19 22:23:58 +01:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_Stroker_ExportBorder( FT_Stroker stroker,
|
|
|
|
FT_StrokerBorder border,
|
|
|
|
FT_Outline* outline );
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_GetCounts
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Call this function once you have finished parsing your paths
|
|
|
|
* with the stroker. It returns the number of points and
|
|
|
|
* contours necessary to export all points/borders from the stroked
|
|
|
|
* outline/path.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2003-12-26 08:26:08 +01:00
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* @output:
|
|
|
|
* anum_points ::
|
|
|
|
* The number of points.
|
|
|
|
*
|
|
|
|
* anum_contours ::
|
|
|
|
* The number of contours.
|
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2003-12-26 08:26:08 +01:00
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Stroker_GetCounts( FT_Stroker stroker,
|
|
|
|
FT_UInt *anum_points,
|
|
|
|
FT_UInt *anum_contours );
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_Export
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Call this function after @FT_Stroker_GetBorderCounts to
|
2009-07-17 10:50:04 +02:00
|
|
|
* export all borders to your own @FT_Outline structure.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2008-09-16 09:25:31 +02:00
|
|
|
* Note that this function appends the border points and
|
|
|
|
* contours to your outline, but does not try to resize its
|
2003-12-26 08:26:08 +01:00
|
|
|
* arrays.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* The target stroker handle.
|
|
|
|
*
|
|
|
|
* outline ::
|
|
|
|
* The target outline handle.
|
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( void )
|
2002-07-01 23:53:54 +02:00
|
|
|
FT_Stroker_Export( FT_Stroker stroker,
|
|
|
|
FT_Outline* outline );
|
2002-06-27 00:05:05 +02:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Stroker_Done
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Destroy a stroker object.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* A stroker handle. Can be NULL.
|
|
|
|
*/
|
2002-06-27 00:05:05 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_Stroker_Done( FT_Stroker stroker );
|
|
|
|
|
2004-01-16 09:57:05 +01:00
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Glyph_Stroke
|
|
|
|
*
|
|
|
|
* @description:
|
2004-01-22 10:07:12 +01:00
|
|
|
* Stroke a given outline glyph object with a given stroker.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @inout:
|
2006-04-22 14:24:52 +02:00
|
|
|
* pglyph ::
|
|
|
|
* Source glyph handle on input, new glyph handle on output.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* A stroker handle.
|
|
|
|
*
|
2004-01-22 10:07:12 +01:00
|
|
|
* destroy ::
|
2008-06-26 21:56:51 +02:00
|
|
|
* A Boolean. If~1, the source glyph object is destroyed
|
2004-01-22 10:07:12 +01:00
|
|
|
* on success.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @note:
|
2004-01-22 10:07:12 +01:00
|
|
|
* The source glyph is untouched in case of error.
|
2012-05-24 07:05:03 +02:00
|
|
|
*
|
|
|
|
* Adding stroke may yield a significantly wider and taller glyph
|
|
|
|
* depending on how large of a radius was used to stroke the glyph. You
|
|
|
|
* may need to manually adjust horizontal and vertical advance amounts
|
|
|
|
* to account for this added size.
|
2004-01-16 09:57:05 +01:00
|
|
|
*/
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Glyph_Stroke( FT_Glyph *pglyph,
|
|
|
|
FT_Stroker stroker,
|
|
|
|
FT_Bool destroy );
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Glyph_StrokeBorder
|
|
|
|
*
|
|
|
|
* @description:
|
2004-01-22 10:07:12 +01:00
|
|
|
* Stroke a given outline glyph object with a given stroker, but
|
|
|
|
* only return either its inside or outside border.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @inout:
|
2004-01-22 10:07:12 +01:00
|
|
|
* pglyph ::
|
|
|
|
* Source glyph handle on input, new glyph handle on output.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* stroker ::
|
|
|
|
* A stroker handle.
|
|
|
|
*
|
2004-01-22 10:07:12 +01:00
|
|
|
* inside ::
|
2008-06-26 21:56:51 +02:00
|
|
|
* A Boolean. If~1, return the inside border, otherwise
|
2004-01-22 10:07:12 +01:00
|
|
|
* the outside border.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
2004-01-22 10:07:12 +01:00
|
|
|
* destroy ::
|
2008-06-26 21:56:51 +02:00
|
|
|
* A Boolean. If~1, the source glyph object is destroyed
|
2004-01-22 10:07:12 +01:00
|
|
|
* on success.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2004-01-16 09:57:05 +01:00
|
|
|
*
|
|
|
|
* @note:
|
2004-01-22 10:07:12 +01:00
|
|
|
* The source glyph is untouched in case of error.
|
2012-05-24 07:05:03 +02:00
|
|
|
*
|
|
|
|
* Adding stroke may yield a significantly wider and taller glyph
|
|
|
|
* depending on how large of a radius was used to stroke the glyph. You
|
|
|
|
* may need to manually adjust horizontal and vertical advance amounts
|
|
|
|
* to account for this added size.
|
2004-01-16 09:57:05 +01:00
|
|
|
*/
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Glyph_StrokeBorder( FT_Glyph *pglyph,
|
|
|
|
FT_Stroker stroker,
|
|
|
|
FT_Bool inside,
|
|
|
|
FT_Bool destroy );
|
|
|
|
|
2014-12-02 23:06:04 +01:00
|
|
|
/* */
|
2002-06-27 00:05:05 +02:00
|
|
|
|
|
|
|
FT_END_HEADER
|
|
|
|
|
2003-06-07 06:02:21 +02:00
|
|
|
#endif /* __FT_STROKE_H__ */
|
|
|
|
|
|
|
|
|
|
|
|
/* END */
|
2006-05-12 16:20:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Local Variables: */
|
|
|
|
/* coding: utf-8 */
|
|
|
|
/* End: */
|