1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Update HarfBuzz, ICU and FreeType

HarfBuzz: Update to version 7.3.0
ICU4C: Update to version 73.1
FreeType: Update to version 2.13.0
This commit is contained in:
bruvzg
2023-05-23 03:05:01 +03:00
parent d5c1b9f883
commit b64df2bf74
810 changed files with 32198 additions and 11081 deletions

View File

@@ -7,7 +7,7 @@
*
* Auto-fitter data for blue strings (body).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter data for blue strings (body).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -7,7 +7,7 @@
*
* Auto-fitter data for blue strings (specification).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter data for blue strings (specification).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for CJK writing system (body).
*
* Copyright (C) 2006-2022 by
* Copyright (C) 2006-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -650,7 +650,7 @@
af_cjk_metrics_check_digits( metrics, face );
}
FT_Set_Charmap( face, oldmap );
face->charmap = oldmap;
return FT_Err_Ok;
}
@@ -741,9 +741,11 @@
( dim == AF_DIMENSION_HORZ ) ? 'H' : 'V',
nn, blue->ref.org, blue->shoot.org ));
FT_TRACE5(( " ref: cur=%.2f fit=%.2f\n",
blue->ref.cur / 64.0, blue->ref.fit / 64.0 ));
(double)blue->ref.cur / 64,
(double)blue->ref.fit / 64 ));
FT_TRACE5(( " shoot: cur=%.2f fit=%.2f\n",
blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 ));
(double)blue->shoot.cur / 64,
(double)blue->shoot.fit / 64 ));
blue->flags |= AF_CJK_BLUE_ACTIVE;
}
@@ -1044,7 +1046,7 @@
{
AF_Edge found = NULL;
FT_Pos best = 0xFFFFU;
FT_Int ee;
FT_UInt ee;
/* look for an edge corresponding to the segment */
@@ -1629,8 +1631,10 @@
FT_TRACE5(( " CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f,"
" dist was %.2f, now %.2f\n",
stem_edge - hints->axis[dim].edges, stem_edge->fpos,
stem_edge->opos / 64.0, stem_edge->pos / 64.0,
dist / 64.0, fitted_width / 64.0 ));
(double)stem_edge->opos / 64,
(double)stem_edge->pos / 64,
(double)dist / 64,
(double)fitted_width / 64 ));
}
@@ -1850,8 +1854,8 @@
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( " CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f,"
" was %.2f\n",
edge1 - edges, edge1->fpos, edge1->opos / 64.0,
blue->fit / 64.0, edge1->pos / 64.0 ));
edge1 - edges, edge1->fpos, (double)edge1->opos / 64,
(double)blue->fit / 64, (double)edge1->pos / 64 ));
num_actions++;
#endif
@@ -2024,8 +2028,8 @@
#if 0
printf( "stem (%d,%d) adjusted (%.1f,%.1f)\n",
edge - edges, edge2 - edges,
( edge->pos - edge->opos ) / 64.0,
( edge2->pos - edge2->opos ) / 64.0 );
(double)( edge->pos - edge->opos ) / 64,
(double)( edge2->pos - edge2->opos ) / 64 );
#endif
anchor = edge;

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for CJK writing system (specification).
*
* Copyright (C) 2006-2022 by
* Copyright (C) 2006-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter coverages (specification only).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -5,7 +5,7 @@
* Auto-fitter dummy routines to be used if no hinting should be
* performed (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -5,7 +5,7 @@
* Auto-fitter dummy routines to be used if no hinting should be
* performed (specification).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Autofitter error codes (specification only).
*
* Copyright (C) 2005-2022 by
* Copyright (C) 2005-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter routines to compute global hinting values (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -129,13 +129,13 @@
FT_Face face = globals->face;
FT_CharMap old_charmap = face->charmap;
FT_UShort* gstyles = globals->glyph_styles;
FT_UInt ss;
FT_UShort ss;
FT_UShort dflt = 0xFFFFU; /* a non-valid value */
FT_UInt i;
FT_UInt dflt = ~0U; /* a non-valid value */
/* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */
for ( i = 0; i < (FT_UInt)globals->glyph_count; i++ )
for ( i = 0; i < globals->glyph_count; i++ )
gstyles[i] = AF_STYLE_UNASSIGNED;
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
@@ -168,8 +168,7 @@
*/
if ( style_class->coverage == AF_COVERAGE_DEFAULT )
{
if ( (FT_UInt)style_class->script ==
globals->module->default_script )
if ( style_class->script == globals->module->default_script )
dflt = ss;
for ( range = script_class->script_uni_ranges;
@@ -183,9 +182,9 @@
gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 &&
gindex < (FT_ULong)globals->glyph_count &&
gindex < globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
gstyles[gindex] = (FT_UShort)ss;
gstyles[gindex] = ss;
for (;;)
{
@@ -194,9 +193,9 @@
if ( gindex == 0 || charcode > range->last )
break;
if ( gindex < (FT_ULong)globals->glyph_count &&
if ( gindex < globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
gstyles[gindex] = (FT_UShort)ss;
gstyles[gindex] = ss;
}
}
@@ -211,9 +210,9 @@
gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 &&
gindex < (FT_ULong)globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
if ( gindex != 0 &&
gindex < globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == ss )
gstyles[gindex] |= AF_NONBASE;
for (;;)
@@ -223,8 +222,8 @@
if ( gindex == 0 || charcode > range->last )
break;
if ( gindex < (FT_ULong)globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
if ( gindex < globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == ss )
gstyles[gindex] |= AF_NONBASE;
}
}
@@ -255,7 +254,7 @@
FT_UInt gindex = FT_Get_Char_Index( face, i );
if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count )
if ( gindex != 0 && gindex < globals->glyph_count )
gstyles[gindex] |= AF_DIGIT;
}
@@ -266,7 +265,7 @@
*/
if ( globals->module->fallback_style != AF_STYLE_UNASSIGNED )
{
FT_Long nn;
FT_UInt nn;
for ( nn = 0; nn < globals->glyph_count; nn++ )
@@ -290,7 +289,7 @@
{
AF_StyleClass style_class = af_style_classes[ss];
FT_UInt count = 0;
FT_Long idx;
FT_UInt idx;
FT_TRACE4(( "%s:\n", af_style_names[style_class->style] ));
@@ -302,7 +301,7 @@
if ( !( count % 10 ) )
FT_TRACE4(( " " ));
FT_TRACE4(( " %ld", idx ));
FT_TRACE4(( " %d", idx ));
count++;
if ( !( count % 10 ) )
@@ -318,7 +317,7 @@
#endif /* FT_DEBUG_LEVEL_TRACE */
FT_Set_Charmap( face, old_charmap );
face->charmap = old_charmap;
return error;
}
@@ -345,7 +344,7 @@
FT_ZERO( &globals->metrics );
globals->face = face;
globals->glyph_count = face->num_glyphs;
globals->glyph_count = (FT_UInt)face->num_glyphs;
/* right after the globals structure come the glyph styles */
globals->glyph_styles = (FT_UShort*)( globals + 1 );
globals->module = module;
@@ -357,7 +356,7 @@
globals->scale_down_factor = 0;
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
globals->hb_font = hb_ft_font_create( face, NULL );
globals->hb_font = hb_ft_font_create_( face, NULL );
globals->hb_buf = hb_buffer_create();
#endif
@@ -429,7 +428,7 @@
FT_Error error = FT_Err_Ok;
if ( gindex >= (FT_ULong)globals->glyph_count )
if ( gindex >= globals->glyph_count )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
@@ -501,7 +500,7 @@
af_face_globals_is_digit( AF_FaceGlobals globals,
FT_UInt gindex )
{
if ( gindex < (FT_ULong)globals->glyph_count )
if ( gindex < globals->glyph_count )
return FT_BOOL( globals->glyph_styles[gindex] & AF_DIGIT );
return FT_BOOL( 0 );

View File

@@ -5,7 +5,7 @@
* Auto-fitter routines to compute global hinting values
* (specification).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -105,7 +105,7 @@ FT_BEGIN_HEADER
typedef struct AF_FaceGlobalsRec_
{
FT_Face face;
FT_Long glyph_count; /* same as face->num_glyphs */
FT_UInt glyph_count; /* unsigned face->num_glyphs */
FT_UShort* glyph_styles;
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
@@ -158,7 +158,7 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
af_face_globals_free( AF_FaceGlobals globals );
FT_LOCAL_DEF( FT_Bool )
FT_LOCAL( FT_Bool )
af_face_globals_is_digit( AF_FaceGlobals globals,
FT_UInt gindex );

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -151,9 +151,9 @@
}
else if ( axis->num_segments >= axis->max_segments )
{
FT_Int old_max = axis->max_segments;
FT_Int new_max = old_max;
FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *segment ) );
FT_UInt old_max = axis->max_segments;
FT_UInt new_max = old_max;
FT_UInt big_max = FT_INT_MAX / sizeof ( *segment );
if ( old_max >= big_max )
@@ -193,7 +193,7 @@
/* Get new edge for given axis, direction, and position, */
/* without initializing the edge itself. */
FT_LOCAL( FT_Error )
FT_LOCAL_DEF( FT_Error )
af_axis_hints_new_edge( AF_AxisHints axis,
FT_Int fpos,
AF_Direction dir,
@@ -216,9 +216,9 @@
}
else if ( axis->num_edges >= axis->max_edges )
{
FT_Int old_max = axis->max_edges;
FT_Int new_max = old_max;
FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *edge ) );
FT_UInt old_max = axis->max_edges;
FT_UInt new_max = old_max;
FT_UInt big_max = FT_INT_MAX / sizeof ( *edge );
if ( old_max >= big_max )
@@ -471,10 +471,10 @@
point->fx,
point->fy,
point->ox / 64.0,
point->oy / 64.0,
point->x / 64.0,
point->y / 64.0,
(double)point->ox / 64,
(double)point->oy / 64,
(double)point->x / 64,
(double)point->y / 64,
af_print_idx( buf5, af_get_strong_edge_index( hints,
point->before,
@@ -597,7 +597,7 @@
FT_Error
af_glyph_hints_get_num_segments( AF_GlyphHints hints,
FT_Int dimension,
FT_Int* num_segments )
FT_UInt* num_segments )
{
AF_Dimension dim;
AF_AxisHints axis;
@@ -623,7 +623,7 @@
FT_Error
af_glyph_hints_get_segment_offset( AF_GlyphHints hints,
FT_Int dimension,
FT_Int idx,
FT_UInt idx,
FT_Pos *offset,
FT_Bool *is_blue,
FT_Pos *blue_offset )
@@ -640,7 +640,7 @@
axis = &hints->axis[dim];
if ( idx < 0 || idx >= axis->num_segments )
if ( idx >= axis->num_segments )
return FT_THROW( Invalid_Argument );
seg = &axis->segments[idx];
@@ -692,13 +692,13 @@
if ( dimension == AF_DIMENSION_HORZ )
AF_DUMP(( "Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n",
"vertical",
65536.0 * 64.0 / hints->x_scale,
10.0 * hints->x_scale / 65536.0 / 64.0 ));
65536 * 64 / (double)hints->x_scale,
10 * (double)hints->x_scale / 65536 / 64 ));
else
AF_DUMP(( "Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n",
"horizontal",
65536.0 * 64.0 / hints->y_scale,
10.0 * hints->y_scale / 65536.0 / 64.0 ));
65536 * 64 / (double)hints->y_scale,
10 * (double)hints->y_scale / 65536 / 64 ));
if ( axis->num_edges )
{
@@ -714,14 +714,14 @@
AF_DUMP(( " %5d %7.2f %5s %4s %5s"
" %c %7.2f %7.2f %11s\n",
AF_INDEX_NUM( edge, edges ),
(int)edge->opos / 64.0,
(double)(int)edge->opos / 64,
af_dir_str( (AF_Direction)edge->dir ),
af_print_idx( buf1, AF_INDEX_NUM( edge->link, edges ) ),
af_print_idx( buf2, AF_INDEX_NUM( edge->serif, edges ) ),
edge->blue_edge ? 'y' : 'n',
edge->opos / 64.0,
edge->pos / 64.0,
(double)edge->opos / 64,
(double)edge->pos / 64,
af_edge_flags_to_string( edge->flags ) ));
AF_DUMP(( "\n" ));
}

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines (specification).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -21,8 +21,6 @@
#include "aftypes.h"
#define xxAF_SORT_SEGMENTS
FT_BEGIN_HEADER
/*
@@ -310,15 +308,12 @@ FT_BEGIN_HEADER
typedef struct AF_AxisHintsRec_
{
FT_Int num_segments; /* number of used segments */
FT_Int max_segments; /* number of allocated segments */
FT_UInt num_segments; /* number of used segments */
FT_UInt max_segments; /* number of allocated segments */
AF_Segment segments; /* segments array */
#ifdef AF_SORT_SEGMENTS
FT_Int mid_segments;
#endif
FT_Int num_edges; /* number of used edges */
FT_Int max_edges; /* number of allocated edges */
FT_UInt num_edges; /* number of used edges */
FT_UInt max_edges; /* number of allocated edges */
AF_Edge edges; /* edges array */
AF_Direction major_dir; /* either vertical or horizontal */
@@ -380,14 +375,14 @@ FT_BEGIN_HEADER
#ifdef FT_DEBUG_AUTOFIT
#define AF_HINTS_DO_HORIZONTAL( h ) \
( !_af_debug_disable_horz_hints && \
( !af_debug_disable_horz_hints_ && \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) )
#define AF_HINTS_DO_VERTICAL( h ) \
( !_af_debug_disable_vert_hints && \
( !af_debug_disable_vert_hints_ && \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) )
#define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints )
#define AF_HINTS_DO_BLUES( h ) ( !af_debug_disable_blue_hints_ )
#else /* !FT_DEBUG_AUTOFIT */

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for Indic writing system (body).
*
* Copyright (C) 2007-2022 by
* Copyright (C) 2007-2023 by
* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.
*
* This file is part of the FreeType project, and may only be used,
@@ -49,8 +49,7 @@
af_cjk_metrics_check_digits( metrics, face );
}
FT_Set_Charmap( face, oldmap );
face->charmap = oldmap;
return FT_Err_Ok;
}

