Formatting.

This commit is contained in:
Werner Lemberg 2001-06-19 23:03:41 +00:00
parent 0b3a99153a
commit 8eb0353fec
44 changed files with 348 additions and 285 deletions

View File

@ -1,20 +1,35 @@
2001-06-19 David Turner <david@freetype.org>
* builds/win32/visualc/freetype.dsp, builds/win32/visualc/index.html:
updated the Visual C++ project (for the 2.0.4 release)
Updated the Visual C++ project (for the 2.0.4 release).
* builds/unix/detect.mk: added rule for AIX detection (which uses
/usr/sbin/init instead of /sbin/init, go figure..)
* builds/unix/detect.mk: Added rule for AIX detection (which uses
/usr/sbin/init instead of /sbin/init).
* include/freetype/fterrors.h: updated some of the error macros to
simplify Werner's latest tricks :o)
* include/freetype/fterrors.h, src/*/*err*.h: Updated some of the
error macros to simplify handling of new error scheme.
* include/freetype/freetype.h (FT_New_Memory_Face): updated docs
2001-06-19 Werner Lemberg <wl@gnu.org>
* include/freetype/fttypes.h (FT_ERROR_MODULE): New macro.
2001-06-19 David Turner <david@freetype.org>
Removing _lots_ of compiler warnings when the most pedantic warning
levels of Visual C++ and Borland C++ are used. Too many files to be
listed here.., but FT2 now compiles without warnings with VC++ and
the "/W4" warning level (lint-style)
listed here, but FT2 now compiles without warnings with VC++ and the
"/W4" warning level (lint-style).
* include/freetype/freetype.h (FT_New_Memory_Face): Updated
documentation.
* include/freetype/fttypes.h (FT_BOOL): New macro.
* include/freetype/internal/ftdebug.h: Add #pragma for Visual C++
to suppress warning.
* include/freetype/internal/ftstream.h (FT_GET_SHORT_{BE,LE},
FT_GET_OFF3_{BE,LE}, FT_GET_LONG_{BE,LE}): New macros.
(NEXT_*): Use them.
* src/autohint/ahglobal.c: Include FT_INTERNAL_DEBUG_H.
(FT_New_Memory_Face): Add `const' to function declaration.
2001-06-18 Werner Lemberg <wl@gnu.org>

View File

@ -1536,10 +1536,10 @@ FT_BEGIN_HEADER
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* the font data bytes are used _directly_ by the @FT_Face object. */
/* this means that they're not copied, and that the client is */
/* The font data bytes are used _directly_ by the @FT_Face object. */
/* This means that they are not copied, and that the client is */
/* responsible for releasing/destroying them _after_ the */
/* corresponding call to @FT_Done_Face */
/* corresponding call to @FT_Done_Face . */
/* */
/* Unlike FreeType 1.x, this function automatically creates a glyph */
/* slot for the face object which can be accessed directly through */

View File

