Skip to content

Commit

Permalink
8290334: Update FreeType to 2.12.1
Browse files Browse the repository at this point in the history
Backport-of: ea8b75cfe453f5806a96ca85dd5e31724750a88f
  • Loading branch information
GoeLin committed Aug 1, 2022
1 parent 60a6890 commit 5f79e3b
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 57 deletions.
2 changes: 1 addition & 1 deletion src/java.desktop/share/legal/freetype.md
@@ -1,4 +1,4 @@
## The FreeType Project: Freetype v2.12.0
## The FreeType Project: Freetype v2.12.1


### FreeType Notice
Expand Down
Expand Up @@ -4942,7 +4942,7 @@ FT_BEGIN_HEADER
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 12
#define FREETYPE_PATCH 0
#define FREETYPE_PATCH 1


/**************************************************************************
Expand Down
Expand Up @@ -528,14 +528,14 @@ FT_BEGIN_HEADER
* @fields:
* num_color_stops ::
* The number of color stops for the requested glyph index. Set by
* @FT_Get_Colorline_Stops.
* @FT_Get_Paint.
*
* current_color_stop ::
* The current color stop. Set by @FT_Get_Colorline_Stops.
*
* p ::
* An opaque pointer into 'COLR' table data. The caller must set this
* to `NULL` before the first call of @FT_Get_Colorline_Stops.
* An opaque pointer into 'COLR' table data. Set by @FT_Get_Paint.
* Updated by @FT_Get_Colorline_Stops.
*
* @since:
* 2.11 -- **currently experimental only!** There might be changes
Expand Down
4 changes: 2 additions & 2 deletions src/java.desktop/share/native/libfreetype/src/base/ftmac.c
Expand Up @@ -314,7 +314,7 @@
NULL, NULL, NULL ) )
return ( OSType ) 0;

return ((FInfo *)(info.finderInfo))->fdType;
return ( (FInfo *)( info.finderInfo ) )->fdType;
}


Expand Down Expand Up @@ -462,7 +462,7 @@

if ( ps_name_len != 0 )
{
ft_memcpy(ps_name, names[0] + 1, ps_name_len);
ft_memcpy( ps_name, names[0] + 1, ps_name_len );
ps_name[ps_name_len] = 0;
}
if ( style->indexes[face_index] > 1 &&
Expand Down
22 changes: 11 additions & 11 deletions src/java.desktop/share/native/libfreetype/src/base/ftrfork.c
Expand Up @@ -402,17 +402,17 @@
FT_Long *result_offset );


CONST_FT_RFORK_RULE_ARRAY_BEGIN(ft_raccess_guess_table,
ft_raccess_guess_rec)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_double, apple_double)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_single, apple_single)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_ufs_export, darwin_ufs_export)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_newvfs, darwin_newvfs)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_hfsplus, darwin_hfsplus)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(vfat, vfat)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_cap, linux_cap)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_double, linux_double)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_netatalk, linux_netatalk)
CONST_FT_RFORK_RULE_ARRAY_BEGIN( ft_raccess_guess_table,
ft_raccess_guess_rec )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( apple_double, apple_double )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( apple_single, apple_single )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( darwin_ufs_export, darwin_ufs_export )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( darwin_newvfs, darwin_newvfs )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( darwin_hfsplus, darwin_hfsplus )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( vfat, vfat )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( linux_cap, linux_cap )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( linux_double, linux_double )
CONST_FT_RFORK_RULE_ARRAY_ENTRY( linux_netatalk, linux_netatalk )
CONST_FT_RFORK_RULE_ARRAY_END


Expand Down
Expand Up @@ -81,7 +81,7 @@

if ( char_code < 255 )
{
FT_UInt code = (FT_UInt)(char_code + 1);
FT_UInt code = (FT_UInt)( char_code + 1 );


for (;;)
Expand Down
8 changes: 4 additions & 4 deletions src/java.desktop/share/native/libfreetype/src/cff/cffgload.c
Expand Up @@ -75,7 +75,7 @@
#endif /* FT_CONFIG_OPTION_INCREMENTAL */