View File

@@ -5,7 +5,7 @@
* Auto-fitter hinting routines for Indic writing system
* (specification).
*
* Copyright (C) 2007-2022 by
* Copyright (C) 2007-2023 by
* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter hinting routines for latin writing system (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -1043,7 +1043,7 @@
AF_FaceGlobals globals = metrics->root.globals;
FT_UShort* gstyles = globals->glyph_styles;
FT_Long i;
FT_UInt i;
FT_TRACE5(( "no blue zones found:"
@@ -1157,7 +1157,7 @@
}
Exit:
FT_Set_Charmap( face, oldmap );
face->charmap = oldmap;
return error;
}
@@ -1275,8 +1275,8 @@
FT_TRACE5(( " "
" vertical scaling changed"
" from %.5f to %.5f (by %ld%%)\n",
scale / 65536.0,
new_scale / 65536.0,
(double)scale / 65536,
(double)new_scale / 65536,
( fitted - scaled ) * 100 / scaled ));
FT_TRACE5(( "\n" ));
@@ -1327,7 +1327,7 @@
FT_TRACE5(( " %ld scaled to %.2f\n",
width->org,
width->cur / 64.0 ));
(double)width->cur / 64 ));
}
FT_TRACE5(( "\n" ));
@@ -1471,13 +1471,13 @@
FT_TRACE5(( " reference %d: %ld scaled to %.2f%s\n",
nn,
blue->ref.org,
blue->ref.fit / 64.0,
(double)blue->ref.fit / 64,
( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? ""
: " (inactive)" ));
FT_TRACE5(( " overshoot %d: %ld scaled to %.2f%s\n",
nn,
blue->shoot.org,
blue->shoot.fit / 64.0,
(double)blue->shoot.fit / 64,
( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? ""
: " (inactive)" ));
}
@@ -2203,7 +2203,7 @@
for ( seg = segments; seg < segment_limit; seg++ )
{
AF_Edge found = NULL;
FT_Int ee;
FT_UInt ee;
/* ignore too short segments, too wide ones, and, in this loop, */
@@ -2277,7 +2277,7 @@
for ( seg = segments; seg < segment_limit; seg++ )
{
AF_Edge found = NULL;
FT_Int ee;
FT_UInt ee;
if ( seg->dir != AF_DIR_NONE )
@@ -2955,8 +2955,9 @@
FT_TRACE5(( " LINK: edge %ld (opos=%.2f) linked to %.2f,"
" dist was %.2f, now %.2f\n",
stem_edge - hints->axis[dim].edges, stem_edge->opos / 64.0,
stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 ));
stem_edge - hints->axis[dim].edges,
(double)stem_edge->opos / 64, (double)stem_edge->pos / 64,
(double)dist / 64, (double)fitted_width / 64 ));
}
@@ -3079,13 +3080,15 @@
if ( !anchor )
FT_TRACE5(( " BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f,"
" was %.2f (anchor=edge %ld)\n",
edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
edge1->pos / 64.0, edge - edges ));
edge1 - edges,
(double)edge1->opos / 64, (double)blue->fit / 64,
(double)edge1->pos / 64, edge - edges ));
else
FT_TRACE5(( " BLUE: edge %ld (opos=%.2f) snapped to %.2f,"
" was %.2f\n",
edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
edge1->pos / 64.0 ));
edge1 - edges,
(double)edge1->opos / 64, (double)blue->fit / 64,
(double)edge1->pos / 64 ));
num_actions++;
#endif
@@ -3201,9 +3204,9 @@
FT_TRACE5(( " ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)"
" snapped to %.2f and %.2f\n",
edge - edges, edge->opos / 64.0,
edge2 - edges, edge2->opos / 64.0,
edge->pos / 64.0, edge2->pos / 64.0 ));
edge - edges, (double)edge->opos / 64,
edge2 - edges, (double)edge2->opos / 64,
(double)edge->pos / 64, (double)edge2->pos / 64 ));
af_latin_align_linked_edge( hints, dim, edge, edge2 );
@@ -3229,8 +3232,8 @@
if ( edge2->flags & AF_EDGE_DONE )
{
FT_TRACE5(( " ADJUST: edge %ld (pos=%.2f) moved to %.2f\n",
edge - edges, edge->pos / 64.0,
( edge2->pos - cur_len ) / 64.0 ));
edge - edges, (double)edge->pos / 64,
(double)( edge2->pos - cur_len ) / 64 ));
edge->pos = edge2->pos - cur_len;
}
@@ -3271,9 +3274,9 @@
FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
" snapped to %.2f and %.2f\n",
edge - edges, edge->opos / 64.0,
edge2 - edges, edge2->opos / 64.0,
edge->pos / 64.0, edge2->pos / 64.0 ));
edge - edges, (double)edge->opos / 64,
edge2 - edges, (double)edge2->opos / 64,
(double)edge->pos / 64, (double)edge2->pos / 64 ));
}
else
@@ -3302,9 +3305,9 @@
FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
" snapped to %.2f and %.2f\n",
edge - edges, edge->opos / 64.0,
edge2 - edges, edge2->opos / 64.0,
edge->pos / 64.0, edge2->pos / 64.0 ));
edge - edges, (double)edge->opos / 64,
edge2 - edges, (double)edge2->opos / 64,
(double)edge->pos / 64, (double)edge2->pos / 64 ));
}
#ifdef FT_DEBUG_LEVEL_TRACE
@@ -3325,8 +3328,8 @@
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[-1].pos / 64.0 ));
(double)edge->pos / 64,
(double)edge[-1].pos / 64 ));
num_actions++;
#endif
@@ -3427,9 +3430,9 @@
af_latin_align_serif_edge( hints, edge->serif, edge );
FT_TRACE5(( " SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)"
" aligned to %.2f\n",
edge - edges, edge->opos / 64.0,
edge->serif - edges, edge->serif->opos / 64.0,
edge->pos / 64.0 ));
edge - edges, (double)edge->opos / 64,
edge->serif - edges, (double)edge->serif->opos / 64,
(double)edge->pos / 64 ));
}
else if ( !anchor )
{
@@ -3437,7 +3440,8 @@
anchor = edge;
FT_TRACE5(( " SERIF_ANCHOR: edge %ld (opos=%.2f)"
" snapped to %.2f\n",
edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));
edge-edges,
(double)edge->opos / 64, (double)edge->pos / 64 ));
}
else
{
@@ -3465,9 +3469,9 @@
FT_TRACE5(( " SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f"
" from %ld (opos=%.2f)\n",
edge - edges, edge->opos / 64.0,
edge->pos / 64.0,
before - edges, before->opos / 64.0 ));
edge - edges, (double)edge->opos / 64,
(double)edge->pos / 64,
before - edges, (double)before->opos / 64 ));
}
else
{
@@ -3475,7 +3479,8 @@
( ( edge->opos - anchor->opos + 16 ) & ~31 );
FT_TRACE5(( " SERIF_LINK2: edge %ld (opos=%.2f)"
" snapped to %.2f\n",
edge - edges, edge->opos / 64.0, edge->pos / 64.0 ));
edge - edges,
(double)edge->opos / 64, (double)edge->pos / 64 ));
}
}
@@ -3495,8 +3500,8 @@
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[-1].pos / 64.0 ));
(double)edge->pos / 64,
(double)edge[-1].pos / 64 ));
num_actions++;
#endif
@@ -3516,8 +3521,8 @@
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[1].pos / 64.0 ));
(double)edge->pos / 64,
(double)edge[1].pos / 64 ));
num_actions++;
#endif

View File

