* include/freetype/ftcache.h: Delete duplicated definition of

FTC_FaceID.

* src/cff/cffdrivr.c (cff_get_cmap_info): Call sfnt module's TT CMap
Info service function if the cmap comes from sfnt.  Return 0 if the
cmap is sythesized in cff module.

Formatting; updating copyright.
This commit is contained in:
Werner Lemberg 2004-01-22 09:07:12 +00:00
parent 271b1e1633
commit 6cda9c489d
24 changed files with 873 additions and 816 deletions

View File

@ -1,3 +1,17 @@
2004-01-20 Masatake YAMATO <jet@gyve.org>
* include/freetype/ftcache.h: Delete duplicated definition of
FTC_FaceID.
* src/cff/cffdrivr.c (cff_get_cmap_info): Call sfnt module's TT CMap
Info service function if the cmap comes from sfnt. Return 0 if the
cmap is sythesized in cff module.
2004-01-20 David Turner <david@freetype.org>
* src/cache/ftcmanag.c (ftc_size_node_compare): Call
FT_Activate_Size.
2004-01-20 Werner Lemberg <wl@gnu.org>
* src/type1/t1parse.c (T1_Get_Private_Dict): Skip exactly one
@ -5,36 +19,44 @@
2004-01-18 David Turner <david@freetype.org>
* src/sfnt/ttsbit.c: removed compiler warning
* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Remove compiler
warning.
* src/tools/docmaker/*: updating beautifier tool
* src/tools/docmaker/*: Updating beautifier tool.
2004-01-15 David Turner <david@freetype.org>
* src/base/ftoutln.c (ft_orientation_extremum_compute): fixing
infinite loop bug !
* src/base/ftoutln.c (ft_orientation_extremum_compute): Fix
infinite loop bug.
* src/base/ftstroke.c, include/freetype/ftstroke.h: fixing bugs and
adding FT_Glyph_Stroke and FT_Glyph_StrokerBorder APIs
* include/freetype/ftstroke.h: Include FT_GLYPH_H.
(FT_Stroker_Rewind, FT_Glyph_Stroke, FT_Glyph_StrokeBorder): New
declarations.
* include/freetype/ftcache.h, include/freetype/cache/ftcmanag.h:
adding FTC_Manager_LookupSize and FTC_Scaler to the public API
(they were previously hidden)
* src/base/ftstroke.c: Include FT_INTERNAL_OBJECTS_H.
(FT_Outline_GetOutsideBorder): Inverse result.
(FT_Stroker_Rewind, FT_Glyph_Stroke, FT_GlyphStrokeBorder): New
functions.
(FT_Stroker_EndSubPath): Close path if needed.
(FT_Stroker_Set, FT_Stroker_ParseOutline): Use FT_Stroker_Rewind.
* src/tools/docmaker/*: updating the DocMaker tool, adding a new
tool named "docbeauty" to beautify the documentation comments
(e.g. convert them to a single block border mode)
* include/freetype/cache/ftcmanag.h (FTC_ScalerRec,
FTC_Manager_LookupSize): Moved to...
* include/freetype/ftcache.h (FTC_ScalerRec,
FTC_Manager_LookupSize): Here.
* src/tools/docmaker/docbeauty.py: New file to beautify the
documentation comments (e.g., to convert them to single block border
mode).
* src/tools/docmaker/docmaker.py (file_exists, make_file_list):
Moved to...
* src/tools/docmaker/utils.py (file_exists, make_file_list): Here.
2004-01-14 David Turner <david@freetype.org>
* include/freetype/internal/ftmemory.h,
src/autohint/ahhint.c, src/base/ftgloadr.c,
src/base/ftglyph.c, src/base/ftoutln.c,
src/base/ftstroke.c, src/cff/cffload.c, src/truetype/ttgload.c,
src/truetype/ttinterp.c:
introducing the new FT_ARRAY_COPY and FT_ARRAY_MOVE macros
to make copying arrays easier
* include/freetype/internal/ftmemory.h (FT_ARRAY_COPY,
FT_ARRAY_MOVE): New macros to make copying arrays easier.
Updated all relevant code to use them.
2004-01-14 Werner Lemberg <wl@gnu.org>

View File

@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (specification). */
/* */
/* Copyright 2000-2001, 2003 by */
/* Copyright 2000-2001, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* FreeType Cache subsystem (specification). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -354,17 +354,6 @@ FT_BEGIN_HEADER
FT_Face *aface );
/*************************************************************************/
/* */
/* <Type> */
/* FTC_Scaler */
/* */
/* <Description> */
/* Handle to a @FTC_ScalerRec structure. */
/* */
typedef struct FTC_FaceIDRec_* FTC_FaceID;
/*************************************************************************/
/* */
/* <Struct> */
@ -372,24 +361,25 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* A structure used to describe a given character size in either */
/* pixels or points to the cache manager. See @FTC_Manager_LookupSize */
/* pixels or points to the cache manager. See */
/* @FTC_Manager_LookupSize. */
/* */
/* <Fields> */
/* face_id :: source face id */
/* face_id :: The source face ID. */
/* */
/* width :: character width */
/* width :: The character width. */
/* */
/* height :: character height */
/* height :: The character height. */
/* */
/* pixel :: booelan. If TRUE, the "width" and "height" fields */
/* pixel :: A Boolean. If TRUE, the `width' and `height' fields */
/* are interpreted as integer pixel character sizes. */
/* If false, they are expressed as 1/64th of points */
/* Otherwise, they are expressed as 1/64th of points. */
/* */
/* x_res :: only used when 'pixel' is FALSE. indicates the */
/* horizontal resolution in dpis */
/* x_res :: Only used when `pixel' is FALSE to indicate the */
/* horizontal resolution in dpi. */
/* */
/* y_res :: only used when 'pixel' is FALSE. indicates the */
/* vertical resolution in dpis */
/* y_res :: Only used when `pixel' is FALSE to indicate the */
/* vertical resolution in dpi. */
/* */
/* <Note> */
/* This type is mainly used to retrieve @FT_Size objects through the */
@ -407,20 +397,19 @@ FT_BEGIN_HEADER
} FTC_ScalerRec, *FTC_Scaler;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_LookupSize */
/* */
/* <Description> */
/* Retrieves the @FT_Size object that corresponds to a given */
/* Retrieve the @FT_Size object that corresponds to a given */
/* @FTC_Scaler through a cache manager. */
/* */
/* <Input> */
/* manager :: A handle to the cache manager. */
/* */
/* scaler :: scaler handle. */
/* scaler :: A scaler handle. */
/* */
/* <Output> */
/* asize :: A handle to the size object. */
@ -430,10 +419,10 @@ FT_BEGIN_HEADER
/* */
/* <Note> */
/* The returned @FT_Size object is always owned by the manager. You */
/* should never try to discard it yourself. */
/* should never try to discard it by yourself. */
/* */
/* You can access the parent @FT_Face object simply as "size->face" */
/* if you need it. Note that this object is also owner by the */
/* You can access the parent @FT_Face object simply as `size->face' */
/* if you need it. Note that this object is also owned by the */
/* manager. */
/* */
FT_EXPORT( FT_Error )

