Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(840)

Unified Diff: third_party/freetype/src/truetype/ttobjs.c

Issue 1413673003: Update bundled freetype to 2.6.1 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: DEPS for corpus Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/freetype/src/truetype/ttobjs.h ('k') | third_party/freetype/src/truetype/ttpic.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/freetype/src/truetype/ttobjs.c
diff --git a/third_party/freetype/src/truetype/ttobjs.c b/third_party/freetype/src/truetype/ttobjs.c
index a73529d8487ef3423b226e5fbde38484910192ee..6060d6f5d1e49f97ed2e256220257119c2e0611d 100644
--- a/third_party/freetype/src/truetype/ttobjs.c
+++ b/third_party/freetype/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
/* */
/* Objects manager (body). */
/* */
-/* Copyright 1996-2013 */
+/* Copyright 1996-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -191,7 +191,7 @@
{
FT_Error error;
FT_UInt32 checksum = 0;
- int i;
+ FT_UInt i;
if ( FT_FRAME_ENTER( length ) )
@@ -200,8 +200,8 @@
for ( ; length > 3; length -= 4 )
checksum += (FT_UInt32)FT_GET_ULONG();
- for ( i = 3; length > 0; length --, i-- )
- checksum += (FT_UInt32)( FT_GET_BYTE() << ( i * 8 ) );
+ for ( i = 3; length > 0; length--, i-- )
+ checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 );
FT_FRAME_EXIT();
@@ -256,89 +256,89 @@
#define TRICK_SFNT_ID_prep 2
{ /* MingLiU 1995 */
- { 0x05bcf058, 0x000002e4 }, /* cvt */
- { 0x28233bf1, 0x000087c4 }, /* fpgm */
- { 0xa344a1ea, 0x000001e1 } /* prep */
+ { 0x05BCF058UL, 0x000002E4UL }, /* cvt */
+ { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
+ { 0xA344A1EAUL, 0x000001E1UL } /* prep */
},
{ /* MingLiU 1996- */
- { 0x05bcf058, 0x000002e4 }, /* cvt */
- { 0x28233bf1, 0x000087c4 }, /* fpgm */
- { 0xa344a1eb, 0x000001e1 } /* prep */
+ { 0x05BCF058UL, 0x000002E4UL }, /* cvt */
+ { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
+ { 0xA344A1EBUL, 0x000001E1UL } /* prep */
},
{ /* DFKaiShu */
- { 0x11e5ead4, 0x00000350 }, /* cvt */
- { 0x5a30ca3b, 0x00009063 }, /* fpgm */
- { 0x13a42602, 0x0000007e } /* prep */
+ { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
+ { 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */
+ { 0x13A42602UL, 0x0000007EUL } /* prep */
},
{ /* HuaTianKaiTi */
- { 0xfffbfffc, 0x00000008 }, /* cvt */
- { 0x9c9e48b8, 0x0000bea2 }, /* fpgm */
- { 0x70020112, 0x00000008 } /* prep */
+ { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
+ { 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */
+ { 0x70020112UL, 0x00000008UL } /* prep */
},
{ /* HuaTianSongTi */
- { 0xfffbfffc, 0x00000008 }, /* cvt */
- { 0x0a5a0483, 0x00017c39 }, /* fpgm */
- { 0x70020112, 0x00000008 } /* prep */
+ { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
+ { 0x0A5A0483UL, 0x00017C39UL }, /* fpgm */
+ { 0x70020112UL, 0x00000008UL } /* prep */
},
{ /* NEC fadpop7.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x40c92555, 0x000000e5 }, /* fpgm */
- { 0xa39b58e3, 0x0000117c } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x40C92555UL, 0x000000E5UL }, /* fpgm */
+ { 0xA39B58E3UL, 0x0000117CUL } /* prep */
},
{ /* NEC fadrei5.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x33c41652, 0x000000e5 }, /* fpgm */
- { 0x26d6c52a, 0x00000f6a } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x33C41652UL, 0x000000E5UL }, /* fpgm */
+ { 0x26D6C52AUL, 0x00000F6AUL } /* prep */
},
{ /* NEC fangot7.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x6db1651d, 0x0000019d }, /* fpgm */
- { 0x6c6e4b03, 0x00002492 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x6DB1651DUL, 0x0000019DUL }, /* fpgm */
+ { 0x6C6E4B03UL, 0x00002492UL } /* prep */
},
{ /* NEC fangyo5.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x40c92555, 0x000000e5 }, /* fpgm */
- { 0xde51fad0, 0x0000117c } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x40C92555UL, 0x000000E5UL }, /* fpgm */
+ { 0xDE51FAD0UL, 0x0000117CUL } /* prep */
},
{ /* NEC fankyo5.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x85e47664, 0x000000e5 }, /* fpgm */
- { 0xa6c62831, 0x00001caa } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x85E47664UL, 0x000000E5UL }, /* fpgm */
+ { 0xA6C62831UL, 0x00001CAAUL } /* prep */
},
{ /* NEC fanrgo5.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x2d891cfd, 0x0000019d }, /* fpgm */
- { 0xa0604633, 0x00001de8 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x2D891CFDUL, 0x0000019DUL }, /* fpgm */
+ { 0xA0604633UL, 0x00001DE8UL } /* prep */
},
{ /* NEC fangot5.ttc */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x40aa774c, 0x000001cb }, /* fpgm */
- { 0x9b5caa96, 0x00001f9a } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x40AA774CUL, 0x000001CBUL }, /* fpgm */
+ { 0x9B5CAA96UL, 0x00001F9AUL } /* prep */
},
{ /* NEC fanmin3.ttc */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x0d3de9cb, 0x00000141 }, /* fpgm */
- { 0xd4127766, 0x00002280 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x0D3DE9CBUL, 0x00000141UL }, /* fpgm */
+ { 0xD4127766UL, 0x00002280UL } /* prep */
},
{ /* NEC FA-Gothic, 1996 */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x4a692698, 0x000001f0 }, /* fpgm */
- { 0x340d4346, 0x00001fca } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x4A692698UL, 0x000001F0UL }, /* fpgm */
+ { 0x340D4346UL, 0x00001FCAUL } /* prep */
},
{ /* NEC FA-Minchou, 1996 */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0xcd34c604, 0x00000166 }, /* fpgm */
- { 0x6cf31046, 0x000022b0 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0xCD34C604UL, 0x00000166UL }, /* fpgm */
+ { 0x6CF31046UL, 0x000022B0UL } /* prep */
},
{ /* NEC FA-RoundGothicB, 1996 */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x5da75315, 0x0000019d }, /* fpgm */
- { 0x40745a5f, 0x000022e0 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x5DA75315UL, 0x0000019DUL }, /* fpgm */
+ { 0x40745A5FUL, 0x000022E0UL } /* prep */
},
{ /* NEC FA-RoundGothicM, 1996 */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0xf055fc48, 0x000001c2 }, /* fpgm */
- { 0x3900ded3, 0x00001e18 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0xF055FC48UL, 0x000001C2UL }, /* fpgm */
+ { 0x3900DED3UL, 0x00001E18UL } /* prep */
}
};
@@ -490,7 +490,10 @@
/* <Input> */
/* stream :: The source font stream. */
/* */
- /* face_index :: The index of the font face in the resource. */
+ /* face_index :: The index of the TrueType font, if we are opening a */
+ /* collection, in bits 0-15. The numbered instance */
+ /* index~+~1 of a GX (sub)font, if applicable, in bits */
+ /* 16-30. */
/* */
/* num_params :: Number of additional generic parameters. Ignored. */
/* */
@@ -599,7 +602,7 @@
ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
}
-#else
+#else /* !FT_CONFIG_OPTION_INCREMENTAL */
if ( !error )
error = tt_face_load_loca( face, stream );
@@ -623,10 +626,56 @@
ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
}
-#endif
+#endif /* !FT_CONFIG_OPTION_INCREMENTAL */
+
+ }
+
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+
+ {
+ FT_Int instance_index = face_index >> 16;
+
+
+ if ( FT_HAS_MULTIPLE_MASTERS( ttface ) &&
+ instance_index > 0 )
+ {
+ error = TT_Get_MM_Var( face, NULL );
+ if ( error )
+ goto Exit;
+ if ( face->blend->mmvar->namedstyle )
+ {
+ FT_Memory memory = ttface->memory;
+
+ FT_Var_Named_Style* named_style;
+ FT_String* style_name;
+
+
+ /* in `face_index', the instance index starts with value 1 */
+ named_style = face->blend->mmvar->namedstyle + instance_index - 1;
+ error = sfnt->get_name( face,
+ (FT_UShort)named_style->strid,
+ &style_name );
+ if ( error )
+ goto Exit;
+
+ /* set style name; if already set, replace it */
+ if ( face->root.style_name )
+ FT_FREE( face->root.style_name );
+ face->root.style_name = style_name;
+
+ /* finally, select the named instance */
+ error = TT_Set_Var_Design( face,
+ face->blend->mmvar->num_axis,
+ named_style->coords );
+ if ( error )
+ goto Exit;
+ }
+ }
}
+#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
+
#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
!defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
@@ -751,14 +800,7 @@
FT_Error error;
- /* debugging instances have their own context */
- if ( size->debug )
- exec = size->context;
- else
- exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
-
- if ( !exec )
- return FT_THROW( Could_Not_Find_Context );
+ exec = size->context;
error = TT_Load_Context( exec, face, size );
if ( error )
@@ -795,7 +837,7 @@
TT_Set_CodeRange( exec,
tt_coderange_font,
face->font_program,
- face->font_program_size );
+ (FT_Long)face->font_program_size );
/* disable CVT and glyph programs coderange */
TT_Clear_CodeRange( exec, tt_coderange_cvt );
@@ -845,14 +887,7 @@
FT_Error error;
- /* debugging instances have their own context */
- if ( size->debug )
- exec = size->context;
- else
- exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
-
- if ( !exec )
- return FT_THROW( Could_Not_Find_Context );
+ exec = size->context;
error = TT_Load_Context( exec, face, size );
if ( error )
@@ -868,7 +903,7 @@
TT_Set_CodeRange( exec,
tt_coderange_cvt,
face->cvt_program,
- face->cvt_program_size );
+ (FT_Long)face->cvt_program_size );
TT_Clear_CodeRange( exec, tt_coderange_glyph );
@@ -876,12 +911,9 @@
{
TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
- if ( !size->debug )
- {
- FT_TRACE4(( "Executing `prep' table.\n" ));
+ FT_TRACE4(( "Executing `prep' table.\n" ));
- error = face->interpreter( exec );
- }
+ error = face->interpreter( exec );
}
else
error = FT_Err_Ok;
@@ -924,12 +956,10 @@
TT_Face face = (TT_Face)ftsize->face;
FT_Memory memory = face->root.memory;
-
- if ( size->debug )
+ if ( size->context )
{
- /* the debug context must be deleted by the debugger itself */
+ TT_Done_Context( size->context );
size->context = NULL;
- size->debug = FALSE;
}
FT_FREE( size->cvt );
@@ -973,9 +1003,21 @@
TT_MaxProfile* maxp = &face->max_profile;
+ /* clean up bytecode related data */
+ FT_FREE( size->function_defs );
+ FT_FREE( size->instruction_defs );
+ FT_FREE( size->cvt );
+ FT_FREE( size->storage );
+
+ if ( size->context )
+ TT_Done_Context( size->context );
+ tt_glyphzone_done( &size->twilight );
+
size->bytecode_ready = -1;
size->cvt_ready = -1;
+ size->context = TT_New_Context( (TT_Driver)face->root.driver );
+
size->max_function_defs = maxp->maxFunctionDefs;
size->max_instruction_defs = maxp->maxInstructionDefs;
@@ -1116,6 +1158,7 @@
TT_Size size = (TT_Size)ttsize;
FT_Error error = FT_Err_Ok;
+
#ifdef TT_USE_BYTECODE_INTERPRETER
size->bytecode_ready = -1;
size->cvt_ready = -1;
@@ -1146,8 +1189,7 @@
#ifdef TT_USE_BYTECODE_INTERPRETER
- if ( size->bytecode_ready >= 0 )
- tt_size_done_bytecode( ttsize );
+ tt_size_done_bytecode( ttsize );
#endif
size->ttmetrics.valid = FALSE;
@@ -1259,10 +1301,6 @@
TT_Driver driver = (TT_Driver)ttdriver;
-
- if ( !TT_New_Context( driver ) )
- return FT_THROW( Could_Not_Find_Context );
-
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
driver->interpreter_version = TT_INTERPRETER_VERSION_38;
#else
@@ -1293,20 +1331,7 @@
FT_LOCAL_DEF( void )
tt_driver_done( FT_Module ttdriver ) /* TT_Driver */
{
-#ifdef TT_USE_BYTECODE_INTERPRETER
- TT_Driver driver = (TT_Driver)ttdriver;
-
-
- /* destroy the execution context */
- if ( driver->context )
- {
- TT_Done_Context( driver->context );
- driver->context = NULL;
- }
-#else
FT_UNUSED( ttdriver );
-#endif
-
}
« no previous file with comments | « third_party/freetype/src/truetype/ttobjs.h ('k') | third_party/freetype/src/truetype/ttpic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698