@@ -5,7 +5,7 @@
* Auto-fitter hinting routines for latin writing system
* (specification).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter glyph loading routines (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -229,9 +229,6 @@
AF_WritingSystemClass writing_system_class;
if ( !size )
return FT_THROW( Invalid_Size_Handle );
FT_ZERO( &scaler );
if ( !size_internal->autohint_metrics.x_scale ||

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter glyph loading routines (specification).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -75,7 +75,7 @@ FT_BEGIN_HEADER
FT_UInt gindex,
FT_Int32 load_flags );
FT_LOCAL_DEF( FT_Fixed )
FT_LOCAL( FT_Fixed )
af_loader_compute_darkening( AF_Loader loader,
FT_Face face,
FT_Pos standard_width );

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter module implementation (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -43,14 +43,14 @@
#endif
int _af_debug_disable_horz_hints;
int _af_debug_disable_vert_hints;
int _af_debug_disable_blue_hints;
int af_debug_disable_horz_hints_;
int af_debug_disable_vert_hints_;
int af_debug_disable_blue_hints_;
/* we use a global object instead of a local one for debugging */
static AF_GlyphHintsRec _af_debug_hints_rec[1];
static AF_GlyphHintsRec af_debug_hints_rec_[1];
void* _af_debug_hints = _af_debug_hints_rec;
void* af_debug_hints_ = af_debug_hints_rec_;
#endif
#include <freetype/internal/ftobjs.h>
@@ -119,8 +119,8 @@
if ( !ft_strcmp( property_name, "fallback-script" ) )
{
FT_UInt* fallback_script;
FT_UInt ss;
AF_Script* fallback_script;
FT_UInt ss;
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
@@ -128,7 +128,7 @@
return FT_THROW( Invalid_Argument );
#endif
fallback_script = (FT_UInt*)value;
fallback_script = (AF_Script*)value;
/* We translate the fallback script to a fallback style that uses */
/* `fallback-script' as its script and `AF_COVERAGE_NONE' as its */
@@ -138,8 +138,8 @@
AF_StyleClass style_class = af_style_classes[ss];
if ( (FT_UInt)style_class->script == *fallback_script &&
style_class->coverage == AF_COVERAGE_DEFAULT )
if ( style_class->script == *fallback_script &&
style_class->coverage == AF_COVERAGE_DEFAULT )
{
module->fallback_style = ss;
break;
@@ -157,7 +157,7 @@
}
else if ( !ft_strcmp( property_name, "default-script" ) )
{
FT_UInt* default_script;
AF_Script* default_script;
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
@@ -165,7 +165,7 @@
return FT_THROW( Invalid_Argument );
#endif
default_script = (FT_UInt*)value;
default_script = (AF_Script*)value;
module->default_script = *default_script;
@@ -291,8 +291,6 @@
{
FT_Error error = FT_Err_Ok;
AF_Module module = (AF_Module)ft_module;
FT_UInt fallback_style = module->fallback_style;
FT_UInt default_script = module->default_script;
if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
@@ -309,9 +307,9 @@
}
else if ( !ft_strcmp( property_name, "fallback-script" ) )
{
FT_UInt* val = (FT_UInt*)value;
AF_Script* val = (AF_Script*)value;
AF_StyleClass style_class = af_style_classes[fallback_style];
AF_StyleClass style_class = af_style_classes[module->fallback_style];
*val = style_class->script;
@@ -320,10 +318,10 @@
}
else if ( !ft_strcmp( property_name, "default-script" ) )
{
FT_UInt* val = (FT_UInt*)value;
AF_Script* val = (AF_Script*)value;
*val = default_script;
*val = module->default_script;
return error;
}
@@ -425,8 +423,8 @@
FT_UNUSED( ft_module );
#ifdef FT_DEBUG_AUTOFIT
if ( _af_debug_hints_rec->memory )
af_glyph_hints_done( _af_debug_hints_rec );
if ( af_debug_hints_rec_->memory )
af_glyph_hints_done( af_debug_hints_rec_ );
#endif
}
@@ -445,7 +443,7 @@
/* in debug mode, we use a global object that survives this routine */
AF_GlyphHints hints = _af_debug_hints_rec;
AF_GlyphHints hints = af_debug_hints_rec_;
AF_LoaderRec loader[1];
FT_UNUSED( size );

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter module implementation (specification).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -36,7 +36,7 @@ FT_BEGIN_HEADER
FT_ModuleRec root;
FT_UInt fallback_style;
FT_UInt default_script;
AF_Script default_script;
FT_Bool no_stem_darkening;
FT_Int darken_params[8];

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter Unicode script ranges (body).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter Unicode script ranges (specification).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter scripts (specification only).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* HarfBuzz interface for accessing OpenType features (body).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* HarfBuzz interface for accessing OpenType features (specification).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -27,7 +27,7 @@
#include <hb.h>
#include <hb-ot.h>
#include <hb-ft.h>
#include "ft-hb.h"
#endif

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter styles (specification only).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter types (specification only).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -57,10 +57,10 @@ FT_BEGIN_HEADER
#ifdef FT_DEBUG_AUTOFIT
extern int _af_debug_disable_horz_hints;
extern int _af_debug_disable_vert_hints;
extern int _af_debug_disable_blue_hints;
extern void* _af_debug_hints;
extern int af_debug_disable_horz_hints_;
extern int af_debug_disable_vert_hints_;
extern int af_debug_disable_blue_hints_;
extern void* af_debug_hints_;
#endif /* FT_DEBUG_AUTOFIT */
@@ -119,13 +119,13 @@ extern void* _af_debug_hints;
typedef struct AF_ScalerRec_
{
FT_Face face; /* source font face */
FT_Fixed x_scale; /* from font units to 1/64th device pixels */
FT_Fixed y_scale; /* from font units to 1/64th device pixels */
FT_Pos x_delta; /* in 1/64th device pixels */
FT_Pos y_delta; /* in 1/64th device pixels */
FT_Render_Mode render_mode; /* monochrome, anti-aliased, LCD, etc. */
FT_UInt32 flags; /* additional control flags, see above */
FT_Face face; /* source font face */
FT_Fixed x_scale; /* from font units to 1/64 device pixels */
FT_Fixed y_scale; /* from font units to 1/64 device pixels */
FT_Pos x_delta; /* in 1/64 device pixels */
FT_Pos y_delta; /* in 1/64 device pixels */
FT_Render_Mode render_mode; /* monochrome, anti-aliased, LCD, etc. */
FT_UInt32 flags; /* additional control flags, see above */
} AF_ScalerRec, *AF_Scaler;

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter writing system declarations (specification only).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter writing systems iterator (specification only).
*
* Copyright (C) 2013-2022 by
* Copyright (C) 2013-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Auto-fitter module (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -18,6 +18,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include "ft-hb.c"
#include "afblue.c"
#include "afcjk.c"
#include "afdummy.c"

115
thirdparty/freetype/src/autofit/ft-hb.c vendored Normal file
View File

@@ -0,0 +1,115 @@
/*
* Copyright © 2009, 2023 Red Hat, Inc.
* Copyright © 2015 Google, Inc.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod, Matthias Clasen
* Google Author(s): Behdad Esfahbod
*/
#include <freetype/freetype.h>
#include <freetype/tttables.h>
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
#include "ft-hb.h"
/* The following three functions are a more or less verbatim
* copy of corresponding HarfBuzz code from hb-ft.cc
*/
static hb_blob_t *
hb_ft_reference_table_ (hb_face_t *face, hb_tag_t tag, void *user_data)
{
FT_Face ft_face = (FT_Face) user_data;
FT_Byte *buffer;
FT_ULong length = 0;
FT_Error error;
FT_UNUSED (face);
/* Note: FreeType like HarfBuzz uses the NONE tag for fetching the entire blob */
error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length);
if (error)
return NULL;
buffer = (FT_Byte *) ft_smalloc (length);
if (!buffer)
return NULL;
error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length);
if (error)
{
free (buffer);
return NULL;
}
return hb_blob_create ((const char *) buffer, length,
HB_MEMORY_MODE_WRITABLE,
buffer, ft_sfree);
}
static hb_face_t *
hb_ft_face_create_ (FT_Face ft_face,
hb_destroy_func_t destroy)
{
hb_face_t *face;
if (!ft_face->stream->read) {
hb_blob_t *blob;
blob = hb_blob_create ((const char *) ft_face->stream->base,
(unsigned int) ft_face->stream->size,
HB_MEMORY_MODE_READONLY,
ft_face, destroy);
face = hb_face_create (blob, ft_face->face_index);
hb_blob_destroy (blob);
} else {
face = hb_face_create_for_tables (hb_ft_reference_table_, ft_face, destroy);
}
hb_face_set_index (face, ft_face->face_index);
hb_face_set_upem (face, ft_face->units_per_EM);
return face;
}
FT_LOCAL_DEF(hb_font_t *)
hb_ft_font_create_ (FT_Face ft_face,
hb_destroy_func_t destroy)
{
hb_font_t *font;
hb_face_t *face;
face = hb_ft_face_create_ (ft_face, destroy);
font = hb_font_create (face);
hb_face_destroy (face);
return font;
}
#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
/* ANSI C doesn't like empty source files */
typedef int _ft_hb_dummy;
#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
/* END */

48
thirdparty/freetype/src/autofit/ft-hb.h vendored Normal file
View File

@@ -0,0 +1,48 @@
/*
* Copyright © 2009, 2023 Red Hat, Inc.
* Copyright © 2015 Google, Inc.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod, Matthias Clasen
* Google Author(s): Behdad Esfahbod
*/
#ifndef FT_HB_H
#define FT_HB_H
#include <hb.h>
#include <freetype/internal/compiler-macros.h>
#include <freetype/freetype.h>
FT_BEGIN_HEADER
FT_LOCAL(hb_font_t *)
hb_ft_font_create_ (FT_Face ft_face,
hb_destroy_func_t destroy);
FT_END_HEADER
#endif /* FT_HB_H */
/* END */

View File

@@ -4,7 +4,7 @@
*
* Quick computation of advance widths (body).
*
* Copyright (C) 2008-2022 by
* Copyright (C) 2008-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -23,7 +23,7 @@
static FT_Error
_ft_face_scale_advances( FT_Face face,
ft_face_scale_advances_( FT_Face face,
FT_Fixed* advances,
FT_UInt count,
FT_Int32 flags )
@@ -96,7 +96,7 @@
error = func( face, gindex, 1, flags, padvance );
if ( !error )
return _ft_face_scale_advances( face, padvance, 1, flags );
return ft_face_scale_advances_( face, padvance, 1, flags );
if ( FT_ERR_NEQ( error, Unimplemented_Feature ) )
return error;
@@ -142,7 +142,7 @@
{
error = func( face, start, count, flags, padvances );
if ( !error )
return _ft_face_scale_advances( face, padvances, count, flags );
return ft_face_scale_advances_( face, padvances, count, flags );
if ( FT_ERR_NEQ( error, Unimplemented_Feature ) )
return error;

View File

@@ -4,7 +4,7 @@
*
* Single object library component (body only).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Private functions used in the `base' module (specification).
*
* Copyright (C) 2008-2022 by
* Copyright (C) 2008-2023 by
* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType bbox computation (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used

View File

@@ -4,7 +4,7 @@
*
* FreeType API for accessing BDF-specific strings (body).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType utility functions for bitmaps (body).
*
* Copyright (C) 2004-2022 by
* Copyright (C) 2004-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -66,11 +66,8 @@
{
FT_Memory memory;
FT_Error error = FT_Err_Ok;
FT_Int pitch;
FT_ULong size;
FT_Int source_pitch_sign, target_pitch_sign;
FT_Int pitch;
FT_Int flip;
if ( !library )
@@ -82,53 +79,29 @@
if ( source == target )
return FT_Err_Ok;
source_pitch_sign = source->pitch < 0 ? -1 : 1;
target_pitch_sign = target->pitch < 0 ? -1 : 1;
if ( !source->buffer )
{
*target = *source;
if ( source_pitch_sign != target_pitch_sign )
target->pitch = -target->pitch;
return FT_Err_Ok;
}
flip = ( source->pitch < 0 && target->pitch > 0 ) ||
( source->pitch > 0 && target->pitch < 0 );
memory = library->memory;
pitch = source->pitch;
FT_FREE( target->buffer );
*target = *source;
if ( flip )
target->pitch = -target->pitch;
if ( !source->buffer )
return FT_Err_Ok;
pitch = source->pitch;
if ( pitch < 0 )
pitch = -pitch;
size = (FT_ULong)pitch * source->rows;
if ( target->buffer )
{
FT_Int target_pitch = target->pitch;
FT_ULong target_size;
if ( target_pitch < 0 )
target_pitch = -target_pitch;
target_size = (FT_ULong)target_pitch * target->rows;
if ( target_size != size )
FT_MEM_QREALLOC( target->buffer, target_size, size );
}
else
FT_MEM_QALLOC( target->buffer, size );
FT_MEM_QALLOC_MULT( target->buffer, target->rows, pitch );
if ( !error )
{
unsigned char *p;
p = target->buffer;
*target = *source;
target->buffer = p;
if ( source_pitch_sign == target_pitch_sign )
FT_MEM_COPY( target->buffer, source->buffer, size );
else
if ( flip )
{
/* take care of bitmap flow */
FT_UInt i;
@@ -146,6 +119,9 @@
t -= pitch;
}
}
else
FT_MEM_COPY( target->buffer, source->buffer,
(FT_Long)source->rows * pitch );
}
return error;
@@ -542,39 +518,31 @@
case FT_PIXEL_MODE_LCD_V:
case FT_PIXEL_MODE_BGRA:
{
FT_Int pad, old_target_pitch, target_pitch;
FT_ULong old_size;
FT_Int width = (FT_Int)source->width;
FT_Int neg = ( target->pitch == 0 && source->pitch < 0 ) ||
target->pitch < 0;
old_target_pitch = target->pitch;
if ( old_target_pitch < 0 )
old_target_pitch = -old_target_pitch;
old_size = target->rows * (FT_UInt)old_target_pitch;
FT_Bitmap_Done( library, target );
target->pixel_mode = FT_PIXEL_MODE_GRAY;
target->rows = source->rows;
target->width = source->width;
pad = 0;
if ( alignment > 0 )
if ( alignment )
{
pad = (FT_Int)source->width % alignment;
if ( pad != 0 )
pad = alignment - pad;
FT_Int rem = width % alignment;
if ( rem )
width = alignment > 0 ? width - rem + alignment
: width - rem - alignment;
}
target_pitch = (FT_Int)source->width + pad;
if ( target_pitch > 0 &&
(FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch )
return FT_THROW( Invalid_Argument );
if ( FT_QREALLOC( target->buffer,
old_size, target->rows * (FT_UInt)target_pitch ) )
if ( FT_QALLOC_MULT( target->buffer, target->rows, width ) )
return error;
target->pitch = target->pitch < 0 ? -target_pitch : target_pitch;
target->pitch = neg ? -width : width;
}
break;

View File

@@ -4,7 +4,7 @@
*
* Arithmetic computations (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -1085,4 +1085,71 @@
}
FT_BASE_DEF( FT_Int32 )
FT_MulAddFix( FT_Fixed* s,
FT_Int32* f,
FT_UInt count )
{
FT_UInt i;
FT_Int64 temp;
#ifndef FT_INT64
FT_Int64 halfUnit;
#endif
#ifdef FT_INT64
temp = 0;
for ( i = 0; i < count; ++i )
temp += (FT_Int64)s[i] * f[i];
return ( temp + 0x8000 ) >> 16;
#else
temp.hi = 0;
temp.lo = 0;
for ( i = 0; i < count; ++i )
{
FT_Int64 multResult;
FT_Int sign = 1;
FT_UInt32 carry = 0;
FT_UInt32 scalar;
FT_UInt32 factor;
scalar = (FT_UInt32)s[i];
factor = (FT_UInt32)f[i];
FT_MOVE_SIGN( s[i], scalar, sign );
FT_MOVE_SIGN( f[i], factor, sign );
ft_multo64( scalar, factor, &multResult );
if ( sign < 0 )
{
/* Emulated `FT_Int64` negation. */
carry = ( multResult.lo == 0 );
multResult.lo = ~multResult.lo + 1;
multResult.hi = ~multResult.hi + carry;
}
FT_Add64( &temp, &multResult, &temp );
}
/* Round value. */
halfUnit.hi = 0;
halfUnit.lo = 0x8000;
FT_Add64( &temp, &halfUnit, &temp );
return (FT_Int32)( ( (FT_Int32)( temp.hi & 0xFFFF ) << 16 ) |
( temp.lo >> 16 ) );
#endif /* !FT_INT64 */
}
/* END */

View File

@@ -4,7 +4,7 @@
*
* FreeType API for accessing CID font information.
*
* Copyright (C) 2007-2022 by
* Copyright (C) 2007-2023 by
* Derek Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType's glyph color management (body).
*
* Copyright (C) 2018-2022 by
* Copyright (C) 2018-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Memory debugger (body).
*
* Copyright (C) 2001-2022 by
* Copyright (C) 2001-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -35,8 +35,8 @@
#include FT_CONFIG_STANDARD_LIBRARY_H
FT_BASE_DEF( const char* ) _ft_debug_file = NULL;
FT_BASE_DEF( long ) _ft_debug_lineno = 0;
FT_BASE_DEF( const char* ) ft_debug_file_ = NULL;
FT_BASE_DEF( long ) ft_debug_lineno_ = 0;
extern void
FT_DumpMemory( FT_Memory memory );
@@ -415,8 +415,8 @@
/* cast to FT_PtrDist first since void* can be larger */
/* than FT_UInt32 and GCC 4.1.1 emits a warning */
hash = (FT_UInt32)(FT_PtrDist)(void*)_ft_debug_file +
(FT_UInt32)( 5 * _ft_debug_lineno );
hash = (FT_UInt32)(FT_PtrDist)(void*)ft_debug_file_ +
(FT_UInt32)( 5 * ft_debug_lineno_ );
pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
for (;;)
@@ -425,8 +425,8 @@
if ( !node )
break;
if ( node->file_name == _ft_debug_file &&
node->line_no == _ft_debug_lineno )
if ( node->file_name == ft_debug_file_ &&
node->line_no == ft_debug_lineno_ )
goto Exit;
pnode = &node->link;
@@ -437,8 +437,8 @@
ft_mem_debug_panic(
"not enough memory to perform memory debugging\n" );
node->file_name = _ft_debug_file;
node->line_no = _ft_debug_lineno;
node->file_name = ft_debug_file_;
node->line_no = ft_debug_lineno_;
node->cur_blocks = 0;
node->max_blocks = 0;
@@ -495,7 +495,7 @@
"org=%s:%d new=%s:%d\n",
node->address, node->size,
FT_FILENAME( node->source->file_name ), node->source->line_no,
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );
FT_FILENAME( ft_debug_file_ ), ft_debug_lineno_ );
}
}
@@ -582,7 +582,7 @@
" Block was allocated at (%s:%ld)\n"
" and released at (%s:%ld).",
address,
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
FT_FILENAME( ft_debug_file_ ), ft_debug_lineno_,
FT_FILENAME( node->source->file_name ), node->source->line_no,
FT_FILENAME( node->free_file_name ), node->free_line_no );
@@ -604,8 +604,8 @@
/* we simply invert the node's size to indicate that the node */
/* was freed. */
node->size = -node->size;
node->free_file_name = _ft_debug_file;
node->free_line_no = _ft_debug_lineno;
node->free_file_name = ft_debug_file_;
node->free_line_no = ft_debug_lineno_;
}
else
{
@@ -627,7 +627,7 @@
ft_mem_debug_panic(
"trying to free unknown block at %p in (%s:%ld)\n",
address,
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );
FT_FILENAME( ft_debug_file_ ), ft_debug_lineno_ );
}
}
@@ -661,8 +661,8 @@
table->alloc_count++;
}
_ft_debug_file = "<unknown>";
_ft_debug_lineno = 0;
ft_debug_file_ = "<unknown>";
ft_debug_lineno_ = 0;
return (FT_Pointer)block;
}
@@ -677,8 +677,8 @@
if ( !block )
ft_mem_debug_panic( "trying to free NULL in (%s:%ld)",
FT_FILENAME( _ft_debug_file ),
_ft_debug_lineno );
FT_FILENAME( ft_debug_file_ ),
ft_debug_lineno_ );
ft_mem_table_remove( table, (FT_Byte*)block, 0 );
@@ -687,8 +687,8 @@
table->alloc_count--;
_ft_debug_file = "<unknown>";
_ft_debug_lineno = 0;
ft_debug_file_ = "<unknown>";
ft_debug_lineno_ = 0;
}
@@ -703,8 +703,8 @@
FT_Pointer new_block;
FT_Long delta;
const char* file_name = FT_FILENAME( _ft_debug_file );
FT_Long line_no = _ft_debug_lineno;
const char* file_name = FT_FILENAME( ft_debug_file_ );
FT_Long line_no = ft_debug_lineno_;
/* unlikely, but possible */
@@ -767,8 +767,8 @@
ft_mem_table_remove( table, (FT_Byte*)block, delta );
_ft_debug_file = "<unknown>";
_ft_debug_lineno = 0;
ft_debug_file_ = "<unknown>";
ft_debug_lineno_ = 0;
if ( !table->keep_alive )
ft_mem_table_free( table, block );
@@ -874,7 +874,7 @@
}
static int
FT_COMPARE_DEF( int )
ft_mem_source_compare( const void* p1,
const void* p2 )
{

View File

@@ -4,7 +4,7 @@
*
* Debugging and logging component (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType API for error code handling.
*
* Copyright (C) 2018-2022 by
* Copyright (C) 2018-2023 by
* Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType utility file for font formats (body).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType utility file to access FSType data (body).
*
* Copyright (C) 2008-2022 by
* Copyright (C) 2008-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Access of TrueType's `gasp' table (body).
*
* Copyright (C) 2007-2022 by
* Copyright (C) 2007-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* The FreeType glyph loader (body).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg
*
* This file is part of the FreeType project, and may only be used,
@@ -212,12 +212,12 @@
FT_Outline* current = &loader->current.outline;
FT_Bool adjust = 0;
FT_UInt new_max, old_max;
FT_UInt new_max, old_max, min_new_max;
error = FT_GlyphLoader_CreateExtra( loader );
if ( error )
return error;
goto Exit;
/* check points & tags */
new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points +
@@ -226,10 +226,18 @@
if ( new_max > old_max )
{
new_max = FT_PAD_CEIL( new_max, 8 );
if ( new_max > FT_OUTLINE_POINTS_MAX )
return FT_THROW( Array_Too_Large );
{
error = FT_THROW( Array_Too_Large );
goto Exit;
}
min_new_max = old_max + ( old_max >> 1 );
if ( new_max < min_new_max )
new_max = min_new_max;
new_max = FT_PAD_CEIL( new_max, 8 );
if ( new_max > FT_OUTLINE_POINTS_MAX )
new_max = FT_OUTLINE_POINTS_MAX;
if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
FT_RENEW_ARRAY( base->tags, old_max, new_max ) )
@@ -254,7 +262,7 @@
error = FT_GlyphLoader_CreateExtra( loader );
if ( error )
return error;
goto Exit;
/* check contours */
old_max = loader->max_contours;
@@ -262,10 +270,18 @@
n_contours;
if ( new_max > old_max )
{
new_max = FT_PAD_CEIL( new_max, 4 );
if ( new_max > FT_OUTLINE_CONTOURS_MAX )
return FT_THROW( Array_Too_Large );
{
error = FT_THROW( Array_Too_Large );
goto Exit;
}
min_new_max = old_max + ( old_max >> 1 );
if ( new_max < min_new_max )
new_max = min_new_max;
new_max = FT_PAD_CEIL( new_max, 4 );
if ( new_max > FT_OUTLINE_CONTOURS_MAX )
new_max = FT_OUTLINE_CONTOURS_MAX;
if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
goto Exit;

View File

@@ -4,7 +4,7 @@
*
* FreeType convenience functions to handle glyphs (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -682,7 +682,10 @@
Exit2:
/* if an error occurred, destroy the glyph */
if ( error )
{
FT_Done_Glyph( glyph );
*aglyph = NULL;
}
else
*aglyph = glyph;

View File

@@ -4,7 +4,7 @@
*
* FreeType API for validating TrueTypeGX/AAT tables (body).
*
* Copyright (C) 2004-2022 by
* Copyright (C) 2004-2023 by
* Masatake YAMATO, Redhat K.K,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*

View File

@@ -4,7 +4,7 @@
*
* FreeType initialization layer (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType API for color filtering of subpixel bitmap glyphs (body).
*
* Copyright (C) 2006-2022 by
* Copyright (C) 2006-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -8,7 +8,7 @@
* This file is for Mac OS X only; see builds/mac/ftoldmac.c for
* classic platforms built by MPW.
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -67,6 +67,7 @@
#include <freetype/freetype.h>
#include <freetype/tttags.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include "ftbase.h"

View File

@@ -4,7 +4,7 @@
*
* Multiple Master font support (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* The FreeType private base classes (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -508,7 +508,7 @@
case FT_PIXEL_MODE_LCD_V:
height *= 3;
/* fall through */
FALL_THROUGH;
case FT_PIXEL_MODE_GRAY:
default:
@@ -605,7 +605,7 @@
FT_FREE( doc->svg_document );
slot->internal->load_flags &= ~FT_GLYPH_OWN_GZIP_SVG;
slot->internal->flags &= ~FT_GLYPH_OWN_GZIP_SVG;
}
}
#endif
@@ -631,8 +631,9 @@
#ifdef FT_CONFIG_OPTION_SVG
if ( slot->face->face_flags & FT_FACE_FLAG_SVG )
{
/* free memory in case SVG was there */
if ( slot->internal->flags & FT_GLYPH_OWN_GZIP_SVG )
/* Free memory in case SVG was there. */
/* `slot->internal` might be NULL in out-of-memory situations. */
if ( slot->internal && slot->internal->flags & FT_GLYPH_OWN_GZIP_SVG )
{
FT_SVG_Document doc = (FT_SVG_Document)slot->other;
@@ -1184,28 +1185,34 @@
pixel_modes[slot->bitmap.pixel_mode],
slot->bitmap.pixel_mode ));
FT_TRACE5(( "\n" ));
FT_TRACE5(( " x advance: %f\n", slot->advance.x / 64.0 ));
FT_TRACE5(( " y advance: %f\n", slot->advance.y / 64.0 ));
FT_TRACE5(( " x advance: %f\n", (double)slot->advance.x / 64 ));
FT_TRACE5(( " y advance: %f\n", (double)slot->advance.y / 64 ));
FT_TRACE5(( " linear x advance: %f\n",
slot->linearHoriAdvance / 65536.0 ));
(double)slot->linearHoriAdvance / 65536 ));
FT_TRACE5(( " linear y advance: %f\n",
slot->linearVertAdvance / 65536.0 ));
(double)slot->linearVertAdvance / 65536 ));
{
FT_Glyph_Metrics* metrics = &slot->metrics;
FT_TRACE5(( " metrics:\n" ));
FT_TRACE5(( " width: %f\n", metrics->width / 64.0 ));
FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
FT_TRACE5(( " width: %f\n", (double)metrics->width / 64 ));
FT_TRACE5(( " height: %f\n", (double)metrics->height / 64 ));
FT_TRACE5(( "\n" ));
FT_TRACE5(( " horiBearingX: %f\n", metrics->horiBearingX / 64.0 ));
FT_TRACE5(( " horiBearingY: %f\n", metrics->horiBearingY / 64.0 ));
FT_TRACE5(( " horiAdvance: %f\n", metrics->horiAdvance / 64.0 ));
FT_TRACE5(( " horiBearingX: %f\n",
(double)metrics->horiBearingX / 64 ));
FT_TRACE5(( " horiBearingY: %f\n",
(double)metrics->horiBearingY / 64 ));
FT_TRACE5(( " horiAdvance: %f\n",
(double)metrics->horiAdvance / 64 ));
FT_TRACE5(( "\n" ));
FT_TRACE5(( " vertBearingX: %f\n", metrics->vertBearingX / 64.0 ));
FT_TRACE5(( " vertBearingY: %f\n", metrics->vertBearingY / 64.0 ));
FT_TRACE5(( " vertAdvance: %f\n", metrics->vertAdvance / 64.0 ));
FT_TRACE5(( " vertBearingX: %f\n",
(double)metrics->vertBearingX / 64 ));
FT_TRACE5(( " vertBearingY: %f\n",
(double)metrics->vertBearingY / 64 ));
FT_TRACE5(( " vertAdvance: %f\n",
(double)metrics->vertAdvance / 64 ));
}
#endif
@@ -1488,7 +1495,7 @@
static FT_Error
open_face( FT_Driver driver,
FT_Stream *astream,
FT_Bool external_stream,
FT_Bool *anexternal_stream,
FT_Long face_index,
FT_Int num_params,
FT_Parameter* params,
@@ -1514,7 +1521,7 @@
face->stream = *astream;
/* set the FT_FACE_FLAG_EXTERNAL_STREAM bit for FT_Done_Face */
if ( external_stream )
if ( *anexternal_stream )
face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM;
if ( FT_NEW( internal ) )
@@ -1544,7 +1551,10 @@
(FT_Int)face_index,
num_params,
params );
*astream = face->stream; /* Stream may have been changed. */
/* Stream may have been changed. */
*astream = face->stream;
*anexternal_stream =
( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0;
if ( error )
goto Fail;
@@ -1668,13 +1678,13 @@
static void
memory_stream_close( FT_Stream stream )
{
FT_Memory memory = stream->memory;
FT_Memory memory = (FT_Memory)stream->descriptor.pointer;
FT_FREE( stream->base );
stream->size = 0;
stream->close = NULL;
FT_FREE( stream );
}
@@ -1705,7 +1715,8 @@
FT_Stream_OpenMemory( stream, base, size );
stream->close = close;
stream->descriptor.pointer = memory;
stream->close = close;
*astream = stream;
@@ -1726,28 +1737,36 @@
{
FT_Open_Args args;
FT_Error error;
FT_Stream stream = NULL;
FT_Memory memory = library->memory;
args.flags = 0;
if ( driver_name )
{
args.driver = FT_Get_Module( library, driver_name );
if ( !args.driver )
{
FT_FREE( base );
return FT_THROW( Missing_Module );
}
args.flags = args.flags | FT_OPEN_DRIVER;
}
/* `memory_stream_close` also frees the stream object. */
error = new_memory_stream( library,
base,
size,
memory_stream_close,
&stream );
&args.stream );
if ( error )
{
FT_FREE( base );
return error;
}
args.flags = FT_OPEN_STREAM;
args.stream = stream;
if ( driver_name )
{
args.flags = args.flags | FT_OPEN_DRIVER;
args.driver = FT_Get_Module( library, driver_name );
}
args.flags |= FT_OPEN_STREAM;
#ifdef FT_MACINTOSH
/* At this point, the face index has served its purpose; */
@@ -1759,21 +1778,7 @@
face_index &= 0x7FFF0000L; /* retain GX data */
#endif
error = ft_open_face_internal( library, &args, face_index, aface, 0 );
if ( !error )
(*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
else
#ifdef FT_MACINTOSH
FT_Stream_Free( stream, 0 );
#else
{
FT_Stream_Close( stream );
FT_FREE( stream );
}
#endif
return error;
return ft_open_face_internal( library, &args, face_index, aface, 0 );
}
@@ -1916,7 +1921,7 @@
sfnt_ps,
length,
FT_MIN( face_index, 0 ),
is_sfnt_cid ? "cid" : "type1",
is_sfnt_cid ? "t1cid" : "type1",
aface );
Exit:
{
@@ -2177,7 +2182,7 @@
FT_Byte* sfnt_data = NULL;
FT_Error error;
FT_ULong flag_offset;
FT_Long rlen;
FT_ULong rlen;
int is_cff;
FT_Long face_index_in_resource = 0;
@@ -2192,11 +2197,11 @@
if ( error )
goto Exit;
if ( FT_READ_LONG( rlen ) )
if ( FT_READ_ULONG( rlen ) )
goto Exit;
if ( rlen < 1 )
if ( !rlen )
return FT_THROW( Cannot_Open_Resource );
if ( (FT_ULong)rlen > FT_MAC_RFORK_MAX_LEN )
if ( rlen > FT_MAC_RFORK_MAX_LEN )
return FT_THROW( Invalid_Offset );
error = open_face_PS_from_sfnt_stream( library,
@@ -2214,8 +2219,9 @@
if ( FT_QALLOC( sfnt_data, rlen ) )
return error;
error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, (FT_ULong)rlen );
if ( error ) {
error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, rlen );
if ( error )
{
FT_FREE( sfnt_data );
goto Exit;
}
@@ -2223,7 +2229,7 @@
is_cff = rlen > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
error = open_face_from_buffer( library,
sfnt_data,
(FT_ULong)rlen,
rlen,
face_index_in_resource,
is_cff ? "cff" : "truetype",
aface );
@@ -2552,7 +2558,7 @@
/* test for valid `library' delayed to `FT_Stream_New' */
if ( ( !aface && face_index >= 0 ) || !args )
if ( !args )
return FT_THROW( Invalid_Argument );
external_stream = FT_BOOL( ( args->flags & FT_OPEN_STREAM ) &&
@@ -2563,6 +2569,14 @@
if ( error )
goto Fail3;
/* Do this error check after `FT_Stream_New` to ensure that the */
/* 'close' callback is called. */
if ( !aface && face_index >= 0 )
{
error = FT_THROW( Invalid_Argument );
goto Fail3;
}
memory = library->memory;
/* If the font driver is specified in the `args' structure, use */
@@ -2584,7 +2598,7 @@
params = args->params;
}
error = open_face( driver, &stream, external_stream, face_index,
error = open_face( driver, &stream, &external_stream, face_index,
num_params, params, &face );
if ( !error )
goto Success;
@@ -2620,7 +2634,7 @@
params = args->params;
}
error = open_face( driver, &stream, external_stream, face_index,
error = open_face( driver, &stream, &external_stream, face_index,
num_params, params, &face );
if ( !error )
goto Success;
@@ -2852,8 +2866,8 @@
/* documentation is in freetype.h */
FT_EXPORT_DEF( FT_Error )
FT_Attach_Stream( FT_Face face,
FT_Open_Args* parameters )
FT_Attach_Stream( FT_Face face,
const FT_Open_Args* parameters )
{
FT_Stream stream;
FT_Error error;
@@ -3278,34 +3292,49 @@
scaled_h = FT_REQUEST_HEIGHT( req );
/* determine scales */
if ( req->height || !req->width )
{
if ( h == 0 )
{
FT_ERROR(( "FT_Request_Metrics: Divide by zero\n" ));
error = FT_ERR( Divide_By_Zero );
goto Exit;
}
metrics->y_scale = FT_DivFix( scaled_h, h );
}
if ( req->width )
{
if ( w == 0 )
{
FT_ERROR(( "FT_Request_Metrics: Divide by zero\n" ));
error = FT_ERR( Divide_By_Zero );
goto Exit;
}
metrics->x_scale = FT_DivFix( scaled_w, w );
if ( req->height )
{
metrics->y_scale = FT_DivFix( scaled_h, h );
if ( req->type == FT_SIZE_REQUEST_TYPE_CELL )
{
if ( metrics->y_scale > metrics->x_scale )
metrics->y_scale = metrics->x_scale;
else
metrics->x_scale = metrics->y_scale;
}
}
else
{
metrics->y_scale = metrics->x_scale;
scaled_h = FT_MulDiv( scaled_w, h, w );
}
}
else
{
metrics->x_scale = metrics->y_scale = FT_DivFix( scaled_h, h );
metrics->x_scale = metrics->y_scale;
scaled_w = FT_MulDiv( scaled_h, w, h );
}
if ( !req->height )
{
metrics->y_scale = metrics->x_scale;
scaled_h = FT_MulDiv( scaled_w, h, w );
}
if ( req->type == FT_SIZE_REQUEST_TYPE_CELL )
{
if ( metrics->y_scale > metrics->x_scale )
metrics->y_scale = metrics->x_scale;
else
metrics->x_scale = metrics->y_scale;
}
Calculate_Ppem:
/* calculate the ppems */
if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL )
@@ -3379,15 +3408,19 @@
FT_TRACE5(( " x scale: %ld (%f)\n",
metrics->x_scale, metrics->x_scale / 65536.0 ));
metrics->x_scale, (double)metrics->x_scale / 65536 ));
FT_TRACE5(( " y scale: %ld (%f)\n",
metrics->y_scale, metrics->y_scale / 65536.0 ));
FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
metrics->y_scale, (double)metrics->y_scale / 65536 ));
FT_TRACE5(( " ascender: %f\n",
(double)metrics->ascender / 64 ));
FT_TRACE5(( " descender: %f\n",
(double)metrics->descender / 64 ));
FT_TRACE5(( " height: %f\n",
(double)metrics->height / 64 ));
FT_TRACE5(( " max advance: %f\n",
(double)metrics->max_advance / 64 ));
FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
}
#endif
@@ -3459,15 +3492,19 @@
FT_TRACE5(( " x scale: %ld (%f)\n",
metrics->x_scale, metrics->x_scale / 65536.0 ));
metrics->x_scale, (double)metrics->x_scale / 65536 ));
FT_TRACE5(( " y scale: %ld (%f)\n",
metrics->y_scale, metrics->y_scale / 65536.0 ));
FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
metrics->y_scale, (double)metrics->y_scale / 65536 ));
FT_TRACE5(( " ascender: %f\n",
(double)metrics->ascender / 64 ));
FT_TRACE5(( " descender: %f\n",
(double)metrics->descender / 64 ));
FT_TRACE5(( " height: %f\n",
(double)metrics->height / 64 ));
FT_TRACE5(( " max advance: %f\n",
(double)metrics->max_advance / 64 ));
FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
}
#endif

