Fixes from the stable branch:
* include/freetype/config/ftoption.h (FT_CONFIG_OPTION_OLD_CALCS): Removed. [FT_CONFIG_OPTION_OLD_CALCS]: Removed. * include/freetype/internal/ftcalc.h, src/base/ftcalc.c [FT_CONFIG_OPTION_OLD_CALCS]: Removed. * src/base/fttrigon.c (FT_Vector_Length): Change algorithm to match output of FreeType 1. * src/pshinter/pshglob.c (psh_globals_scale_widths): Fixed a small bug that created un-even stem widths when hinting Postscript fonts. formatting, updating copyright
This commit is contained in:
parent
a1c0779c23
commit
de757dd175
14
ChangeLog
14
ChangeLog
@ -1,5 +1,19 @@
|
||||
2002-04-02 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
Fixes from the stable branch:
|
||||
|
||||
* include/freetype/config/ftoption.h (FT_CONFIG_OPTION_OLD_CALCS):
|
||||
Removed.
|
||||
[FT_CONFIG_OPTION_OLD_CALCS]: Removed.
|
||||
* include/freetype/internal/ftcalc.h, src/base/ftcalc.c
|
||||
[FT_CONFIG_OPTION_OLD_CALCS]: Removed.
|
||||
|
||||
* src/base/fttrigon.c (FT_Vector_Length): Change algorithm to match
|
||||
output of FreeType 1.
|
||||
|
||||
* src/pshinter/pshglob.c (psh_globals_scale_widths): Fixed a small
|
||||
bug that created un-even stem widths when hinting Postscript fonts.
|
||||
|
||||
* src/type1/t1driver.c, src/type1/t1parse.c: 16bit fixes.
|
||||
|
||||
2002-04-01 Werner Lemberg <wl@gnu.org>
|
||||
|
@ -277,16 +277,6 @@ FT_BEGIN_HEADER
|
||||
#define FT_DEBUG_MEMORY
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Computation Algorithms */
|
||||
/* */
|
||||
/* Used for debugging, this configuration macro should disappear */
|
||||
/* soon. */
|
||||
/* */
|
||||
#undef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The size in bytes of the render pool used by the scan-line converter */
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* Arithmetic computations (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -27,163 +27,9 @@
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* OLD 64-bits internal API */
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
#ifdef FT_LONG64
|
||||
|
||||
typedef FT_INT64 FT_Int64;
|
||||
|
||||
#define ADD_64( x, y, z ) z = (x) + (y)
|
||||
#define MUL_64( x, y, z ) z = (FT_Int64)(x) * (y)
|
||||
#define DIV_64( x, y ) ( (x) / (y) )
|
||||
|
||||
#define SQRT_64( z ) FT_Sqrt64( z )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Sqrt64 */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Computes the square root of a 64-bit value. That sounds stupid, */
|
||||
/* but it is needed to obtain maximal accuracy in the TrueType */
|
||||
/* bytecode interpreter. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* l :: A 64-bit integer. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The 32-bit square-root. */
|
||||
/* */
|
||||
FT_EXPORT( FT_Int32 )
|
||||
FT_Sqrt64( FT_Int64 l );
|
||||
|
||||
|
||||
#else /* !FT_LONG64 */
|
||||
|
||||
|
||||
typedef struct FT_Int64_
|
||||
{
|
||||
FT_UInt32 lo;
|
||||
FT_UInt32 hi;
|
||||
|
||||
} FT_Int64;
|
||||
|
||||
|
||||
#define ADD_64( x, y, z ) FT_Add64( &x, &y, &z )
|
||||
#define MUL_64( x, y, z ) FT_MulTo64( x, y, &z )
|
||||
#define DIV_64( x, y ) FT_Div64by32( &x, y )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Add64 */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Add two Int64 values. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* x :: A pointer to the first value to be added. */
|
||||
/* y :: A pointer to the second value to be added. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* z :: A pointer to the result of `x + y'. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Will be wrapped by the ADD_64() macro. */
|
||||
/* */
|
||||
FT_EXPORT( void )
|
||||
FT_Add64( FT_Int64* x,
|
||||
FT_Int64* y,
|
||||
FT_Int64 *z );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_MulTo64 */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Multiplies two Int32 integers. Returns an Int64 integer. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* x :: The first multiplier. */
|
||||
/* y :: The second multiplier. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* z :: A pointer to the result of `x * y'. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Will be wrapped by the MUL_64() macro. */
|
||||
/* */
|
||||
FT_EXPORT( void )
|
||||
FT_MulTo64( FT_Int32 x,
|
||||
FT_Int32 y,
|
||||
FT_Int64 *z );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Div64by32 */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Divides an Int64 value by an Int32 value. Returns an Int32 */
|
||||
/* integer. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* x :: A pointer to the dividend. */
|
||||
/* y :: The divisor. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The result of `x / y'. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Will be wrapped by the DIV_64() macro. */
|
||||
/* */
|
||||
FT_EXPORT( FT_Int32 )
|
||||
FT_Div64by32( FT_Int64* x,
|
||||
FT_Int32 y );
|
||||
|
||||
|
||||
#define SQRT_64( z ) FT_Sqrt64( &z )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Sqrt64 */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Computes the square root of a 64-bits value. That sounds stupid, */
|
||||
/* but it is needed to obtain maximal accuracy in the TrueType */
|
||||
/* bytecode interpreter. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* z :: A pointer to a 64-bit integer. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The 32-bit square-root. */
|
||||
/* */
|
||||
FT_EXPORT( FT_Int32 )
|
||||
FT_Sqrt64( FT_Int64* x );
|
||||
|
||||
|
||||
#endif /* !FT_LONG64 */
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
||||
|
||||
|
||||
|
||||
FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x );
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
#define SQRT_32( x ) FT_Sqrt32( x )
|
||||
|
||||
|
||||
@ -206,9 +52,6 @@ FT_BEGIN_HEADER
|
||||
FT_Sqrt32( FT_Int32 x );
|
||||
|
||||
|
||||
#endif /* !FT_CONFIG_OPTION_OLD_CALCS */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
|
||||
/* we need to define a 64-bits data type here */
|
||||
#ifndef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
#ifdef FT_LONG64
|
||||
|
||||
@ -56,8 +55,6 @@
|
||||
|
||||
#endif /* FT_LONG64 */
|
||||
|
||||
#endif /* !FT_CONFIG_OPTION_OLD_CALCS */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -70,7 +67,7 @@
|
||||
|
||||
|
||||
/* The following three functions are available regardless of whether */
|
||||
/* FT_LONG64 or FT_CONFIG_OPTION_OLD_CALCS is defined. */
|
||||
/* FT_LONG64 is defined. */
|
||||
|
||||
/* documentation is in freetype.h */
|
||||
|
||||
@ -102,27 +99,6 @@
|
||||
}
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
static const FT_Long ft_square_roots[63] =
|
||||
{
|
||||
1L, 1L, 2L, 3L, 4L, 5L, 8L, 11L,
|
||||
16L, 22L, 32L, 45L, 64L, 90L, 128L, 181L,
|
||||
256L, 362L, 512L, 724L, 1024L, 1448L, 2048L, 2896L,
|
||||
4096L, 5892L, 8192L, 11585L, 16384L, 23170L, 32768L, 46340L,
|
||||
|
||||
65536L, 92681L, 131072L, 185363L, 262144L, 370727L,
|
||||
524288L, 741455L, 1048576L, 1482910L, 2097152L, 2965820L,
|
||||
4194304L, 5931641L, 8388608L, 11863283L, 16777216L, 23726566L,
|
||||
|
||||
33554432L, 47453132L, 67108864L, 94906265L,
|
||||
134217728L, 189812531L, 268435456L, 379625062L,
|
||||
536870912L, 759250125L, 1073741824L, 1518500250L,
|
||||
2147483647L
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
/* documentation is in ftcalc.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Int32 )
|
||||
@ -152,11 +128,10 @@
|
||||
return root;
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
||||
|
||||
|
||||
#ifdef FT_LONG64
|
||||
|
||||
|
||||
/* documentation is in freetype.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Long )
|
||||
@ -222,51 +197,6 @@
|
||||
}
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
/* a helper function for FT_Sqrt64() */
|
||||
|
||||
static int
|
||||
ft_order64( FT_Int64 z )
|
||||
{
|
||||
int j = 0;
|
||||
|
||||
|
||||
while ( z )
|
||||
{
|
||||
z = (unsigned FT_INT64)z >> 1;
|
||||
j++;
|
||||
}
|
||||
return j - 1;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftcalc.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Int32 )
|
||||
FT_Sqrt64( FT_Int64 l )
|
||||
{
|
||||
FT_Int64 r, s;
|
||||
|
||||
|
||||
if ( l <= 0 ) return 0;
|
||||
if ( l == 1 ) return 1;
|
||||
|
||||
r = ft_square_roots[ft_order64( l )];
|
||||
|
||||
do
|
||||
{
|
||||
s = r;
|
||||
r = ( r + l / r ) >> 1;
|
||||
|
||||
} while ( r > s || r * r > l );
|
||||
|
||||
return (FT_Int32)r;
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
||||
|
||||
|
||||
#else /* FT_LONG64 */
|
||||
|
||||
|
||||
@ -498,7 +428,9 @@
|
||||
|
||||
/* apparently, the second version of this code is not compiled correctly */
|
||||
/* on Mac machines with the MPW C compiler.. tsss, tsss, tss... */
|
||||
|
||||
#if 1
|
||||
|
||||
FT_EXPORT_DEF( FT_Int32 )
|
||||
FT_Div64by32( FT_Int64* x,
|
||||
FT_Int32 y )
|
||||
@ -550,7 +482,9 @@
|
||||
|
||||
return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
|
||||
}
|
||||
#else
|
||||
|
||||
#else /* 0 */
|
||||
|
||||
FT_EXPORT_DEF( FT_Int32 )
|
||||
FT_Div64by32( FT_Int64* x,
|
||||
FT_Int32 y )
|
||||
@ -582,86 +516,8 @@
|
||||
|
||||
return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
|
||||
/* two helper functions for FT_Sqrt64() */
|
||||
|
||||
static void
|
||||
FT_Sub64( FT_Int64* x,
|
||||
FT_Int64* y,
|
||||
FT_Int64* z )
|
||||
{
|
||||
register FT_UInt32 lo, hi;
|
||||
|
||||
|
||||
lo = x->lo - y->lo;
|
||||
hi = x->hi - y->hi - ( (FT_Int32)lo < 0 );
|
||||
|
||||
z->lo = lo;
|
||||
z->hi = hi;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ft_order64( FT_Int64* z )
|
||||
{
|
||||
FT_UInt32 i;
|
||||
int j;
|
||||
|
||||
|
||||
i = z->lo;
|
||||
j = 0;
|
||||
if ( z->hi )
|
||||
{
|
||||
i = z->hi;
|
||||
j = 32;
|
||||
}
|
||||
|
||||
while ( i > 0 )
|
||||
{
|
||||
i >>= 1;
|
||||
j++;
|
||||
}
|
||||
return j - 1;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftcalc.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Int32 )
|
||||
FT_Sqrt64( FT_Int64* l )
|
||||
{
|
||||
FT_Int64 l2;
|
||||
FT_Int32 r, s;
|
||||
|
||||
|
||||
if ( (FT_Int32)l->hi < 0 ||
|
||||
( l->hi == 0 && l->lo == 0 ) )
|
||||
return 0;
|
||||
|
||||
s = ft_order64( l );
|
||||
if ( s == 0 )
|
||||
return 1;
|
||||
|
||||
r = ft_square_roots[s];
|
||||
do
|
||||
{
|
||||
s = r;
|
||||
r = ( r + FT_Div64by32( l, r ) ) >> 1;
|
||||
FT_MulTo64( r, r, &l2 );
|
||||
FT_Sub64 ( l, &l2, &l2 );
|
||||
|
||||
} while ( r > s || (FT_Int32)l2.hi < 0 );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
||||
#endif /* 0 */
|
||||
|
||||
|
||||
#endif /* FT_LONG64 */
|
||||
|
@ -417,7 +417,11 @@
|
||||
ft_trig_pseudo_polarize( &v );
|
||||
|
||||
v.x = ft_trig_downscale( v.x );
|
||||
return ( shift >= 0 ) ? ( v.x >> shift ) : ( v.x << -shift );
|
||||
|
||||
if ( shift > 0 )
|
||||
return ( v.x + ( 1 << ( shift - 1 ) ) ) >> shift;
|
||||
|
||||
return v.x << -shift;
|
||||
}
|
||||
|
||||
|
||||
|
@ -380,10 +380,10 @@
|
||||
root->num_glyphs = cff->charstrings_index.count;
|
||||
|
||||
/* set global bbox, as well as EM size */
|
||||
root->bbox.xMin = dict->font_bbox.xMin >> 16;
|
||||
root->bbox.yMin = dict->font_bbox.yMin >> 16;
|
||||
root->bbox.xMax = (dict->font_bbox.xMax + 0xFFFFU) >> 16;
|
||||
root->bbox.yMax = (dict->font_bbox.yMax + 0xFFFFU) >> 16;
|
||||
root->bbox.xMin = dict->font_bbox.xMin >> 16;
|
||||
root->bbox.yMin = dict->font_bbox.yMin >> 16;
|
||||
root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
|
||||
root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
|
||||
|
||||
|
||||
root->ascender = (FT_Short)( root->bbox.yMax );
|
||||
|
@ -378,10 +378,10 @@
|
||||
root->num_fixed_sizes = 0;
|
||||
root->available_sizes = 0;
|
||||
|
||||
root->bbox.xMin = face->cid.font_bbox.xMin >> 16;
|
||||
root->bbox.yMin = face->cid.font_bbox.yMin >> 16;
|
||||
root->bbox.xMax = (face->cid.font_bbox.xMax + 0xFFFFU) >> 16;
|
||||
root->bbox.yMax = (face->cid.font_bbox.yMax + 0xFFFFU) >> 16;
|
||||
root->bbox.xMin = face->cid.font_bbox.xMin >> 16;
|
||||
root->bbox.yMin = face->cid.font_bbox.yMin >> 16;
|
||||
root->bbox.xMax = ( face->cid.font_bbox.xMax + 0xFFFFU ) >> 16;
|
||||
root->bbox.yMax = ( face->cid.font_bbox.yMax + 0xFFFFU ) >> 16;
|
||||
|
||||
if ( !root->units_per_EM )
|
||||
root->units_per_EM = 1000;
|
||||
|
@ -45,13 +45,35 @@
|
||||
PSH_Widths stdw = &dim->stdw;
|
||||
FT_UInt count = stdw->count;
|
||||
PSH_Width width = stdw->widths;
|
||||
PSH_Width stand = width; /* standard width/height */
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
|
||||
|
||||
for ( ; count > 0; count--, width++ )
|
||||
if ( count > 0 )
|
||||
{
|
||||
width->cur = FT_MulFix( width->org, scale );
|
||||
width->fit = FT_RoundFix( width->cur );
|
||||
|
||||
width++;
|
||||
count--;
|
||||
|
||||
for ( ; count > 0; count--, width++ )
|
||||
{
|
||||
FT_Pos w, dist;
|
||||
|
||||
|
||||
w = FT_MulFix( width->org, scale );
|
||||
dist = w - stand->cur;
|
||||
|
||||
if ( dist < 0 )
|
||||
dist = -dist;
|
||||
|
||||
if ( dist < 128 )
|
||||
w = stand->cur;
|
||||
|
||||
width->cur = w;
|
||||
width->fit = FT_RoundFix( w );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1599,7 +1599,7 @@
|
||||
/* in the current face */
|
||||
/* */
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
TT_Build_CMaps( TT_Face face )
|
||||
TT_Build_CMaps( TT_Face face )
|
||||
{
|
||||
FT_Byte* table = face->cmap_table;
|
||||
FT_Byte* limit = table + face->cmap_size;
|
||||
|
@ -391,8 +391,8 @@
|
||||
root->num_fixed_sizes = 0;
|
||||
root->available_sizes = 0;
|
||||
|
||||
root->bbox.xMin = face->type1.font_bbox.xMin >> 16;
|
||||
root->bbox.yMin = face->type1.font_bbox.yMin >> 16;
|
||||
root->bbox.xMin = face->type1.font_bbox.xMin >> 16;
|
||||
root->bbox.yMin = face->type1.font_bbox.yMin >> 16;
|
||||
root->bbox.xMax = ( face->type1.font_bbox.xMax + 0xFFFFU ) >> 16;
|
||||
root->bbox.yMax = ( face->type1.font_bbox.yMax + 0xFFFFU ) >> 16;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2001 by
|
||||
# Copyright 2001, 2002 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# Copyright 1996-2000, 2001 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* FreeType font driver for Windows FNT/FON files */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -112,7 +112,7 @@
|
||||
|
||||
|
||||
static void
|
||||
fnt_font_done( FNT_Font font,
|
||||
fnt_font_done( FNT_Font font,
|
||||
FT_Stream stream )
|
||||
{
|
||||
if ( font->fnt_frame )
|
||||
@ -124,10 +124,10 @@
|
||||
|
||||
|
||||
static FT_Error
|
||||
fnt_font_load( FNT_Font font,
|
||||
fnt_font_load( FNT_Font font,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Error error;
|
||||
WinFNT_Header header = &font->header;
|
||||
|
||||
|
||||
@ -169,10 +169,10 @@
|
||||
static void
|
||||
fnt_face_done_fonts( FNT_Face face )
|
||||
{
|
||||
FT_Memory memory = FT_FACE(face)->memory;
|
||||
FT_Stream stream = FT_FACE(face)->stream;
|
||||
FNT_Font cur = face->fonts;
|
||||
FNT_Font limit = cur + face->num_fonts;
|
||||
FT_Memory memory = FT_FACE( face )->memory;
|
||||
FT_Stream stream = FT_FACE( face )->stream;
|
||||
FNT_Font cur = face->fonts;
|
||||
FNT_Font limit = cur + face->num_fonts;
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
@ -186,9 +186,9 @@
|
||||
static FT_Error
|
||||
fnt_face_get_dll_fonts( FNT_Face face )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Stream stream = FT_FACE(face)->stream;
|
||||
FT_Memory memory = FT_FACE(face)->memory;
|
||||
FT_Error error;
|
||||
FT_Stream stream = FT_FACE( face )->stream;
|
||||
FT_Memory memory = FT_FACE( face )->memory;
|
||||
WinMZ_HeaderRec mz_header;
|
||||
|
||||
|
||||
@ -310,10 +310,10 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_USE_CMAPS
|
||||
|
||||
typedef struct FNT_CMapRec_
|
||||
|
||||
typedef struct FNT_CMapRec_
|
||||
{
|
||||
FT_CMapRec cmap;
|
||||
FT_UInt32 first;
|
||||
@ -325,11 +325,12 @@
|
||||
static FT_Error
|
||||
fnt_cmap_init( FNT_CMap cmap )
|
||||
{
|
||||
FNT_Face face = (FNT_Face) FT_CMAP_FACE(cmap);
|
||||
FNT_Face face = (FNT_Face)FT_CMAP_FACE( cmap );
|
||||
FNT_Font font = face->fonts;
|
||||
|
||||
cmap->first = (FT_UInt32) font->header.first_char;
|
||||
cmap->count = (FT_UInt32)(font->header.last_char - cmap->first + 1);
|
||||
|
||||
cmap->first = (FT_UInt32) font->header.first_char;
|
||||
cmap->count = (FT_UInt32)( font->header.last_char - cmap->first + 1 );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -341,6 +342,7 @@
|
||||
{
|
||||
FT_UInt gindex = 0;
|
||||
|
||||
|
||||
char_code -= cmap->first;
|
||||
if ( char_code < cmap->count )
|
||||
gindex = char_code + 1;
|
||||
@ -350,13 +352,14 @@
|
||||
|
||||
|
||||
static FT_UInt
|
||||
fnt_cmap_char_next( FNT_CMap cmap,
|
||||
FT_UInt32 *pchar_code )
|
||||
fnt_cmap_char_next( FNT_CMap cmap,
|
||||
FT_UInt32 *pchar_code )
|
||||
{
|
||||
FT_UInt gindex = 0;
|
||||
FT_UInt32 result = 0;
|
||||
FT_UInt32 char_code = *pchar_code + 1;
|
||||
|
||||
|
||||
if ( char_code <= cmap->first )
|
||||
{
|
||||
result = cmap->first;
|
||||
@ -376,19 +379,23 @@
|
||||
return gindex;
|
||||
}
|
||||
|
||||
|
||||
static FT_CMap_ClassRec fnt_cmap_class_rec =
|
||||
{
|
||||
sizeof( FNT_CMapRec ),
|
||||
(FT_CMap_InitFunc) fnt_cmap_init,
|
||||
(FT_CMap_DoneFunc) NULL,
|
||||
(FT_CMap_CharIndexFunc) fnt_cmap_char_index,
|
||||
(FT_CMap_CharNextFunc) fnt_cmap_char_next
|
||||
sizeof ( FNT_CMapRec ),
|
||||
|
||||
(FT_CMap_InitFunc) fnt_cmap_init,
|
||||
(FT_CMap_DoneFunc) NULL,
|
||||
(FT_CMap_CharIndexFunc)fnt_cmap_char_index,
|
||||
(FT_CMap_CharNextFunc) fnt_cmap_char_next
|
||||
};
|
||||
|
||||
static FT_CMap_Class fnt_cmap_class = &fnt_cmap_class_rec;
|
||||
static FT_CMap_Class fnt_cmap_class = &fnt_cmap_class_rec;
|
||||
|
||||
|
||||
#else /* !FT_CONFIG_OPTION_USE_CMAPS */
|
||||
|
||||
|
||||
static FT_UInt
|
||||
FNT_Get_Char_Index( FT_CharMap charmap,
|
||||
FT_Long char_code )
|
||||
@ -399,8 +406,8 @@
|
||||
if ( charmap )
|
||||
{
|
||||
FNT_Font font = ((FNT_Face)charmap->face)->fonts;
|
||||
FT_Long first = font->header.first_char;
|
||||
FT_Long count = font->header.last_char - first + 1;
|
||||
FT_Long first = font->header.first_char;
|
||||
FT_Long count = font->header.last_char - first + 1;
|
||||
|
||||
|
||||
char_code -= first;
|
||||
@ -422,7 +429,7 @@
|
||||
if ( charmap )
|
||||
{
|
||||
FNT_Font font = ((FNT_Face)charmap->face)->fonts;
|
||||
FT_Long first = font->header.first_char;
|
||||
FT_Long first = font->header.first_char;
|
||||
|
||||
|
||||
if ( char_code < first )
|
||||
@ -473,6 +480,7 @@
|
||||
/* this didn't work, now try to load a single FNT font */
|
||||
FNT_Font font;
|
||||
|
||||
|
||||
if ( FT_NEW( face->fonts ) )
|
||||
goto Exit;
|
||||
|
||||
@ -490,7 +498,7 @@
|
||||
/* all right, one or more fonts were loaded; we now need to */
|
||||
/* fill the root FT_Face fields with relevant information */
|
||||
{
|
||||
FT_Face root = FT_FACE( face );
|
||||
FT_Face root = FT_FACE( face );
|
||||
FNT_Font fonts = face->fonts;
|
||||
FNT_Font limit = fonts + face->num_fonts;
|
||||
FNT_Font cur;
|
||||
@ -592,7 +600,7 @@
|
||||
FNT_Size_Set_Pixels( FNT_Size size )
|
||||
{
|
||||
/* look up a font corresponding to the current pixel size */
|
||||
FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
|
||||
FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
|
||||
FNT_Font cur = face->fonts;
|
||||
FNT_Font limit = cur + face->num_fonts;
|
||||
|
||||
@ -624,7 +632,7 @@
|
||||
FT_UInt glyph_index,
|
||||
FT_Int load_flags )
|
||||
{
|
||||
FNT_Font font = size->font;
|
||||
FNT_Font font = size->font;
|
||||
FT_Error error = 0;
|
||||
FT_Byte* p;
|
||||
FT_Int len;
|
||||
@ -653,12 +661,12 @@
|
||||
/* jump to glyph entry */
|
||||
p = font->fnt_frame + 118 + len * glyph_index;
|
||||
|
||||
bitmap->width = FT_NEXT_SHORT_LE(p);
|
||||
bitmap->width = FT_NEXT_SHORT_LE( p );
|
||||
|
||||
if ( new_format )
|
||||
offset = FT_NEXT_ULONG_LE(p);
|
||||
offset = FT_NEXT_ULONG_LE( p );
|
||||
else
|
||||
offset = FT_NEXT_USHORT_LE(p);
|
||||
offset = FT_NEXT_USHORT_LE( p );
|
||||
|
||||
/* jump to glyph data */
|
||||
p = font->fnt_frame + /* font->header.bits_offset */ + offset;
|
||||
@ -730,32 +738,32 @@
|
||||
sizeof( FNT_SizeRec ),
|
||||
sizeof( FT_GlyphSlotRec ),
|
||||
|
||||
(FT_Face_InitFunc) FNT_Face_Init,
|
||||
(FT_Face_DoneFunc) FNT_Face_Done,
|
||||
(FT_Size_InitFunc) 0,
|
||||
(FT_Size_DoneFunc) 0,
|
||||
(FT_Slot_InitFunc) 0,
|
||||
(FT_Slot_DoneFunc) 0,
|
||||
(FT_Face_InitFunc) FNT_Face_Init,
|
||||
(FT_Face_DoneFunc) FNT_Face_Done,
|
||||
(FT_Size_InitFunc) 0,
|
||||
(FT_Size_DoneFunc) 0,
|
||||
(FT_Slot_InitFunc) 0,
|
||||
(FT_Slot_DoneFunc) 0,
|
||||
|
||||
(FT_Size_ResetPointsFunc) FNT_Size_Set_Pixels,
|
||||
(FT_Size_ResetPixelsFunc)FNT_Size_Set_Pixels,
|
||||
(FT_Slot_LoadFunc) FNT_Load_Glyph,
|
||||
(FT_Size_ResetPixelsFunc) FNT_Size_Set_Pixels,
|
||||
(FT_Slot_LoadFunc) FNT_Load_Glyph,
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_USE_CMAPS
|
||||
(FT_CharMap_CharIndexFunc) 0,
|
||||
(FT_CharMap_CharIndexFunc)0,
|
||||
#else
|
||||
(FT_CharMap_CharIndexFunc) FNT_Get_Char_Index,
|
||||
(FT_CharMap_CharIndexFunc)FNT_Get_Char_Index,
|
||||
#endif
|
||||
|
||||
|
||||
(FT_Face_GetKerningFunc) 0,
|
||||
(FT_Face_AttachFunc) 0,
|
||||
(FT_Face_GetAdvancesFunc) 0,
|
||||
(FT_Face_GetKerningFunc) 0,
|
||||
(FT_Face_AttachFunc) 0,
|
||||
(FT_Face_GetAdvancesFunc) 0,
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_USE_CMAPS
|
||||
(FT_CharMap_CharNextFunc) 0
|
||||
(FT_CharMap_CharNextFunc) 0
|
||||
#else
|
||||
(FT_CharMap_CharNextFunc) FNT_Get_Next_Char
|
||||
(FT_CharMap_CharNextFunc) FNT_Get_Next_Char
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* FreeType font driver for Windows FNT/FON files */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* Copyright 1996-2001, 2002 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
Loading…
Reference in New Issue
Block a user