@ -13,56 +13,61 @@
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This special header file is used to define the FT2 enumeration */
/* constants. It can also be used to generate error message strings */
/* with a small macro trick explained below. */
/* */
/* I - Error Formats: */
/* ------------------ */
/* I - Error Formats */
/* ----------------- */
/* */
/* Since release 2.1, the error constants have changed. The lower byte */
/* of the error value gives the "generic" error code, while the higher */
/* bytes indicates in which module the error occured. */
/* Since release 2.1, the error constants have changed. The lower */
/* byte of the error value gives the "generic" error code, while the */
/* higher byte indicates in which module the error occured. */
/* */
/* You can use the macro FT_ERROR_BASE(x) macro to extract the */
/* generic error code from a FT_Error */
/* You can use the macro FT_ERROR_BASE(x) macro to extract the generic */
/* error code from an FT_Error value. */
/* */
/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can */
/* be undefined in ftoption.h in order to make the higher byte always */
/* zero, in case you'd need to be compatible with previous versions */
/* of FT2. */
/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
/* undefined in ftoption.h in order to make the higher byte always */
/* zero, in case you need to be compatible with previous versions of */
/* FreeType 2. */
/* */
/* */
/* II - Error Message strings: */
/* --------------------------- */
/* II - Error Message strings */
/* -------------------------- */
/* */
/* The error definitions below are made through special macros that */
/* allow client applications to build a table of error message strings */
/* if they need it. The strings are not included in a normal build of */
/* FT2 to save space (most client apps do not use them) */
/* FreeType 2 to save space (most client applications do not use */
/* them). */
/* */
/* To do so, you'll need to define the following macros before */
/* including this file: */
/* To do so, you have to define the following macros before including */
/* this file: */
/* */
/* FT_ERROR_START_LIST :: */
/* this macro is called before anything else to define the */
/* start of the error list. It is followed by several */
/* FT_ERROR_DEF calls (see below) */
/* This macro is called before anything else to define the start of */
/* the error list. It is followed by several FT_ERROR_DEF calls */
/* (see below). */
/* */
/* FT_ERROR_DEF( e, v, s ) :: */
/* this macro is called to define one single error. */
/* 'e' is the error code identifier (e.g. FT_Err_Invalid_Argument) */
/* 'v' is the error numerical value */
/* 's' is the corresponding error string */
/* This macro is called to define one single error. */
/* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */
/* `v' is the error numerical value. */
/* `s' is the corresponding error string. */
/* */
/* FT_ERROR_END_LIST :: */
/* this macro is used to end the list. */
/* This macro ends the list. */
/* */
/* Additionally, you'll need to undefine __FTERRORS_H__ before */
/* #including this file. */
/* Additionally, you have to undefine __FTERRORS_H__ before #including */
/* this file. */
/* */
/* Here's a simple example: */
/* Here is a simple example: */
/* */
/* { */
/* #undef __FTERRORS_H__ */
@ -79,15 +84,17 @@
/* #include FT_ERRORS_H */
/* } */
/* */
/* */
/***************************************************************************/
/*************************************************************************/
#ifndef __FTERRORS_H__
#define __FTERRORS_H__
/* include module base error codes */
#include FT_MODULE_ERRORS_H
/*******************************************************************/
/*******************************************************************/
/***** *****/
@ -96,34 +103,37 @@
/*******************************************************************/
/*******************************************************************/
#undef FT_NEED_EXTERN_C
#define FT_ERR_XCAT( x, y ) x ## y
#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
/* FT_ERR_PREFIX is used as a prefix for error identifiers */
/* by default, we use "FT_Err_" */
/* FT_ERR_PREFIX is used as a prefix for error identifiers. */
/* By default, we use `FT_Err_'. */
/* */
#ifndef FT_ERR_PREFIX
#define FT_ERR_PREFIX FT_Err_
#endif
/* FT_ERR_BASE is used as the base for module-specific errors */
/* FT_ERR_BASE is used as the base for module-specific errors. */
/* */
#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
#ifndef FT_ERR_BASE
#define FT_ERR_BASE FT_Mod_Err_Base
#endif
#else
#define FT_ERR_BASE 0
#endif
#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
/* if FT_ERRORDEF is not defined, we need to define a simple enumeration */
/* type.. */
/* If FT_ERRORDEF is not defined, we need to define a simple */
/* enumeration type. */
/* */
#ifndef FT_ERRORDEF
@ -143,25 +153,25 @@
#define FT_ERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
/* this is only used for FT_Err_Ok, which must be 0 !! */
/* this is only used for FT_Err_Ok, which must be 0! */
#define FT_NOERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** LIST OF ERROR CODES/MESSAGES *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** LIST ERROR CODES/MESSAGES *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#ifdef FT_ERROR_START_LIST
FT_ERROR_START_LIST
#endif
/* generic errors */
FT_NOERRORDEF_( Ok, 0x00, \
@ -342,10 +352,11 @@
FT_ERROR_END_LIST
#endif
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** SIMPLE CLEANUPP *****/
/***** SIMPLE CLEANUP *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/

View File

@ -66,7 +66,9 @@
/*******************************************************************/
/*******************************************************************/
#undef FT_NEED_EXTERN_C
#ifndef FT_MODERRDEF
#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
@ -85,6 +87,7 @@
#endif /* !FT_MODERRDEF */
/*******************************************************************/
/*******************************************************************/
/***** *****/
@ -93,6 +96,7 @@
/*******************************************************************/
/*******************************************************************/
#ifdef FT_MODERR_START_LIST
FT_MODERR_START_LIST
#endif
@ -118,6 +122,7 @@
FT_MODERR_END_LIST
#endif
/*******************************************************************/
/*******************************************************************/
/***** *****/
@ -126,6 +131,7 @@
/*******************************************************************/
/*******************************************************************/
#ifdef FT_NEED_EXTERN_C
}
#endif

View File

@ -510,7 +510,10 @@ FT_BEGIN_HEADER
#define FT_IS_EMPTY( list ) ( (list).head == 0 )
/* return base error code (without module-specific prefix) */
#define FT_ERROR_BASE( x ) ( (x) & 255 )
#define FT_ERROR_BASE( x ) ( (x) & 0xFF )
/* return module error code */
#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
#define FT_BOOL( x ) ( (FT_Bool)( x ) )

View File

