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.
In particular, local extrema without horizontal or vertical segments
are better recognized:
+ A + D
\ /
\ /
\ /
\ /
\ + C
\ /
B +/
If the distances AB and CD are large, point B wasn't previously
detected as an extremum since the `ft_corner_is_flat' function
`swallowed' BC regardless of its direction, tagging point B as weak.
The next iteration started at B and made `ft_corner_is_flat' swallow
point C, tagging it as weak also, et voilà.
To improve that, another pass gets now performed before calling
`ft_corner_is_flat' to improve the `topology' of an outline: A
sequence of non-horizontal or non-vertical vectors that point into
the same quadrant are handled as a single, large vector.
Additionally, distances of near points are now accumulated, which
makes the auto-hinter handle them as if they were prepended to the
next non-near vector.
This generally improves the auto-hinter's rendering results.
* src/autofit/afhints.c (af_glyph_hints_reload): Implement it.
* src/autofit/afhints.h (AF_FLAGS): Remove no longer used flag
`AF_FLAG_NEAR'.
Problem reported by Karsten Lücke <karsten.luecke@kltf.de>.
The new algorithm takes care of the width of stems: If the distance
between two segments is larger than the largest stem width, the
demerits quickly increase for larger distances. This improves
hinting of slanted fonts (especially if the inner parts of serifs
have non-horizontal `shoulders'), avoiding false stem links.
* src/autofit/aflatin.c (af_latin_hints_link_segments): Use largest
stem width (if available) to compute better demerits for distances
between stems.
(af_latin_hints_detect_features): Pass stem width array and array
size.
(af_latin_metrics_init_widths): Updated to use original algorithm.
(af_latin_hints_apply): Updated to use new algorithm.
* src/autofit/aflatin.h: Updated.
* src/autofit/afcjk.c: Updated.
Work around a bug in pkg-config version 0.28 and earlier: If a
variable value gets surrounded by doublequotes (in particular values
for the `prefix' variable), the prefix override mechanism fails.
* builds/unix/freetype2.in: Don't use doublequotes.
* builds/unix/unix-def.in (freetype.pc): Escape spaces in directory
names with backslashes.
Based on a patch from Marek Kašík <mkasik@redhat.com>.
* builds/unix/configure.raw (LIBS_CONFIG): Remove.
* builds/unix/freetype-config.in (libs): Hard-code value.
* builds/unix/unix-def.in: Updated.
This works around a problem with HarfBuzz (<= 0.9.26), which doesn't
validate glyph indices returned by
`hb_ot_layout_lookup_collect_glyphs'.
* src/autofit/hbshim.c (af_get_coverage): Guard `idx'.
* docs/CHANGES: Updated.
=========================
Tag sources with `VER-2-5-3'.
* docs/VERSION.DLL: Update documentation and bump version number to
2.5.3.
* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.5.2/2.5.3/, s/252/253/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 3.
* builds/unix/configure.raw (version_info): Set to 17:2:11.
* CMakeLists.txt (VERSION_PATCH): Set to 3.
* docs/CHANGES: Updated.
* builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Don't use
pkg-config for bzip2 since not all GNU/Linux distributions have
`bzip2.pc' (and the header file `bzlib.h' is located in /usr/include
normally).
o Introduce `auto' value for `--with-XXX' library options; this is
now the default.
o First use `pkg-config' for library detection, then fall back to
other tests.
* builds/unix/configure.raw (--with-zlib, --with-bzip2, --with-png,
--with-harfbuzz): Rewrite.
Use new `xxx_reqpriv', `xxx_libpriv', and `xxx_libstaticconf'
variables to collect data for `freetype2.pc' and `freetype-config'.
(FT2_EXTRA_LIBS): Renamed to ...
(ft2_extra_libs): This since it gets no longer substituted.
(REQUIRES_PRIVATE, LIBS_PRIVATE, LIBS_CONFIG, LIBSSTATIC_CONFIG):
New output variables, replacing `XXX_PKG' and `LIBXXX'.
Add notice at the end of `configure' showing the library
configuration.
* builds/unix/freetype-config.in (--static): New command line
option.
(libs): Updated.
(staticlibs): New variable, to be used if `--static' is given.
* builds/doc/freetype-config.1: Document `--static'.
* builds/unix/freetype2.in, builds/unix/unix-def.in: Updated.
Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.
* builds/unix/configure.raw: Don't use gcc's `-pedantic' flag for
versions < 4.6. This is especially needed for Max OS X since this
OS runs a gcc variant (or emulation) based on version 4.2.1.
* src/cff/cf2ft.c (cf2_initLocalRegionBuffer,
cf2_initGlobalRegionBuffer): It is possible for a charstring to call
a subroutine if no subroutines exist. This is an error but should
not trigger an assert. Split the assert to account for this.
* src/cff/cf2hints.c (cf2_hintmap_build): Return when `hintMask' is
invalid. In this case, it is not safe to use the length of
`hStemHintArray'; the exception has already been recorded in
`hintMask'.
bdflib puts data from the input stream into a buffer in chunks of
1024 bytes. The data itself gets then parsed line by line, simply
increasing the current pointer into the buffer; if the search for
the final newline character exceeds the buffer size, more data gets
read.
However, in case the current line's end is very near to the buffer
end, and the keyword to compare with is longer than the current
line's length, an out-of-bounds read might happen since `memcmp'
doesn't stop properly at the string end.
* src/bdf/bdflib.c: s/ft_memcmp/ft_strncmp/ to make comparisons
stop at string ends.
The build target is now `windows' instead of `win32'.
Problem reported by Nickolas George <darknova.clan@gmail.com>.
* builds/modules.mk: Don't use `win32' and `win16' (!) but
`windows'.
* builds/windows/detect.mk, builds/windows/win32-def.mk:
s/win32/windows/.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Fix handling
of alternative standard characters.
This also fixes a compilation warning in non-debug mode.
* src/cff/cf2ft.c (cf2_checkTransform): Convert assertion into
parameter check.
(cf2_decoder_parse_charstrings): Call `cf2_checkTransform' only if
we are scaling the outline.
(cf2_getPpemY): Remove problematic assertion.
This is useful for OpenType features like `c2sc' (caps to small
caps) that don't have lowercase letters by definition, or other
features that mainly operate on numerals.
* src/autofit/afscript.h: Add more standard characters.
* src/autofit/aftypes.h: Update use of `SCRIPT' macro.
(AF_ScriptClassRec): Add members to hold two more standard
characters.
(AF_DEFINE_SCRIPT_CLASS): Updated.
* src/autofit/afglobal.c, src/autofit/afglobal.h,
* src/autofit/afpic.c, src/autofit/afranges.h, src/autofit/hbshim.c:
Update use of `SCRIPT' macro.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Scan two more
standard characters.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap) <glyph_format==5>:
Don't check metrics, which this format doesn't have.
This is another correction to the commit from 2013-11-21.
* src/type1/t1load.c (t1_parse_font_matrix): Properly handle result
of `T1_ToFixedArray'.
* src/cid/cidload.c (cid_parse_font_matrix): Synchronize with
`t1_parse_font_matrix'.
* src/type42/t42parse.c (t42_parse_font_matrix): Synchronize with
`t1_parse_font_matrix'.
(t42_parse_encoding): Synchronize with `t1_parse_encoding'.
* src/psaux/psobjs.c (ps_parser_load_field) <T1_FIELD_TYPE_BBOX>,
<T1_FIELD_TYPE_MMOX>: Properly handle result of `ps_tofixedarray'.
Split the single, incorrect Indic entry into separate scripts so
that the covered ranges are the same: Bengali, Devanagari, Gujarati,
Gurmukhi, Kannada, Limbu, Malayalam, Oriya, Sinhala, Sundanese,
Syloti Nagri, Tamil, Telugu, and Tibetan. At the same time, remove
entries for Meetai Mayak and Sharada – the Unicode ranges were
incorrect (and nobody has complained about that), fonts are scarce
for those scripts, and the Indic auto-hinter support is rudimentary
anyways.
* src/autofit/afscript.h: Updated, using AF_CONFIG_OPTION_INDIC and
AF_CONFIG_OPTION_CJK.
* src/autofit/afstyles.h (STYLE_DEFAULT_INDIC): New auxiliary macro.
Use it, together with AF_CONFIG_OPTION_INDIC and
AF_CONFIG_OPTION_CJK, to update.
* src/autofit/afranges.c [AF_CONFIG_OPTION_INDIC]: Updated.
[!AF_CONFIG_OPTION_INDIC, !AF_CONFIG_OPTION_CJK]: Removed.
Sort entries by tags.
With this commit, the implementation of coverage handling is
completed.
* src/autofit/hbshim.c (af_get_coverage): Exit early if nothing to
do.
Reject coverages which don't contain appropriate glyphs for blue
zones.