* builds/unix/config.guess, builds/unix/config.sub: Updated to
latest versions from gnu.org. * builds/compiler/gcc-dev.mk: Add `-Wno-long-long' flag. * include/freetype/internal/ftcalc.h: Define FT_SqrtFixed() uncoditionally. * src/base/ftbbox.c: Include FT_INTERNAL_CALC_H. Fix compiler warnings. * src/base/ftcalc.c: Fix (potential) compiler warnings. * src/base/ftcalc.c (FT_SqrtFixed): Corrected/optimized the 32-bit fixed-point square root computation. It is now used even with 64-bits integers, as it is _much_ faster than calling FT_Sqrt64 :-) * src/base/ftbbox.c: Removed invalid "#include FT_BEZIER_H" line. * src/base/ftbbox.c (BBox_Cubic_Check): Rewrote function to use direct computations with 16.16 values instead of sub-divisions. It is now slower, but proves a point :-) * src/raster/ftraster.c, src/smooth/ftgrays.c, src/base/ftbbox.c: Fixed the bezier stack depths. * src/base/ftcalc.c (FT_MulFix): Minor rounding fix. * builds/beos: Added BeOS-specific files to the old build system (no changes were necessary to support BeOS in the Jamfile though). * ftconfig.h, ftoption.h: Updated "ftconfig.h" to detect 64-bit int types on platforms where Autoconf is not available). Also removed FTCALC_USE_LONG_LONG and replaced it with FT_CONFIG_OPTION_FORCE_INT64. * builds/win32/freetype.dsp: Updated the Visual C++ project file. Doesn't create a DLL yet. * cffgload.c: Removed a compilation warning.
This commit is contained in:
parent
65abdf98fb
commit
4e8b203556
50
ChangeLog
50
ChangeLog
@ -1,35 +1,49 @@
|
||||
2001-04-26 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* builds/unix/config.guess, builds/unix/config.sub: Updated to
|
||||
latest versions from gnu.org.
|
||||
|
||||
* builds/compiler/gcc-dev.mk: Add `-Wno-long-long' flag.
|
||||
|
||||
* include/freetype/internal/ftcalc.h: Define FT_SqrtFixed()
|
||||
uncoditionally.
|
||||
* src/base/ftbbox.c: Include FT_INTERNAL_CALC_H.
|
||||
Fix compiler warnings.
|
||||
* src/base/ftcalc.c: Fix (potential) compiler warnings.
|
||||
|
||||
2001-04-26 David Turner <david@freetype.org>
|
||||
|
||||
* src/base/ftcalc.c (FT_SqrtFixed): corrected/optimised the 32-bit
|
||||
fixed-point square root. it is now used even with 64-bits
|
||||
ints, as it's simply _much_ faster than calling FT_Sqrt64 :-)
|
||||
* src/base/ftcalc.c (FT_SqrtFixed): Corrected/optimized the 32-bit
|
||||
fixed-point square root computation. It is now used even with
|
||||
64-bits integers, as it is _much_ faster than calling FT_Sqrt64 :-)
|
||||
|
||||
* src/base/ftbbox.c : removed invalid "#include FT_BEZIER_H" line
|
||||
* src/base/ftbbox.c: Removed invalid "#include FT_BEZIER_H" line.
|
||||
|
||||
2001-04-25 David Turner <david@freetype.org>
|
||||
|
||||
* src/base/ftbbox.c (BBox_Cubic_Check): rewrote function to use
|
||||
direct computations with 16.16 values instead of sub-divisions.
|
||||
It is now slower, but proves a point :-)
|
||||
* src/base/ftbbox.c (BBox_Cubic_Check): Rewrote function to use
|
||||
direct computations with 16.16 values instead of sub-divisions. It
|
||||
is now slower, but proves a point :-)
|
||||
|
||||
* src/raster/ftraster.c, src/smooth/ftgrays.c, src/base/ftbbox.c :
|
||||
fixed the bezier stack depths..
|
||||
* src/raster/ftraster.c, src/smooth/ftgrays.c, src/base/ftbbox.c:
|
||||
Fixed the bezier stack depths.
|
||||
|
||||
* src/base/ftcalc.c (FT_MulFix): minor rounding fix
|
||||
* src/base/ftcalc.c (FT_MulFix): Minor rounding fix.
|
||||
|
||||
* builds/beos : added BeOS-specific files to the old build system
|
||||
(no changes were necessary to support BeOS in the Jamfile though)
|
||||
* builds/beos: Added BeOS-specific files to the old build system
|
||||
(no changes were necessary to support BeOS in the Jamfile though).
|
||||
|
||||
2001-04-20 David Turner <david@freetype.org>
|
||||
|
||||
* ftconfig.h, ftoption.h: updated "ftconfig.h" to detect 64-bit int
|
||||
types on platforms where Autoconf is not available). Also removed
|
||||
FTCALC_USE_LONG_LONG and replaced it with FT_CONFIG_OPTION_FORCE_INT64
|
||||
* ftconfig.h, ftoption.h: Updated "ftconfig.h" to detect 64-bit int
|
||||
types on platforms where Autoconf is not available). Also removed
|
||||
FTCALC_USE_LONG_LONG and replaced it with
|
||||
FT_CONFIG_OPTION_FORCE_INT64.
|
||||
|
||||
* builds/win32/freetype.dsp: updated the Visual C++ project file. Doesn't
|
||||
create a DLL yet..
|
||||
* builds/win32/freetype.dsp: Updated the Visual C++ project file.
|
||||
Doesn't create a DLL yet.
|
||||
|
||||
* cffgload.c: removed a compilation warning
|
||||
* cffgload.c: Removed a compilation warning.
|
||||
|
||||
2001-04-10 Tom Kacvinsky <tjk@ams.org>
|
||||
|
||||
|
184
docs/docmaker.py
184
docs/docmaker.py
@ -10,11 +10,11 @@
|
||||
|
||||
import fileinput, sys, string, glob
|
||||
|
||||
# the Project's title, this can be over-ridden from the command line with
|
||||
# an option
|
||||
# The Project's title. This can be overridden from the command line with
|
||||
# an option.
|
||||
project_title = "Project"
|
||||
|
||||
# The following defines the HTML header used by all generated pages
|
||||
# The following defines the HTML header used by all generated pages.
|
||||
#
|
||||
html_header_1 = """\
|
||||
<html>
|
||||
@ -38,52 +38,54 @@ html_header_2= """ API Reference</title>
|
||||
|
||||
html_header_3=""" API Reference</h1></center>
|
||||
"""
|
||||
# this is recomputed later when the project title changes
|
||||
|
||||
# This is recomputed later when the project title changes.
|
||||
#
|
||||
html_header = html_header_1 + project_title + html_header_2 + project_title + html_header_3
|
||||
|
||||
# The HTML footer used by all generated pages
|
||||
# The HTML footer used by all generated pages.
|
||||
#
|
||||
html_footer = """\
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
# The header and footer used for each section
|
||||
# The header and footer used for each section.
|
||||
#
|
||||
section_title_header = "<center><h1>"
|
||||
section_title_footer = "</h1></center>"
|
||||
|
||||
# The header and footer used for code segments
|
||||
# The header and footer used for code segments.
|
||||
#
|
||||
code_header = "<font color=blue><pre>"
|
||||
code_footer = "</pre></font>"
|
||||
|
||||
# Paragraph header and footer
|
||||
# Paragraph header and footer.
|
||||
#
|
||||
para_header = "<p>"
|
||||
para_footer = "</p>"
|
||||
|
||||
# Block header and footer
|
||||
# Block header and footer.
|
||||
#
|
||||
block_header = "<center><table width=75%><tr><td>"
|
||||
block_footer = "</td></tr></table><hr width=75%></center>"
|
||||
|
||||
# Description header/footer
|
||||
# Description header/footer.
|
||||
#
|
||||
description_header = "<center><table width=87%><tr><td>"
|
||||
description_footer = "</td></tr></table></center><br>"
|
||||
|
||||
# Marker header/inter/footer combination
|
||||
# Marker header/inter/footer combination.
|
||||
#
|
||||
marker_header = "<center><table width=87% cellpadding=5><tr bgcolor=#EEEEFF><td><em><b>"
|
||||
marker_inter = "</b></em></td></tr><tr><td>"
|
||||
marker_footer = "</td></tr></table></center>"
|
||||
|
||||
# Source code extracts header/footer
|
||||
# Source code extracts header/footer.
|
||||
#
|
||||
source_header = "<center><table width=87%><tr bgcolor=#D6E8FF width=100%><td><pre>"
|
||||
source_footer = "</pre></table></center><br>"
|
||||
|
||||
# Chapter header/inter/footer
|
||||
# Chapter header/inter/footer.
|
||||
#
|
||||
chapter_header = "<center><table width=75%><tr><td><h2>"
|
||||
chapter_inter = "</h2><ul>"
|
||||
@ -92,8 +94,8 @@ chapter_footer = "</ul></td></tr></table></center>"
|
||||
current_section = None
|
||||
|
||||
|
||||
# This function is used to sort the index. It's a simple lexicographical
|
||||
# sort, except that it places capital letters before small ones.
|
||||
# This function is used to sort the index. It is a simple lexicographical
|
||||
# sort, except that it places capital letters before lowercase ones.
|
||||
#
|
||||
def index_sort( s1, s2 ):
|
||||
if not s1:
|
||||
@ -126,7 +128,7 @@ def index_sort( s1, s2 ):
|
||||
return 0
|
||||
|
||||
|
||||
# sort input_list, placing the elements of order_list in front
|
||||
# Sort input_list, placing the elements of order_list in front.
|
||||
#
|
||||
def sort_order_list( input_list, order_list ):
|
||||
new_list = order_list[:]
|
||||
@ -136,8 +138,8 @@ def sort_order_list( input_list, order_list ):
|
||||
return new_list
|
||||
|
||||
|
||||
# translate a single line of source to HTML. This will convert
|
||||
# a "<" into "<.", ">" into ">.", etc..
|
||||
# Translate a single line of source to HTML. This will convert
|
||||
# a "<" into "<.", ">" into ">.", etc.
|
||||
#
|
||||
def html_format( line )
|
||||
result = string.replace( line, "<", "<." )
|
||||
@ -146,8 +148,8 @@ def html_format( line )
|
||||
return result
|
||||
|
||||
|
||||
# The FreeType 2 reference is extracted from the source files. These contain
|
||||
# various comment blocks that follow one of the following formats:
|
||||
# The FreeType 2 reference is extracted from the source files. These
|
||||
# contain various comment blocks that follow one of the following formats:
|
||||
#
|
||||
# /**************************
|
||||
# *
|
||||
@ -176,7 +178,7 @@ def html_format( line )
|
||||
# /**************************/
|
||||
#
|
||||
# Each block contains a list of markers; each one can be followed by
|
||||
# some arbitrary text or a list of fields. Here's an example:
|
||||
# some arbitrary text or a list of fields. Here an example:
|
||||
#
|
||||
# <Struct>
|
||||
# MyStruct
|
||||
@ -195,15 +197,15 @@ def html_format( line )
|
||||
#
|
||||
# Each field is simply of the format: WORD :: TEXT...
|
||||
#
|
||||
# Note that typically each comment block is followed by some source
|
||||
# code declaration that may need to be kept in the reference.
|
||||
# Note that typically each comment block is followed by some source code
|
||||
# declaration that may need to be kept in the reference.
|
||||
#
|
||||
# Note that markers can alternatively be written as "@MARKER:"
|
||||
# instead of "<MARKER>". All marker identifiers are converted to
|
||||
# lower case during parsing in order to simply sorting.
|
||||
# Note that markers can alternatively be written as "@MARKER:" instead of
|
||||
# "<MARKER>". All marker identifiers are converted to lower case during
|
||||
# parsing in order to simply sorting.
|
||||
#
|
||||
# We associate with each block the following source lines that do not
|
||||
# begin with a comment. For example, the following:
|
||||
# We associate with each block the following source lines that do not begin
|
||||
# with a comment. For example, the following:
|
||||
#
|
||||
# /**********************************
|
||||
# *
|
||||
@ -211,38 +213,37 @@ def html_format( line )
|
||||
# *
|
||||
# */
|
||||
#
|
||||
# bla_bla_bla
|
||||
# bilip_bilip
|
||||
# bla_bla_bla
|
||||
# bilip_bilip
|
||||
#
|
||||
# /* - this comment acts as a separator - */
|
||||
#
|
||||
# blo_blo_blo
|
||||
# blo_blo_blo
|
||||
#
|
||||
#
|
||||
# will only keep the first two lines of sources with
|
||||
# the "blabla" block.
|
||||
# will only keep the first two lines of sources with
|
||||
# the "blabla" block.
|
||||
#
|
||||
# However, the comment will be kept, with following source lines
|
||||
# if it contains a starting '#' or '@' as in:
|
||||
# However, the comment will be kept, with following source lines if it
|
||||
# contains a starting '#' or '@' as in:
|
||||
#
|
||||
# /*@.....*/
|
||||
# /*#.....*/
|
||||
# /* @.....*/
|
||||
# /* #.....*/
|
||||
# /*@.....*/
|
||||
# /*#.....*/
|
||||
# /* @.....*/
|
||||
# /* #.....*/
|
||||
#
|
||||
|
||||
|
||||
|
||||
#############################################################################
|
||||
#
|
||||
# The DocCode class is used to store source code lines
|
||||
# The DocCode class is used to store source code lines.
|
||||
#
|
||||
# 'self.lines' contains a set of source code lines that will
|
||||
# be dumped as HTML in a <PRE> tag.
|
||||
# 'self.lines' contains a set of source code lines that will be dumped as
|
||||
# HTML in a <PRE> tag.
|
||||
#
|
||||
# The object is filled line by line by the parser; it strips the
|
||||
# leading "margin" space from each input line before storing it
|
||||
# in 'self.lines'.
|
||||
# The object is filled line by line by the parser; it strips the leading
|
||||
# "margin" space from each input line before storing it in 'self.lines'.
|
||||
#
|
||||
class DocCode:
|
||||
|
||||
@ -278,11 +279,11 @@ class DocCode:
|
||||
while l > 0 and string.strip( self.lines[l - 1] ) == "":
|
||||
l = l - 1
|
||||
|
||||
# the code footer should be directly appended to the last code
|
||||
# line to avoid an additional blank line
|
||||
# The code footer should be directly appended to the last code
|
||||
# line to avoid an additional blank line.
|
||||
#
|
||||
sys.stdout.write( code_header )
|
||||
for line in self.lines[0 : l+1]:
|
||||
for line in self.lines[0 : l+1]:
|
||||
sys.stdout.write( '\n' + html_format(line) )
|
||||
sys.stdout.write( code_footer )
|
||||
|
||||
@ -370,8 +371,9 @@ class DocParagraph:
|
||||
|
||||
cursor = cursor + len( word ) + 1
|
||||
|
||||
# handle trailing periods, commas, etc. at the end of
|
||||
# cross references.
|
||||
|
||||
# Handle trailing periods, commas, etc. at the end of cross
|
||||
# references.
|
||||
#
|
||||
if extra:
|
||||
if cursor + len( extra ) + 1 > max_width:
|
||||
@ -410,10 +412,9 @@ class DocParagraph:
|
||||
#
|
||||
# DocContent is used to store the content of a given marker.
|
||||
#
|
||||
# The "self.items" list contains (field,elements) records, where
|
||||
# "field" corresponds to a given structure fields or function
|
||||
# parameter (indicated by a "::"), or NULL for a normal section
|
||||
# of text/code.
|
||||
# The "self.items" list contains (field,elements) records, where "field"
|
||||
# corresponds to a given structure fields or function parameter (indicated
|
||||
# by a "::"), or NULL for a normal section of text/code.
|
||||
#
|
||||
# Hence, the following example:
|
||||
#
|
||||
@ -436,8 +437,8 @@ class DocParagraph:
|
||||
#
|
||||
# in 'self.items'.
|
||||
#
|
||||
# The DocContent object is entirely built at creation time; you must
|
||||
# pass a list of input text lines in the "lines_list" parameter.
|
||||
# The DocContent object is entirely built at creation time; you must pass a
|
||||
# list of input text lines in the "lines_list" parameter.
|
||||
#
|
||||
class DocContent:
|
||||
|
||||
@ -449,7 +450,7 @@ class DocContent:
|
||||
paragraph = None # represents the current DocParagraph
|
||||
code = None # represents the current DocCode
|
||||
|
||||
elements = [] # the list of elements for the current field,
|
||||
elements = [] # the list of elements for the current field;
|
||||
# contains DocParagraph or DocCode objects
|
||||
|
||||
field = None # the current field
|
||||
@ -633,20 +634,18 @@ class DocContent:
|
||||
|
||||
#############################################################################
|
||||
#
|
||||
#
|
||||
# The DocBlock class is used to store a given comment block. It contains
|
||||
# The DocBlock class is used to store a given comment block. It contains
|
||||
# a list of markers, as well as a list of contents for each marker.
|
||||
#
|
||||
# "self.items" is a list of (marker, contents) elements, where
|
||||
# 'marker' is a lowercase marker string, and 'contents' is a DocContent
|
||||
# object.
|
||||
# "self.items" is a list of (marker, contents) elements, where 'marker' is
|
||||
# a lowercase marker string, and 'contents' is a DocContent object.
|
||||
#
|
||||
# "self.source" is simply a list of text lines taken from the
|
||||
# uncommented source itself.
|
||||
# "self.source" is simply a list of text lines taken from the uncommented
|
||||
# source itself.
|
||||
#
|
||||
# Finally, "self.name" is a simple identifier used to uniquely identify
|
||||
# the block. It is taken from the first word of the first
|
||||
# paragraph of the first marker of a given block, i.e:
|
||||
# the block. It is taken from the first word of the first paragraph of the
|
||||
# first marker of a given block, i.e:
|
||||
#
|
||||
# <Type> Goo
|
||||
# <Description> Bla bla bla
|
||||
@ -708,6 +707,7 @@ class DocBlock:
|
||||
|
||||
|
||||
# This function adds a new element to 'self.items'.
|
||||
#
|
||||
# 'marker' is a marker string, or None.
|
||||
# 'lines' is a list of text lines used to compute a list of
|
||||
# DocContent objects.
|
||||
@ -726,7 +726,7 @@ class DocBlock:
|
||||
l = len( lines )
|
||||
|
||||
# add a new marker only if its marker and its content list
|
||||
# aren't empty
|
||||
# are not empty
|
||||
#
|
||||
if l > 0 and marker:
|
||||
content = DocContent( lines )
|
||||
@ -931,14 +931,13 @@ class DocSectionList:
|
||||
abstract = block.find_content( "abstract" )
|
||||
|
||||
if self.sections.has_key( name ):
|
||||
# There is already a section with this name in our
|
||||
# list. We will try to complete it.
|
||||
# There is already a section with this name in our list. We
|
||||
# will try to complete it.
|
||||
#
|
||||
section = self.sections[name]
|
||||
if section.abstract:
|
||||
# This section already has an abstract defined;
|
||||
# simply check that the new section doesn't
|
||||
# provide a new one.
|
||||
# This section already has an abstract defined; simply check
|
||||
# that the new section doesn't provide a new one.
|
||||
#
|
||||
if abstract:
|
||||
section.block.print_error(
|
||||
@ -949,8 +948,8 @@ class DocSectionList:
|
||||
"second definition in " +
|
||||
"'" + block.location() + "'" )
|
||||
else:
|
||||
# The old section didn't contain an abstract; we are
|
||||
# now going to replace it.
|
||||
# The old section didn't contain an abstract; we are now
|
||||
# going to replace it.
|
||||
#
|
||||
section.abstract = abstract
|
||||
section.description = block.find_content( "description" )
|
||||
@ -979,8 +978,8 @@ class DocSectionList:
|
||||
|
||||
|
||||
def prepare_files( self, file_prefix = None ):
|
||||
# prepare the section list, by computing section filenames
|
||||
# and the index
|
||||
# prepare the section list, by computing section filenames and the
|
||||
# index
|
||||
#
|
||||
if file_prefix:
|
||||
prefix = file_prefix + "-"
|
||||
@ -996,8 +995,8 @@ class DocSectionList:
|
||||
else:
|
||||
section.title = "UNKNOWN_SECTION_TITLE!"
|
||||
|
||||
# sort section elements according to the <order> marker if
|
||||
# available
|
||||
|
||||
# sort section elements according to the <order> marker if available
|
||||
#
|
||||
for section in self.sections.values():
|
||||
order = section.block.find_content( "order" )
|
||||
@ -1101,7 +1100,7 @@ class DocSectionList:
|
||||
|
||||
|
||||
|
||||
# Filter a given list of DocBlocks. Returns a new list of DocBlock objects
|
||||
# Filter a given list of DocBlocks. Returns a new list of DocBlock objects
|
||||
# that only contains element whose "type" (i.e. first marker) is in the
|
||||
# "types" parameter.
|
||||
#
|
||||
@ -1152,7 +1151,8 @@ class DocDocument:
|
||||
if block.name:
|
||||
content = block.find_content( "chapter" )
|
||||
if content:
|
||||
# it's a chapter definition -- add it to our list
|
||||
# a chapter definition -- add it to our list
|
||||
#
|
||||
chapter = DocChapter( block )
|
||||
self.chapters.append( chapter )
|
||||
else:
|
||||
@ -1216,6 +1216,7 @@ class DocDocument:
|
||||
print chapter_footer
|
||||
|
||||
# list lost sections
|
||||
#
|
||||
if self.lost_sections:
|
||||
print chapter_header + "OTHER SECTIONS:" + chapter_inter
|
||||
|
||||
@ -1234,6 +1235,7 @@ class DocDocument:
|
||||
print chapter_footer
|
||||
|
||||
# index
|
||||
#
|
||||
print chapter_header + '<a href="' + self.section_list.index_filename + '">Index</a>' + chapter_footer
|
||||
|
||||
print html_footer
|
||||
@ -1265,8 +1267,8 @@ def filter_section_blocks( block ):
|
||||
return block.section != None
|
||||
|
||||
|
||||
# Perform a lexicographical comparison of two DocBlock
|
||||
# objects. Returns -1, 0 or 1.
|
||||
# Perform a lexicographical comparison of two DocBlock objects. Returns -1,
|
||||
# 0 or 1.
|
||||
#
|
||||
def block_lexicographical_compare( b1, b2 ):
|
||||
if not b1.name:
|
||||
@ -1285,7 +1287,7 @@ def block_lexicographical_compare( b1, b2 ):
|
||||
return 1
|
||||
|
||||
|
||||
# dump a list block as a single HTML page
|
||||
# Dump a list block as a single HTML page.
|
||||
#
|
||||
def dump_html_1( block_list ):
|
||||
print html_header
|
||||
@ -1349,7 +1351,7 @@ def make_block_list():
|
||||
# 1 - parse comment format 1
|
||||
# 2 - parse comment format 2
|
||||
#
|
||||
# 4 - wait for beginning of source (or comment ??)
|
||||
# 4 - wait for beginning of source (or comment?)
|
||||
# 5 - process source
|
||||
#
|
||||
comment = []
|
||||
@ -1414,15 +1416,15 @@ def make_block_list():
|
||||
#
|
||||
elif format == 1:
|
||||
|
||||
# If the line doesn't begin with a "*", something went
|
||||
# wrong, and we must exit, and forget the current block.
|
||||
# If the line doesn't begin with a "*", something went wrong,
|
||||
# and we must exit, and forget the current block.
|
||||
#
|
||||
if l == 0 or line2[0] != '*':
|
||||
block = []
|
||||
format = 0
|
||||
|
||||
# Otherwise, we test for an end of block, which is an
|
||||
# arbitrary number of '*', followed by '/'.
|
||||
# Otherwise, we test for an end of block, which is an arbitrary
|
||||
# number of '*', followed by '/'.
|
||||
#
|
||||
else:
|
||||
i = 1
|
||||
@ -1449,8 +1451,8 @@ def make_block_list():
|
||||
#
|
||||
elif format == 2:
|
||||
|
||||
# If the line doesn't begin with '/*' and end with '*/',
|
||||
# this is the end of the format 2 format.
|
||||
# If the line doesn't begin with '/*' and end with '*/', this is
|
||||
# the end of the format 2 format.
|
||||
#
|
||||
if l < 4 or line2[: 2] != '/*' or line2[-2 :] != '*/':
|
||||
if block != []:
|
||||
@ -1538,7 +1540,7 @@ def main( argv ):
|
||||
## section_list.dump_html_index()
|
||||
|
||||
|
||||
# If called from the command line
|
||||
# if called from the command line
|
||||
#
|
||||
if __name__ == '__main__':
|
||||
main( sys.argv )
|
||||
|
@ -342,11 +342,12 @@
|
||||
/* */
|
||||
/* @description: */
|
||||
/* A macro used in #include statements to name the file containing */
|
||||
/* a small useful API to handle bezier arcs. Note that you _must_ */
|
||||
/* include FT_FREETYPE_H or FT_IMAGE_H before this header.. */
|
||||
/* a small useful API to handle bezier arcs. Note that you _must_ */
|
||||
/* include FT_FREETYPE_H or FT_IMAGE_H before this header. */
|
||||
/* */
|
||||
#define FT_BEZIER_H <freetype/ftbezier.h>
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @macro: */
|
||||
|
@ -146,10 +146,10 @@ FT_BEGIN_HEADER
|
||||
FT_Int32 y );
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x );
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
#define SQRT_64( z ) FT_Sqrt64( &z )
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include FT_BBOX_H
|
||||
#include FT_IMAGE_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_INTERNAL_CALC_H
|
||||
|
||||
|
||||
typedef struct TBBox_Rec_
|
||||
@ -36,7 +37,7 @@
|
||||
FT_BBox bbox;
|
||||
|
||||
} TBBox_Rec;
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -214,7 +215,7 @@
|
||||
FT_Pos* min,
|
||||
FT_Pos* max )
|
||||
{
|
||||
FT_Pos stack[32*3+1], *arc;
|
||||
FT_Pos stack[32*3 + 1], *arc;
|
||||
|
||||
|
||||
arc = stack;
|
||||
@ -253,7 +254,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Unknown direction - split the arc in two */
|
||||
/* Unknown direction -- split the arc in two */
|
||||
arc[6] = y4;
|
||||
arc[1] = y1 = ( y1 + y2 ) / 2;
|
||||
arc[5] = y4 = ( y4 + y3 ) / 2;
|
||||
@ -285,15 +286,28 @@
|
||||
FT_Pos* min,
|
||||
FT_Pos* max )
|
||||
{
|
||||
FT_Pos a = y4 - 3*y3 + 3*y2 - y1;
|
||||
FT_Pos b = y3 - 2*y2 + y1;
|
||||
FT_Pos c = y2 - y1;
|
||||
FT_Pos d = y1;
|
||||
FT_Pos y;
|
||||
FT_Fixed uu;
|
||||
|
||||
/* the polynom is "a*x^3 + 3b*x^2 + 3c*x + d", however, we also */
|
||||
/* have dP/dx(u) = 0, which implies that P(u) = b*u^2 + 2c*u + d */
|
||||
/* FT_Pos a = y4 - 3*y3 + 3*y2 - y1; */
|
||||
FT_Pos b = y3 - 2*y2 + y1;
|
||||
FT_Pos c = y2 - y1;
|
||||
FT_Pos d = y1;
|
||||
FT_Pos y;
|
||||
FT_Fixed uu;
|
||||
|
||||
FT_UNUSED ( y4 );
|
||||
|
||||
|
||||
/* The polynom is */
|
||||
/* */
|
||||
/* a*x^3 + 3b*x^2 + 3c*x + d . */
|
||||
/* */
|
||||
/* However, we also have */
|
||||
/* */
|
||||
/* dP/dx(u) = 0 , */
|
||||
/* */
|
||||
/* which implies that */
|
||||
/* */
|
||||
/* P(u) = b*u^2 + 2c*u + d */
|
||||
|
||||
if ( u > 0 && u < 0x10000L )
|
||||
{
|
||||
uu = FT_MulFix( u, u );
|
||||
@ -316,7 +330,7 @@
|
||||
/* always compare first and last points */
|
||||
if ( y1 < *min ) *min = y1;
|
||||
else if ( y1 > *max ) *max = y1;
|
||||
|
||||
|
||||
if ( y4 < *min ) *min = y4;
|
||||
else if ( y4 > *max ) *max = y4;
|
||||
|
||||
@ -334,47 +348,48 @@
|
||||
return;
|
||||
}
|
||||
|
||||
/* there are some split points, now, find them.. */
|
||||
/* There are some split points. Find them. */
|
||||
{
|
||||
FT_Pos a = y4 - 3*y3 + 3*y2 - y1;
|
||||
FT_Pos b = y3 - 2*y2 + y1;
|
||||
FT_Pos c = y2 - y1;
|
||||
FT_Pos d, t1;
|
||||
FT_Pos d;
|
||||
FT_Fixed t;
|
||||
|
||||
/* we need to solve "ax²+2bx+c" here, without floating points !! */
|
||||
/* the trick is to normalize to a different representation in order */
|
||||
/* to use our 16.16 fixed point routines.. */
|
||||
|
||||
|
||||
/* we need to solve "ax^2+2bx+c" here, without floating points! */
|
||||
/* The trick is to normalize to a different representation in order */
|
||||
/* to use our 16.16 fixed point routines. */
|
||||
/* */
|
||||
/* we're going to compute FT_MulFix(b,b) and FT_MulFix(a,c) after */
|
||||
/* the normalisation. these values must fit in a single 16.16 */
|
||||
/* We compute FT_MulFix(b,b) and FT_MulFix(a,c) after the */
|
||||
/* the normalization. These values must fit into a single 16.16 */
|
||||
/* value. */
|
||||
/* */
|
||||
/* we normalize a, b and c to "8.16" fixed float values to ensure */
|
||||
/* that their product is held in a "16.16" value.. */
|
||||
/* We normalize a, b, and c to "8.16" fixed float values to ensure */
|
||||
/* that their product is held in a "16.16" value. */
|
||||
/* */
|
||||
{
|
||||
FT_ULong t1, t2;
|
||||
int shift = 0;
|
||||
|
||||
|
||||
|
||||
t1 = (FT_ULong)((a >= 0) ? a : -a );
|
||||
t2 = (FT_ULong)((b >= 0) ? b : -b );
|
||||
t1 |= t2;
|
||||
t2 = (FT_ULong)((c >= 0) ? c : -c );
|
||||
t1 |= t2;
|
||||
|
||||
if ( t1 == 0 ) /* all coefficients are 0 !! */
|
||||
|
||||
if ( t1 == 0 ) /* all coefficients are 0! */
|
||||
return;
|
||||
|
||||
|
||||
if ( t1 > 0xFFFFFFL )
|
||||
{
|
||||
do
|
||||
{
|
||||
shift--;
|
||||
t1 >>= 1;
|
||||
}
|
||||
while ( t1 > 0xFFFFFFL );
|
||||
|
||||
} while ( t1 > 0xFFFFFFL );
|
||||
|
||||
a >>= shift;
|
||||
b >>= shift;
|
||||
c >>= shift;
|
||||
@ -385,9 +400,8 @@
|
||||
{
|
||||
shift++;
|
||||
t1 <<= 1;
|
||||
}
|
||||
while ( t1 < 0x800000L );
|
||||
|
||||
} while ( t1 < 0x800000L );
|
||||
|
||||
a <<= shift;
|
||||
b <<= shift;
|
||||
c <<= shift;
|
||||
@ -399,7 +413,7 @@
|
||||
{
|
||||
if ( b != 0 )
|
||||
{
|
||||
t = - FT_DivFix( c, b )/2;
|
||||
t = - FT_DivFix( c, b ) / 2;
|
||||
test_cubic_zero( y1, y2, y3, y4, t, min, max );
|
||||
}
|
||||
}
|
||||
@ -412,23 +426,23 @@
|
||||
|
||||
if ( d == 0 )
|
||||
{
|
||||
/* there is a single split point, at -b/a */
|
||||
/* there is a single split point at -b/a */
|
||||
t = - FT_DivFix( b, a );
|
||||
test_cubic_zero( y1, y2, y3, y4, t, min, max );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* there are two solutions, we need to filter them though */
|
||||
/* there are two solutions; we need to filter them though */
|
||||
d = FT_SqrtFixed( (FT_Int32)d );
|
||||
t = - FT_DivFix( b - d, a );
|
||||
test_cubic_zero( y1, y2, y3, y4, t, min, max );
|
||||
|
||||
|
||||
t = - FT_DivFix( b + d, a );
|
||||
test_cubic_zero( y1, y2, y3, y4, t, min, max );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -239,50 +239,49 @@
|
||||
FT_UInt32 y,
|
||||
FT_Int64 *z )
|
||||
{
|
||||
{
|
||||
FT_UInt32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
|
||||
FT_UInt32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
|
||||
|
||||
|
||||
lo1 = x & 0x0000FFFFU; hi1 = x >> 16;
|
||||
lo2 = y & 0x0000FFFFU; hi2 = y >> 16;
|
||||
lo1 = x & 0x0000FFFFU; hi1 = x >> 16;
|
||||
lo2 = y & 0x0000FFFFU; hi2 = y >> 16;
|
||||
|
||||
lo = lo1 * lo2;
|
||||
i1 = lo1 * hi2;
|
||||
i2 = lo2 * hi1;
|
||||
hi = hi1 * hi2;
|
||||
lo = lo1 * lo2;
|
||||
i1 = lo1 * hi2;
|
||||
i2 = lo2 * hi1;
|
||||
hi = hi1 * hi2;
|
||||
|
||||
/* Check carry overflow of i1 + i2 */
|
||||
i1 += i2;
|
||||
hi += (FT_UInt32)( i1 < i2 ) << 16;
|
||||
/* Check carry overflow of i1 + i2 */
|
||||
i1 += i2;
|
||||
hi += (FT_UInt32)( i1 < i2 ) << 16;
|
||||
|
||||
hi += i1 >> 16;
|
||||
i1 = i1 << 16;
|
||||
hi += i1 >> 16;
|
||||
i1 = i1 << 16;
|
||||
|
||||
/* Check carry overflow of i1 + lo */
|
||||
lo += i1;
|
||||
hi += ( lo < i1 );
|
||||
/* Check carry overflow of i1 + lo */
|
||||
lo += i1;
|
||||
hi += ( lo < i1 );
|
||||
|
||||
z->lo = lo;
|
||||
z->hi = hi;
|
||||
}
|
||||
z->lo = lo;
|
||||
z->hi = hi;
|
||||
}
|
||||
|
||||
|
||||
static FT_UInt32
|
||||
ft_div64by32( FT_UInt32 hi,
|
||||
FT_UInt32 lo,
|
||||
FT_UInt32 y )
|
||||
FT_UInt32 y )
|
||||
{
|
||||
FT_UInt r, q;
|
||||
FT_Int i;
|
||||
|
||||
FT_Int i;
|
||||
|
||||
|
||||
q = 0;
|
||||
r = hi;
|
||||
|
||||
if ( r >= y )
|
||||
return (FT_UInt32)0x7FFFFFFF;
|
||||
|
||||
i = 32;
|
||||
r = hi;
|
||||
|
||||
if ( r >= y )
|
||||
return (FT_UInt32)0x7FFFFFFFL;
|
||||
|
||||
i = 32;
|
||||
do
|
||||
{
|
||||
r <<= 1;
|
||||
@ -295,10 +294,9 @@
|
||||
q |= 1;
|
||||
}
|
||||
lo <<= 1;
|
||||
}
|
||||
while (--i);
|
||||
|
||||
return q;
|
||||
} while ( --i );
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
@ -310,6 +308,7 @@
|
||||
{
|
||||
register FT_UInt32 lo, hi, max;
|
||||
|
||||
|
||||
max = x->lo > y->lo ? x->lo : y->lo;
|
||||
lo = x->lo + y->lo;
|
||||
hi = x->hi + y->hi + ( lo < max );
|
||||
@ -319,15 +318,13 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* documentation is in freetype.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Long ) FT_MulDiv( FT_Long a,
|
||||
FT_Long b,
|
||||
FT_Long c )
|
||||
{
|
||||
long s;
|
||||
long s;
|
||||
|
||||
|
||||
if ( a == 0 || b == c )
|
||||
@ -347,10 +344,10 @@
|
||||
|
||||
|
||||
ft_multo64( a, b, &temp );
|
||||
|
||||
temp2.hi = 0;
|
||||
temp2.lo = (FT_UInt32)(c >> 1);
|
||||
FT_Add64( &temp, &temp2, &temp );
|
||||
|
||||
temp2.hi = 0;
|
||||
temp2.lo = (FT_UInt32)(c >> 1);
|
||||
FT_Add64( &temp, &temp2, &temp );
|
||||
a = ft_div64by32( temp.hi, temp.lo, b );
|
||||
}
|
||||
else
|
||||
@ -440,13 +437,14 @@
|
||||
FT_Int32 y,
|
||||
FT_Int64 *z )
|
||||
{
|
||||
FT_Int32 s;
|
||||
FT_Int32 s;
|
||||
|
||||
|
||||
s = x; x = ABS( x );
|
||||
s ^= y; y = ABS( y );
|
||||
|
||||
ft_multo64( x, y, z );
|
||||
|
||||
if ( s < 0 )
|
||||
{
|
||||
z->lo = (FT_UInt32)-(FT_Int32)z->lo;
|
||||
@ -476,7 +474,7 @@
|
||||
if ( x->hi == 0 )
|
||||
{
|
||||
if ( y > 0 )
|
||||
q = (x->lo + (y >> 1)) / y;
|
||||
q = ( x->lo + ( y >> 1 ) ) / y;
|
||||
else
|
||||
q = 0x7FFFFFFFL;
|
||||
|
||||
@ -484,6 +482,7 @@
|
||||
}
|
||||
|
||||
q = ft_div64by32( x->hi, x->lo, y );
|
||||
|
||||
return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
|
||||
}
|
||||
|
||||
@ -563,20 +562,20 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
||||
|
||||
|
||||
|
||||
#endif /* FT_LONG64 */
|
||||
|
||||
|
||||
/* a not-so-fast but working 16.16 fixed point square root function */
|
||||
/* a not-so-fast but working 16.16 fixed point square root function */
|
||||
|
||||
FT_EXPORT_DEF( FT_Int32 ) FT_SqrtFixed( FT_Int32 x )
|
||||
{
|
||||
FT_UInt32 root, rem_hi, rem_lo, test_div;
|
||||
FT_Int count;
|
||||
|
||||
|
||||
root = 0;
|
||||
|
||||
if ( x > 0 )
|
||||
@ -584,19 +583,19 @@
|
||||
rem_hi = 0;
|
||||
rem_lo = x;
|
||||
count = 24;
|
||||
do
|
||||
do
|
||||
{
|
||||
rem_hi = (rem_hi << 2) | (rem_lo >> 30);
|
||||
rem_hi = ( rem_hi << 2 ) | ( rem_lo >> 30 );
|
||||
rem_lo <<= 2;
|
||||
root <<= 1;
|
||||
test_div = (root << 1) + 1;
|
||||
test_div = ( root << 1 ) + 1;
|
||||
|
||||
if ( rem_hi >= test_div )
|
||||
{
|
||||
rem_hi -= test_div;
|
||||
root += 1;
|
||||
}
|
||||
}
|
||||
while (--count);
|
||||
} while ( --count );
|
||||
}
|
||||
|
||||
return (FT_Int32)root;
|
||||
|
@ -247,7 +247,7 @@
|
||||
|
||||
TScan last_ey;
|
||||
|
||||
FT_Vector bez_stack[32 * 3+1];
|
||||
FT_Vector bez_stack[32 * 3 + 1];
|
||||
int lev_stack[32];
|
||||
|
||||
FT_Outline outline;
|
||||
|
Loading…
Reference in New Issue
Block a user