View File

@@ -4,7 +4,7 @@
*
* FreeType API for validating OpenType tables (body).
*
* Copyright (C) 2004-2022 by
* Copyright (C) 2004-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType outline management (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -130,7 +130,7 @@
}
FT_TRACE5(( " move to (%.2f, %.2f)\n",
v_start.x / 64.0, v_start.y / 64.0 ));
(double)v_start.x / 64, (double)v_start.y / 64 ));
error = func_interface->move_to( &v_start, user );
if ( error )
goto Exit;
@@ -152,7 +152,7 @@
vec.y = SCALED( point->y );
FT_TRACE5(( " line to (%.2f, %.2f)\n",
vec.x / 64.0, vec.y / 64.0 ));
(double)vec.x / 64, (double)vec.y / 64 ));
error = func_interface->line_to( &vec, user );
if ( error )
goto Exit;
@@ -181,8 +181,10 @@
{
FT_TRACE5(( " conic to (%.2f, %.2f)"
" with control (%.2f, %.2f)\n",
vec.x / 64.0, vec.y / 64.0,
v_control.x / 64.0, v_control.y / 64.0 ));
(double)vec.x / 64,
(double)vec.y / 64,
(double)v_control.x / 64,
(double)v_control.y / 64 ));
error = func_interface->conic_to( &v_control, &vec, user );
if ( error )
goto Exit;
@@ -197,8 +199,10 @@
FT_TRACE5(( " conic to (%.2f, %.2f)"
" with control (%.2f, %.2f)\n",
v_middle.x / 64.0, v_middle.y / 64.0,
v_control.x / 64.0, v_control.y / 64.0 ));
(double)v_middle.x / 64,
(double)v_middle.y / 64,
(double)v_control.x / 64,
(double)v_control.y / 64 ));
error = func_interface->conic_to( &v_control, &v_middle, user );
if ( error )
goto Exit;
@@ -209,8 +213,10 @@
FT_TRACE5(( " conic to (%.2f, %.2f)"
" with control (%.2f, %.2f)\n",
v_start.x / 64.0, v_start.y / 64.0,
v_control.x / 64.0, v_control.y / 64.0 ));
(double)v_start.x / 64,
(double)v_start.y / 64,
(double)v_control.x / 64,
(double)v_control.y / 64 ));
error = func_interface->conic_to( &v_control, &v_start, user );
goto Close;
@@ -242,9 +248,12 @@
FT_TRACE5(( " cubic to (%.2f, %.2f)"
" with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
vec.x / 64.0, vec.y / 64.0,
vec1.x / 64.0, vec1.y / 64.0,
vec2.x / 64.0, vec2.y / 64.0 ));
(double)vec.x / 64,
(double)vec.y / 64,
(double)vec1.x / 64,
(double)vec1.y / 64,
(double)vec2.x / 64,
(double)vec2.y / 64 ));
error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
if ( error )
goto Exit;
@@ -253,9 +262,12 @@
FT_TRACE5(( " cubic to (%.2f, %.2f)"
" with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
v_start.x / 64.0, v_start.y / 64.0,
vec1.x / 64.0, vec1.y / 64.0,
vec2.x / 64.0, vec2.y / 64.0 ));
(double)v_start.x / 64,
(double)v_start.y / 64,
(double)vec1.x / 64,
(double)vec1.y / 64,
(double)vec2.x / 64,
(double)vec2.y / 64 ));
error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
goto Close;
}
@@ -264,7 +276,7 @@
/* close the contour with a line segment */
FT_TRACE5(( " line to (%.2f, %.2f)\n",
v_start.x / 64.0, v_start.y / 64.0 ));
(double)v_start.x / 64, (double)v_start.y / 64 ));
error = func_interface->line_to( &v_start, user );
Close:

