ref: 5811c7c3a583e3f9f71908ca9ab5cc0d0ea01c77
parent: db5285a0423b6cc5ec9d7ac010aecb877ac229da
author: Werner Lemberg <[email protected]>
date: Sun Jul 2 09:53:16 EDT 2000
Formatting. Fixed some errors which prevented compiling.
--- a/include/freetype/ftoutln.h
+++ b/include/freetype/ftoutln.h
@@ -16,9 +16,18 @@
/* */
/***************************************************************************/
+
#ifndef FTOUTLN_H
#define FTOUTLN_H
+
+#include <freetype/freetype.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
/*************************************************************************/
/* */
/* <Function> */
@@ -307,6 +316,12 @@
FT_Raster_Params* params );
+#ifdef __cplusplus
+ }
+#endif
#endif /* FTOUTLN_H */
+
+
+/* END */
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -561,7 +561,7 @@
/* <Note> */
/* The 2x2 transformation matrix is also applied to the glyph's */
/* advance vector. */
- /*
+ /* */
FT_EXPORT_FUNC( FT_Error ) FT_Glyph_Transform( FT_Glyph glyph,
FT_Matrix* matrix,
FT_Vector* delta )
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -23,7 +23,6 @@
#include <freetype/tttags.h>
#include <freetype/ftoutln.h>
-
#include <ttgload.h>
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -146,10 +145,10 @@
}
-#define cur_to_org( n, zone ) \
+#define cur_to_org( n, zone ) \
MEM_Copy( (zone)->org, (zone)->cur, n * sizeof ( FT_Vector ) )
-#define org_to_cur( n, zone ) \
+#define org_to_cur( n, zone ) \
MEM_Copy( (zone)->cur, (zone)->org, n * sizeof ( FT_Vector ) )
@@ -165,6 +164,7 @@
{
FT_UInt k;
+
if ( delta_x )
for ( k = 0; k < n; k++ )
coords[k].x += delta_x;
@@ -175,10 +175,11 @@
}
- static void tt_prepare_zone( TT_GlyphZone* zone,
- FT_GlyphLoad* load,
- FT_UInt start_point,
- FT_UInt start_contour )
+ static
+ void tt_prepare_zone( TT_GlyphZone* zone,
+ FT_GlyphLoad* load,
+ 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;
@@ -286,7 +287,6 @@
outline = &gloader->current.outline;
}
-
/* reading the bytecode instructions */
slot->control_len = 0;
slot->control_data = 0;
@@ -481,6 +481,7 @@
subglyph->transform.yy = yy;
num_subglyphs++;
+
} while ( subglyph->flags & MORE_COMPONENTS );
gloader->current.num_subglyphs = num_subglyphs;
@@ -575,6 +576,7 @@
FT_Fixed x_scale = load->size->metrics.x_scale;
FT_Fixed y_scale = load->size->metrics.y_scale;
+
/* first scale the glyph points */
for ( ; vec < limit; vec++ )
{
@@ -726,6 +728,7 @@
loader->exec->glyphSize = 0;
#endif
+
error = FT_Err_Ok;
goto Exit;
}
@@ -777,6 +780,7 @@
goto Fail;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
{
TT_Size size = (TT_Size)loader->size;
@@ -838,7 +842,6 @@
goto Exit;
}
-
/*********************************************************************/
/*********************************************************************/
/*********************************************************************/
@@ -963,7 +966,7 @@
/*******************************************************************/
/*******************************************************************/
- /* we have finished loading all sub-glyphs, now, look for */
+ /* we have finished loading all sub-glyphs; now, look for */
/* instructions for this composite! */
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -986,7 +989,7 @@
goto Fail;
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
- /* in some fonts ?? */
+ /* in some fonts? */
if ( n_ins == 0xFFFF )
n_ins = 0;
@@ -1131,11 +1134,11 @@
FT_Pos advance = loader->advance;
- /* the flag FT_LOAD_NO_ADVANCE_CHECK was introduced to */
- /* correctly support DynaLab fonts, which have an incorrect */
- /* `advance_Width_Max' field! It is used, to my knowledge, */
- /* exclusively in the X-TrueType font server. */
- /* */
+ /* the flag FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH was introduced to */
+ /* correctly support DynaLab fonts, which have an incorrect */
+ /* `advance_Width_Max' field! It is used, to my knowledge, */
+ /* exclusively in the X-TrueType font server. */
+ /* */
if ( face->postscript.isFixedPitch &&
( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 )
advance = face->horizontal.advance_Width_Max;
@@ -1373,7 +1376,7 @@
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
- /* seek to the beginning of the glyph table. For Type 43 fonts */
+ /* seek to the beginning of the glyph table. For Type 42 fonts */
/* the table might be accessed from a Postscript stream or something */
/* else... */
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -36,7 +36,6 @@
FT_Short* bearing,
FT_UShort* advance );
-
LOCAL_DEF
void TT_Init_Glyph_Loading( TT_Face face );
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -443,12 +443,9 @@
FT_Error error;
- FT_TRACE1(( "TT.Create_Create: new object at 0x%08p, parent = 0x%08p\n",
+ FT_TRACE1(( "Init_Context: new object at 0x%08p, parent = 0x%08p\n",
exec, face ));
- /* XXX: We don't reserve arrays anymore, this is done automatically */
- /* during a call to Context_Load(). */
-
exec->memory = memory;
exec->callSize = 32;
@@ -474,8 +471,8 @@
return TT_Err_Ok;
Fail_Memory:
- FT_ERROR(( "TT.Context_Create: not enough memory for 0x%08lx\n",
- (long)exec ));
+ FT_ERROR(( "Init_Context: not enough memory for 0x%08lx\n",
+ (FT_Long)exec ));
TT_Destroy_Context( exec, memory );
return error;
@@ -528,7 +525,6 @@
}
-
/*************************************************************************/
/* */
/* <Function> */
@@ -796,7 +792,7 @@
if ( !driver->context )
{
- FT_Error error;
+ FT_Error error;
/* allocate object */
@@ -1203,7 +1199,7 @@
const FT_Vector Null_Vector = {0,0};
-#undef PACK
+#undef PACK
#undef NULL_Vector
@@ -1237,15 +1233,22 @@
else
{
FT_Long x, y;
+
+
#ifdef FT_CONFIG_OPTION_OLD_CALCS
+
x = TT_MULDIV( CUR.GS.projVector.x, CUR.tt_metrics.x_ratio, 0x4000 );
y = TT_MULDIV( CUR.GS.projVector.y, CUR.tt_metrics.y_ratio, 0x4000 );
CUR.tt_metrics.ratio = Norm( x, y );
+
#else
+
x = TT_MULDIV( CUR.GS.projVector.x, CUR.tt_metrics.x_ratio, 0x8000 );
y = TT_MULDIV( CUR.GS.projVector.y, CUR.tt_metrics.y_ratio, 0x8000 );
CUR.tt_metrics.ratio = FT_Sqrt32( x * x + y * y ) << 1;
+
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
+
}
return CUR.tt_metrics.ratio;
@@ -1287,6 +1290,7 @@
CUR.cvt[index] = value;
}
+
static
void Write_CVT_Stretched( EXEC_OP_ FT_ULong index,
FT_F26Dot6 value )
@@ -1420,14 +1424,20 @@
if ( v != 0 )
{
+
#ifdef NO_APPLE_PATENT
+
if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )
zone->cur[point].x += distance;
+
#else
+
zone->cur[point].x += TT_MULDIV( distance,
v * 0x10000L,
CUR.F_dot_P );
+
#endif
+
zone->tags[point] |= FT_Curve_Tag_Touch_X;
}
@@ -1435,14 +1445,20 @@
if ( v != 0 )
{
+
#ifdef NO_APPLE_PATENT
+
if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )
zone->cur[point].y += distance;
+
#else
+
zone->cur[point].y += TT_MULDIV( distance,
v * 0x10000L,
CUR.F_dot_P );
+
#endif
+
zone->tags[point] |= FT_Curve_Tag_Touch_Y;
}
}
@@ -1457,6 +1473,7 @@
/* */
/*************************************************************************/
+
static
void Direct_Move_X( EXEC_OP_ TT_GlyphZone* zone,
FT_UShort point,
@@ -1465,7 +1482,7 @@
UNUSED_EXEC;
zone->cur[point].x += distance;
- zone->tags[point] |= FT_Curve_Tag_Touch_X;
+ zone->tags[point] |= FT_Curve_Tag_Touch_X;
}
@@ -1477,7 +1494,7 @@
UNUSED_EXEC;
zone->cur[point].y += distance;
- zone->tags[point] |= FT_Curve_Tag_Touch_Y;
+ zone->tags[point] |= FT_Curve_Tag_Touch_Y;
}
@@ -2209,7 +2226,7 @@
if ( W == 0 )
{
- /* XXX: UNDOCUMENTED! It seems that it's possible to try */
+ /* XXX: UNDOCUMENTED! It seems that it is possible to try */
/* to normalize the vector (0,0). Return immediately. */
return SUCCESS;
}
@@ -2664,7 +2681,7 @@
/* */
/* It seems that the value that is read here is */
/* expressed in 16.16 format rather than in font */
- /* units.. */
+ /* units. */
/* */
#define DO_SSW \
CUR.GS.single_width_value = (FT_F26Dot6)( args[0] >> 10 );
@@ -3847,7 +3864,7 @@
static
void Ins_AA( INS_ARG )
{
- /* Intentional - no longer supported */
+ /* intentionally no longer supported */
}
@@ -3986,7 +4003,7 @@
/* */
/* MANAGING THE FLOW OF CONTROL */
/* */
- /* Instructions appear in the specification's order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4100,7 +4117,7 @@
/* */
/* DEFINING AND USING FUNCTIONS AND INSTRUCTIONS */
/* */
- /* Instructions appear in the specification's order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4436,7 +4453,7 @@
/* */
/* PUSHING DATA ONTO THE INTERPRETER STACK */
/* */
- /* Instructions appear in the specification's order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4960,7 +4977,7 @@
static
void Ins_SCANTYPE( INS_ARG )
{
- /* For compatibility with future enhancements, */
+ /* for compatibility with future enhancements, */
/* we must ignore new modes */
if ( args[0] >= 0 && args[0] <= 5 )
@@ -4977,7 +4994,7 @@
/* */
/* MANAGING OUTLINES */
/* */
- /* Instructions appear in the specification's order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4993,9 +5010,9 @@
{
FT_UShort point;
-
UNUSED_ARG;
+
if ( CUR.top < CUR.GS.loop )
{
CUR.error = TT_Err_Too_Few_Arguments;
@@ -5282,7 +5299,7 @@
FT_F26Dot6 dx,
dy;
- FT_UShort last_point, i;
+ FT_UShort last_point, i;
if ( BOUNDS( args[0], 2 ) )
@@ -5918,7 +5935,7 @@
return;
}
- /* XXX: there are some glyphs in some braindead but popular */
+ /* XXX: There are some glyphs in some braindead but popular */
/* fonts out there (e.g. [aeu]grave in monotype.ttf) */
/* calling IP[] with bad values of rp[12]. */
/* Do something sane when this odd thing happens. */
@@ -6020,7 +6037,7 @@
/* Local variables for Ins_IUP: */
- struct LOC_Ins_IUP
+ struct LOC_Ins_IUP
{
FT_Vector* orgs; /* original and current coordinate */
FT_Vector* curs; /* arrays */
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -181,10 +181,11 @@
FT_F26Dot6 phase; /* `SuperRounding' */
FT_F26Dot6 threshold;
- /* this seems to be unused */
#if 0
+ /* this seems to be unused */
FT_Int cur_ppem; /* ppem along the current proj vector */
#endif
+
FT_Bool instruction_trap; /* If `True', the interpreter will */
/* exit after each instruction */
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -41,8 +41,8 @@
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttobjs
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_ttobjs
/*************************************************************************/
@@ -62,10 +62,12 @@
/* <Input> */
/* zone :: A pointer to the target glyph zone. */
/* */
- LOCAL_FUNC void TT_Done_GlyphZone( TT_GlyphZone* zone )
+ LOCAL_FUNC
+ void TT_Done_GlyphZone( TT_GlyphZone* zone )
{
FT_Memory memory = zone->memory;
+
FREE( zone->contours );
FREE( zone->tags );
FREE( zone->cur );
@@ -97,13 +99,15 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
- LOCAL_FUNC FT_Error TT_New_GlyphZone( FT_Memory memory,
- FT_UShort maxPoints,
- FT_Short maxContours,
- TT_GlyphZone* zone )
+ LOCAL_FUNC
+ FT_Error TT_New_GlyphZone( FT_Memory memory,
+ FT_UShort maxPoints,
+ FT_Short maxContours,
+ TT_GlyphZone* zone )
{
- FT_Error error;
+ FT_Error error;
+
if ( maxPoints > 0 )
maxPoints += 2;
@@ -156,6 +160,7 @@
FT_Library library;
SFNT_Interface* sfnt;
+
library = face->root.driver->root.library;
sfnt = (SFNT_Interface*)FT_Get_Module_Interface( library, "sfnt" );
if ( !sfnt )
@@ -222,6 +227,7 @@
SFNT_Interface* sfnt = face->sfnt;
+
/* for `extended TrueType formats' (i.e. compressed versions) */
if ( face->extra.finalizer )
face->extra.finalizer( face->extra.data );
@@ -269,8 +275,9 @@
LOCAL_DEF
FT_Error TT_Init_Size( TT_Size size )
{
- FT_Error error = 0;
+ FT_Error error = TT_Err_Ok;
+
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
TT_Face face = (TT_Face)size->root.face;
@@ -546,23 +553,20 @@
}
/* Compute root ascender, descender, test height, and max_advance */
- metrics->ascender = ( FT_MulFix( face->root.ascender,
- metrics->y_scale ) + 32 ) & -64;
-
- metrics->descender = ( FT_MulFix( face->root.descender,
- metrics->y_scale ) + 32 ) & -64;
-
- metrics->height = ( FT_MulFix( face->root.height,
- metrics->y_scale ) + 32 ) & -64;
-
+ metrics->ascender = ( FT_MulFix( face->root.ascender,
+ metrics->y_scale ) + 32 ) & -64;
+ metrics->descender = ( FT_MulFix( face->root.descender,
+ metrics->y_scale ) + 32 ) & -64;
+ metrics->height = ( FT_MulFix( face->root.height,
+ metrics->y_scale ) + 32 ) & -64;
metrics->max_advance = ( FT_MulFix( face->root.max_advance_width,
- metrics->x_scale ) + 32 ) & -64;
+ metrics->x_scale ) + 32 ) & -64;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
{
- TT_ExecContext exec;
- FT_UInt i, j;
+ TT_ExecContext exec;
+ FT_UInt i, j;
/* Scale the cvt values to the new ppem. */
@@ -613,7 +617,7 @@
{
error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
if ( error )
- goto Fin;
+ goto End;
if ( !size->debug )
error = face->interpreter( exec );
@@ -624,7 +628,7 @@
size->GS = exec->GS;
/* save default graphics state */
- Fin:
+ End:
TT_Save_Context( exec, size );
if ( !size->debug )
@@ -641,7 +645,6 @@
}
-
/*************************************************************************/
/* */
/* <Function> */
@@ -659,7 +662,7 @@
LOCAL_FUNC
FT_Error TT_Init_Driver( TT_Driver driver )
{
- FT_Error error;
+ FT_Error error;
/* set `extra' in glyph loader */
@@ -693,7 +696,9 @@
/* destroy extensions registry if needed */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+
TT_Done_Extensions( driver );
+
#endif
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -706,6 +711,7 @@
}
#endif
+
}
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -106,6 +106,7 @@
} TT_GraphicsState;
+
LOCAL_DEF void TT_Done_GlyphZone( TT_GlyphZone* zone );
LOCAL_DEF FT_Error TT_New_GlyphZone( FT_Memory memory,
@@ -113,6 +114,7 @@
FT_Short maxContours,
TT_GlyphZone* zone );
+
/*************************************************************************/
/* */
/* EXECUTION SUBTABLES */
@@ -166,7 +168,6 @@
} TT_DefRecord, *TT_DefArray;
-
/*************************************************************************/
/* */
/* Subglyph transformation record. */
@@ -297,10 +298,10 @@
} TT_Size_Metrics;
- /***********************************************************************/
- /* */
- /* TrueType size class. */
- /* */
+ /*************************************************************************/
+ /* */
+ /* TrueType size class. */
+ /* */
typedef struct TT_SizeRec_
{
FT_SizeRec root;
@@ -346,10 +347,10 @@
} TT_SizeRec;
- /***********************************************************************/
- /* */
- /* TrueType driver class. */
- /* */
+ /*************************************************************************/
+ /* */
+ /* TrueType driver class. */
+ /* */
typedef struct TT_DriverRec_
{
FT_DriverRec root;
@@ -399,6 +400,7 @@
LOCAL_DEF
void TT_Done_Driver( TT_Driver driver );
+
#ifdef __cplusplus
}