ref: 8edbcabce1b3756fb1921f85901dcce944bdf1e7
parent: cf24d51531d41b1675753d39533c6ae562f8104b
author: David Turner <[email protected]>
date: Tue Jun 19 04:28:24 EDT 2001
- updated doc for FT_New_Memory_Face - removed lots of compiler warnings in lint-style warning modes (/W4 with Visual C++)
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1458,14 +1458,14 @@
/* */
typedef struct FT_Open_Args_
{
- FT_Open_Flags flags;
- FT_Byte* memory_base;
- FT_Long memory_size;
- FT_String* pathname;
- FT_Stream stream;
- FT_Module driver;
- FT_Int num_params;
- FT_Parameter* params;
+ FT_Open_Flags flags;
+ const FT_Byte* memory_base;
+ FT_Long memory_size;
+ FT_String* pathname;
+ FT_Stream stream;
+ FT_Module driver;
+ FT_Int num_params;
+ FT_Parameter* params;
} FT_Open_Args;
@@ -1536,6 +1536,11 @@
/* 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 */
+ /* responsible for releasing/destroying them _after_ the */
+ /* 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 */
/* `face->glyph'. */
@@ -1546,11 +1551,11 @@
/* `aface'. Its return value should be 0 if the font format is */
/* recognized, or non-zero if not. */
/* */
- FT_EXPORT( FT_Error ) FT_New_Memory_Face( FT_Library library,
- FT_Byte* file_base,
- FT_Long file_size,
- FT_Long face_index,
- FT_Face *aface );
+ FT_EXPORT( FT_Error ) FT_New_Memory_Face( FT_Library library,
+ const FT_Byte* file_base,
+ FT_Long file_size,
+ FT_Long face_index,
+ FT_Face *aface );
/*************************************************************************/
--- a/include/freetype/fterrors.h
+++ b/include/freetype/fterrors.h
@@ -13,91 +13,128 @@
/* 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: */
+/* ------------------ */
+/* */
+/* 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. */
+/* */
+/* You can use the macro FT_ERROR_BASE(x) macro to extract the */
+/* generic error code from a FT_Error */
+/* */
+/* 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. */
+/* */
+/* */
+/* 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) */
+/* */
+/* To do so, you'll need 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) */
+/* */
+/* 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 */
+/* */
+/* FT_ERROR_END_LIST :: */
+/* this macro is used to end the list. */
+/* */
+/* Additionally, you'll need to undefine __FTERRORS_H__ before */
+/* #including this file. */
+/* */
+/* Here's a simple example: */
+/* */
+/* { */
+/* #undef __FTERRORS_H__ */
+/* #define FT_ERRORDEF( e, v, s ) { e, s }, */
+/* #define FT_ERROR_START_LIST { */
+/* #define FT_ERROR_END_LIST { 0, 0 } }; */
+/* */
+/* const struct */
+/* { */
+/* int err_code; */
+/* const char* err_msg */
+/* } ft_errors[] = */
+/* */
+/* #include FT_ERRORS_H */
+/* } */
+/* */
+/* */
/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* This file is used to define the FreeType error enumeration constants. */
- /* */
- /* The lower byte gives the error code, the higher byte gives the */
- /* module. The base module has error offset 0. For example, the error */
- /* `FT_Err_Invalid_File_Format' has value 0x003, the error */
- /* `TT_Err_Invalid_File_Format' has value 0xB03, the error */
- /* `T1_Err_Invalid_File_Format' has value 0xC03, etc. */
- /* */
- /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS (in ftoption.h) */
- /* to make the higher byte always zero. */
- /* */
- /* It can also be used to create an error message table easily with */
- /* something like */
- /* */
- /* { */
- /* #undef __FTERRORS_H__ */
- /* #define FT_ERRORDEF( e, v, s ) { e, s }, */
- /* #define FT_ERROR_START_LIST { */
- /* #define FT_ERROR_END_LIST { 0, 0 } }; */
- /* */
- /* const struct */
- /* { */
- /* int err_code; */
- /* const char* err_msg */
- /* } ft_errors[] = */
- /* */
- /* #include FT_ERRORS_H */
- /* } */
- /* */
- /* To use such a table, all errors must be ANDed with 0x00FF to remove */
- /* the module error offset. */
- /* */
- /*************************************************************************/
-
-
#ifndef __FTERRORS_H__
#define __FTERRORS_H__
-#include FT_MODULE_ERRORS_H
-#undef FT_NEED_EXTERN_C
+ /*******************************************************************/
+ /*******************************************************************/
+ /***** *****/
+ /***** SETUP MACROS *****/
+ /***** *****/
+ /*******************************************************************/
+ /*******************************************************************/
+#include FT_MODULE_ERRORS_H
- /* public interface */
-
+#undef FT_NEED_EXTERN_C
#ifndef FT_ERRORDEF
-#define FT_ERRORDEF( e, v, s ) e = v,
+# define FT_ERRORDEF( e, v, s ) e = v,
-#ifdef __cplusplus
-#define FT_NEED_EXTERN_C
- extern "C" {
-#endif
+# ifdef __cplusplus
+# define FT_NEED_EXTERN_C
+ extern "C" {
+# endif
#endif /* !FT_ERRORDEF */
#ifndef FT_ERROR_START_LIST
+# define FT_ERROR_START_LIST enum {
+#endif
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST FT_Err_Max };
+#ifndef FT_ERROR_END_LIST
+# define FT_ERROR_END_LIST FT_Err_Max };
+#endif
-#endif /* !FT_ERROR_START_LIST */
- /* internal interface */
-
-#ifndef FT_ERRORDEF_
-
#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FT_Err_ ## e, v + FT_Mod_Err_Base, s )
+ FT_ERRORDEF( FT_Err_ ## e, v + FT_Mod_Err_Base, s )
+
#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FT_Err_ ## e, v, s )
+ FT_ERRORDEF( FT_Err_ ## e, v, s )
-#endif /* !FT_ERRORDEF_ */
+ /*******************************************************************/
+ /*******************************************************************/
+ /***** *****/
+ /***** LIST ERROR CODES/MESSAGES *****/
+ /***** *****/
+ /*******************************************************************/
+ /*******************************************************************/
-#ifdef FT_ERROR_START_LIST
FT_ERROR_START_LIST
-#endif
/* generic errors */
@@ -276,11 +313,17 @@
"argument stack underflow" )
-#ifdef FT_ERROR_END_LIST
FT_ERROR_END_LIST
-#endif
+ /*******************************************************************/
+ /*******************************************************************/
+ /***** *****/
+ /***** SIMPLE CLEANUPP *****/
+ /***** *****/
+ /*******************************************************************/
+ /*******************************************************************/
+
#undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST
#undef FT_ERRORDEF
@@ -292,7 +335,6 @@
}
#endif
-#endif /* __FTERRORS_H__ */
-
+#endif /* __FT_ERRORS_H__ */
/* END */
--- a/include/freetype/fttypes.h
+++ b/include/freetype/fttypes.h
@@ -512,6 +512,7 @@
/* return base error code (without module-specific prefix) */
#define FT_ERROR_BASE( x ) ( (x) & 255 )
+#define FT_BOOL(x) ((FT_Bool)(x))
FT_END_HEADER
--- a/include/freetype/internal/ftdebug.h
+++ b/include/freetype/internal/ftdebug.h
@@ -221,6 +221,14 @@
#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 */
+/* in order to compile cleanly with the maximum level of warnings */
+#pragma warning( disable : 4127 )
+
+#endif /* _MSC_VER */
+
FT_END_HEADER
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -143,34 +143,57 @@
/* integer extraction macros -- the `buffer' parameter must ALWAYS be of */
/* type `char*' or equivalent (1-byte elements). */
/* */
+
+#define FT_GET_SHORT_BE(p) \
+ ((short)( ((signed char)(p)[0] << 8) | \
+ (p)[1] ))
+
+#define FT_GET_OFF3_BE(p) \
+ ((long) ( ((signed char)(p)[0] << 16) | \
+ ((p)[1] << 8) | \
+ (p)[2] ))
+
+#define FT_GET_LONG_BE(p) \
+ ((long) ( ((signed char)(p)[0] << 24) | \
+ ((p)[1] << 16) | \
+ ((p)[2] << 8) | \
+ (p)[3] ))
+
+#define FT_GET_SHORT_LE(p) \
+ ((short)( ((signed char)(p)[1] << 8) | \
+ (p)[0] ))
+
+#define FT_GET_OFF3_LE(p) \
+ ((long) ( ((signed char)(p)[2] << 16) | \
+ ((p)[1] << 8) | \
+ (p)[0] ))
+
+#define FT_GET_LONG_LE(p) \
+ ((long) ( ((signed char)(p)[3] << 24) | \
+ ((p)[2] << 16) | \
+ ((p)[1] << 8) | \
+ (p)[0] ))
+
#define NEXT_Char( buffer ) \
( (signed char)*buffer++ )
+
#define NEXT_Byte( buffer ) \
( (unsigned char)*buffer++ )
#define NEXT_Short( buffer ) \
- ( buffer += 2, \
- ( (short)( (signed char)buffer[-2] << 8 ) | \
- (unsigned char)buffer[-1] ) )
+ ( (short)( buffer += 2, FT_GET_SHORT_BE(buffer-2) ) )
#define NEXT_UShort( buffer ) \
( (unsigned short)NEXT_Short( buffer ) )
-#define NEXT_Offset( buffer ) \
- ( buffer += 3, \
- ( ( (long)(signed char)buffer[-3] << 16 ) | \
- ( (long)(unsigned char)buffer[-2] << 8 ) | \
- (long)(unsigned char)buffer[-1] ) )
+#define NEXT_Offset( buffer ) \
+ ( (long)( buffer += 3, FT_GET_OFF3_BE(buffer-3) ) )
#define NEXT_UOffset( buffer ) \
( (unsigned long)NEXT_Offset( buffer ) )
-#define NEXT_Long( buffer ) \
- ( buffer += 4, \
- ( ( (long)(signed char)buffer[-4] << 24 ) | \
- ( (long)(unsigned char)buffer[-3] << 16 ) | \
- ( (long)(unsigned char)buffer[-2] << 8 ) | \
- (long)(unsigned char)buffer[-1] ) )
+#define NEXT_Long( buffer ) \
+ ( (long)( buffer += 4, FT_GET_LONG_BE(buffer-4) ) )
#define NEXT_ULong( buffer ) \
( (unsigned long)NEXT_Long( buffer ) )
@@ -177,29 +200,20 @@
#define NEXT_ShortLE( buffer ) \
- ( buffer += 2, \
- ( (short)( (signed char)buffer[-1] << 8 ) | \
- (unsigned char)buffer[-2] ) )
+ ( (short)( buffer += 2, FT_GET_SHORT_LE(buffer-2) ) )
#define NEXT_UShortLE( buffer ) \
( (unsigned short)NEXT_ShortLE( buffer ) )
#define NEXT_OffsetLE( buffer ) \
- ( buffer += 3, \
- ( ( (long)(signed char)buffer[-1] << 16 ) | \
- ( (long)(unsigned char)buffer[-2] << 8 ) | \
- (long)(unsigned char)buffer[-3] ) )
+ ( (long)( buffer += 3, FT_GET_OFF3_LE(buffer-3) ) )
#define NEXT_UOffsetLE( buffer ) \
- ( (unsigned long)NEXT_OffsetLE( buffer ) )
+ ( (unsigned long)NEXT_OffsetLE( buffer ) )
#define NEXT_LongLE( buffer ) \
- ( buffer += 4, \
- ( ( (long)(signed char)buffer[-1] << 24 ) | \
- ( (long)(unsigned char)buffer[-2] << 16 ) | \
- ( (long)(unsigned char)buffer[-3] << 8 ) | \
- (long)(unsigned char)buffer[-4] ) )
+ ( (long)( buffer += 4, FT_GET_LONG_LE(buffer-4) ) )
#define NEXT_ULongLE( buffer ) \
( (unsigned long)NEXT_LongLE( buffer ) )
--- a/src/autohint/ahglobal.c
+++ b/src/autohint/ahglobal.c
@@ -20,6 +20,7 @@
#include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
#include "ahglobal.h"
#include "ahglyph.h"
@@ -214,9 +215,9 @@
} while ( next != index );
/* now, set the `round' flag depending on the segment's kind */
- round =
+ round = FT_BOOL(
FT_CURVE_TAG( glyph->outline.tags[prev] ) != FT_Curve_Tag_On ||
- FT_CURVE_TAG( glyph->outline.tags[next] ) != FT_Curve_Tag_On ;
+ FT_CURVE_TAG( glyph->outline.tags[next] ) != FT_Curve_Tag_On );
AH_LOG(( "%c ", round ? 'r' : 'f' ));
}
@@ -265,7 +266,7 @@
{
FT_Pos ref = *blue_ref;
FT_Pos shoot = *blue_shoot;
- FT_Bool over_ref = ( shoot > ref );
+ FT_Bool over_ref = FT_BOOL( shoot > ref );
if ( AH_IS_TOP_BLUE( blue ) ^ over_ref )
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -558,7 +558,7 @@
for ( ; contour < contour_limit; contour++, end++ )
{
contour[0] = points + index;
- index = end[0] + 1;
+ index = (short)(end[0] + 1);
}
}
@@ -959,9 +959,9 @@
/* check that the segments are correctly oriented and */
/* positioned to form a black distance */
- is_dir = ( seg1->dir == outline->horz_major_dir ||
- seg1->dir == outline->vert_major_dir );
- is_pos = pos1 > pos2;
+ is_dir = (FT_Bool)( seg1->dir == outline->horz_major_dir ||
+ seg1->dir == outline->vert_major_dir );
+ is_pos = (FT_Bool)(pos1 > pos2);
if ( pos1 == pos2 || !(is_dir ^ is_pos) )
continue;
@@ -1199,7 +1199,7 @@
/* check for links -- if seg->serif is set, then seg->link must */
/* be ignored */
- is_serif = seg->serif && seg->serif->edge != edge;
+ is_serif = (FT_Bool)(seg->serif && seg->serif->edge != edge);
if ( seg->link || is_serif )
{
@@ -1371,8 +1371,8 @@
/* zone, check for left edges */
/* */
/* of course, that's for TrueType XXX */
- FT_Bool is_top_blue = AH_IS_TOP_BLUE( blue );
- FT_Bool is_major_dir = 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;
@@ -1403,7 +1403,7 @@
/* top zone, or under the reference position of a bottom zone */
if ( edge->flags & ah_edge_round && dist != 0 )
{
- FT_Bool is_under_ref = edge->fpos < *blue_pos;
+ FT_Bool is_under_ref = FT_BOOL( edge->fpos < *blue_pos );
if ( is_top_blue ^ is_under_ref )
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -1004,10 +1004,10 @@
FT_Error error;
AH_Outline* outline = hinter->glyph;
AH_Loader* gloader = hinter->loader;
- FT_Bool no_horz_hints =
- ( load_flags & AH_HINT_NO_HORZ_EDGES ) != 0;
- FT_Bool no_vert_hints =
- ( load_flags & AH_HINT_NO_VERT_EDGES ) != 0;
+ FT_Bool no_horz_hints = FT_BOOL(
+ ( load_flags & AH_HINT_NO_HORZ_EDGES ) != 0 );
+ FT_Bool no_vert_hints = FT_BOOL(
+ ( load_flags & AH_HINT_NO_VERT_EDGES ) != 0 );
/* load the glyph */
@@ -1251,7 +1251,7 @@
dummy.points += num_base_points;
- dummy.n_points = num_new_points;
+ dummy.n_points = (short)num_new_points;
FT_Outline_Translate( &dummy, x, y );
}
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -187,7 +187,7 @@
{
error = 0;
FT_New_Memory_Stream( library,
- args->memory_base,
+ (FT_Byte*)args->memory_base,
args->memory_size,
stream );
}
@@ -529,13 +529,13 @@
FT_UInt n;
- base->outline.n_points += current->outline.n_points;
- 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] += 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 );
@@ -570,8 +570,8 @@
MEM_Copy( target->base.extra_points, source->base.extra_points,
num_points * sizeof ( FT_Vector ) );
- out->n_points = num_points;
- out->n_contours = num_contours;
+ out->n_points = (short)num_points;
+ out->n_contours = (short)num_contours;
FT_GlyphLoader_Adjust_Points( target );
}
@@ -844,10 +844,10 @@
/* do we need to load the glyph through the auto-hinter? */
library = driver->root.library;
hinter = library->auto_hinter;
- autohint = 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);
+ FT_DRIVER_USES_OUTLINES(driver) );
if ( autohint )
{
if ( FT_DRIVER_HAS_HINTER( driver ) &&
@@ -1127,11 +1127,11 @@
/* documentation is in freetype.h */
- FT_EXPORT_DEF( FT_Error ) FT_New_Memory_Face( FT_Library library,
- FT_Byte* file_base,
- FT_Long file_size,
- FT_Long face_index,
- FT_Face *aface )
+ FT_EXPORT_DEF( FT_Error ) FT_New_Memory_Face( FT_Library library,
+ const FT_Byte* file_base,
+ FT_Long file_size,
+ FT_Long face_index,
+ FT_Face *aface )
{
FT_Open_Args args;
@@ -1172,7 +1172,7 @@
*aface = 0;
- external_stream = ( ( 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 );
@@ -1648,8 +1648,8 @@
if ( pixel_height < 1 )
pixel_height = 1;
- metrics->x_ppem = pixel_width;
- metrics->y_ppem = pixel_height;
+ metrics->x_ppem = (FT_UShort)pixel_width;
+ metrics->y_ppem = (FT_UShort)pixel_height;
if ( face->face_flags & FT_FACE_FLAG_SCALABLE )
{
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -64,7 +64,7 @@
FT_Int n; /* index of contour in outline */
FT_UInt first; /* index of first point in contour */
- char tag; /* current point's state */
+ FT_Int tag; /* current point's state */
FT_Int shift;
FT_Pos delta;
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -31,10 +31,10 @@
#define FT_COMPONENT trace_stream
- FT_BASE_DEF( void ) FT_New_Memory_Stream( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Stream stream )
+ FT_BASE_DEF( void ) FT_New_Memory_Stream( FT_Library library,
+ FT_Byte* base,
+ FT_ULong size,
+ FT_Stream stream )
{
stream->memory = library->memory;
stream->base = base;
--- a/src/cache/ftcchunk.c
+++ b/src/cache/ftcchunk.c
@@ -50,9 +50,9 @@
data->ref_count = (FT_Short) 0;
node->cset = cset;
node->cset_index = (FT_UShort)index;
- node->num_elements = ( 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;
+ : cset->element_max - cset->element_count*index );
if ( alloc )
{
/* allocate elements array */
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -225,7 +225,7 @@
FT_Bool ftc_image_set_compare( FTC_ImageSet iset,
FTC_Image_Desc* type )
{
- return !memcmp( &iset->description, type, sizeof ( *type ) );
+ return FT_BOOL(!memcmp( &iset->description, type, sizeof ( *type ) ));
}
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -74,7 +74,7 @@
{
FT_UNUSED( lru );
- return ((FT_Size)node->root.data)->face == (FT_Face)data;
+ return FT_BOOL(((FT_Size)node->root.data)->face == (FT_Face)data);
}
@@ -184,9 +184,9 @@
FT_UNUSED( node );
- return ( size->face == req->face &&
- size->metrics.x_ppem == req->width &&
- size->metrics.y_ppem == req->height );
+ return FT_BOOL( size->face == req->face &&
+ size->metrics.x_ppem == req->width &&
+ size->metrics.y_ppem == req->height );
}
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -317,7 +317,7 @@
FT_Bool ftc_sbit_chunk_set_compare( FTC_SBitSet sset,
FTC_Image_Desc* type )
{
- return !memcmp( &sset->desc, type, sizeof ( *type ) );
+ return FT_BOOL(!memcmp( &sset->desc, type, sizeof ( *type ) ));
}
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -409,7 +409,7 @@
point->x = x >> 16;
point->y = y >> 16;
- *control = flag ? FT_Curve_Tag_On : FT_Curve_Tag_Cubic;
+ *control = (FT_Byte)(flag ? FT_Curve_Tag_On : FT_Curve_Tag_Cubic);
builder->last = *point;
}
@@ -452,7 +452,7 @@
if ( !error )
{
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] = outline->n_points - 1;
+ outline->contours[outline->n_contours - 1] = (short)(outline->n_points - 1);
outline->n_contours++;
}
@@ -512,7 +512,7 @@
}
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] = outline->n_points - 1;
+ outline->contours[outline->n_contours - 1] = (short)(outline->n_points - 1);
}
@@ -655,7 +655,7 @@
FT_Outline dummy;
- dummy.n_points = base->n_points - n_base_points;
+ dummy.n_points = (short)(base->n_points - n_base_points);
dummy.points = base->points + n_base_points;
FT_Outline_Translate( &dummy, adx, ady );
@@ -2142,8 +2142,8 @@
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
- hinting = ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
- ( load_flags & FT_LOAD_NO_HINTING ) == 0;
+ hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
+ ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
glyph->root.format = ft_glyph_format_outline; /* by default */
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1753,7 +1753,7 @@
goto Exit;
/* Assign code to GID mapping. */
- encoding->codes[glyph_code] = j;
+ encoding->codes[glyph_code] = (FT_UShort)j;
/* Assign code to SID mapping. */
encoding->sids[glyph_code] = charset->sids[j];
@@ -1764,8 +1764,8 @@
case 1:
{
FT_Byte nleft;
- FT_Byte i = 1;
- FT_Byte k;
+ FT_UInt i = 1;
+ FT_UInt k;
/* Parse the Format1 ranges. */
@@ -1786,11 +1786,11 @@
for ( k = i; k < nleft + i; k++, glyph_code++ )
{
/* Make sure k is not too big. */
- if ( (FT_UInt)k > num_glyphs )
+ if ( k > num_glyphs )
goto Exit;
/* Assign code to GID mapping. */
- encoding->codes[glyph_code] = k;
+ encoding->codes[glyph_code] = (FT_UShort)k;
/* Assign code to SID mapping. */
encoding->sids[glyph_code] = charset->sids[k];
@@ -1837,7 +1837,7 @@
}
/* Now, make the assignment. */
- encoding->codes[glyph_code] = glyph_id;
+ encoding->codes[glyph_code] = (FT_UShort)glyph_id;
}
}
}
@@ -1879,7 +1879,7 @@
encoding->sids [j] = 0;
}
else
- encoding->codes[j] = i;
+ encoding->codes[j] = (FT_UShort)i;
}
}
break;
@@ -1910,7 +1910,7 @@
encoding->sids [j] = 0;
}
else
- encoding->codes[j] = i;
+ encoding->codes[j] = (FT_UShort)i;
}
}
break;
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -388,7 +388,7 @@
root->bbox = dict->font_bbox;
root->ascender = (FT_Short)( root->bbox.yMax >> 16 );
root->descender = (FT_Short)( root->bbox.yMin >> 16 );
- root->height = ( ( 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;
@@ -474,8 +474,8 @@
charmap->root.face = (FT_Face)face;
- charmap->root.platform_id = platform;
- charmap->root.encoding_id = encoding;
+ charmap->root.platform_id = (FT_UShort)platform;
+ charmap->root.encoding_id = (FT_UShort)encoding;
charmap->root.encoding = find_encoding( platform, encoding );
/* now, set root->charmap with a unicode charmap */
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -144,8 +144,8 @@
FT_Byte* p = start;
FT_Long num, divider, result, exp;
FT_Int sign = 0, exp_sign = 0;
- FT_Byte nib;
- FT_Byte phase;
+ FT_UInt nib;
+ FT_UInt phase;
result = 0;
@@ -495,7 +495,7 @@
while ( p < limit )
{
- FT_Byte v = *p;
+ FT_UInt v = *p;
if ( v >= 27 && v != 31 )
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -225,8 +225,8 @@
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
- hinting = ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
- ( load_flags & FT_LOAD_NO_HINTING ) == 0;
+ hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
+ ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
glyph->root.format = ft_glyph_format_outline;
@@ -240,8 +240,8 @@
cid_load_glyph );
/* set up the decoder */
- decoder.builder.no_recurse =
- ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
+ decoder.builder.no_recurse = FT_BOOL(
+ ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );
error = cid_load_glyph( &decoder, glyph_index );
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -70,8 +70,8 @@
FT_Byte plain;
- plain = ( *buffer ^ ( seed >> 8 ) );
- seed = ( *buffer + seed ) * 52845U + 22719;
+ plain = (FT_Byte)( *buffer ^ ( seed >> 8 ) );
+ seed = (FT_UShort)(( *buffer + seed ) * 52845 + 22719);
*buffer++ = plain;
length--;
}
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -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 = ( ( root->ascender + root->descender ) * 12 )
- / 10;
+ root->height = (FT_Short)( (( root->ascender + root->descender ) * 12 )
+ / 10 );
#if 0
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -224,11 +224,11 @@
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;
@@ -719,7 +719,7 @@
( ( i % ( lastCol - firstCol + 1 ) ) +
firstCol );
- tmpEncoding[j].glyph = encodingOffset;
+ tmpEncoding[j].glyph = (FT_Short)encodingOffset;
j++;
}
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -925,7 +925,7 @@
old_limit = parser->limit;
/* we store the elements count */
- *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) = 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;
@@ -1156,7 +1156,7 @@
}
point->x = x;
point->y = y;
- *control = flag ? FT_Curve_Tag_On : FT_Curve_Tag_Cubic;
+ *control = (FT_Byte)(flag ? FT_Curve_Tag_On : FT_Curve_Tag_Cubic);
builder->last = *point;
}
@@ -1199,7 +1199,7 @@
if ( !error )
{
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] = outline->n_points - 1;
+ outline->contours[outline->n_contours - 1] = (short)(outline->n_points - 1);
outline->n_contours++;
}
@@ -1260,7 +1260,7 @@
}
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] = outline->n_points - 1;
+ outline->contours[outline->n_contours - 1] = (short)(outline->n_points - 1);
}
@@ -1282,8 +1282,8 @@
FT_Byte plain;
- plain = ( *buffer ^ ( seed >> 8 ) );
- seed = ( *buffer + seed ) * 52845U + 22719;
+ plain = (FT_Byte) ( *buffer ^ ( seed >> 8 ) );
+ seed = (FT_UShort)(( *buffer + seed ) * 52845 + 22719 );
*buffer++ = plain;
length--;
}
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -284,7 +284,7 @@
FT_Outline dummy;
- dummy.n_points = base->n_points - n_base_points;
+ dummy.n_points = (short)(base->n_points - n_base_points);
dummy.points = base->points + n_base_points;
FT_Outline_Translate( &dummy, adx - asb, ady );
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -67,7 +67,7 @@
for ( count = 4; count > 0; count--, p++ )
{
char c = *p;
- unsigned char d;
+ unsigned int d;
d = (unsigned char)c - '0';
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -282,11 +282,11 @@
FT_F26Dot6 X; /* current coordinate during sweep */
PProfile link; /* link to next profile - various purpose */
PLong offset; /* start of profile's data in render pool */
- Int flow; /* Profile orientation: Asc/Descending */
- Long height; /* profile's height in scanlines */
- Long start; /* profile's starting scanline */
+ int flow; /* Profile orientation: Asc/Descending */
+ long height; /* profile's height in scanlines */
+ long start; /* profile's starting scanline */
- UShort countL; /* number of lines to step before this */
+ unsigned countL; /* number of lines to step before this */
/* profile becomes drawable */
PProfile next; /* next profile in same contour, used */
@@ -947,7 +947,7 @@
ras.joint = FALSE;
}
- ras.joint = ( f2 == 0 );
+ ras.joint = (char)( f2 == 0 );
if ( ras.fresh )
{
@@ -1603,7 +1603,7 @@
FT_Vector* limit;
char* tags;
- char tag; /* current point's state */
+ unsigned tag; /* current point's state */
points = ras.outline.points;
@@ -1808,8 +1808,8 @@
static
Bool Convert_Glyph( RAS_ARGS int flipped )
{
- Short i;
- UShort start;
+ int i;
+ unsigned start;
PProfile lastProfile;
@@ -1833,7 +1833,7 @@
ras.state = Unknown;
ras.gProfile = NULL;
- if ( Decompose_Curve( RAS_VARS 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;
@@ -1859,7 +1859,7 @@
if ( Finalize_Profile_Table( RAS_VAR ) )
return FAILURE;
- return ( ras.top < ras.maxBuff ? SUCCESS : FAILURE );
+ return (Bool)( ras.top < ras.maxBuff ? SUCCESS : FAILURE );
}
@@ -2058,7 +2058,7 @@
PProfile right )
{
Long e1, e2;
- Short c1, c2;
+ int c1, c2;
Byte f1, f2;
Byte* target;
@@ -2086,11 +2086,11 @@
c1 = (Short)( e1 >> 3 );
c2 = (Short)( e2 >> 3 );
- f1 = (unsigned char)0xFF >> ( e1 & 7 );
- f2 = ~( (unsigned char)0x7F >> ( e2 & 7 ) );
+ f1 = (Byte) ( 0xFF >> ( e1 & 7 ) );
+ f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
- if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
- if ( ras.gray_max_x < c2 ) ras.gray_max_x = c2;
+ if ( ras.gray_min_x > c1 ) ras.gray_min_x = (short)c1;
+ if ( ras.gray_max_x < c2 ) ras.gray_max_x = (short)c2;
target = ras.bTarget + ras.traceOfs + c1;
c2 -= c1;
@@ -2755,7 +2755,7 @@
Sort( &draw_right );
y_change = (Short)ras.sizeBuff[-ras.numTurns--];
- y_height = y_change - y;
+ y_height = (Short)(y_change - y);
while ( y < y_change )
{
@@ -2929,7 +2929,7 @@
i = ras.band_stack[ras.band_top].y_min;
j = ras.band_stack[ras.band_top].y_max;
- k = ( i + j ) / 2;
+ k = (Short)(( i + j ) / 2);
if ( ras.band_top >= 7 || k < i )
{
@@ -2942,7 +2942,7 @@
ras.band_stack[ras.band_top + 1].y_min = k;
ras.band_stack[ras.band_top + 1].y_max = j;
- ras.band_stack[ras.band_top].y_max = k - 1;
+ ras.band_stack[ras.band_top].y_max = (Short)(k - 1);
ras.band_top++;
}
@@ -2980,7 +2980,7 @@
ft_outline_high_precision );
ras.scale_shift = ras.precision_shift;
ras.dropOutControl = 2;
- ras.second_pass = !( 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;
@@ -2990,9 +2990,9 @@
ras.band_top = 0;
ras.band_stack[0].y_min = 0;
- ras.band_stack[0].y_max = ras.target.rows - 1;
+ ras.band_stack[0].y_max = (short)(ras.target.rows - 1);
- ras.bWidth = ras.target.width;
+ ras.bWidth = (unsigned short)ras.target.width;
ras.bTarget = (Byte*)ras.target.buffer;
if ( ( error = Render_Single_Pass( RAS_VARS 0 ) ) != 0 )
@@ -3008,7 +3008,7 @@
ras.band_top = 0;
ras.band_stack[0].y_min = 0;
- ras.band_stack[0].y_max = ras.target.width - 1;
+ ras.band_stack[0].y_max = (short)(ras.target.width - 1);
if ( ( error = Render_Single_Pass( RAS_VARS 1 ) ) != 0 )
return error;
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -277,8 +277,8 @@
/* */
/* do we have outlines in there? */
- has_outline = ( ( TT_LookUp_Table( face, TTAG_glyf ) != 0 ) ||
- ( TT_LookUp_Table( face, TTAG_CFF ) != 0 ) );
+ has_outline = FT_BOOL( ( TT_LookUp_Table( face, TTAG_glyf ) != 0 ) ||
+ ( TT_LookUp_Table( face, TTAG_CFF ) != 0 ) );
is_apple_sbit = 0;
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@@ -286,7 +286,7 @@
/* if this font doesn't contain outlines, we try to load */
/* a `bhed' table */
if ( !has_outline )
- is_apple_sbit = !LOAD_( bitmap_header );
+ is_apple_sbit = FT_BOOL(!LOAD_( bitmap_header ));
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
@@ -437,8 +437,8 @@
charmap->root.face = (FT_Face)face;
- charmap->root.platform_id = platform;
- charmap->root.encoding_id = encoding;
+ charmap->root.platform_id = (FT_UShort)platform;
+ charmap->root.encoding_id = (FT_UShort)encoding;
charmap->root.encoding = find_encoding( platform, encoding );
/* now, set root->charmap with a unicode charmap */
@@ -538,13 +538,13 @@
root->ascender = face->horizontal.Ascender;
root->descender = face->horizontal.Descender;
- root->height = root->ascender - root->descender +
- face->horizontal.Line_Gap;
+ root->height = (FT_Short)( root->ascender - root->descender +
+ face->horizontal.Line_Gap );
/* if the line_gap is 0, we add an extra 15% to the text height -- */
/* this computation is based on various versions of Times New Roman */
if ( face->horizontal.Line_Gap == 0 )
- root->height = ( root->height * 115 + 50 ) / 100;
+ root->height = (FT_Short)(( root->height * 115 + 50 ) / 100 );
#if 0
@@ -567,9 +567,9 @@
root->max_advance_width = face->horizontal.advance_Width_Max;
- root->max_advance_height = face->vertical_info
+ root->max_advance_height = (FT_Short)( face->vertical_info
? face->vertical.advance_Height_Max
- : root->height;
+ : root->height );
root->underline_position = face->postscript.underlinePosition;
root->underline_thickness = face->postscript.underlineThickness;
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -123,7 +123,7 @@
for ( i = 0; i < 256; i++ )
{
- u = GET_UShort() / 8;
+ u = (FT_UShort)(GET_UShort() / 8);
cmap2->subHeaderKeys[i] = u;
if ( num_SH < u )
@@ -134,8 +134,8 @@
/* load subheaders */
- cmap2->numGlyphId = l =
- ( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFF ) / 2;
+ cmap2->numGlyphId = l = (FT_UShort)(
+ ( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFF ) / 2 );
if ( ALLOC_ARRAY( cmap2->subHeaders,
num_SH + 1,
@@ -151,7 +151,7 @@
cmap2sub->entryCount = GET_UShort();
cmap2sub->idDelta = GET_Short();
/* we apply the location offset immediately */
- cmap2sub->idRangeOffset = GET_UShort() - ( num_SH - i ) * 8 - 2;
+ cmap2sub->idRangeOffset = (FT_UShort)( GET_UShort() - ( num_SH - i ) * 8 - 2 );
cmap2sub++;
}
@@ -185,7 +185,7 @@
cmap4->entrySelector = GET_UShort();
cmap4->rangeShift = GET_UShort();
- num_Seg = cmap4->segCountX2 / 2;
+ num_Seg = (FT_UShort)(cmap4->segCountX2 / 2);
FORGET_Frame();
@@ -215,8 +215,8 @@
FORGET_Frame();
- cmap4->numGlyphId = l =
- ( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFF ) / 2;
+ cmap4->numGlyphId = l = (FT_UShort)(
+ ( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFF ) / 2 );
/* load IDs */
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -604,11 +604,11 @@
face->root.num_glyphs = maxProfile->numGlyphs;
- face->root.internal->max_points = MAX( maxProfile->maxCompositePoints,
- maxProfile->maxPoints );
+ face->root.internal->max_points = (FT_UShort)MAX( maxProfile->maxCompositePoints,
+ maxProfile->maxPoints );
- face->root.internal->max_contours = MAX( maxProfile->maxCompositeContours,
- maxProfile->maxContours );
+ face->root.internal->max_contours = (FT_Short)MAX( maxProfile->maxCompositeContours,
+ maxProfile->maxContours );
face->max_components = (FT_ULong)maxProfile->maxComponentElements +
maxProfile->maxComponentDepth;
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -212,7 +212,7 @@
{
index -= 257;
if ( index > num_names )
- num_names = index;
+ num_names = (FT_UShort)index;
}
}
}
@@ -244,8 +244,8 @@
TT_Post_20* table = &face->postscript_names.names.format_20;
- table->num_glyphs = num_glyphs;
- table->num_names = num_names;
+ table->num_glyphs = (FT_UShort)num_glyphs;
+ table->num_names = (FT_UShort)num_names;
table->glyph_indices = glyph_indices;
table->glyph_names = name_strings;
}
@@ -319,7 +319,7 @@
TT_Post_25* table = &face->postscript_names.names.format_25;
- table->num_glyphs = num_glyphs;
+ table->num_glyphs = (FT_UShort)num_glyphs;
table->offsets = offset_table;
}
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -76,7 +76,7 @@
FT_Int height;
FT_UShort acc;
- FT_Byte loaded;
+ FT_UInt loaded;
/* first of all, compute starting write position */
@@ -104,10 +104,10 @@
for ( height = target->rows; height > 0; height-- )
{
- FT_Byte* cur = line_buff; /* current write cursor */
- FT_Int count = line_bits; /* # of bits to extract per line */
- FT_Byte shift = x_offset & 7; /* current write shift */
- FT_Byte space = 8 - shift;
+ FT_Byte* cur = line_buff; /* current write cursor */
+ FT_UInt count = line_bits; /* # of bits to extract per line */
+ FT_Byte shift = (FT_Byte)(x_offset & 7); /* current write shift */
+ FT_Byte space = (FT_Byte)(8 - shift);
/* first of all, read individual source bytes */
@@ -163,7 +163,7 @@
}
/* now write remaining bits */
- val = ( (FT_Byte)( acc >> 8 ) ) & ~( 0xFF >> count );
+ val = (FT_Byte)(( (FT_Byte)( acc >> 8 ) ) & ~( 0xFF >> count ));
cur[0] |= val >> shift;
if ( count > space )
@@ -175,7 +175,10 @@
/* now, skip to next line */
if ( byte_padded )
- acc = loaded = 0; /* clear accumulator on byte-padded lines */
+ {
+ acc = 0;
+ loaded = 0; /* clear accumulator on byte-padded lines */
+ }
line_buff += line_incr;
}
@@ -328,7 +331,7 @@
{
FT_ULong num_glyphs, n;
FT_Int size_elem;
- FT_Bool large = ( range->index_format == 1 );
+ FT_Bool large = FT_BOOL( range->index_format == 1 );
num_glyphs = range->last_glyph - range->first_glyph + 1L;
@@ -696,7 +699,7 @@
if ( glyph_index >= (FT_UInt)range->first_glyph &&
glyph_index <= (FT_UInt)range->last_glyph )
{
- FT_UShort delta = glyph_index - range->first_glyph;
+ FT_UShort delta = (FT_UShort)(glyph_index - range->first_glyph);
switch ( range->index_format )
@@ -992,9 +995,9 @@
MEM_Move( line, line + count * line_len,
( rows - count ) * line_len );
- metrics->height -= count;
- metrics->horiBearingY -= count;
- metrics->vertBearingY -= count;
+ metrics->height = (FT_Byte)( metrics->height - count );
+ metrics->horiBearingY = (FT_Char)( metrics->horiBearingY - count );
+ metrics->vertBearingY = (FT_Char)( metrics->vertBearingY - count );
map->rows -= count;
rows -= count;
@@ -1025,7 +1028,7 @@
Found_Bottom:
if ( count > 0 )
{
- metrics->height -= count;
+ metrics->height = (FT_Byte)( metrics->height - count );
rows -= count;
map->rows -= count;
}
@@ -1058,7 +1061,7 @@
FT_Byte* cur = line;
- old = cur[0] << 1;
+ old = (FT_Byte)(cur[0] << 1);
for ( n = 8; n < width; n += 8 )
{
FT_Byte val;
@@ -1065,8 +1068,8 @@
val = cur[1];
- cur[0] = old | ( val >> 7 );
- old = val << 1;
+ cur[0] = (FT_Byte)(old | ( val >> 7 ));
+ old = (FT_Byte)(val << 1);
cur++;
}
cur[0] = old;
@@ -1095,7 +1098,7 @@
line = (FT_Byte*)map->buffer + ( right >> 3 );
limit = line + rows * line_len;
- mask = 0x80 >> ( right & 7 );
+ mask = (FT_Byte)(0x80 >> ( right & 7 ));
for ( ; line < limit; line += line_len )
if ( line[0] & mask )
@@ -1449,9 +1452,9 @@
/* some heuristic values */
- metrics->vertBearingX = -metrics->width / 2;
- metrics->vertBearingY = advance / 10;
- metrics->vertAdvance = advance * 12 / 10;
+ metrics->vertBearingX = (FT_Char)(-metrics->width / 2);
+ metrics->vertBearingY = (FT_Char)( advance / 10 );
+ metrics->vertAdvance = (FT_Char)( advance * 12 / 10 );
}
/* Crop the bitmap now, unless specified otherwise */
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1308,7 +1308,7 @@
(int)span->x + span->len == (int)x &&
span->coverage == coverage )
{
- span->len += acount;
+ span->len = (unsigned short)(span->len + acount);
return;
}
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -180,8 +180,8 @@
FT_UInt start_point,
FT_UInt start_contour )
{
- zone->n_points = load->outline.n_points - start_point;
- zone->n_contours = load->outline.n_contours - start_contour;
+ zone->n_points = (FT_UShort)(load->outline.n_points - start_point);
+ zone->n_contours = (FT_Short) (load->outline.n_contours - start_contour);
zone->org = load->extra_points + start_point;
zone->cur = load->outline.points + start_point;
zone->tags = (FT_Byte*)load->outline.tags + start_point;
@@ -408,8 +408,8 @@
for ( n = 0; n < n_points; n++ )
outline->tags[n] &= FT_Curve_Tag_On;
- outline->n_points = n_points;
- outline->n_contours = n_contours;
+ outline->n_points = (FT_UShort)n_points;
+ outline->n_contours = (FT_Short) n_contours;
Fail:
return error;
@@ -1215,7 +1215,7 @@
/* */
if ( face->os2.version != 0xFFFF )
{
- top_bearing = face->os2.sTypoLineGap / 2;
+ top_bearing = (FT_Short)(face->os2.sTypoLineGap / 2);
advance_height = (FT_UShort)( face->os2.sTypoAscender -
face->os2.sTypoDescender +
face->os2.sTypoLineGap );
@@ -1222,7 +1222,7 @@
}
else
{
- top_bearing = face->horizontal.Line_Gap / 2;
+ top_bearing = (FT_Short)(face->horizontal.Line_Gap / 2);
advance_height = (FT_UShort)( face->horizontal.Ascender +
face->horizontal.Descender +
face->horizontal.Line_Gap );
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -161,8 +161,8 @@
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
- hinting = ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
- ( load_flags & FT_LOAD_NO_HINTING ) == 0;
+ hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
+ ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
glyph->root.format = ft_glyph_format_outline;
@@ -176,7 +176,7 @@
if ( error )
goto Exit;
- decoder.builder.no_recurse = ( ( 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;
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1702,7 +1702,7 @@
if ( strcmp( (const char*)char_name,
(const char*)glyph_name ) == 0 )
{
- type1->encoding.char_index[charcode] = index;
+ type1->encoding.char_index[charcode] = (FT_UShort)index;
type1->encoding.char_name [charcode] = (char*)glyph_name;
/* Change min/max encoded char only if glyph name is */
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -278,7 +278,7 @@
root->ascender = (FT_Short)( face->type1.font_bbox.yMax >> 16 );
root->descender = (FT_Short)( face->type1.font_bbox.yMin >> 16 );
- root->height = ( ( 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 =
@@ -291,7 +291,7 @@
/* in case of error, keep the standard width */
if ( !error )
- root->max_advance_width = max_advance;
+ root->max_advance_width = (FT_Short)max_advance;
else
error = 0; /* clear error */
}
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -436,7 +436,7 @@
break;
/* otherwise, store byte */
- *write++ = ( hex1 << 4 ) | hexa_value( cur[1] );
+ *write++ = (FT_Byte)(( hex1 << 4 ) | hexa_value( cur[1] ));
count++;
cur++;
}
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -524,7 +524,7 @@
else
glyph_index = font->header.default_char - font->header.first_char;
- new_format = font->header.version == 0x300;
+ new_format = FT_BOOL( font->header.version == 0x300 );
len = new_format ? 6 : 4;
/* jump to glyph entry */