View File

@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (specification). */
/* */
/* Copyright 2002, 2003 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -242,8 +242,9 @@ FT_BEGIN_HEADER
*
* @description:
* Reset a stroker object without changing its attributes.
* you should call this function before beginning a new
* series of calls to @FT_Stroker_BeginSubPath/@FT_Stroker_EndSubPath
* You should call this function before beginning a new
* series of calls to @FT_Stroker_BeginSubPath or
* @FT_Stroker_EndSubPath.
*
* @input:
* stroker ::
@ -284,7 +285,7 @@ FT_BEGIN_HEADER
* If `opened' is 1, the outline is processed as an open path, and the
* stroker will generate a single `stroke' outline.
*
* this function calls @FT_Stroker_Rewind automatically
* This function calls @FT_Stroker_Rewind automatically.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ParseOutline( FT_Stroker stroker,
@ -612,24 +613,25 @@ FT_BEGIN_HEADER
* FT_Glyph_Stroke
*
* @description:
* stroke a given outline glyph object with a given stroker
* Stroke a given outline glyph object with a given stroker.
*
* @inout:
* pglyph :: source glyph handle on input, new glyph handle
* pglyph :: Source glyph handle on input, new glyph handle
* on output.
*
* @input:
* stroker ::
* A stroker handle.
*
* destroy :: boolean. If TRUE, the source glyph object is destroyed
* on success
* destroy ::
* A Boolean. If TRUE, the source glyph object is destroyed
* on success.
*
* @return:
* FreeType error code. 0 means success
* FreeType error code. 0 means success.
*
* @note:
* the source glyph is untouched in case of error.
* The source glyph is untouched in case of error.
*/
FT_EXPORT( FT_Error )
FT_Glyph_Stroke( FT_Glyph *pglyph,
@ -643,28 +645,30 @@ FT_BEGIN_HEADER
* FT_Glyph_StrokeBorder
*
* @description:
* stroke a given outline glyph object with a given stroker, but
* only returns either its inside or outside border
* Stroke a given outline glyph object with a given stroker, but
* only return either its inside or outside border.
*
* @inout:
* pglyph :: source glyph handle on input, new glyph handle
* on output.
* pglyph ::
* Source glyph handle on input, new glyph handle on output.
*
* @input:
* stroker ::
* A stroker handle.
*
* inside :: boolean. If TRUE, return the inside border; otherwise,
* the outside border
* inside ::
* A Boolean. If TRUE, return the inside border, otherwise
* the outside border.
*
* destroy :: boolean. If TRUE, the source glyph object is destroyed
* on success
* destroy ::
* A Boolean. If TRUE, the source glyph object is destroyed
* on success.
*
* @return:
* FreeType error code. 0 means success
* FreeType error code. 0 means success.
*
* @note:
* the source glyph is untouched in case of error.
* The source glyph is untouched in case of error.
*/
FT_EXPORT( FT_Error )
FT_Glyph_StrokeBorder( FT_Glyph *pglyph,

View File

@ -4,7 +4,7 @@
/* */
/* The FreeType memory management macros (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -180,11 +180,12 @@ FT_BEGIN_HEADER
#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
#define FT_ARRAY_COPY( dest, source, count ) \
FT_MEM_COPY( dest, source, (count)*sizeof(*(dest)) )
#define FT_ARRAY_COPY( dest, source, count ) \
FT_MEM_COPY( dest, source, (count) * sizeof( *(dest) ) )
#define FT_ARRAY_MOVE( dest, source, count ) \
FT_MEM_MOVE( dest, source, (count) * sizeof( *(dest) ) )
#define FT_ARRAY_MOVE( dest, source, count ) \
FT_MEM_MOVE( dest, source, (count)*sizeof(*(dest)) )
/*************************************************************************/
/* */

View File

@ -4,7 +4,7 @@
/* */
/* Glyph hinter (body). */
/* */
/* Copyright 2000-2001, 2002, 2003 Catharon Productions Inc. */
/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */
/* Author: David Turner */
/* */
/* This file is part of the Catharon Typography Project and shall only */

View File

@ -4,7 +4,7 @@
/* */
/* The FreeType glyph loader (body). */
/* */
/* Copyright 2002, 2003 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* FreeType convenience functions to handle glyphs (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* FreeType outline management (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (body). */
/* */
/* Copyright 2002, 2003 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -1416,8 +1416,7 @@
FT_Angle turn;
FT_Int inside_side;
/* close the path if needed
*/
/* close the path if needed */
if ( stroker->center.x != stroker->subpath_start.x ||
stroker->center.y != stroker->subpath_start.y )
{
@ -1747,9 +1746,9 @@
}
extern const FT_Glyph_Class ft_outline_glyph_class;
FT_EXPORT_DEF( FT_Error )
FT_Glyph_Stroke( FT_Glyph *pglyph,
FT_Stroker stroker,
@ -1758,6 +1757,7 @@
FT_Error error = FT_Err_Invalid_Argument;
FT_Glyph glyph = NULL;
if ( pglyph == NULL )
goto Exit;
@ -1768,6 +1768,7 @@
{
FT_Glyph copy;
error = FT_Glyph_Copy( glyph, &copy );
if ( error )
goto Exit;
@ -1780,15 +1781,17 @@
FT_Outline* outline = &oglyph->outline;
FT_UInt num_points, num_contours;
error = FT_Stroker_ParseOutline( stroker, outline, 0 );
if (error)
if ( error )
goto Fail;
(void)FT_Stroker_GetCounts( stroker, &num_points, &num_contours );
FT_Outline_Done( glyph->library, outline );
error = FT_Outline_New( glyph->library, num_points, num_contours, outline );
error = FT_Outline_New( glyph->library,
num_points, num_contours, outline );
if ( error )
goto Fail;
@ -1825,6 +1828,7 @@
FT_Error error = FT_Err_Invalid_Argument;
FT_Glyph glyph = NULL;
if ( pglyph == NULL )
goto Exit;
@ -1835,6 +1839,7 @@
{
FT_Glyph copy;
error = FT_Glyph_Copy( glyph, &copy );
if ( error )
goto Exit;
@ -1848,12 +1853,13 @@
FT_Outline* outline = &oglyph->outline;
FT_UInt num_points, num_contours;
border = FT_Outline_GetOutsideBorder( outline );
if ( inside )
border = 1-border;
border = 1 - border;
error = FT_Stroker_ParseOutline( stroker, outline, 0 );
if (error)
if ( error )
goto Fail;
(void)FT_Stroker_GetBorderCounts( stroker, border,
@ -1892,5 +1898,4 @@
}
/* END */

View File

@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (body). */
/* */
/* Copyright 2000-2001, 2002, 2003 by */
/* Copyright 2000-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -29,6 +29,7 @@
#include "cffdrivr.h"
#include "cffgload.h"
#include "cffload.h"
#include "cffcmap.h"
#include "cfferrs.h"
@ -340,22 +341,40 @@
/*
* (empty) TT CMAP INFO
* TT CMAP INFO
*
* Hide TT CMAP INFO service defined in SFNT module;
* just return 0.
* If the charmap is a synthetic Unicode encoding cmap or
* a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO
* service defined in SFNT module.
*
* Otherwise call the service function in the sfnt module.
*
*/
static FT_Error
cff_get_cmap_info( FT_CharMap charmap,
TT_CMapInfo *cmap_info )
{
FT_UNUSED( charmap );
FT_CMap cmap = FT_CMAP( charmap );
FT_Error error = CFF_Err_Ok;
cmap_info->language = 0;
return CFF_Err_Ok;
if ( cmap->clazz != &cff_cmap_encoding_class_rec &&
cmap->clazz != &cff_cmap_unicode_class_rec )
{
FT_Face face = FT_CMAP_FACE( cmap );
FT_Library library = FT_FACE_LIBRARY( face );
FT_Module sfnt = FT_Get_Module( library, "sfnt" );
FT_Service_TTCMaps service = ft_module_get_service (
sfnt, FT_SERVICE_ID_TT_CMAP );
if ( service && service->get_cmap_info )
error = service->get_cmap_info( charmap, cmap_info );
}
return error;
}

View File

@ -4,7 +4,7 @@
/* */
/* OpenType and CFF data/program tables loader (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 parser (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -59,6 +59,7 @@
FT_Byte buffer[256 + 10];
FT_Int buff_len;
FT_Byte *cur, *limit;
FT_Byte *arg1, *arg2;
FT_MEM_ZERO( parser, sizeof ( *parser ) );
@ -135,16 +136,26 @@
parser->root.limit = parser->root.cursor + ps_len;
parser->num_dict = -1;
/* finally we check whether `StartData' was real -- it could be */
/* in a comment or string */
/* Finally, we check whether `StartData' was real -- it could be */
/* in a comment or string. We also get its arguments to find out */
/* whether the data is represented in binary or hex format. */
limit = parser->root.limit;
cur = parser->root.cursor;
arg1 = cur;
cid_parser_skip_PS_token( parser );
cid_parser_skip_spaces ( parser );
arg2 = cur;
cid_parser_skip_PS_token( parser );
cid_parser_skip_spaces ( parser );
while ( cur < limit )
{
if ( *cur == 'S' && ft_strncmp( (char*)cur, "StartData", 9 ) == 0 )
{
if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 )
parser->data_type = 1;
limit = parser->root.limit;
cur = parser->root.cursor;
goto Exit;
@ -152,7 +163,9 @@
cid_parser_skip_PS_token( parser );
cid_parser_skip_spaces ( parser );
cur = parser->root.cursor;
arg1 = arg2;
arg2 = cur;
cur = parser->root.cursor;
}
/* we haven't found the correct `StartData'; go back and continue */

View File

@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 parser (specification). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -50,6 +50,9 @@ FT_BEGIN_HEADER
/* data_offset :: The start position of the binary data (i.e., the */
/* end of the data to be parsed. */
/* */
/* data_type :: If true, the binary data is represented in */
/* hexadecimal format. */
/* */
/* cid :: A structure which holds the information about */
/* the current font. */
/* */
@ -64,6 +67,7 @@ FT_BEGIN_HEADER
FT_Long postscript_len;
FT_ULong data_offset;
FT_Bool data_type;
CID_FaceInfo cid;
FT_Int num_dict;

View File

@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -636,7 +636,7 @@
for ( i = 0; i < face->num_sbit_strikes; i++ )
{
if ( ( (FT_UInt)face->sbit_strikes[i].y_ppem == y_ppem ) &&
( ( x_ppem == 0 ) ||
( ( x_ppem == 0 ) ||
( (FT_UInt)face->sbit_strikes[i].x_ppem == x_ppem ) ) )
{
*astrike_index = i;

File diff suppressed because it is too large Load Diff

View File

@ -1,109 +1,109 @@
#!/usr/bin/env python
#
# DocBeauty 0.1 (c) 2003 David Turner <david@freetype.org>
#
# This program is used to beautify the documentation comments used
# in the FreeType 2 public headers.
#
from sources import *
from content import *
from utils import *
import utils
import sys, os, time, string, getopt
content_processor = ContentProcessor()
def beautify_block( block ):
if block.content:
content_processor.reset()
markups = content_processor.process_content( block.content )
text = []
first = 1
for markup in markups:
text.extend( markup.beautify( first ) )
first = 0
# now beautify the documentation "borders" themselves
lines = [ " /*************************************************************************" ]
for l in text:
lines.append( " *" + l )
lines.append( " */" )
block.lines = lines
def usage():
print "\nDocBeauty 0.1 Usage information\n"
print " docbeauty [options] file1 [ file2 ... ]\n"
print "using the following options:\n"
print " -h : print this page"
print " -b : backup original files with the 'orig' extension"
print ""
print " --backup : same as -b"
def main( argv ):
"""main program loop"""
global output_dir
try:
opts, args = getopt.getopt( sys.argv[1:],
"hb",
[ "help", "backup" ] )
except getopt.GetoptError:
usage()
sys.exit( 2 )
if args == []:
usage()
sys.exit( 1 )
# process options
#
output_dir = None
do_backup = None
for opt in opts:
if opt[0] in ( "-h", "--help" ):
usage()
sys.exit( 0 )
if opt[0] in ( "-b", "--backup" ):
do_backup = 1
# create context and processor
source_processor = SourceProcessor()
# retrieve the list of files to process
file_list = make_file_list( args )
for filename in file_list:
source_processor.parse_file( filename )
for block in source_processor.blocks:
beautify_block( block )
new_name = filename + ".new"
ok = None
try:
file = open( new_name, "wt" )
for block in source_processor.blocks:
for line in block.lines:
file.write( line )
file.write( "\n" )
file.close()
except:
ok = 0
# if called from the command line
#
if __name__ == '__main__':
main( sys.argv )
# eof
#!/usr/bin/env python
#
# DocBeauty (c) 2003, 2004 David Turner <david@freetype.org>
#
# This program is used to beautify the documentation comments used
# in the FreeType 2 public headers.
#
from sources import *
from content import *
from utils import *
import utils
import sys, os, time, string, getopt
content_processor = ContentProcessor()
def beautify_block( block ):
if block.content:
content_processor.reset()
markups = content_processor.process_content( block.content )
text = []
first = 1
for markup in markups:
text.extend( markup.beautify( first ) )
first = 0
# now beautify the documentation "borders" themselves
lines = [ " /*************************************************************************" ]
for l in text:
lines.append( " *" + l )
lines.append( " */" )
block.lines = lines
def usage():
print "\nDocBeauty 0.1 Usage information\n"
print " docbeauty [options] file1 [ file2 ... ]\n"
print "using the following options:\n"
print " -h : print this page"
print " -b : backup original files with the 'orig' extension"
print ""
print " --backup : same as -b"
def main( argv ):
"""main program loop"""
global output_dir
try:
opts, args = getopt.getopt( sys.argv[1:],
"hb",
[ "help", "backup" ] )
except getopt.GetoptError:
usage()
sys.exit( 2 )
if args == []:
usage()
sys.exit( 1 )
# process options
#
output_dir = None
do_backup = None
for opt in opts:
if opt[0] in ( "-h", "--help" ):
usage()
sys.exit( 0 )
if opt[0] in ( "-b", "--backup" ):
do_backup = 1
# create context and processor
source_processor = SourceProcessor()
# retrieve the list of files to process
file_list = make_file_list( args )
for filename in file_list:
source_processor.parse_file( filename )
for block in source_processor.blocks:
beautify_block( block )
new_name = filename + ".new"
ok = None
try:
file = open( new_name, "wt" )
for block in source_processor.blocks:
for line in block.lines:
file.write( line )
file.write( "\n" )
file.close()
except:
ok = 0
# if called from the command line
#
if __name__ == '__main__':
main( sys.argv )
# eof

View File

@ -1,16 +1,16 @@
#!/usr/bin/env python
#
# DocMaker 0.2 (c) 2002 David Turner <david@freetype.org>
# DocMaker (c) 2002, 2004 David Turner <david@freetype.org>
#
# This program is a re-write of the original DocMaker took used
# to generate the API Reference of the FreeType font engine
# by converting in-source comments into structured HTML
# by converting in-source comments into structured HTML.
#
# This new version is capable of outputting XML data, as well
# as accepts more liberal formatting options
# as accepts more liberal formatting options.
#
# It also uses regular expression matching and substitution
# to speed things significantly
# to speed things significantly.
#
from sources import *
@ -25,7 +25,7 @@ import sys, os, time, string, glob, getopt
def usage():
print "\nDocMaker 0.2 Usage information\n"
print "\nDocMaker Usage information\n"
print " docmaker [options] file1 [ file2 ... ]\n"
print "using the following options:\n"
print " -h : print this page"

View File

@ -1,15 +1,15 @@
from sources import *
from content import *
from utils import *
# This is the base Formatter class. its purpose is to convert
# a content processor's data into specific documents (i.e. table of
# contents, global index, and individual API reference indices).
#
# You'll need to sub-class it to output anything sensible. For example,
# the file tohtml.py contains the definition of the HtmlFormatter sub-class
# used to output, you guessed it, HTML !
#
# This is the base Formatter class. its purpose is to convert
# a content processor's data into specific documents (i.e. table of
# contents, global index, and individual API reference indices).
#
# You'll need to sub-class it to output anything sensible. For example,
# the file tohtml.py contains the definition of the HtmlFormatter sub-class
# used to output, you guessed it, HTML.
#
class Formatter:

View File

@ -223,7 +223,7 @@ class SourceBlock:
if len(l) > 0:
for tag in re_markup_tags:
if tag.match( l ):
self.content = lines
self.content = lines
return
def location( self ):
@ -328,9 +328,9 @@ class SourceProcessor:
"""process a normal line and check if it's the start of a new block"""
for f in re_source_block_formats:
if f.start.match( line ):
self.add_block_lines()
self.add_block_lines()
self.format = f
self.lineno = fileinput.filelineno()
self.lineno = fileinput.filelineno()
self.lines.append( line )

View File

@ -85,7 +85,7 @@ def check_output( ):
sys.exit( 2 )
else:
output_dir = None
def file_exists( pathname ):
"""checks that a given file exists"""
result = 1

View File

@ -4,7 +4,7 @@
/* */
/* TrueType Glyph Loader (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (body). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */