Skip to content

Commit

Permalink
Update FreeType from Chromium 114.0.5735.358
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlstrom-g committed May 8, 2024
3 parents 80a62f0 + b5d96de + 44af3e4 commit a4ccb4d
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 47 deletions.
6 changes: 6 additions & 0 deletions third_party/freetype/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ source_set("freetype_source") {

defines += [ "FT2_BUILD_LIBRARY" ]

if (use_system_harfbuzz) {
configs += [ "//third_party/harfbuzz-ng:harfbuzz_from_pkgconfig" ]
} else {
configs += [ "//third_party/harfbuzz-ng:harfbuzz_config" ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ "//build/config/sanitizers:cfi_icall_generalize_pointers" ]
configs += [ ":freetype-warnings" ]
Expand Down
4 changes: 2 additions & 2 deletions third_party/freetype/METADATA
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
third_party {
identifier {
type: "ChromiumVersion"
value: "112.0.5615.134" # from https://chromereleases.googleblog.com/2023/04/stable-channel-update-for-chromeos_19.html
value: "114.0.5735.358" # from https://chromereleases.googleblog.com/2024/03/long-term-support-channel-update-for_26.html
}
identifier {
type: "Git"
value: "https://chromium.googlesource.com/chromium/src.git"
version: "53b87ba394bbdcf2f9d63e985ca5385a5b420ca9"
version: "1759c6ae9316996b9f150c0ce9d0ca78a3d15c02"
}
identifier {
type: "UpstreamSubdir"
Expand Down
6 changes: 3 additions & 3 deletions third_party/freetype/README.chromium
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Name: FreeType
URL: http://www.freetype.org/
Version: VER-2-13-0-69
Revision: e78e2d29a95baf6053e30cc9422aa20319259803
CPEPrefix: cpe:/a:freetype:freetype:2.13.0
Version: VER-2-13-0-76-g0a3836c97
Revision: 0a3836c97d5e84d6721ac0fd2839e8ae1b7be8d9
CPEPrefix: cpe:/a:freetype:freetype:2.12.1
License: Custom license "inspired by the BSD, Artistic, and IJG (Independent
JPEG Group) licenses"
License File: src/docs/FTL.TXT
Expand Down
6 changes: 3 additions & 3 deletions third_party/freetype/src/METADATA
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ description:
third_party {
identifier {
type: "ChromiumVersion"
value: "112.0.5615.134" # from https://chromereleases.googleblog.com/2023/04/stable-channel-update-for-chromeos_19.html
value: "114.0.5735.358" # from https://chromereleases.googleblog.com/2024/03/long-term-support-channel-update-for_26.html
}
identifier {
type: "Git"
value: "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git"
version: "e78e2d29a95baf6053e30cc9422aa20319259803"
# from https://chromium.googlesource.com/chromium/src/+/112.0.5615.134/DEPS#353
version: "0a3836c97d5e84d6721ac0fd2839e8ae1b7be8d9"
# from https://chromium.googlesource.com/chromium/src/+/114.0.5735.358/DEPS#347
}
last_upgrade_date {
year: 2023
Expand Down
12 changes: 5 additions & 7 deletions third_party/freetype/src/include/freetype/freetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ FT_BEGIN_HEADER
* Note that the bounding box might be off by (at least) one pixel for
* hinted fonts. See @FT_Size_Metrics for further discussion.
*
* Note that the bounding box does not vary in OpenType variable fonts
* Note that the bounding box does not vary in OpenType variation fonts
* and should only be used in relation to the default instance.
*
* units_per_EM ::
Expand Down Expand Up @@ -1090,9 +1090,9 @@ FT_BEGIN_HEADER

FT_Generic generic;

/*# The following member variables (down to `underline_thickness`) */
/*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
/*# for bitmap fonts. */
/* The following member variables (down to `underline_thickness`) */
/* are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
/* for bitmap fonts. */
FT_BBox bbox;

FT_UShort units_per_EM;
Expand All @@ -1110,7 +1110,7 @@ FT_BEGIN_HEADER
FT_Size size;
FT_CharMap charmap;

/*@private begin */
/* private fields, internal to FreeType */

FT_Driver driver;
FT_Memory memory;
Expand All @@ -1123,8 +1123,6 @@ FT_BEGIN_HEADER

FT_Face_Internal internal;

/*@private end */

} FT_FaceRec;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ FT_BEGIN_HEADER
typedef void
(*FT_Metrics_Adjust_Func)( FT_Face face );

typedef void
typedef FT_Error
(*FT_Size_Reset_Func)( FT_Size size );


Expand Down
45 changes: 40 additions & 5 deletions third_party/freetype/src/src/cid/cidgload.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,44 @@
off2 = cid_get_offset( &p, cid->gd_bytes );
FT_FRAME_EXIT();

if ( fd_select >= cid->num_dicts ||
off2 > stream->size ||
off1 > off2 )

if ( fd_select >= cid->num_dicts )
{
FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" ));
/*
* fd_select == 0xFF is often used to indicate that the CID
* has no charstring to be rendered, similar to GID = 0xFFFF
* in TrueType fonts.
*/
if ( (cid->fd_bytes == 1 && fd_select == 0xFFU ) ||
(cid->fd_bytes == 2 && fd_select == 0xFFFFU ) )
{
FT_TRACE1(( "cid_load_glyph: fail for glyph_index=%d, "
"FD number %d is the max integer fitting into %d byte%s\n",
glyph_index, fd_select, cid->fd_bytes,
cid->fd_bytes == 1 ? "" : "s" ));
}
else
{
FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, "
"FD number %d > number of dicts %d\n",
glyph_index, fd_select, cid->num_dicts ));
}
error = FT_THROW( Invalid_Offset );
goto Exit;
}
else if ( off2 > stream->size )
{
FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, "
"end of the glyph data is beyond the data stream\n",
glyph_index ));
error = FT_THROW( Invalid_Offset );
goto Exit;
}
else if ( off1 > off2 )
{
FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, "
"the end position of glyph data is set before the start position\n",
glyph_index ));
error = FT_THROW( Invalid_Offset );
goto Exit;
}
Expand Down Expand Up @@ -161,7 +194,9 @@
cs_offset = decoder->lenIV >= 0 ? (FT_UInt)decoder->lenIV : 0;
if ( cs_offset > glyph_length )
{
FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" ));
FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, "
"offset to the charstring is beyond glyph length\n",
glyph_index ));
error = FT_THROW( Invalid_Offset );
goto Exit;
}
Expand Down
24 changes: 13 additions & 11 deletions third_party/freetype/src/src/sfnt/sfdriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,14 @@
FT_TRACE0(( "get_win_string:"
" Character 0x%X invalid in PS name string\n",
((unsigned)p[0])*256 + (unsigned)p[1] ));
break;
continue;
}
}
if ( !len )
*r = '\0';
*r = '\0';