{
CFF_Font cff = (CFF_Font)(face->extra.data);
CFF_Font cff = (CFF_Font)( face->extra.data );


return cff_index_access_element( &cff->charstrings_index, glyph_index,
Expand Down Expand Up @@ -111,7 +111,7 @@
#endif /* FT_CONFIG_OPTION_INCREMENTAL */

{
CFF_Font cff = (CFF_Font)(face->extra.data);
CFF_Font cff = (CFF_Font)( face->extra.data );


cff_index_forget_element( &cff->charstrings_index, pointer );
Expand Down Expand Up @@ -370,8 +370,8 @@
SFNT_Service sfnt;


if ( size->root.metrics.x_ppem < 1 ||
size->root.metrics.y_ppem < 1 )
if ( size && (size->root.metrics.x_ppem < 1 ||
size->root.metrics.y_ppem < 1 ) )
{
error = FT_THROW( Invalid_Size_Handle );
return error;
Expand Down
Expand Up @@ -248,7 +248,7 @@
else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
CFF_Font cff = (CFF_Font)(face->extra.data);
CFF_Font cff = (CFF_Font)( face->extra.data );


bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar );
Expand Down
8 changes: 4 additions & 4 deletions src/java.desktop/share/native/libfreetype/src/psaux/psconv.c
Expand Up @@ -535,11 +535,11 @@

if ( r & 1 )
{
*buffer = (FT_Byte)(*buffer + c);
*buffer = (FT_Byte)( *buffer + c );
buffer++;
}
else
*buffer = (FT_Byte)(c << 4);
*buffer = (FT_Byte)( c << 4 );

r++;
}
Expand Down Expand Up @@ -572,8 +572,8 @@
if ( p >= limit )
return 0;

if ( n > (FT_UInt)(limit - p) )
n = (FT_UInt)(limit - p);
if ( n > (FT_UInt)( limit - p ) )
n = (FT_UInt)( limit - p );

for ( r = 0; r < n; r++ )
{
Expand Down
Expand Up @@ -518,7 +518,7 @@

if ( *cur == '<' ) /* <...> */
{
if ( cur + 1 < limit && *(cur + 1) == '<' ) /* << */
if ( cur + 1 < limit && *( cur + 1 ) == '<' ) /* << */
{
cur++;
cur++;
Expand Down
Expand Up @@ -2269,7 +2269,7 @@
/* This is due to the fact that, in the vast majority of cases, */
/* the span length in bytes is relatively small. */
while ( --c2 > 0 )
*(++target) = 0xFF;
*( ++target ) = 0xFF;

target[1] |= f2;
}
Expand Down
4 changes: 2 additions & 2 deletions src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c
Expand Up @@ -367,7 +367,7 @@
}

/* transform transparency to alpha */
if ( png_get_valid(png, info, PNG_INFO_tRNS ) )
if ( png_get_valid( png, info, PNG_INFO_tRNS ) )
png_set_tRNS_to_alpha( png );

if ( bitdepth == 16 )
Expand All @@ -387,7 +387,7 @@
png_set_filler( png, 0xFF, PNG_FILLER_AFTER );

/* recheck header after setting EXPAND options */
png_read_update_info(png, info );
png_read_update_info( png, info );
png_get_IHDR( png, info,
&imgWidth, &imgHeight,
&bitdepth, &color_type, &interlace,
Expand Down
3 changes: 2 additions & 1 deletion src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c
Expand Up @@ -1066,7 +1066,8 @@
*/
if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_CBLC ||
face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX ||
face->colr )
face->colr ||
face->svg )
flags |= FT_FACE_FLAG_COLOR; /* color glyphs */

if ( has_outline == TRUE )
Expand Down
6 changes: 3 additions & 3 deletions src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c
Expand Up @@ -973,7 +973,7 @@
/* composite glyph */
FT_Bool have_instructions = FALSE;
FT_UShort instruction_size = 0;
FT_ULong composite_size;
FT_ULong composite_size = 0;
FT_ULong size_needed;
FT_Byte* pointer = NULL;

Expand Down Expand Up @@ -2104,7 +2104,7 @@
error = FT_THROW( Invalid_Table );
goto Exit;
}
file_offset = ROUND4(woff2.metaOffset + woff2.metaLength);
file_offset = ROUND4( woff2.metaOffset + woff2.metaLength );
}

if ( woff2.privOffset )
Expand All @@ -2114,7 +2114,7 @@
error = FT_THROW( Invalid_Table );
goto Exit;
}
file_offset = ROUND4(woff2.privOffset + woff2.privLength);
file_offset = ROUND4( woff2.privOffset + woff2.privLength );
}