@ -221,9 +221,10 @@ FT_BEGIN_HEADER
#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )
#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
/* we disable the warnings "conditional expression is constant" here */
/* we disable the warning `conditional expression is constant' here */
/* in order to compile cleanly with the maximum level of warnings */
#pragma warning( disable : 4127 )

View File

@ -165,7 +165,6 @@ FT_BEGIN_HEADER
#define FT_GET_OFF3_LE( p ) \
( (long) ( ( (signed char)(p)[2] << 16 ) | \
((p)[1] << 8) | \
(p)[0] ) )
#define FT_GET_LONG_LE( p ) \

View File

@ -1371,8 +1371,10 @@
/* zone, check for left edges */
/* */
/* of course, that's for TrueType XXX */
FT_Bool is_top_blue = FT_BOOL(AH_IS_TOP_BLUE( blue ));
FT_Bool is_major_dir = FT_BOOL(edge->dir == outline->horz_major_dir);
FT_Bool is_top_blue =
FT_BOOL( AH_IS_TOP_BLUE( blue ) );
FT_Bool is_major_dir =
FT_BOOL( edge->dir == outline->horz_major_dir );
if ( !blue_active[blue] )
continue;

View File

@ -529,13 +529,17 @@
FT_UInt n;
base->outline.n_points = (short)( base->outline.n_points + current->outline.n_points );
base->outline.n_contours = (short)( base->outline.n_contours + current->outline.n_contours );
base->outline.n_points =
(short)( base->outline.n_points + current->outline.n_points );
base->outline.n_contours =
(short)( base->outline.n_contours + current->outline.n_contours );
base->num_subglyphs += current->num_subglyphs;
/* adjust contours count in newest outline */
for ( n = 0; n < n_curr_contours; n++ )
current->outline.contours[n] = (short)( current->outline.contours[n] + n_base_points );
current->outline.contours[n] =
(short)( current->outline.contours[n] + n_base_points );
/* prepare for another new glyph image */
FT_GlyphLoader_Prepare( loader );
@ -844,7 +848,8 @@
/* do we need to load the glyph through the auto-hinter? */
library = driver->root.library;
hinter = library->auto_hinter;
autohint = FT_BOOL( hinter &&
autohint =
FT_BOOL( hinter &&
!( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) ) &&
FT_DRIVER_IS_SCALABLE( driver ) &&
FT_DRIVER_USES_OUTLINES( driver ) );
@ -1172,7 +1177,8 @@
*aface = 0;
external_stream = FT_BOOL(( args->flags & ft_open_stream ) && args->stream);
external_stream = FT_BOOL( ( args->flags & ft_open_stream ) &&
args->stream );
/* create input stream */
error = ft_new_input_stream( library, args, &stream );

View File

@ -50,7 +50,8 @@
data->ref_count = (FT_Short) 0;
node->cset = cset;
node->cset_index = (FT_UShort)index;
node->num_elements = (unsigned short)(( index + 1 < cset->num_chunks )
node->num_elements = (unsigned short)(
( index + 1 < cset->num_chunks )
? cset->element_count
: cset->element_max - cset->element_count*index );
if ( alloc )

View File

@ -452,7 +452,8 @@
if ( !error )
{
if ( outline->n_contours > 0 )
outline->contours[outline->n_contours - 1] = (short)(outline->n_points - 1);
outline->contours[outline->n_contours - 1] =
(short)( outline->n_points - 1 );
outline->n_contours++;
}
@ -512,7 +513,8 @@
}
if ( outline->n_contours > 0 )
outline->contours[outline->n_contours - 1] = (short)(outline->n_points - 1);
outline->contours[outline->n_contours - 1] =
(short)( outline->n_points - 1 );
}

View File

@ -388,7 +388,8 @@
root->bbox = dict->font_bbox;
root->ascender = (FT_Short)( root->bbox.yMax >> 16 );
root->descender = (FT_Short)( root->bbox.yMin >> 16 );
root->height = (FT_Short)(( ( root->ascender - root->descender ) * 12 ) / 10);
root->height = (FT_Short)(
( ( root->ascender - root->descender ) * 12 ) / 10 );
if ( dict->units_per_em )
root->units_per_EM = dict->units_per_em;

View File

@ -229,8 +229,8 @@
root->ascender = (FT_Short)( face->cid.font_bbox.yMax >> 16 );
root->descender = (FT_Short)( face->cid.font_bbox.yMin >> 16 );
root->height = (FT_Short)( (( root->ascender + root->descender ) * 12 )
/ 10 );
root->height = (FT_Short)(
( ( root->ascender + root->descender ) * 12 ) / 10 );
#if 0

View File