FT_FRAME_EXIT();

if ( !len )
if ( r != result )
return result;

get_win_string_error:
Expand Down Expand Up @@ -580,15 +579,14 @@
FT_TRACE0(( "get_apple_string:"
" Character `%c' (0x%X) invalid in PS name string\n",
*p, *p ));
break;
continue;
}
}
if ( !len )
*r = '\0';
*r = '\0';

FT_FRAME_EXIT();

if ( !len )
if ( r != result )
return result;

get_apple_string_error:
Expand Down Expand Up @@ -819,9 +817,9 @@

if ( !found )
{
/* as a last resort we try the family name; note that this is */
/* not in the Adobe TechNote, but GX fonts (which predate the */
/* TechNote) benefit from this behaviour */
/* according to the 'name' documentation in the OpenType */
/* specification the font family name is to be used if the */
/* typographic family name is missing, so let's do that */
found = sfnt_get_name_id( face,
TT_NAME_ID_FONT_FAMILY,
&win,
Expand Down Expand Up @@ -853,6 +851,10 @@
{
FT_TRACE0(( "sfnt_get_var_ps_name:"
" No valid PS name prefix for font instances found\n" ));
/* XXX It probably makes sense to never let this fail */
/* since an arbitrary prefix should work, too. */
/* On the other hand, it is very unlikely that */
/* we ever reach this code at all. */
return NULL;
}

Expand Down
1 change: 1 addition & 0 deletions third_party/freetype/src/src/truetype/ttgxvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/sfnt.h>
#include <freetype/internal/services/svmetric.h>
#include <freetype/tttags.h>
#include <freetype/ttnameid.h>
#include <freetype/ftmm.h>
Expand Down
10 changes: 0 additions & 10 deletions third_party/freetype/src/src/truetype/ttinterp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7321,14 +7321,6 @@
* GETINFO[]: GET INFOrmation
* Opcode range: 0x88
* Stack: uint32 --> uint32
*
* XXX: UNDOCUMENTED: Selector bits higher than 9 are currently (May
* 2015) not documented in the OpenType specification.
*
* Selector bit 11 is incorrectly described as bit 8, while the
* real meaning of bit 8 (vertical LCD subpixels) stays
* undocumented. The same mistake can be found in Greg Hitchcock's
* whitepaper.
*/
static void
Ins_GETINFO( TT_ExecContext exc,
Expand Down Expand Up @@ -7387,8 +7379,6 @@
* VARIATION GLYPH
* Selector Bit: 3
* Return Bit(s): 10
*
* XXX: UNDOCUMENTED!
*/
if ( (args[0] & 8 ) != 0 && exc->face->blend )
K |= 1 << 10;
Expand Down
12 changes: 8 additions & 4 deletions third_party/freetype/src/src/truetype/ttobjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1346,12 +1346,16 @@
* Used for variation fonts as an iterator function.
*
* @Input:
* size ::
* A handle to the target size object.
* ft_size ::
* A handle to the target TT_Size object. This function will be called
* through a `FT_Size_Reset_Func` pointer which takes `FT_Size`. This
* function must take `FT_Size` as a result. The passed `FT_Size` is
* expected to point to a `TT_Size`.
*/
FT_LOCAL_DEF( FT_Error )
tt_size_reset_height( TT_Size size )
tt_size_reset_height( FT_Size ft_size )
{
TT_Size size = (TT_Size)ft_size;
TT_Face face = (TT_Face)size->root.face;
FT_Size_Metrics* size_metrics = &size->hinted_metrics;

Expand Down Expand Up @@ -1408,7 +1412,7 @@
FT_Size_Metrics* size_metrics = &size->hinted_metrics;


error = tt_size_reset_height( size );
error = tt_size_reset_height( (FT_Size)size );
if ( error )
return error;

Expand Down
2 changes: 1 addition & 1 deletion third_party/freetype/src/src/truetype/ttobjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ FT_BEGIN_HEADER
#endif /* TT_USE_BYTECODE_INTERPRETER */

FT_LOCAL( FT_Error )
tt_size_reset_height( TT_Size size );
tt_size_reset_height( FT_Size size );

FT_LOCAL( FT_Error )
tt_size_reset( TT_Size size );
Expand Down

0 comments on commit a4ccb4d

Please sign in to comment.