View File

@@ -5,7 +5,7 @@
* FreeType API for checking patented TrueType bytecode instructions
* (body). Obsolete, retained for backward compatibility.
*
* Copyright (C) 2007-2022 by
* Copyright (C) 2007-2023 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType API for accessing PFR-specific data (body).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -5,7 +5,7 @@
* Get and set properties of PostScript drivers (body).
* See `ftdriver.h' for available properties.
*
* Copyright (C) 2017-2022 by
* Copyright (C) 2017-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Embedded resource forks accessor (body).
*
* Copyright (C) 2004-2022 by
* Copyright (C) 2004-2023 by
* Masatake YAMATO and Redhat K.K.
*
* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are

View File

@@ -7,7 +7,7 @@
*
* This is _not_ used to retrieve glyph names!
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* I/O stream support (body).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -261,7 +261,7 @@
}
#ifdef FT_DEBUG_MEMORY
/* assume _ft_debug_file and _ft_debug_lineno are already set */
/* assume `ft_debug_file_` and `ft_debug_lineno_` are already set */
stream->base = (unsigned char*)ft_mem_qalloc( memory,
(FT_Long)count,
&error );
@@ -363,11 +363,11 @@
}
FT_BASE_DEF( FT_UShort )
FT_BASE_DEF( FT_UInt16 )
FT_Stream_GetUShort( FT_Stream stream )
{
FT_Byte* p;
FT_UShort result;
FT_UInt16 result;
FT_ASSERT( stream && stream->cursor );
@@ -382,11 +382,11 @@
}
FT_BASE_DEF( FT_UShort )
FT_BASE_DEF( FT_UInt16 )
FT_Stream_GetUShortLE( FT_Stream stream )
{
FT_Byte* p;
FT_UShort result;
FT_UInt16 result;
FT_ASSERT( stream && stream->cursor );
@@ -401,11 +401,11 @@
}
FT_BASE_DEF( FT_ULong )
FT_BASE_DEF( FT_UInt32 )
FT_Stream_GetUOffset( FT_Stream stream )
{
FT_Byte* p;
FT_ULong result;
FT_UInt32 result;
FT_ASSERT( stream && stream->cursor );
@@ -419,11 +419,11 @@
}
FT_BASE_DEF( FT_ULong )
FT_BASE_DEF( FT_UInt32 )
FT_Stream_GetULong( FT_Stream stream )
{
FT_Byte* p;
FT_ULong result;
FT_UInt32 result;
FT_ASSERT( stream && stream->cursor );
@@ -437,11 +437,11 @@
}
FT_BASE_DEF( FT_ULong )
FT_BASE_DEF( FT_UInt32 )
FT_Stream_GetULongLE( FT_Stream stream )
{
FT_Byte* p;
FT_ULong result;
FT_UInt32 result;
FT_ASSERT( stream && stream->cursor );
@@ -493,13 +493,13 @@
}
FT_BASE_DEF( FT_UShort )
FT_BASE_DEF( FT_UInt16 )
FT_Stream_ReadUShort( FT_Stream stream,
FT_Error* error )
{
FT_Byte reads[2];
FT_Byte* p;
FT_UShort result = 0;
FT_UInt16 result = 0;
FT_ASSERT( stream );
@@ -538,13 +538,13 @@
}
FT_BASE_DEF( FT_UShort )
FT_BASE_DEF( FT_UInt16 )
FT_Stream_ReadUShortLE( FT_Stream stream,
FT_Error* error )
{
FT_Byte reads[2];
FT_Byte* p;
FT_UShort result = 0;
FT_UInt16 result = 0;
FT_ASSERT( stream );
@@ -628,13 +628,13 @@
}
FT_BASE_DEF( FT_ULong )
FT_BASE_DEF( FT_UInt32 )
FT_Stream_ReadULong( FT_Stream stream,
FT_Error* error )
{
FT_Byte reads[4];
FT_Byte* p;
FT_ULong result = 0;
FT_UInt32 result = 0;
FT_ASSERT( stream );
@@ -673,13 +673,13 @@
}
FT_BASE_DEF( FT_ULong )
FT_BASE_DEF( FT_UInt32 )
FT_Stream_ReadULongLE( FT_Stream stream,
FT_Error* error )
{
FT_Byte reads[4];
FT_Byte* p;
FT_ULong result = 0;
FT_UInt32 result = 0;
FT_ASSERT( stream );

View File

@@ -4,7 +4,7 @@
*
* FreeType path stroker (body).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType synthesizing code for emboldening and slanting (body).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -45,6 +45,18 @@
FT_EXPORT_DEF( void )
FT_GlyphSlot_Oblique( FT_GlyphSlot slot )
{
/* Value '0x0366A' corresponds to a shear angle of about 12 degrees. */
FT_GlyphSlot_Slant( slot, 0x0366A, 0 );
}
/* documentation is in ftsynth.h */
FT_EXPORT_DEF( void )
FT_GlyphSlot_Slant( FT_GlyphSlot slot,
FT_Fixed xslant,
FT_Fixed yslant )
{
FT_Matrix transform;
FT_Outline* outline;
@@ -61,13 +73,11 @@
/* we don't touch the advance width */
/* For italic, simply apply a shear transform, with an angle */
/* of about 12 degrees. */
/* For italic, simply apply a shear transform */
transform.xx = 0x10000L;
transform.yx = 0x00000L;
transform.yx = -yslant;
transform.xy = 0x0366AL;
transform.xy = xslant;
transform.yy = 0x10000L;
FT_Outline_Transform( outline, &transform );

View File

@@ -4,7 +4,7 @@
*
* ANSI-specific FreeType low-level system interface (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType trigonometric functions (body).
*
* Copyright (C) 2001-2022 by
* Copyright (C) 2001-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType utility file for PS names support (body).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType utility file for memory and list management (body).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType API for accessing Windows FNT specific info (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -92,24 +92,18 @@ THE SOFTWARE.
{
BDF_CMap cmap = (BDF_CMap)bdfcmap;
BDF_encoding_el* encodings = cmap->encodings;
FT_ULong min, max, mid; /* num_encodings */
FT_UShort result = 0; /* encodings->glyph */
FT_ULong min = 0;
FT_ULong max = cmap->num_encodings;
FT_ULong mid = ( min + max ) >> 1;
min = 0;
max = cmap->num_encodings;
mid = ( min + max ) >> 1;
while ( min < max )
{
FT_ULong code;
FT_ULong code = encodings[mid].enc;
if ( mid >= max || mid < min )
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
if ( charcode == code )
{
/* increase glyph index by 1 -- */
@@ -123,8 +117,10 @@ THE SOFTWARE.
else
min = mid + 1;
/* prediction in a continuous block */
/* reasonable prediction in a continuous block */
mid += charcode - code;
if ( mid >= max || mid < min )
mid = ( min + max ) >> 1;
}
return result;
@@ -137,25 +133,19 @@ THE SOFTWARE.
{
BDF_CMap cmap = (BDF_CMap)bdfcmap;
BDF_encoding_el* encodings = cmap->encodings;
FT_ULong min, max, mid; /* num_encodings */
FT_UShort result = 0; /* encodings->glyph */
FT_ULong charcode = *acharcode + 1;
FT_ULong min = 0;
FT_ULong max = cmap->num_encodings;
FT_ULong mid = ( min + max ) >> 1;
min = 0;
max = cmap->num_encodings;
mid = ( min + max ) >> 1;
while ( min < max )
{
FT_ULong code; /* same as BDF_encoding_el.enc */
FT_ULong code = encodings[mid].enc;
if ( mid >= max || mid < min )
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
if ( charcode == code )
{
/* increase glyph index by 1 -- */
@@ -171,6 +161,8 @@ THE SOFTWARE.
/* prediction in a continuous block */
mid += charcode - code;
if ( mid >= max || mid < min )
mid = ( min + max ) >> 1;
}
charcode = 0;

View File

@@ -58,7 +58,7 @@
*/
static const bdf_options_t _bdf_opts =
static const bdf_options_t bdf_opts_ =
{
1, /* Correct metrics. */
1, /* Preserve unencoded glyphs. */
@@ -76,7 +76,7 @@
/* List of most properties that might appear in a font. Doesn't include */
/* the RAW_* and AXIS_* properties in X11R6 polymorphic fonts. */
static const bdf_property_t _bdf_properties[] =
static const bdf_property_t bdf_properties_[] =
{
{ "ADD_STYLE_NAME", BDF_ATOM, 1, { 0 } },
{ "AVERAGE_WIDTH", BDF_INTEGER, 1, { 0 } },
@@ -164,8 +164,8 @@
};
static const unsigned long
_num_bdf_properties = sizeof ( _bdf_properties ) /
sizeof ( _bdf_properties[0] );
num_bdf_properties_ = sizeof ( bdf_properties_ ) /
sizeof ( bdf_properties_[0] );
/* An auxiliary macro to parse properties, to be used in conditionals. */
@@ -227,7 +227,7 @@
/* Function type for parsing lines of a BDF font. */
typedef FT_Error
(*_bdf_line_func_t)( char* line,
(*bdf_line_func_t_)( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
@@ -236,19 +236,19 @@
/* List structure for splitting lines into fields. */
typedef struct _bdf_list_t_
typedef struct bdf_list_t__
{
char** field;
unsigned long size;
unsigned long used;
FT_Memory memory;
} _bdf_list_t;
} bdf_list_t_;
/* Structure used while loading BDF fonts. */
typedef struct _bdf_parse_t_
typedef struct bdf_parse_t__
{
unsigned long flags;
unsigned long cnt;
@@ -268,12 +268,12 @@
bdf_font_t* font;
bdf_options_t* opts;
_bdf_list_t list;
bdf_list_t_ list;
FT_Memory memory;
unsigned long size; /* the stream size */
} _bdf_parse_t;
} bdf_parse_t_;
#define setsbit( m, cc ) \
@@ -283,7 +283,7 @@
static void
_bdf_list_init( _bdf_list_t* list,
bdf_list_init_( bdf_list_t_* list,
FT_Memory memory )
{
FT_ZERO( list );
@@ -292,7 +292,7 @@
static void
_bdf_list_done( _bdf_list_t* list )
bdf_list_done_( bdf_list_t_* list )
{
FT_Memory memory = list->memory;
@@ -306,15 +306,15 @@
static FT_Error
_bdf_list_ensure( _bdf_list_t* list,
unsigned long num_items ) /* same as _bdf_list_t.used */
bdf_list_ensure_( bdf_list_t_* list,
unsigned long num_items ) /* same as bdf_list_t_.used */
{
FT_Error error = FT_Err_Ok;
if ( num_items > list->size )
{
unsigned long oldsize = list->size; /* same as _bdf_list_t.size */
unsigned long oldsize = list->size; /* same as bdf_list_t_.size */
unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5;
unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) );
FT_Memory memory = list->memory;
@@ -340,7 +340,7 @@
static void
_bdf_list_shift( _bdf_list_t* list,
bdf_list_shift_( bdf_list_t_* list,
unsigned long n )
{
unsigned long i, u;
@@ -367,7 +367,7 @@
static char *
_bdf_list_join( _bdf_list_t* list,
bdf_list_join_( bdf_list_t_* list,
int c,
unsigned long *alen )
{
@@ -405,7 +405,7 @@
/* don't have to check the number of fields in most cases. */
static FT_Error
_bdf_list_split( _bdf_list_t* list,
bdf_list_split_( bdf_list_t_* list,
const char* separators,
char* line,
unsigned long linelen )
@@ -467,7 +467,7 @@
/* Resize the list if necessary. */
if ( list->used == list->size )
{
error = _bdf_list_ensure( list, list->used + 1 );
error = bdf_list_ensure_( list, list->used + 1 );
if ( error )
goto Exit;
}
@@ -496,7 +496,7 @@
/* Finally, NULL-terminate the list. */
if ( list->used + final_empty >= list->size )
{
error = _bdf_list_ensure( list, list->used + final_empty + 1 );
error = bdf_list_ensure_( list, list->used + final_empty + 1 );
if ( error )
goto Exit;
}
@@ -515,12 +515,12 @@
static FT_Error
_bdf_readstream( FT_Stream stream,
_bdf_line_func_t callback,
bdf_readstream_( FT_Stream stream,
bdf_line_func_t_ callback,
void* client_data,
unsigned long *lno )
{
_bdf_line_func_t cb;
bdf_line_func_t_ cb;
unsigned long lineno, buf_size;
int refill, hold, to_skip;
ptrdiff_t bytes, start, end, cursor, avail;
@@ -603,7 +603,7 @@
error = FT_THROW( Missing_Startfont_Field );
else
{
FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno ));
FT_ERROR(( "bdf_readstream_: " ERRMSG6, lineno ));
error = FT_THROW( Invalid_Argument );
}
goto Exit;
@@ -702,7 +702,7 @@
/* Routine to convert a decimal ASCII string to an unsigned long integer. */
static unsigned long
_bdf_atoul( const char* s )
bdf_atoul_( const char* s )
{
unsigned long v;
@@ -727,7 +727,7 @@
/* Routine to convert a decimal ASCII string to a signed long integer. */
static long
_bdf_atol( const char* s )
bdf_atol_( const char* s )
{
long v, neg;
@@ -760,7 +760,7 @@
/* Routine to convert a decimal ASCII string to an unsigned short integer. */
static unsigned short
_bdf_atous( const char* s )
bdf_atous_( const char* s )
{
unsigned short v;
@@ -785,7 +785,7 @@
/* Routine to convert a decimal ASCII string to a signed short integer. */
static short
_bdf_atos( const char* s )
bdf_atos_( const char* s )
{
short v, neg;
@@ -874,7 +874,7 @@
p->builtin = 0;
p->value.atom = NULL; /* nothing is ever stored here */
n = _num_bdf_properties + font->nuser_props;
n = num_bdf_properties_ + font->nuser_props;
error = ft_hash_str_insert( p->name, n, &(font->proptbl), memory );
if ( error )
@@ -900,10 +900,10 @@
if ( ( propid = ft_hash_str_lookup( name, &(font->proptbl) ) ) == NULL )
return 0;
if ( *propid >= _num_bdf_properties )
return font->user_props + ( *propid - _num_bdf_properties );
if ( *propid >= num_bdf_properties_ )
return font->user_props + ( *propid - num_bdf_properties_ );
return (bdf_property_t*)_bdf_properties + *propid;
return (bdf_property_t*)bdf_properties_ + *propid;
}
@@ -943,7 +943,7 @@
static FT_Error
_bdf_add_comment( bdf_font_t* font,
bdf_add_comment_( bdf_font_t* font,
char* comment,
unsigned long len )
{
@@ -972,13 +972,13 @@
/* Set the spacing from the font name if it exists, or set it to the */
/* default specified in the options. */
static FT_Error
_bdf_set_default_spacing( bdf_font_t* font,
bdf_set_default_spacing_( bdf_font_t* font,
bdf_options_t* opts,
unsigned long lineno )
{
size_t len;
char name[256];
_bdf_list_t list;
bdf_list_t_ list;
FT_Memory memory;
FT_Error error = FT_Err_Ok;
@@ -993,7 +993,7 @@
memory = font->memory;
_bdf_list_init( &list, memory );
bdf_list_init_( &list, memory );
font->spacing = opts->font_spacing;
@@ -1001,14 +1001,14 @@
/* Limit ourselves to 256 characters in the font name. */
if ( len >= 256 )
{
FT_ERROR(( "_bdf_set_default_spacing: " ERRMSG7, lineno ));
FT_ERROR(( "bdf_set_default_spacing_: " ERRMSG7, lineno ));
error = FT_THROW( Invalid_Argument );
goto Exit;
}
FT_MEM_COPY( name, font->name, len );
error = _bdf_list_split( &list, "-", name, (unsigned long)len );
error = bdf_list_split_( &list, "-", name, (unsigned long)len );
if ( error )
goto Fail;
@@ -1032,7 +1032,7 @@
}
Fail:
_bdf_list_done( &list );
bdf_list_done_( &list );
Exit:
return error;
@@ -1042,7 +1042,7 @@
/* Determine whether the property is an atom or not. If it is, then */
/* clean it up so the double quotes are removed if they exist. */
static int
_bdf_is_atom( char* line,
bdf_is_atom_( char* line,
unsigned long linelen,
char** name,
char** value,
@@ -1106,7 +1106,7 @@
static FT_Error
_bdf_add_property( bdf_font_t* font,
bdf_add_property_( bdf_font_t* font,
const char* name,
char* value,
unsigned long lineno )
@@ -1141,11 +1141,11 @@
break;
case BDF_INTEGER:
fp->value.l = _bdf_atol( value );
fp->value.l = bdf_atol_( value );
break;
case BDF_CARDINAL:
fp->value.ul = _bdf_atoul( value );
fp->value.ul = bdf_atoul_( value );
break;
default:
@@ -1177,10 +1177,10 @@
font->props_size++;
}
if ( *propid >= _num_bdf_properties )
prop = font->user_props + ( *propid - _num_bdf_properties );
if ( *propid >= num_bdf_properties_ )
prop = font->user_props + ( *propid - num_bdf_properties_ );
else
prop = (bdf_property_t*)_bdf_properties + *propid;
prop = (bdf_property_t*)bdf_properties_ + *propid;
fp = font->props + font->props_used;
@@ -1200,11 +1200,11 @@
break;
case BDF_INTEGER:
fp->value.l = _bdf_atol( value );
fp->value.l = bdf_atol_( value );
break;
case BDF_CARDINAL:
fp->value.ul = _bdf_atoul( value );
fp->value.ul = bdf_atoul_( value );
break;
}
@@ -1238,7 +1238,7 @@
{
if ( !fp->value.atom )
{
FT_ERROR(( "_bdf_add_property: " ERRMSG8, lineno, "SPACING" ));
FT_ERROR(( "bdf_add_property_: " ERRMSG8, lineno, "SPACING" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -1263,7 +1263,7 @@
static FT_Error
_bdf_parse_end( char* line,
bdf_parse_end_( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
@@ -1283,7 +1283,7 @@
/* Actually parse the glyph info and bitmaps. */
static FT_Error
_bdf_parse_glyphs( char* line,
bdf_parse_glyphs_( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
@@ -1294,8 +1294,8 @@
unsigned char* bp;
unsigned long i, slen, nibbles;
_bdf_line_func_t* next;
_bdf_parse_t* p;
bdf_line_func_t_* next;
bdf_parse_t_* p;
bdf_glyph_t* glyph;
bdf_font_t* font;
@@ -1305,8 +1305,8 @@
FT_UNUSED( lineno ); /* only used in debug mode */
next = (_bdf_line_func_t *)call_data;
p = (_bdf_parse_t *) client_data;
next = (bdf_line_func_t_ *)call_data;
p = (bdf_parse_t_ *) client_data;
font = p->font;
memory = font->memory;
@@ -1324,7 +1324,7 @@
s++;
linelen--;
}
error = _bdf_add_comment( p->font, s, linelen );
error = bdf_add_comment_( p->font, s, linelen );
}
goto Exit;
}
@@ -1334,21 +1334,21 @@
{
if ( _bdf_strncmp( line, "CHARS", 5 ) != 0 )
{
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "CHARS" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "CHARS" ));
error = FT_THROW( Missing_Chars_Field );
goto Exit;
}
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1] );
p->cnt = font->glyphs_size = bdf_atoul_( p->list.field[1] );
/* We need at least 20 bytes per glyph. */
if ( p->cnt > p->size / 20 )
{
p->cnt = font->glyphs_size = p->size / 20;
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG17, p->cnt ));
FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG17, p->cnt ));
}
/* Make sure the number of glyphs is non-zero. */
@@ -1359,7 +1359,7 @@
/* number of code points available in Unicode). */
if ( p->cnt >= 0x110000UL )
{
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "CHARS" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "CHARS" ));
error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -1378,7 +1378,7 @@
if ( p->flags & BDF_GLYPH_BITS_ )
{
/* Missing ENDCHAR field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENDCHAR" ));
error = FT_THROW( Corrupted_Font_Glyphs );
goto Exit;
}
@@ -1390,7 +1390,7 @@
by_encoding );
p->flags &= ~BDF_START_;
*next = _bdf_parse_end;
*next = bdf_parse_end_;
goto Exit;
}
@@ -1417,7 +1417,7 @@
if ( p->flags & BDF_GLYPH_BITS_ )
{
/* Missing ENDCHAR field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENDCHAR" ));
error = FT_THROW( Missing_Startchar_Field );
goto Exit;
}
@@ -1426,17 +1426,17 @@
/* encoding can be checked for an unencoded character. */
FT_FREE( p->glyph_name );
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
_bdf_list_shift( &p->list, 1 );
bdf_list_shift_( &p->list, 1 );
s = _bdf_list_join( &p->list, ' ', &slen );
s = bdf_list_join_( &p->list, ' ', &slen );
if ( !s )
{
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG8, lineno, "STARTCHAR" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG8, lineno, "STARTCHAR" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -1459,16 +1459,16 @@
if ( !( p->flags & BDF_GLYPH_ ) )
{
/* Missing STARTCHAR field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "STARTCHAR" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "STARTCHAR" ));
error = FT_THROW( Missing_Startchar_Field );
goto Exit;
}
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
p->glyph_enc = _bdf_atol( p->list.field[1] );
p->glyph_enc = bdf_atol_( p->list.field[1] );
/* Normalize negative encoding values. The specification only */
/* allows -1, but we can be more generous here. */
@@ -1477,7 +1477,7 @@
/* Check for alternative encoding format. */
if ( p->glyph_enc == -1 && p->list.used > 2 )
p->glyph_enc = _bdf_atol( p->list.field[2] );
p->glyph_enc = bdf_atol_( p->list.field[2] );
if ( p->glyph_enc < -1 || p->glyph_enc >= 0x110000L )
p->glyph_enc = -1;
@@ -1564,7 +1564,7 @@
{
if ( !( p->flags & BDF_GLYPH_HEIGHT_CHECK_ ) )
{
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG13, glyph->encoding ));
FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG13, glyph->encoding ));
p->flags |= BDF_GLYPH_HEIGHT_CHECK_;
}
@@ -1591,7 +1591,7 @@
if ( i < nibbles &&
!( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) )
{
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding ));
FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG16, glyph->encoding ));
p->flags |= BDF_GLYPH_WIDTH_CHECK_;
}
@@ -1605,7 +1605,7 @@
sbitset( hdigits, line[nibbles] ) &&
!( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) )
{
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding ));
FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG14, glyph->encoding ));
p->flags |= BDF_GLYPH_WIDTH_CHECK_;
}
@@ -1616,11 +1616,11 @@
/* Expect the SWIDTH (scalable width) field next. */
if ( _bdf_strncmp( line, "SWIDTH", 6 ) == 0 )
{
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
glyph->swidth = _bdf_atous( p->list.field[1] );
glyph->swidth = bdf_atous_( p->list.field[1] );
p->flags |= BDF_SWIDTH_;
goto Exit;
@@ -1629,17 +1629,17 @@
/* Expect the DWIDTH (device width) field next. */
if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 )
{
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
glyph->dwidth = _bdf_atous( p->list.field[1] );
glyph->dwidth = bdf_atous_( p->list.field[1] );
if ( !( p->flags & BDF_SWIDTH_ ) )
{
/* Missing SWIDTH field. Emit an auto correction message and set */
/* the scalable width from the device width. */
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG9, lineno ));
FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG9, lineno ));
glyph->swidth = (unsigned short)FT_MulDiv(
glyph->dwidth, 72000L,
@@ -1654,14 +1654,14 @@
/* Expect the BBX field next. */
if ( _bdf_strncmp( line, "BBX", 3 ) == 0 )
{
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
glyph->bbx.width = _bdf_atous( p->list.field[1] );
glyph->bbx.height = _bdf_atous( p->list.field[2] );
glyph->bbx.x_offset = _bdf_atos( p->list.field[3] );
glyph->bbx.y_offset = _bdf_atos( p->list.field[4] );
glyph->bbx.width = bdf_atous_( p->list.field[1] );
glyph->bbx.height = bdf_atous_( p->list.field[2] );
glyph->bbx.x_offset = bdf_atos_( p->list.field[3] );
glyph->bbx.y_offset = bdf_atos_( p->list.field[4] );
/* Generate the ascent and descent of the character. */
glyph->bbx.ascent = (short)( glyph->bbx.height + glyph->bbx.y_offset );
@@ -1682,7 +1682,7 @@
{
/* Missing DWIDTH field. Emit an auto correction message and set */
/* the device width to the glyph width. */
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG10, lineno ));
FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG10, lineno ));
glyph->dwidth = glyph->bbx.width;
}
@@ -1718,7 +1718,7 @@
if ( !( p->flags & BDF_BBX_ ) )
{
/* Missing BBX field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "BBX" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "BBX" ));
error = FT_THROW( Missing_Bbx_Field );
goto Exit;
}
@@ -1729,7 +1729,7 @@
bitmap_size = glyph->bpr * glyph->bbx.height;
if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU )
{
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG4, lineno ));
error = FT_THROW( Bbx_Too_Big );
goto Exit;
}
@@ -1745,13 +1745,13 @@
goto Exit;
}
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG9, lineno ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG9, lineno ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
Missing_Encoding:
/* Missing ENCODING field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENCODING" ));
error = FT_THROW( Missing_Encoding_Field );
Exit:
@@ -1764,15 +1764,15 @@
/* Load the font properties. */
static FT_Error
_bdf_parse_properties( char* line,
bdf_parse_properties_( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
void* client_data )
{
unsigned long vlen;
_bdf_line_func_t* next;
_bdf_parse_t* p;
bdf_line_func_t_* next;
bdf_parse_t_* p;
char* name;
char* value;
char nbuf[128];
@@ -1781,8 +1781,8 @@
FT_UNUSED( lineno );
next = (_bdf_line_func_t *)call_data;
p = (_bdf_parse_t *) client_data;
next = (bdf_line_func_t_ *)call_data;
p = (bdf_parse_t_ *) client_data;
/* Check for the end of the properties. */
if ( _bdf_strncmp( line, "ENDPROPERTIES", 13 ) == 0 )
@@ -1797,28 +1797,28 @@
{
p->font->font_ascent = p->font->bbx.ascent;
ft_sprintf( nbuf, "%hd", p->font->bbx.ascent );
error = _bdf_add_property( p->font, "FONT_ASCENT",
error = bdf_add_property_( p->font, "FONT_ASCENT",
nbuf, lineno );
if ( error )
goto Exit;
FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent ));
FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent ));
}
if ( bdf_get_font_property( p->font, "FONT_DESCENT" ) == 0 )
{
p->font->font_descent = p->font->bbx.descent;
ft_sprintf( nbuf, "%hd", p->font->bbx.descent );
error = _bdf_add_property( p->font, "FONT_DESCENT",
error = bdf_add_property_( p->font, "FONT_DESCENT",
nbuf, lineno );
if ( error )
goto Exit;
FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent ));
FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent ));
}
p->flags &= ~BDF_PROPS_;
*next = _bdf_parse_glyphs;
*next = bdf_parse_glyphs_;
goto Exit;
}
@@ -1835,27 +1835,27 @@
value += 7;
if ( *value )
*value++ = 0;
error = _bdf_add_property( p->font, name, value, lineno );
error = bdf_add_property_( p->font, name, value, lineno );
if ( error )
goto Exit;
}
else if ( _bdf_is_atom( line, linelen, &name, &value, p->font ) )
else if ( bdf_is_atom_( line, linelen, &name, &value, p->font ) )
{
error = _bdf_add_property( p->font, name, value, lineno );
error = bdf_add_property_( p->font, name, value, lineno );
if ( error )
goto Exit;
}
else
{
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
name = p->list.field[0];
_bdf_list_shift( &p->list, 1 );
value = _bdf_list_join( &p->list, ' ', &vlen );
bdf_list_shift_( &p->list, 1 );
value = bdf_list_join_( &p->list, ' ', &vlen );
error = _bdf_add_property( p->font, name, value, lineno );
error = bdf_add_property_( p->font, name, value, lineno );
if ( error )
goto Exit;
}
@@ -1867,15 +1867,15 @@
/* Load the font header. */
static FT_Error
_bdf_parse_start( char* line,
bdf_parse_start_( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
void* client_data )
{
unsigned long slen;
_bdf_line_func_t* next;
_bdf_parse_t* p;
bdf_line_func_t_* next;
bdf_parse_t_* p;
bdf_font_t* font;
char *s;
@@ -1885,8 +1885,8 @@
FT_UNUSED( lineno ); /* only used in debug mode */
next = (_bdf_line_func_t *)call_data;
p = (_bdf_parse_t *) client_data;
next = (bdf_line_func_t_ *)call_data;
p = (bdf_parse_t_ *) client_data;
if ( p->font )
memory = p->font->memory;
@@ -1905,7 +1905,7 @@
s++;
linelen--;
}
error = _bdf_add_comment( p->font, s, linelen );
error = bdf_add_comment_( p->font, s, linelen );
}
goto Exit;
}
@@ -1939,8 +1939,8 @@
error = ft_hash_str_init( &(font->proptbl), memory );
if ( error )
goto Exit;
for ( i = 0, prop = (bdf_property_t*)_bdf_properties;
i < _num_bdf_properties; i++, prop++ )
for ( i = 0, prop = (bdf_property_t*)bdf_properties_;
i < num_bdf_properties_; i++, prop++ )
{
error = ft_hash_str_insert( prop->name, i,
&(font->proptbl), memory );
@@ -1966,23 +1966,23 @@
if ( !( p->flags & BDF_FONT_BBX_ ) )
{
/* Missing the FONTBOUNDINGBOX field. */
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
error = FT_THROW( Missing_Fontboundingbox_Field );
goto Exit;
}
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
/* at this point, `p->font' can't be NULL */
p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1] );
p->cnt = p->font->props_size = bdf_atoul_( p->list.field[1] );
/* We need at least 4 bytes per property. */
if ( p->cnt > p->size / 4 )
{
p->font->props_size = 0;
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "STARTPROPERTIES" ));
FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "STARTPROPERTIES" ));
error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -1994,7 +1994,7 @@
}
p->flags |= BDF_PROPS_;
*next = _bdf_parse_properties;
*next = bdf_parse_properties_;
goto Exit;
}
@@ -2005,20 +2005,20 @@
if ( !( p->flags & BDF_SIZE_ ) )
{
/* Missing the SIZE field. */
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "SIZE" ));
FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "SIZE" ));
error = FT_THROW( Missing_Size_Field );
goto Exit;
}
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
p->font->bbx.width = _bdf_atous( p->list.field[1] );
p->font->bbx.height = _bdf_atous( p->list.field[2] );
p->font->bbx.width = bdf_atous_( p->list.field[1] );
p->font->bbx.height = bdf_atous_( p->list.field[2] );
p->font->bbx.x_offset = _bdf_atos( p->list.field[3] );
p->font->bbx.y_offset = _bdf_atos( p->list.field[4] );
p->font->bbx.x_offset = bdf_atos_( p->list.field[3] );
p->font->bbx.y_offset = bdf_atos_( p->list.field[4] );
p->font->bbx.ascent = (short)( p->font->bbx.height +
p->font->bbx.y_offset );
@@ -2033,16 +2033,16 @@
/* The next thing to check for is the FONT field. */
if ( _bdf_strncmp( line, "FONT", 4 ) == 0 )
{
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
_bdf_list_shift( &p->list, 1 );
bdf_list_shift_( &p->list, 1 );
s = _bdf_list_join( &p->list, ' ', &slen );
s = bdf_list_join_( &p->list, ' ', &slen );
if ( !s )
{
FT_ERROR(( "_bdf_parse_start: " ERRMSG8, lineno, "FONT" ));
FT_ERROR(( "bdf_parse_start_: " ERRMSG8, lineno, "FONT" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -2056,7 +2056,7 @@
/* If the font name is an XLFD name, set the spacing to the one in */
/* the font name. If there is no spacing fall back on the default. */
error = _bdf_set_default_spacing( p->font, p->opts, lineno );
error = bdf_set_default_spacing_( p->font, p->opts, lineno );
if ( error )
goto Exit;
@@ -2071,18 +2071,18 @@
if ( !( p->flags & BDF_FONT_NAME_ ) )
{
/* Missing the FONT field. */
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONT" ));
FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONT" ));
error = FT_THROW( Missing_Font_Field );
goto Exit;
}
error = _bdf_list_split( &p->list, " +", line, linelen );
error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
p->font->point_size = _bdf_atoul( p->list.field[1] );
p->font->resolution_x = _bdf_atoul( p->list.field[2] );
p->font->resolution_y = _bdf_atoul( p->list.field[3] );
p->font->point_size = bdf_atoul_( p->list.field[1] );
p->font->resolution_x = bdf_atoul_( p->list.field[2] );
p->font->resolution_y = bdf_atoul_( p->list.field[3] );
/* Check for the bits per pixel field. */
if ( p->list.used == 5 )
@@ -2090,7 +2090,7 @@
unsigned short bpp;
bpp = _bdf_atous( p->list.field[4] );
bpp = bdf_atous_( p->list.field[4] );
/* Only values 1, 2, 4, 8 are allowed for greymap fonts. */
if ( bpp > 4 )
@@ -2103,7 +2103,7 @@
p->font->bpp = 1;
if ( p->font->bpp != bpp )
FT_TRACE2(( "_bdf_parse_start: " ACMSG11, p->font->bpp ));
FT_TRACE2(( "bdf_parse_start_: " ACMSG11, p->font->bpp ));
}
else
p->font->bpp = 1;
@@ -2122,7 +2122,7 @@
if ( !( p->flags & BDF_FONT_BBX_ ) )
{
/* Missing the FONTBOUNDINGBOX field. */
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
error = FT_THROW( Missing_Fontboundingbox_Field );
goto Exit;
}
@@ -2131,28 +2131,28 @@
/* for compiling fonts. */
p->font->font_ascent = p->font->bbx.ascent;
ft_sprintf( nbuf, "%hd", p->font->bbx.ascent );
error = _bdf_add_property( p->font, "FONT_ASCENT",
error = bdf_add_property_( p->font, "FONT_ASCENT",
nbuf, lineno );
if ( error )
goto Exit;
FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent ));
FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent ));
p->font->font_descent = p->font->bbx.descent;
ft_sprintf( nbuf, "%hd", p->font->bbx.descent );
error = _bdf_add_property( p->font, "FONT_DESCENT",
error = bdf_add_property_( p->font, "FONT_DESCENT",
nbuf, lineno );
if ( error )
goto Exit;
FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent ));
FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent ));
*next = _bdf_parse_glyphs;
*next = bdf_parse_glyphs_;
/* A special return value. */
error = -1;
goto Exit;
}
FT_ERROR(( "_bdf_parse_start: " ERRMSG9, lineno ));
FT_ERROR(( "bdf_parse_start_: " ERRMSG9, lineno ));
error = FT_THROW( Invalid_File_Format );
Exit:
@@ -2174,7 +2174,7 @@
bdf_font_t* *font )
{
unsigned long lineno = 0; /* make compiler happy */
_bdf_parse_t *p = NULL;
bdf_parse_t_ *p = NULL;
FT_Error error = FT_Err_Ok;
@@ -2182,14 +2182,14 @@
if ( FT_NEW( p ) )
goto Exit;
p->opts = (bdf_options_t*)( opts ? opts : &_bdf_opts );
p->opts = (bdf_options_t*)( opts ? opts : &bdf_opts_ );
p->minlb = 32767;
p->size = stream->size;
p->memory = memory; /* only during font creation */
_bdf_list_init( &p->list, memory );
bdf_list_init_( &p->list, memory );
error = _bdf_readstream( stream, _bdf_parse_start,
error = bdf_readstream_( stream, bdf_parse_start_,
(void *)p, &lineno );
if ( error )
goto Fail;
@@ -2283,7 +2283,7 @@
Exit:
if ( p )
{
_bdf_list_done( &p->list );
bdf_list_done_( &p->list );
FT_FREE( p->glyph_name );
FT_FREE( p );

View File

@@ -8,7 +8,7 @@
* parse compressed PCF fonts, as found with many X11 server
* distributions.
*
* Copyright (C) 2010-2022 by
* Copyright (C) 2010-2023 by
* Joel Klinghed.
*
* based on `src/gzip/ftgzip.c'

View File

@@ -4,7 +4,7 @@
*
* The FreeType Caching sub-system (body only).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* The FreeType basic cache interface (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -120,8 +120,7 @@
}
#endif
if ( !error )
result = (FT_UInt)face->num_glyphs;
result = (FT_UInt)face->num_glyphs;
return result;
}
@@ -320,7 +319,7 @@
#if 0xFFFFFFFFUL > FT_UINT_MAX
if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
FT_TRACE1(( "FTC_ImageCache_Lookup:"
" higher bits in load_flags 0x%x are dropped\n",
" higher bits in load_flags 0x%lx are dropped\n",
(FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
#endif
@@ -518,7 +517,7 @@
#if 0xFFFFFFFFUL > FT_UINT_MAX
if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
FT_TRACE1(( "FTC_ImageCache_Lookup:"
" higher bits in load_flags 0x%x are dropped\n",
" higher bits in load_flags 0x%lx are dropped\n",
(FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
#endif

View File

@@ -4,7 +4,7 @@
*
* The FreeType internal cache interface (body).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -307,7 +307,7 @@
#if 0
/* check, just in case of general corruption :-) */
if ( manager->num_nodes == 0 )
FT_TRACE0(( "ftc_node_destroy: invalid cache node count (%d)\n",
FT_TRACE0(( "ftc_node_destroy: invalid cache node count (%u)\n",
manager->num_nodes ));
#endif
}

View File

@@ -4,7 +4,7 @@
*
* FreeType internal cache interface (specification).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Callback functions of the caching sub-system (specification only).
*
* Copyright (C) 2004-2022 by
* Copyright (C) 2004-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType CharMap cache (body)
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -295,21 +295,19 @@
if ( error )
goto Exit;
if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
if ( cmap_index < face->num_charmaps )
{
FT_CharMap old, cmap = NULL;
FT_CharMap old = face->charmap;
FT_CharMap cmap = face->charmaps[cmap_index];
old = face->charmap;
cmap = face->charmaps[cmap_index];
if ( old != cmap && !no_cmap_change )
FT_Set_Charmap( face, cmap );
if ( !no_cmap_change )
face->charmap = cmap;
gindex = FT_Get_Char_Index( face, char_code );
if ( old != cmap && !no_cmap_change )
FT_Set_Charmap( face, old );
if ( !no_cmap_change )
face->charmap = old;
}
FTC_CMAP_NODE( node )->indices[char_code -

View File

@@ -4,7 +4,7 @@
*
* Caching sub-system error codes (specification only).
*
* Copyright (C) 2001-2022 by
* Copyright (C) 2001-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType Glyph Image (FT_Glyph) cache (body).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType abstract glyph cache (specification).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType Image cache (body).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType Generic Image cache (specification)
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType Cache Manager (body).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -383,6 +383,7 @@
manager->library = library;
manager->memory = memory;
manager->max_weight = max_bytes;
manager->cur_weight = 0;
manager->request_face = requester;
manager->request_data = req_data;
@@ -488,8 +489,8 @@
FTC_Cache cache = manager->caches[node->cache_index];
if ( (FT_UInt)node->cache_index >= manager->num_caches )
FT_TRACE0(( "FTC_Manager_Check: invalid node (cache index = %ld\n",
if ( node->cache_index >= manager->num_caches )
FT_TRACE0(( "FTC_Manager_Check: invalid node (cache index = %hu\n",
node->cache_index ));
else
weight += cache->clazz.node_weight( node, cache );
@@ -519,7 +520,7 @@
if ( count != manager->num_nodes )
FT_TRACE0(( "FTC_Manager_Check:"
" invalid cache node count %d instead of %d\n",
" invalid cache node count %u instead of %u\n",
manager->num_nodes, count ));
}
}
@@ -547,7 +548,7 @@
#ifdef FT_DEBUG_ERROR
FTC_Manager_Check( manager );
FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %u\n",
manager->cur_weight, manager->max_weight,
manager->num_nodes ));
#endif
@@ -693,9 +694,9 @@
FTC_Node_Unref( FTC_Node node,
FTC_Manager manager )
{
if ( node &&
manager &&
(FT_UInt)node->cache_index < manager->num_caches )
if ( node &&
manager &&
node->cache_index < manager->num_caches )
node->ref_count--;
}

View File

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

View File

@@ -4,7 +4,7 @@
*
* FreeType MRU support (body).
*
* Copyright (C) 2003-2022 by
* Copyright (C) 2003-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* Simple MRU list-cache (specification).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType sbits manager (body).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* A small-bitmap cache (specification).
*
* Copyright (C) 2000-2022 by
* Copyright (C) 2000-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* FreeType OpenType driver component (body only).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* CFF character mapping table (cmap) support (body).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* CFF character mapping table (cmap) support (specification).
*
* Copyright (C) 2002-2022 by
* Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,8 +4,8 @@
*
* OpenType font driver implementation (body).
*
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
@@ -936,22 +936,103 @@
}
static FT_Error
cff_load_item_variation_store( CFF_Face face,
FT_ULong offset,
GX_ItemVarStore itemStore )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
return mm->load_item_var_store( FT_FACE(face), offset, itemStore );
}
static FT_Error
cff_load_delta_set_index_mapping( CFF_Face face,
FT_ULong offset,
GX_DeltaSetIdxMap map,
GX_ItemVarStore itemStore,
FT_ULong table_len )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
return mm->load_delta_set_idx_map( FT_FACE( face ), offset, map,
itemStore, table_len );
}
static FT_Int
cff_get_item_delta( CFF_Face face,
GX_ItemVarStore itemStore,
FT_UInt outerIndex,
FT_UInt innerIndex )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
return mm->get_item_delta( FT_FACE( face ), itemStore,
outerIndex, innerIndex );
}
static void
cff_done_item_variation_store( CFF_Face face,
GX_ItemVarStore itemStore )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
mm->done_item_var_store( FT_FACE( face ), itemStore );
}
static void
cff_done_delta_set_index_map( CFF_Face face,
GX_DeltaSetIdxMap deltaSetIdxMap )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
mm->done_delta_set_idx_map( FT_FACE ( face ), deltaSetIdxMap );
}
FT_DEFINE_SERVICE_MULTIMASTERSREC(
cff_service_multi_masters,
(FT_Get_MM_Func) NULL, /* get_mm */
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
(FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */
(FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */
(FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
(FT_Set_Var_Design_Func) cff_set_var_design, /* set_var_design */
(FT_Get_Var_Design_Func) cff_get_var_design, /* get_var_design */
(FT_Set_Instance_Func) cff_set_instance, /* set_instance */
(FT_Set_MM_WeightVector_Func)cff_set_mm_weightvector, /* set_mm_weightvector */
(FT_Get_MM_WeightVector_Func)cff_get_mm_weightvector, /* get_mm_weightvector */
(FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
(FT_Done_Blend_Func) cff_done_blend /* done_blend */
(FT_Get_MM_Func) NULL, /* get_mm */
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
(FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */
(FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */
(FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
(FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */
(FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */
(FT_Set_Instance_Func) cff_set_instance, /* set_instance */
(FT_Set_MM_WeightVector_Func)
cff_set_mm_weightvector,
/* set_mm_weightvector */
(FT_Get_MM_WeightVector_Func)
cff_get_mm_weightvector,
/* get_mm_weightvector */
(FT_Var_Load_Delta_Set_Idx_Map_Func)
cff_load_delta_set_index_mapping,
/* load_delta_set_idx_map */
(FT_Var_Load_Item_Var_Store_Func)
cff_load_item_variation_store,
/* load_item_variation_store */
(FT_Var_Get_Item_Delta_Func)
cff_get_item_delta, /* get_item_delta */
(FT_Var_Done_Item_Var_Store_Func)
cff_done_item_variation_store,
/* done_item_variation_store */
(FT_Var_Done_Delta_Set_Idx_Map_Func)
cff_done_delta_set_index_map,
/* done_delta_set_index_map */
(FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
(FT_Done_Blend_Func) cff_done_blend /* done_blend */
)
@@ -1027,8 +1108,7 @@
/*************************************************************************/
/*************************************************************************/
#if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \
defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
#if defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_DEFINE_SERVICEDESCREC10(
cff_services,
@@ -1043,7 +1123,7 @@
FT_SERVICE_ID_PROPERTIES, &cff_service_properties,
FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load
)
#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
#else
FT_DEFINE_SERVICEDESCREC8(
cff_services,
@@ -1056,32 +1136,6 @@
FT_SERVICE_ID_PROPERTIES, &cff_service_properties,
FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load
)
#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_DEFINE_SERVICEDESCREC9(
cff_services,
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
FT_SERVICE_ID_MULTI_MASTERS, &cff_service_multi_masters,
FT_SERVICE_ID_METRICS_VARIATIONS, &cff_service_metrics_var,
FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name,
FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info,
FT_SERVICE_ID_CID, &cff_service_cid_info,
FT_SERVICE_ID_PROPERTIES, &cff_service_properties,
FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load
)
#else
FT_DEFINE_SERVICEDESCREC7(
cff_services,
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name,
FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info,
FT_SERVICE_ID_CID, &cff_service_cid_info,
FT_SERVICE_ID_PROPERTIES, &cff_service_properties,
FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load
)
#endif

View File

@@ -4,7 +4,7 @@
*
* High-level OpenType driver interface (specification).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* CFF error codes (specification only).
*
* Copyright (C) 2001-2022 by
* Copyright (C) 2001-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (body).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -356,18 +356,14 @@
#ifdef FT_CONFIG_OPTION_SVG
/* check for OT-SVG */
if ( ( load_flags & FT_LOAD_COLOR ) &&
( (TT_Face)glyph->root.face )->svg )
if ( ( load_flags & FT_LOAD_COLOR ) && face->svg )
{
/*
* We load the SVG document and try to grab the advances from the
* table. For the bearings we rely on the presetting hook to do that.
*/
FT_Short dummy;
FT_UShort advanceX;
FT_UShort advanceY;
SFNT_Service sfnt;
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
if ( size && (size->root.metrics.x_ppem < 1 ||
@@ -379,10 +375,17 @@
FT_TRACE3(( "Trying to load SVG glyph\n" ));
sfnt = (SFNT_Service)((TT_Face)glyph->root.face)->sfnt;
error = sfnt->load_svg_doc( (FT_GlyphSlot)glyph, glyph_index );
if ( !error )
{
FT_Fixed x_scale = size->root.metrics.x_scale;
FT_Fixed y_scale = size->root.metrics.y_scale;
FT_Short dummy;
FT_UShort advanceX;
FT_UShort advanceY;
FT_TRACE3(( "Successfully loaded SVG glyph\n" ));
glyph->root.format = FT_GLYPH_FORMAT_SVG;
@@ -404,17 +407,11 @@
&dummy,
&advanceY );
advanceX =
(FT_UShort)FT_MulDiv( advanceX,
glyph->root.face->size->metrics.x_ppem,
glyph->root.face->units_per_EM );
advanceY =
(FT_UShort)FT_MulDiv( advanceY,
glyph->root.face->size->metrics.y_ppem,
glyph->root.face->units_per_EM );
glyph->root.linearHoriAdvance = advanceX;
glyph->root.linearVertAdvance = advanceY;
glyph->root.metrics.horiAdvance = advanceX << 6;
glyph->root.metrics.vertAdvance = advanceY << 6;
glyph->root.metrics.horiAdvance = FT_MulFix( advanceX, x_scale );
glyph->root.metrics.vertAdvance = FT_MulFix( advanceY, y_scale );
return error;
}
@@ -491,13 +488,14 @@
decoder.builder.no_recurse =
FT_BOOL( load_flags & FT_LOAD_NO_RECURSE );
/* now load the unscaled outline */
error = cff_get_glyph_data( face, glyph_index,
&charstring, &charstring_len );
/* this function also checks for a valid subfont index */
error = decoder_funcs->prepare( &decoder, size, glyph_index );
if ( error )
goto Glyph_Build_Finished;
error = decoder_funcs->prepare( &decoder, size, glyph_index );
/* now load the unscaled outline */
error = cff_get_glyph_data( face, glyph_index,
&charstring, &charstring_len );
if ( error )
goto Glyph_Build_Finished;

View File

@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (specification).
*
* Copyright (C) 1996-2022 by
* Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

Some files were not shown because too many files have changed in this diff Show More