Don't cast cmap init function pointers to an incompatible type.
Without this patch, the number of parameters between declaration and
the real signature differs. Calling such a function results in
undefined behavior.
ISO/IEC 9899:TC3 (Committee Draft September 7, 2007)
6.5.2.2 Function calls
9 If the function is defined with a type that is not
compatible with the type (of the expression) pointed to by
the expression that denotes the called function, the
behavior is undefined.
On certain platforms (c -> js with emscripten) this causes
termination of execution or invalid calls because in the emscripten
implementation, function pointers of different types are stored in
different pointer arrays. Incorrect pointer type here results in
indexing of an incorrect array.
* src/cff/cffcmap.c (cff_cmap_encoding_init, cff_cmap_unicode_init),
src/pfr/pfrcmap.c (pfr_cmap_init), src/psaux/t1cmap.c
t1_cmap_standard_init, t1_cmap_expert_init, t1_cmap_custom_init,
t1_cmap_unicode_init), src/winfonts/winfnt.c (fnt_cmap_init): Fix
signature.
This is a follow-up to Savannah bug #43659.
* src/type42/t42objs.c (T42_Face_Init): Exclusively use the
`truetype' font driver for loading the font contained in the `sfnts'
array.
* src/type42/t42objs.c (T42_Open_Face): Initialize `face->ttf_size'.
* src/type42/t42parse.c (t42_parse_sfnts): Always set
`face->ttf_size' directly. This ensures a correct stream size in
the call to `FT_Open_Face', which follows after parsing, even for
buggy input data.
Fix error messages.
* src/sfnt/ttcmap.c (tt_cmap8_validate, tt_cmap10_validate,
tt_cmap12_validate, tt_cmap13_validate, tt_cmap14_validate): Protect
against overflow in additions and multiplications.
The scaling between the hypotenuse and its CORDIC approximation is
based on regression analysis. The smaller padding for `theta' is
justifed by its maximum error of less than 6.
* src/base/fttrigon.c (ft_trig_downscale): Borrow code from
./ftcalc.c (ft_multo64), change linear intercept.
(ft_trig_pseudo_polarize): Decrease `theta' padding.
Before this patch, it was impossible to ever call DELTAP[123] in
subpixel hinting mode as described in the ClearType whitepaper; it
only worked if in `compatibility mode'. However, compatibility mode
essentially disables SHPIX, completely ruining hinting of
ttfautohint output, for example.
We now follow the whitepaper more closely so that DELTAP[123]
instructions for touched points in the non-subpixel direction are
executed.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Translate origin
virtually by modifying cbox, actually translate outline if cumulative
shift is not zero.
* include/internal/ftcalc.h (FT_HYPOT): Move macro from here...
* include/internal/ftobjs.h: ... to here, next to required `FT_ABS'.
* src/smooth/ftgrays.c (gray_render_cubic): Use it here.
We no longer need an otherwise unused typedef that can cause a gcc
warning.
Problem reported by Alexei.
* src/cff/cffobjs.c (cff_driver_init): Use
`CFF_CONFIG_OPTION_DARKENING_PARAMETER_XXX' macros directly.
(SET_DARKENING_PARAMETERS): Removed.
Compile time tests are now ...
* devel/ftoption.h, include/config/ftoption.h: ... here.
* include/internal/ftcalc.h (FT_HYPOT): Macro to approximate Euclidean
distance with the alpha max plus beta min algorithm.
* src/base/ftcalc.c (ft_corner_is_flat): Use it instead of Taxicab metric.
We have been hit by
https://connect.microsoft.com/VisualStudio/feedback/details/718976/msvc-pr
* devel/ftoption.h, include/config/ftoption.h: Replace
`CFF_CONFIG_OPTION_DARKENING_PARAMETERS' with eight macros
`CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}'.
* src/cff/cffobjs.c (SET_DARKENING_PARAMETERS): Removed. We no
longer need double expansion.
(SET_DARKENING_PARAMETERS_0): Renamed to ...
(SET_DARKENING_PARAMETERS): ... this.
Update call.
* src/sfnt/ttsbit.c (tt_face_load_sbit) [TT_SBIT_TABLE_TYPE_SBIX]:
Accept overlay format also, but emit warning message in that case.
(tt_sbit_decoder_load_metrics): Add missing newline to error
message.
(tt_sbit_load_sbix_image): Add `rgbl' graphic type (as used on iOS
7.1) to the list of unsupported formats.
Zero distance does not have to be treated specially if you follow
specifications and check the sign as the very last step of rounding.
* src/truetype/ttinterp.c (Round_None, Round_To_Grid,
Round_Down_To_Grid, Round_Up_To_Grid, Round_To_Double_Grid): Use
macros when available, do not check for non-zero distance.
(Round_To_Half_Grid, Round_Super, Round_Super_45): Ditto, return phase
if sign changed.
This essentially moves the Telugu script from the `Indic' hinter to
the `Latin' hinter.
Note that this is a first shot and quite certainly needs
refinements.
* src/autofit/afblue.dat: Add blue zone data for Telugu.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Telugu standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Telugu data out of
AF_CONFIG_OPTION_INDIC block.
* src/autofit/afstyles.h: Update Telugu data; in particular, use
AF_WRITING_SYSTEM_LATIN.
* devel/ftoption.h, include/config/ftoption.h
(CFF_CONFIG_OPTION_DARKENING_PARAMETERS): New macro.
* src/cff/cffobjs.c (SET_DARKENING_PARAMETERS,
SET_DARKENING_PARAMETERS_0): New macros.
(cff_driver_init): Use new macros.
Suggested by Doug Felt <dougfelt@gmail.com>.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics): Set
`vertAdvance' to zero...
* src/truetype/ttgload.c (TT_Load_Glyph): ... and set here a default
value for `vertAdvance' based on `linearVertAdvance' in case
`vertAdvance' is zero. Note that the previous computed ad-hoc value
for `linearVertAdvance' was apparently not tested in a real-life
situation.