For `Index' and `TOC' links, we now simply use the `text-align' CSS
property of `<td>' to enforce flush-left and flush-right,
eliminating the hack with an empty, full-width `<td>' element
inbetween.
The change also enforces the same (smaller) size for all index and
TOC links.
Replace some `<table>' tags with `<div>' to simplify structure.
Move `bgcolor' attribute to CSS.
Replace most `width' attributes with CSS. The remaining instances
(providing a similar effect as LaTeX's `\hfill' command) are removed
in a later patch.
suggested by Alexei.
* src/pfr/pfrsbit.c (pfr_slot_load_bitmap): Prevent too
negative values in `xpos' and `ypos + ysize'.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Prevent
too negative values in `x_left' and `y_top'. Either negative
values in `width' and `height' are checked.
Python 2.6 was released in 2008...
* builds/freetype.mk (refdoc): Use python's `-B' option.
* builds/detect.mk (std_setup, dos_setup): Mention required python
version for `refdoc' target.
`API functions' are functions tagged with `FT_EXPORT_DEF'.
Besides trivial fixes, the following changes are included, too.
* src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Set
error code if no service is available.
* src/base/ftinit.c (FT_Done_FreeType): Change return value for
invalid `library' parameter to `Invalid_Library_Handle'.
* src/base/ftobjs.c (FT_New_Size): Change return value for invalid
`asize' parameter to `Invalid_Argument'.
* src/base/ftoutln.c (FT_Outline_Copy): Change return value for
invalid `source' and `target' parameters to `Invalid_Outline'.
(FT_Outline_Done_Internal): Change return value for invalid
`outline' parameter to `Invalid_Outline'.
* src/raster/ftraster.c (ft_black_set_mode): Change return type to
`int' to stay in sync with `FT_Renderer_SetModeFunc' prototype.
* src/smooth/ftgrays.c (gray_raster_set_mode): New dummy function
for orthogonality.
(ft_grays_raster): Use it.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
We use a cast to indicate that we intentionally ignore a function's
return value. However, this doesn't apply to API functions where
errors can only happen for trivially invalid input.
* src/base/ftstroke.c (FT_Glyph_Stroke, FT_Glyph_StrokeBorder),
src/base/ftsynth.c (FT_GlyphSlot_Embolden), src/cff/cffgload.c
(cff_slot_load), src/pfr/pfrdrivr.c (pfr_get_kerning),
src/type1/t1load.c (parse_encoding), src/type42/t42parse.c
(t42_parse_encoding): Do it.
This adds an additional constraint to make the fix from 2013-01-25
really work.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_image) <index_format==4>:
Check `p' before `num_glyphs'.
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.
`FT_MulFix' takes `FT_Long' parameters as defined in `freetype.h',
but several inline implementations of it in `ftcalc.h' take
`FT_Int32' arguments. This is causing compiler warnings on x86-64:
If parameters of type `FT_Fixed' (= `FT_Long') are passed to the
inline implementation of this function, integer values are truncated
from 64bit to 32bit.
* include/internal/ftcalc.h (FT_MulFix) [FT_MULFIX_ASSEMBLER]: Add
casts.
* 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.
User-defined properties should be empty by default to prevent linker
failures.
* builds/windows/vc2010/freetype.user.props,
builds/windows/vc2010/freetype.vcxproj:
s/OptionsDirectory/UserOptionDirectory/.
Comment out all user options.
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 simplifies custom build configurations, especially for
automated build environments.
* builds/windows/vc2010/freetype.user.props: New configuration file.
* builds/windows/vc2010/freetype.vcxproj: Include
`freetype.user.props' and use its data fields.
* builds/windows/vc2010/index.html: Updated.
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.
* builds/cmake/iOS.cmake: New file. Universal binaries are built
with both 32 and 64 bit arm architectures.
* CMakeLists.txt (IOS_PLATFORM): New variable for running the iOS
toolchain. Possible values are `OS' to build on iOS, or
`SIMULATOR' to build on APPLE.
* 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.
The legal range for delta shift is zero through six. Negative values
are illegal according to
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM04/Chap4.html#delta%20shift
* src/truetype/ttobjs.h (delta_shift, delta_base): Make unsigned.
* src/truetype/ttinterp.h (DO_SDS): Throw an error if delta_shift
out of range.
(Ins_DELTAP, Ins_DELTAC): Optimize for legal delta_shift.
We shift as many bits as we can into the high register, perform
32-bit division with modulo there, then work through the remaining
bits with long division. This optimization is especially noticeable
for smaller dividends that barely use the high register.
* src/base/ftcalc.c (ft_div64by32): Updated.
This applies to `FT_MulDiv' but not to `FT_DivFix', where overflows or
lack thereof are predicted accurately.
* src/base/ftcalc.c (ft_div64by32): Improve readability.
(FT_MulDiv, FT_MulDiv_No_Round) [!FT_LONG64]: Use straight division
when multiplication stayed within 32 bits.
This fixes a 13-year old bug. The original overflow check should have
been updated when rounding was introduced into this function
(c2cd00443b).
* src/base/ftcalc.c (FT_DivFix) [!FT_LONG64]: Updated.
* include/freetype.h (FT_DivFix): Updated documentation.
* src/truetype/ttinterp.h (TT_ExecContextRec): New field
`cur_ppem_func' with a function pointer.
* src/truetype/ttinterp.c (TT_RunIns): Initialize `cur_ppem_func'
depending on the pixel geometry to either...
(Current_Ppem_Stretched): ... this for stretched pixels.
(Current_Ppem): ... or this for square pixels.
(DO_MPPEM, DO_MPS, Ins_DELTAP, Ins_DELTAC): Use `cur_ppem_func'.
* include/freetype.h (FT_MulFix): Unconditionally defined.
* src/base/ftcalc.c [FT_MULFIX_ASSEMBLER]: Move code from here...
* include/internal/ftcalc.h [FT_MULFIX_ASSEMBLER]: ... to here,
which conditionally replaces the function with an inline version
through the macro.
* src/pfr/pfrobjs.c (pfr_face_get_kerning): Use `FT_MSB' instead of
`ft_highpow2'.
* src/base/ftutil.c, include/internal/ftobjs.h (ft_highpow2): Remove
it.
FT_MulFix assembler used to reside in ftcalc.c before f47d263f1b.
* include/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h [FT_MULFIX_ASSEMBLER]: Move code from here...
* src/base/ftcalc.c [FT_MULFIX_ASSEMBLER]: ... to here.
In case of an error in the `prep' table, no longer try to execute it
again and again. This makes FreeType handle endless loops in buggy
fonts much faster.
* src/truetype/ttobjs.h (TT_SizeRec): The fields `bytecode_ready'
and `cvt_ready' are now negative if not initialized yet, otherwise
they indicate the error code of the last run.
* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep,
tt_size_done_bytecode, tt_size_init_bytecode,
tt_size_ready_bytecode, tt_size_init, tt_size_done, tt_size_reset):
Updated.
* src/truetype/ttgload.c (tt_loader_init): Updated.
* src/truetype/ttinterp.c (TT_RunIns): Force reexecution of `fpgm'
and `prep' only if we are in the `glyf' table.
Problem reported by Ralf S. Engelschall <rse@engelschall.com>.
* src/autofit/afhints.c (af_glyph_hints_reload): Fix threshold for
finding first non-near point.
Properly initialize non-near point deltas.
This essentially moves the Devanagari script from the `Indic' hinter
to the `Latin' hinter. Thanks to Girish Dalvi
<girish.dalvi@gmail.com> for guidance with blue zone characters!
* src/autofit/afblue.dat: Add blue zone data for Devanagari.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Devanagari standard characters and
move data out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Devanagari data out of
AF_CONFIG_OPTION_INDIC block.
Move U+20B9, (new) Rupee sign, from Latin to Devanagari.
* src/autofit/afstyles.h: Update Devanagari data; in particular, use
AF_WRITING_SYSTEM_LATIN.
* src/autofit/afhints.h (AF_Edge_Flags): New value
`AF_EDGE_NEUTRAL'.
* src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Trace
neutral blue zones with AF_EDGE_NEUTRAL.
(af_latin_hint_edges): Skip neutral blue zones if necessary.
Such blue zones match either the top or the bottom of a contour. We
need them for scripts where accent-like elements directly touch the
base character (for example, some vowel signs in Devanagari, cf.
U+0913 or U+0914).
* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_NEUTRAL): New
property.
* src/autofit/afblue.h: Regenerated.
* src/autofit/aflatin.h (AF_LATIN_IS_NEUTRAL_BLUE): New macro.
(AF_LATIN_BLUE_NEUTRAL): New enumeration value.
* src/autofit/aflatin.c (af_latin_metrics_init_blues,
af_latin_hints_compute_blue_edges): Handle neutral blue zones.
This spot has been missed while introducing support for various
drop-out modes years ago (including no drop-out mode, which this
commit fixes).
Problem reported by Patrick Thomas <pthomas505@gmail.com>.
The adaptation of the cjk auto-hinter module to blue stringsets in
2013-08-25 had three severe bugs. Mea culpa.
1. Contrary to the latin auto-hinter, characters for reference and
overshoot values of a blue zone are specified separately. Due to
the screwed-up change it didn't work at all.
2. A boolean comparison was erroneously replaced with a cast,
causing invalid results with the `^' operator later on. The
visual artifact caused by this problem is the topic of the bug
report.
3. Two flag values were inverted, causing incorrect assignment of
reference and overshoot values.
* src/autofit/afblue.dat: Fix CJK bluestrings, introducing a new
syntax to have both reference and overshoot characters in a single
string. This is error #1.
Add extensive comments.
* src/autofit/afblue.hin (AF_BLUE_PROPERTY_CJK_FILL): Removed, no
longer used.
(AF_BLUE_PROPERTY_CJK_TOP, AF_BLUE_PROPERTY_CJK_HORIZ): Fix values.
This is error #3.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Correct error #1.
Use character `|' to separate characters for reference and overshoot
values.
Improve tracing messages, synchronizing them with the latin
auto-hinter.
(af_cjk_hints_compute_blue_edges): Fix value of `is_top_right_blue'.
This is error #2.
(af_cjk_align_linked_edge): Add tracing message.
* src/autofit/afcjk.h (AF_CJK_IS_FILLED_BLUE): Removed, no longer
used.
* src/autofit/hbshim.c (af_get_coverage): Merge input glyph coverage
of GSUB lookups into output coverage. Otherwise, ligatures are not
handled properly.
Don't check blue zone characters for default coverage.