if ( file_offset != ( ROUND4( woff2.length ) ) )
Expand Down
Expand Up @@ -465,7 +465,7 @@
if ( subheader )
{
FT_Byte* p = subheader;
FT_UInt idx = (FT_UInt)(char_code & 0xFF);
FT_UInt idx = (FT_UInt)( char_code & 0xFF );
FT_UInt start, count;
FT_Int delta;
FT_UInt offset;
Expand Down
10 changes: 5 additions & 5 deletions src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c
Expand Up @@ -1104,8 +1104,8 @@

for ( ; vec < limit; vec++, u++ )
{
vec->x = ( FT_MulFix( u->x, x_scale ) + 32 ) >> 6;
vec->y = ( FT_MulFix( u->y, y_scale ) + 32 ) >> 6;
vec->x = ADD_LONG( FT_MulFix( u->x, x_scale ), 32 ) >> 6;
vec->y = ADD_LONG( FT_MulFix( u->y, y_scale ), 32 ) >> 6;
}
}
else
Expand Down Expand Up @@ -1228,8 +1228,8 @@
p1 = gloader->base.outline.points + k;
p2 = gloader->base.outline.points + l;

x = p1->x - p2->x;
y = p1->y - p2->y;
x = SUB_LONG( p1->x, p2->x );
y = SUB_LONG( p1->y, p2->y );
}
else
{
Expand Down Expand Up @@ -2255,7 +2255,7 @@
if ( loader->widthp )
glyph->metrics.horiAdvance = loader->widthp[glyph_index] * 64;
else
glyph->metrics.horiAdvance = SUB_LONG(loader->pp2.x, loader->pp1.x);
glyph->metrics.horiAdvance = SUB_LONG( loader->pp2.x, loader->pp1.x );

/* set glyph dimensions */
glyph->metrics.width = SUB_LONG( bbox.xMax, bbox.xMin );
Expand Down
Expand Up @@ -516,14 +516,6 @@
exec->GS.round_state = 1;
exec->GS.loop = 1;

#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
exec->iup_called = FALSE;
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
exec->iupx_called = FALSE;
exec->iupy_called = FALSE;
#endif

/* some glyphs leave something on the stack. so we clean it */
/* before a new execution. */
exec->top = 0;
Expand Down Expand Up @@ -7847,6 +7839,15 @@
Compute_Funcs( exc );
Compute_Round( exc, (FT_Byte)exc->GS.round_state );

/* These flags cancel execution of some opcodes after IUP is called */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
exc->iup_called = FALSE;
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
exc->iupx_called = FALSE;
exc->iupy_called = FALSE;
#endif

do
{
exc->opcode = exc->code[exc->IP];
Expand Down
Expand Up @@ -203,7 +203,7 @@
kp->index1 = FT_Get_Char_Index( t1_face, p[0] );
kp->index2 = FT_Get_Char_Index( t1_face, p[1] );

kp->x = (FT_Int)FT_PEEK_SHORT_LE(p + 2);
kp->x = (FT_Int)FT_PEEK_SHORT_LE( p + 2 );
kp->y = 0;

kp++;
Expand Down
12 changes: 6 additions & 6 deletions src/java.desktop/share/native/libfreetype/src/type1/t1load.c
Expand Up @@ -2057,9 +2057,9 @@
name_table->elements[n][len] = '\0';

/* record index of /.notdef */
if ( *cur == '.' &&
if ( *cur == '.' &&
ft_strcmp( ".notdef",
(const char*)(name_table->elements[n]) ) == 0 )
(const char*)( name_table->elements[n] ) ) == 0 )
{
notdef_index = n;
notdef_found = 1;
Expand Down Expand Up @@ -2331,8 +2331,8 @@
/* in valid Type 1 fonts we don't see `RD' or `-|' directly */
/* since those tokens are handled by parse_subrs and */
/* parse_charstrings */
else if ( *cur == 'R' && cur + 6 < limit && *(cur + 1) == 'D' &&
have_integer )
else if ( *cur == 'R' && cur + 6 < limit && *( cur + 1 ) == 'D' &&
have_integer )
{
FT_ULong s;
FT_Byte* b;
Expand All @@ -2344,8 +2344,8 @@
have_integer = 0;
}

else if ( *cur == '-' && cur + 6 < limit && *(cur + 1) == '|' &&
have_integer )
else if ( *cur == '-' && cur + 6 < limit && *( cur + 1 ) == '|' &&
have_integer )
{
FT_ULong s;
FT_Byte* b;
Expand Down

1 comment on commit 5f79e3b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.