@ -224,11 +224,16 @@ THE SOFTWARE.
if ( READ_Fields( pcf_compressed_metric_header, &compr_metric ) )
return error;
metric->leftSideBearing = (FT_Short)(compr_metric.leftSideBearing - 0x80);
metric->rightSideBearing = (FT_Short)(compr_metric.rightSideBearing - 0x80);
metric->characterWidth = (FT_Short)(compr_metric.characterWidth - 0x80);
metric->ascent = (FT_Short)(compr_metric.ascent - 0x80);
metric->descent = (FT_Short)(compr_metric.descent - 0x80);
metric->leftSideBearing =
(FT_Short)( compr_metric.leftSideBearing - 0x80 );
metric->rightSideBearing =
(FT_Short)( compr_metric.rightSideBearing - 0x80 );
metric->characterWidth =
(FT_Short)( compr_metric.characterWidth - 0x80 );
metric->ascent =
(FT_Short)( compr_metric.ascent - 0x80 );
metric->descent =
(FT_Short)( compr_metric.descent - 0x80 );
metric->attributes = 0;
return PCF_Err_Ok;

View File

@ -925,7 +925,8 @@
old_limit = parser->limit;
/* we store the elements count */
*(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) = (FT_Byte)num_elements;
*(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
(FT_Byte)num_elements;
/* we now load each element, adjusting the field.offset on each one */
token = elements;
@ -1199,7 +1200,8 @@
if ( !error )
{
if ( outline->n_contours > 0 )
outline->contours[outline->n_contours - 1] = (short)(outline->n_points - 1);
outline->contours[outline->n_contours - 1] =
(short)( outline->n_points - 1 );
outline->n_contours++;
}
@ -1260,7 +1262,8 @@
}
if ( outline->n_contours > 0 )
outline->contours[outline->n_contours - 1] = (short)(outline->n_points - 1);
outline->contours[outline->n_contours - 1] =
(short)( outline->n_points - 1 );
}

View File

@ -1833,7 +1833,9 @@
ras.state = Unknown;
ras.gProfile = NULL;
if ( Decompose_Curve( RAS_VARS (unsigned short)start, ras.outline.contours[i], flipped ) )
if ( Decompose_Curve( RAS_VARS (unsigned short)start,
ras.outline.contours[i],
flipped ) )
return FAILURE;
start = ras.outline.contours[i] + 1;
@ -2980,7 +2982,8 @@
ft_outline_high_precision );
ras.scale_shift = ras.precision_shift;
ras.dropOutControl = 2;
ras.second_pass = (FT_Byte)(!( ras.outline.flags & ft_outline_single_pass ));
ras.second_pass = (FT_Byte)( !( ras.outline.flags &
ft_outline_single_pass ) );
/* Vertical Sweep */
ras.Proc_Sweep_Init = Vertical_Sweep_Init;

View File

@ -151,7 +151,8 @@
cmap2sub->entryCount = GET_UShort();
cmap2sub->idDelta = GET_Short();
/* we apply the location offset immediately */
cmap2sub->idRangeOffset = (FT_UShort)( GET_UShort() - ( num_SH - i ) * 8 - 2 );
cmap2sub->idRangeOffset = (FT_UShort)(
GET_UShort() - ( num_SH - i ) * 8 - 2 );
cmap2sub++;
}

View File

@ -604,10 +604,12 @@
face->root.num_glyphs = maxProfile->numGlyphs;
face->root.internal->max_points = (FT_UShort)MAX( maxProfile->maxCompositePoints,
face->root.internal->max_points =
(FT_UShort)MAX( maxProfile->maxCompositePoints,
maxProfile->maxPoints );
face->root.internal->max_contours = (FT_Short)MAX( maxProfile->maxCompositeContours,
face->root.internal->max_contours =
(FT_Short)MAX( maxProfile->maxCompositeContours,
maxProfile->maxContours );
face->max_components = (FT_ULong)maxProfile->maxComponentElements +

View File

@ -176,7 +176,8 @@
if ( error )
goto Exit;
decoder.builder.no_recurse = FT_BOOL( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
decoder.builder.no_recurse = FT_BOOL(
( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
decoder.num_subrs = type1->num_subrs;
decoder.subrs = type1->subrs;

View File

@ -278,7 +278,8 @@
root->ascender = (FT_Short)( face->type1.font_bbox.yMax >> 16 );
root->descender = (FT_Short)( face->type1.font_bbox.yMin >> 16 );
root->height = (FT_Short)(( ( root->ascender - root->descender ) * 12 ) / 10 );
root->height = (FT_Short)(
( ( root->ascender - root->descender ) * 12 ) / 10 );
/* now compute the maximum advance width */
root->max_advance_width =