* src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c
(tt_get_advances): Use `is_default_instance' for test; this gets
recomputed after changing blend coordinates.
When asking for an unhinted non-default variations,
`linearVertAdvance' is currently the value from the `hmtx' table
instead of the actual value after applying the variation. `HVAR'
support fixes this, but fonts will exist without that table and will
need sane fallback.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
load_truetype_glyph): Implement linear advance adjustments if `HVAR'
or `VVAR' tables are missing.
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
* src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM.
* src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(cff_get_advances): Test for HVAR and VVAR.
* src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=304
* src/base/ftobjs.c (FT_Open_Face): Code moved to...
(ft_open_face_internal): ... this function.
Add a parameter to control whether we try special Mac font handling
in case of failure.
(FT_Open_Face, FT_New_Face, FT_New_Memory_Face,
open_face_from_buffer): Use `ft_open_face_internal'.
In particular, we need access to named instance data.
* include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func):
Add argument for `FT_MM_Var'.
* src/cff/cffload.c (cff_get_var_blend): Updated.
* src/cff/cffload.h: Updated.
* src/cff/cf2ft.c (cf2_getNormalizedVector): Updated.
* src/truetype/ttgxvar.c (tt_get_var_blend): Updated.
Accept value `NULL' for arguments.
* src/truetype/ttgxvar.h: Updated.
This is better behaviour than exiting with an error.
* include/freetype/internal/tttypes.h (TT_Face): Add `use_fvar'
field.
* src/sfnt/sfobjs.c (sfnt_init_face): Compute `use_fvar', also
updating the validation code.
Use `use_fvar' to compute FT_FACE_FLAG_MULTIPLE_MASTERS.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Remove `fvar' validation
code.
* include/freetype/internal/tttypes.h (TT_Face): Move
`is_default_instance' into TT_CONFIG_OPTION_GX_VAR_SUPPORT
block.
* src/sfnt/sfobjs.c (sfnt_init_face): Updated.
* src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): New macro.
(TT_Load_Glyph): Use it.
* src/sfnt/sfobjs.c (sfnt_init_face): If the axis count in `fvar' is
zero, set `num_instances' to zero.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Handle `fvar' table with
zero axes as invalid.
* src/truetype/ttobjs.c (tt_face_init): Improve logic of loading
`loca', `cvt', `fpgm', and `prep' table.
* src/base/ftobjs.c (FT_Open_Face): Return info on number of
available faces and numbered instances, or the indices of the
requested face and numbered instance.
* src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts.
* src/cff/cf2font.h: Include `cffload.h'.
* src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and
FT_SERVICE_MULTIPLE_MASTERS_H.
(cff_vstore_load): Eliminate `vsSize'.
(cff_load_private_dict): Tag as `FT_LOCAL_DEF'.
* src/cff/cffload.h: Include `cffobjs.h'.
Provide declaration for `cff_load_private_dict'.
* src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate
`minorVersion' and `map_offset'.
The font variation code. All parts dependent on the GX code in the
`truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
In other words, you can still compile the `cff' module without
defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2
support without font variation).
* src/cff/cf2font.c (cf2_font_setup): Add support for font
variation.
* src/cff/cf2font.h (CF2_Font): Add fields for variation data.
* src/cff/cf2ft.c (cf2_free_instance): Free blend data.
(cf2_getVStore, cf2_getNormalizedVector): New functions.
* src/cff/cf2ft.h: Updated.
* src/cff/cf2intrp.c: Include `cffload.h'.
(cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with...
(cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values.
(cf2_doBlend): New function.
(cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes.
* src/cff/cffload.c (FT_fdot14ToFixed): New macro.
(cff_vstore_done, cff_vstore_load): New functions.
(cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector,
cff_blend_check_vector): New functions.
(cff_load_private_dict): Add arguments for blend vector.
Handle blend data.
(cff_subfont_load, cff_subfont_done): Updated.
(cff_font_load): Handle CFF2 variation store data.
(cff_font_done): Updated.
* src/cff/cffload.h: Include `cffparse.h'.
Updated.
* src/cff/cffobjs.c (cff_face_done): Updated.
* src/cff/cffparse.c: Include `cffload.h'.
(cff_parse_num): Handle internal value 255.
(cff_parse_vsindex, cff_parse_blend): New functions.
(CFF_FIELD_BLEND): New macro.
(cff_parser_run): Updated.
* src/cff/cffparse.h (cff_kind_blend): New enum value.
* src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend'
dictionary values.
* src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion,
CFF_VStore, CFF_Blend): New structures.
(CFF_FontRecDict): Add `vstore_offset' field.
(CFF_Private): Add `vsindex' field.
(CFF_SubFont): Add fields for blend data.
(CFF_Font): Add `vstore' field.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar',
since glyph variation data is directly embedded.
(TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts.
Note that this is not complete yet; it only handles advance width
variation.
Activation of the code follows in another commit.
* include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member.
* src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion,
GX_HVStore, GX_WidthMap): New auxiliary structures for...
(GX_HVarTable): ... HVAR main structure.
(GX_BlendRec): Add data for HVAR loading.
* src/truetype/ttgxvar.c (FT_FIXED_ONE, FT_fdot14ToFixed,
FT_intToFixed, FT_fixedToInt): New macros.
(ft_var_load_hvar): New function.
(TT_Get_MM_Var): Updated.
(tt_done_blend): Deallocate HVAR data.
* src/cff/cfftypes.h (CFF_Font): Add `library' and `base_offset'
fields.
* src/cff/cffload.c (cff_subfont_load): Change last argument to
`CFF_Font'
Split off parsing of private dictionary into...
(cff_load_private_dict): ...this new function.
(cff_font_load): Updated.
No effect yet; service functions will be implemented later on.
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
* include/freetype/internal/services/svmetric.h: New file.
* include/freetype/internal/ftserv.h
(FT_SERVICE_METRICS_VARIATIONS_H): New macro.
* include/freetype/internal/tttypes.h (TT_Face): New field `var'.
* src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(sfnt_init_face): Initialize `face->var'.
* src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(tt_service_metrics_variations): New service.
(tt_services): Updated.
* src/truetype/ttpic.h: Updated.
The code simply uses the MM functions from the `truetype' module.
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
* include/freetype/internal/tttypes.h (TT_Face): New field `mm'.
* src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
(cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var,
cff_set_var_design, cff_get_var_design): New functions.
(cff_service_multi_masters): New service.
(cff_services): Updated.
* src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New
functions.
* src/cff/cffload.h: Updated.
* src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro.
* src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
(sfnt_init_face): Initialize `face->mm'.
It can now differentiate between local and global searches.
* src/base/ftobjs.c (ft_module_get_service): Add `global' argument.
(FT_Get_TrueType_Engine_Type): Updated.
* src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated.
* include/freetype/internal/ftobjs.h: Updated.
* include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE):
Updated.
For internal use; we want to share code between the forthcoming CFF2
support and TrueType.
* include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func):
New typedef.
(MultiMasters): Add `get_var_blend'.
(FT_Service_MultiMasters): Updated.
* src/truetype/ttgxvar.c (tt_get_var_blend): New function.
* src/truetype/ttgxvar.h: Updated.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
For internal use; we want to share code between the forthcoming CFF2
support and TrueType.
* include/freetype/internal/services/svmm.h (FT_Done_Blend_Func):
New typedef.
(MultiMasters): Add `done_blend'.
(FT_Service_MultiMasters): Updated.
* src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument.
* src/truetype/ttgxvar.h: Updated.
* src/truetype/ttobjs.c (TT_Face_Done): Updated.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
CFF2 fonts will need access to those two functions.
* include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H.
(SFNT_Interface): Add `get_glyph_name' and `get_name_index' members.
(FT_DEFINE_SFNT_INTERFACE): Updated.
* src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index):
Fix signatures to exactly correspond to the glyph dict service
function typedefs.
(sfnt_interface): Updated.
Note that the low-level functions aren't implemented yet.
* include/freetype/ftmm.h: Declare.
* include/freetype/internal/services/svmm.h
(FT_Get_Var_Design_Func): New typedef.
(MultiMasters): New MM service function `get_var_design'.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
Update all callers.
* src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement.
* src/truetype/ttdriver.c: Updated.
* src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to
handle `get_var_design' service.
* src/truetype/ttgxvar.h: Updated.
* src/type1/t1driver.c: Updated.
* src/type1/t1load.c (T1_Get_Var_Design): New dummp function to
handle `get_var_design' service.
* src/type1/t1load.h: Updated.
Building FreeType with external zlib 1.2.8 makes msvc 14 stop with
the following error.
ftgzip.c
zlib-1.2.8\zlib.h(86): error C2061:
syntax error: identifier 'z_const'
zlib-1.2.8\zlib.h(94): error C2054:
expected '(' to follow 'z_const'
zlib-1.2.8\zlib.h(94): error C2085:
'msg': not in formal parameter list
...
zlib-1.2.8\zlib.h(877): fatal error C1003:
error count exceeds 100; stopping compilation
The error happens because FreeType keeps an own copy of zlib-1.1.4
under `src/gzip'. When building `src/gzip/ftgzip.c' with
FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses
#include <zlib.h>
which correctly finds an external `zlib.h', but `zlib.h' itself has
a line
#include "zconf.h"
which makes Visual Studio 2015 find `src/gzip/zconf.h' while
compiling the files in `src/gzip'.
* src/gzip/zconf.h: Rename to...
* src/gzip/ftzconf.h: ... this.
* src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated.
Function calls through pointers must use a matching signature to
work on Emscripten, since such calls are dispatched through lookup
tables grouped by signature.
* src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Fix
typedef.
Also improve some comments and remove unused code.
No functional change.
* src/autofit/afloader.c (af_loader_load_g): Merged with...
(af_loader_load_glyph): ...this function.
Split off emboldening code into...
(af_loader_embolden_glyph_in_slot): ... this function.
* builds/unix/configure.raw: Call `AC_TYPE_LONG_LONG_INT'.
* builds/unix/ftconfig.in (FT_LONG64): Enable for LLP64 systems (and
suppress warnings) even without `FT_CONFIG_OPTION_FORCE_INT64'.
It's unavoidable to call the PNG engine, but to get the metrics it
is sufficient to read the PNG image's header only.
* src/sfnt/pngshim.c (Load_SBit_Png): Add argument to control the
allocation of the glyph slot.
* src/sfnt/pngshim.h: Updated.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_png,
tt_face_load_sbix_image, tt_face_load_sbit_image): Updated.
This also fixes a bug introduced in 2016-10-01 which prevents
display of embedded bitmap fonts that use the `sbix' format.
* src/sfnt/ttsbit.c (tt_face_load_sbit): Store `sbix' size and
offset also in `ebdt_size' and `ebdt_start', respectively. This
makes the test for an embedded bitmap data table succeed for this
format.
(tt_face_load_strike_metrics) <TT_SBIT_TABLE_TYPE_SBIX>: Use
`ebdt_size' and `ebdt_start'
(tt_face_load_sbix_image): Ditto.
`FT_Load_Glyph' doesn't generate a bitmap for a non-bitmap glyph
until the user calls `FT_Render_Glyph'. However, it always
allocates memory for bitmaps and copies or decodes the contents of a
bitmap glyph, which can be quite slow for PNG data.
* include/freetype/freetype.h (FT_LOAD_BITMAP_METRICS_ONLY): New
macro.
* src/base/ftobjs.c (FT_Load_Glyph): Unset FT_LOAD_RENDER if
FT_LOAD_BITMAP_METRICS_ONLY is used.
* src/sfnt/ttsbit.c (tt_sbit_decoder_alloc_bitmap,
tt_sbit_decoder_load_bitmap): Add argument to control allocation of
the glyph slot.
(tt_sbit_decoder_load_image, tt_sbit_decoder_load_compound,
tt_face_load_sbit_image): Updated.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Quickly exit if
`FT_LOAD_BITMAP_METRICS_ONLY' is set.
* src/pfr/pfrsbit.c, src/pfr/pfrsbit.h (pfr_slot_load_bitmap): Add
argument to control allocation of the glyph slot.
* src/pfr/pfrobjs (pfr_slot_load): Updated.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto.
* docs/CHANGES: Updated.
* include/freetype/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h (FT_TYPEOF): Update code to use definition in
current version of `intprops.h'.
Other minor synchronization to reduce code differences between the
three files.
This is required by OpenType 1.8; it also avoids rounding surprises.
* src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates
outside of the allowed range to always stay within the range instead
of producing an error.
* src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for
loop counter handling.
* src/truetype/ttinterp.c: Updated.
(Ins_SCANTYPE): Use signed constant.
(TT_RunIns): Ensure `num_twilight_points' is 16bit.
* include/freetype/ftmm.h: Declare.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func):
New typedef.
(MultiMasters): New MM service function `get_mm_blend'.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
Update all callers.
* src/base/ftmm.c (FT_Get_MM_Blend_Coordinates,
FT_Get_Var_Blend_Coordinates): Implement.
* src/truetype/ttdriver.c: Updated.
* src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle
`get_mm_blend' service.
* src/truetype/ttgxvar.h: Updated.
* src/type1/t1driver.c: Updated.
* src/type1/t1load.c (T1_Get_MM_Blend): New function to handle
`get_mm_blend' service.
* src/type1/t1load.h: Updated.
* docs/CHANGES: Document.
This is a very old patch from openSuSE (from 2006, submitted to
FreeType in 2011) that I forgot to apply.
https://build.opensuse.org/package/view_file/openSUSE:Factory/freetype2/freetype2-bitmap-foundry.patch
Prepend the foundry name plus a space to the family name. There are
many fonts just called `Fixed' which look completely different, and
which have nothing to do with each other. When selecting `Fixed' in
KDE or Gnome one gets results that appear rather random, the style
changes often if one changes the size and one cannot select some
fonts at all.
We also check whether we have `wide' characters; all put together,
we get family names like `Sony Fixed' or `Misc Fixed Wide'.
* src/pcf/pcfread.c (pcf_load_font): Implement it.
* docs/CHANGES: Document it.
This avoids additional calls to `tt_face_lookup_table' for the
`glyf' table, which can be expensive.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Move
`glyf_offset' field to ...
(TT_FaceRec): ... this structure.
* src/truetype/ttgload.c (load_truetype_glyph): Updated.
(tt_loader_init): Move initialization of `glyf_offset' to ...
* src/truetype/ttpload.c (tt_face_load_loca): .. this function.
This speeds up FreeType's handling of malformed fonts.
* src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number
of twilight points, the total number of negative jumps, and the
total number of loops in LOOPCALL opcodes. The values are based on
the number of points and entries in the CVT table.
(Ins_JMPR): Test negative jump counter.
(Ins_LOOPCALL): Test loopcall counter.
* src/truetype/ttinterp.h (TT_ExecContext): Updated.
* docs/CHANGES: Updated.
Without this patch, a loca sequence like `0 100000 0 100000 ...',
where value 100000 is larger than the `glyf' table size, makes
FreeType handle the whole `glyf' table as a single glyph again and
again, which is certainly invalid (and can be very slow, too).
* src/truetype/ttpload.c (tt_face_get_location): Implement.
Improve tracing messages.
We don't need some divisions if a line segments stays within a single
row or a single column of pixels.
* src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions
conditional.
The algorithm calls `gray_set_cell' at the start of each new contour
or when the contours cross the cell boundaries. Double-checking for
that is wasteful.
* src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell.
(gray_convert_glyph): Remove initialization introduced by 44b172e88.
Problems reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40
We now map the strike index right before accessing the physical
data, not earlier.
* src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map'
after creating the map so that...
* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function
can be used before and after setting up `sbit_strike_map'.
(tt_face_set_sbit_strike): Revert change.
(tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index.
* src/truetype/ttdriver.c (tt_size_select): Revert change.
FreeType tries to sanitize strike header data; we now reject
completely broken ones.
* include/freetype/internal/tttypes.h (TT_FaceRec): New
`sbit_strike_map' array pointer.
* src/base/ftobjs.c (FT_Match_Size): Reject matches where either
width or height would be zero.
Add tracing message in case of error.
* src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map',
only using (more or less) valid strike header data for
FT_Face's `available_sizes' array.
(sfnt_done_face): Updated.
* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use
`sbit_strike_map'.
(tt_face_load_strike_metrics): Improve tracing.
* src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'.
=======================
Tag sources with `VER-2-7'.
* docs/VERSION.TXT: Add entry for version 2.7.
* 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.6.5/2.7/, s/265/27/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 7.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 18:6:12.
* CMakeLists.txt (VERSION_MINOR): Set to 7.
(VERSION_PATCH): Set to 0.
* docs/CHANGES: Updated.
* src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly
instead of...
(gray_start_cell): ... this function, which is removed.
(gray_convert_glyph): Make initial y-coordinate invalid.
* src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): New macro, set to
500.
* src/tools/ftrandom/Makefile (CFLAGS): Split off include
directories to ...
(INCLUDES): ... this new variable.
(LDFLAGS): New variable.
(ftrandom.o, ftrandom): Updated.
Thanks to Hrant H Papazian <hpapazian@gmail.com> for help.
* src/autofit/afblue.dat (AF_BLUE_STRING_ARMENIAN_*): Improve
selection of characters.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
It now supports both a normal build (`./configure && make') and a
development build (`make devel').
* src/tools/ftrandom/Makefile (VPATH): Set it so that
`libfreetype.a' gets searched in both `objs' (for the development
build) and `objs/.libs' (for a normal build which uses libtool).
(LIBS): Add missing libraries.
(ftrandom.o): New rule.
(ftrandom): Use automatic variables.
Problems reported by Bob Taylor <Bob.Taylor@monotype.com>.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix rough
sanity test for glyph variation array header size.
Always set stream position before reading packed x and y deltas.
Fix thinko w.r.t. `localpoints' array.
* src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better
default.
(error_fraction): Make it of type `double' to work as advertized –
this was completely broken.
Update all related code.
(error_count, fcnt): Make it unsigned to fix compiler warnings.
Update all related code.
(fontlist): Change `len' member to `long' to fix compiler warnings.
(FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag
unused variables.
(TestFace, FindFonts, copyfont, do_test): Fix compiler warnings.
(ExecuteTest): Ditto.
Call `FT_Done_FreeType'.
(getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned
int'.
(usage): Improve output.
(main): Fix compiler warnings.
* src/tools/ftrandom/README: Updated.
* src/base/ftobjs.c (FT_Open_Face): Check whether negation was
actually successful. For example, this can fail for value
-32768 if the type is `signed short'. If there are problems,
disable the stroke.
It turns out that there is significant cost associated with `FT_Span'
creation and calls to `gray_render_span' because it happerns so
frequently. This removes these steps from our internal use but leaves
it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain
is about 5%.
* src/smooth/ftgrays.c (gray_render_span): Removed. The code is
migrated to...
(gray_hline): ... here.
Zero coverage is unlikely (1 out of 256) to warrant checking. This
gives 0.5% speed improvement in dendering simple glyphs.
* src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks.
This gives 2% speed improvement in rendering simple glyphs.
* src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a
pointer to its bottom-left and pitch to be used in...
(gray_TWorker): ... here.
(gray_render_span): Move pixmap flow check from here...
(gray_raster_render): .. to here.
This commit avoids `EBDT' and friends being looked up again and
again while loading a single embedded bitmap.
* include/freetype/internal/tttypes.h (TT_FaceRec)
[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and
`ebdt_size'.
* src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ...
(tt_face_load_sbit): ... this function; also store the table size
and offset.
This removes unnecessary complexity of span merging and buffering.
Instead, the spans are rendered as they come, speeding up the
rendering by about 5% percents as a result.
* src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed.
(gray_TWorker): Remove span buffer and related fields.
(gray_sweep, gray_hline): Updated.
* include/freetype/ftimage.h: Remove documentation note about
`FT_MAX_GRAY_SPANS', which was never in `ftoption.h' and is now gone.
`FT_Get_Advance' returns 0 for bitmap fonts. It first gets the
advance value from the font table and then scales it by the
`font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't
set that value for bitmap fonts and the advance gets scaled to zero.
Taken from
https://github.com/behdad/harfbuzz/issues/252
* src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
<TT_SBIT_TABLE_TYPE_EBLC>: Set scale values.
Since 2016-05-16 we detect infinite recursion directly.
* src/sfnt/ttload.c (tt_face_load_maxp): Don't adjust
`maxComponentDepth'.
* src/truetype/ttgload.c (load_truetype_glyph): Don't abort if
`maxComponentDepth' is not valid. Instead, simply adjust its value
and emit a tracing message.
To match the logic in FDEF. The value of the end is only used for
bound-checking in `Ins_JMPR', so it may not have been obvious that
it was not recorded. Tested (as part of Font Validator 2.0) all the
fonts on Fedora and did not see any change.
* src/truetype/ttinterp.c (Ins_IDEF): Updated.
GETDATA[], opcode 0x92
bytecode instruction. It always returns 17, and we have absolutely
no idea what it is good for...
* src/truetype/ttinterp.c (Pop_Push_Count, opcode_name): Updated.
(Ins_GETDATA): New function.
(TT_RunIns): Add it.
This commit implements undocumented (but confirmed) stuff from
Apple's old bytecode engine.
GETVARIATION[], opcode 0x91
This opcode pushes normalized variation coordinates for all axes
onto the stack (in 2.14 format). Coordinate of first axis gets
pushed first.
GETINFO[], selector bit 3
If GX variation support is enabled, bit 10 of the result is set
to 1.
* src/truetype/ttinterp.c: Include FT_MULTIPLE_MASTERS_H.
(opcode_name) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
(Ins_GETINFO) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle selector
bit 3, checking support for variation glyph hinting.
(Ins_GETVARIATION) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function
to implement opcode 0x91.
(TT_RunIns) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle opcode 0x91.
This finally fixes the rendering of the cyclist and the lizard in
the `Zycon' font.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point
index is always cumulative.
(tt_handle_deltas): Rename to...
(tt_interpolate_deltas): ... This.
Add new parameter for output point array.
Update caller.
(TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds
the intermediate results of `tt_interpolate_deltas' that are to be
added to `outline->points'.
* src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace
`delta' also.
Don't show first point of segment as a replacement for `pos'; this
is (a) misleading, since the difference to `pos' can be almost
arbitrarily large in corner cases, and (b) it is better to have all
segment data in font units instead of a single value given in output
space coordinates.
Improve layout.
(af_glyph_hints_dump_edges): Show px->units and units->px conversion
values for convenience.
Improve layout.
* src/autofit/afhints.h (AF_SegmentRec): New member `delta'.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Compute
`delta'.
(af_latin_hints_compute_edges): Reject segments with a delta larger
than 0.5px.
The coordinates of the base font should be used for interpolation
purposes, NOT the current points (i.e., the result of accumulation
of previous deltas).
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize
`points_org' before looping over all tuples.
This commit covers the most important one.
* src/autofit/afmodule.c (af_property_set): Handle `warping',
`darkening-parameters', and `no-stem-darkening'.
* src/cff/cffdrivr.c (cff_property_set): Handle
`darkening-parameters', `hinting-engine', and `no-stem-darkening'.
* src/truetype/ttdriver.c (tt_property_set): Handle
`interpreter-version'.
Recognizing properties follows in another commit.
* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES): New macro.
* include/freetype/config/ftstdlib.h (ft_getenv): New macro.
* src/base/ftinit.c (ft_set_default_properties): New function to
parse `FREETYPE_PROPERTIES' and calling `ft_property_string_set'.
(FT_Init_FreeType): Updated.
This is a preparation for handling an `FREETYPE_PROPERTIES'
environment variable to control (some) driver properties.
No change in functionality.
* src/base/ftobjs.c (ft_property_do): Add `value_is_string'
parameter.
(ft_property_string_set): New function.
(FT_Property_Set, FT_Property_Get): Updated.
* include/freetype/internal/ftobjs.h: Updated.
* include/freetype/internal/services/svprop.h
(FT_Properties_SetFunc): Add `value_is_string' parameter.
* src/autofit/afmodule.c (af_property_set), src/cff/cffdrivr.c
(cff_property_set), src/truetype/ttdriver.c (tt_property_set):
Updated, emitting an error currently if `value_is_string' is set.
* Jamfile: Update the directories of the header files scanned for
ftexport.sym. They were incorrect since the migration of the
header files, on 2015-06-22. Either inexisting include/cache
(removed on 2006-03-20) is not needed to be listed explicitly.
Now ftmac.h is scanned only in the case of Mac OS & Mac OS X.
Rasterization sub-banding is utilized at large sizes while using
rather small fixed memory pool. Indeed it is possible to make an
educated guess how much memory is necessary at a given size for a
given glyph. It turns out that, for large majority of European glyphs,
you should store about 8 times more boundary pixels than their height.
Or, vice versa, if your memory pool can hold 800 pixels the band
height should be 100 and you should sub-band anything larger than
that. Should you still run out of memory, FreeType bisects the band
but you have wasted some time. This is what has been implemented in
FreeType since the beginning.
It was overlooked, however, that the top band could grow to twice the
default band size leading to unnecessary memory overflows there. This
commit fixes that. Now the bands are distributed more evenly and
cannot exceed the default size.
Now the magic number 8 is really suitable for rather simple European
scripts. For complex Chinese logograms the magic number should be 13
but that is subject for another day.
* src/smooth/ftgrays.c (gray_convert_glyph): Revise sub-banding
protocol.
Mac OS X linker throws errors when `-exported_symbol_list' input
file includes non-existing symbols. Reported by Ryan Schmidt.
* builds/exports.mk: Exclude ftmac.h from the headers for apinames
by default. Include it when ftmac.c would be compiled.
=========================
Tag sources with `VER-2-6-4'.
* docs/VERSION.TXT: Update documentation and bump version number to
2.6.4.
* 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.6.3/2.6.4/, s/263/264/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 4.
* builds/unix/configure.raw (version_info): Set to 18:4:12.
* CMakeLists.txt (VERSION_PATCH): Set to 4.
* docs/CHANGES: Updated.
* src/smooth/ftgrays.c (TArea): Restore original definition as `int'.
(gray_render_line) [FT_LONG64]: Updated.
(gray_convert_glyph): 32-bit band bisection stack should be 32 bands.
(gray_convert_glyph_inner): Trace successes and failures.
Doing so allows us to link them to edges – some fonts like
`NotoSansGurmukhi-Regular' have such isolated points sitting exactly
on other outlines.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Don't
ignore one-point contours but handle them specially as one-point
segments.
(af_latin_hints_compute_edges): Append one-point segments to edges
if possible.
This patch restores original `TCoord' definition as `int' so that the
rendering pool is used more efficiently on LP64 platforms (unix).
* src/smooth/ftgrays.c (gray_TWorker, TCell, gray_TBand): Switch some
fields to `TCoord'.
(gray_find_cell, gray_render_scanline, gray_render_line, gray_hline,
gray_sweep, gray_convert_glyph): Updated.
* src/smooth/ftgrays.c (gray_convert_glyph): Do not use volatile
qualifier.
(gray_raster_render): Move span initializations from here.
(gray_sweep): ... to here and remove unused `target' argument.
* src/smooth/ftgrays.c (gray_init_cells): Remove function.
(gray_TWorker): Remove fields that become local variables.
(gray_raster_render): Move rendering buffer declaration from here.
(gray_convert_glyph): ... to here and update accordingly.
Removing the checks from `gray_hline' shaves 1% off rendering speed.
* src/smooth/ftgrays.c [STANDALONE_]: Duplicate `FT_MIN' and `FT_MAX'.
(gray_TWorker): No need to store `clip_box'.
(gray_hline): Remove unnecessary boundary checks.
(gray_convert_glyph): Move boundary checks from here.
(gray_raster_render): ... to here and consolidate.
* src/smooth/ftgrays.c [STANDALONE_]: Duplicate `FT_Outline_Get_CBox'.
(gray_compute_cbox): Remove this function.
(gray_convert_glyph): Update to use `FT_Outline_Get_CBox'.
* CMakeLists.txt: Each time cmake is run those files are
modified and the whole FreeType library is recompiled. With this
change we change the files only if there are real modifications, so
we can avoid recompilations.
This compiler doesn't recognize the end-of-comment sequence `*/' if
it immediately follows non-ASCII characters.
* src/autofit/afscript.h: Ensure whitespace before `*/'.
* src/truetype/ttinterp.c (Ins_SHPIX): Allow SHPIX to move points in
the twilight zone. Otherwise, treat SHPIX the same as DELTAP.
Unbreaks various fonts such as older versions of Rokkitt and DTL
Argo T Light that would glitch severly after calling ALIGNRP after a
blocked SHPIX.
Suggested by Alexei. `UL' is only needed for 16bit compilers, but
it seems noone is using this anymore (and we no longer test whether
FreeType compiles in such an environment). Otherwise, it is easy to
add the postfix to the `AF_UNICODE_RANGE' macro.
The convergence of Bézier flatteners is fast with the deviation
from straight line being assymptotically cut 4-fold on each bisection.
This justifies smaller bisection stack size.
* src/smooth/ftgrays.c (gray_TWorker): Remove common `bez_stack'.
(gray_render_conic): Create and use conic `bez_stack'. Move back the
band analysis from...
(gray_conic_to): ... here.
(gray_render_cubic): Create and use cubic `bez_stack'. Move back the
band analysis from...
(gray_cubic_to): ... here.
(gray_move_to): Updated.
* src/autofit/afblue.dat: Add blue zone data for Armenian.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Armenian standard characters.
* src/autofit/afranges.c: Add Armenian data.
* src/autofit/afstyles.h: Add Armenian data.
This was commented about 10 years ago – I think the reason then to
disable libtool's `-export-symbols' option was to give some badly
programmed applications access to internal FreeType functions.
I believe that we should no longer take care of such programs; the
number of symbols exported should be rather restricted as much as
possible.
This essentially moves the Gurmukhi script from the `Indic' hinter to
the `Latin' hinter.
* src/autofit/afblue.dat: Add blue zone data for Gurmukhi.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Gurmukhi standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Gurmukhi data out of
AF_CONFIG_OPTION_INDIC block.
* src/autofit/afstyles.h: Update Gurmukhi data; in particular, use
AF_WRITING_SYSTEM_LATIN.
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
* include/freetype/config/ftstdlib.h (FT_LONG_MIN): New macro.
* src/cff/cffparse.c (cff_parse_font_matrix): Use largest scaling
value of all matrix coefficients to scale matrix.
* src/cff/cffobjs.c (cff_face_init): Use `matrix->yx' member for
matrix normalization if `matrix->yy' is zero.
The previous fix for #46372 misunderstood a composite glyph referring
same component twice as a recursive reference. See the discussion
http://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html
Thanks to Khaled Hosny for finding this issue.
* src/truetype/ttgload.c (ft_list_get_node_at): A function to get
the i-th node from FT_List. (load_truetype_glyph): In the traversal
scan of the reference tree in the composite glyph, we clear the
nodes filled by previous sibling chain.
We never dereference `face_id', and some implementations might use a
running number instead of a pointer. Additionally, disallowing
value zero was undocumented.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup), src/cache/ftcmanag.c
(FTC_Manager_LookupFace, FTC_Manager_RemoveFaceID): Remove test for
`face_id'.
A single decrement counter of segments to draw, instead of an array,
contains all the information necessary to decide when to split and
when to draw a conic segment. The number of splits before each draw is
equal to the number of trailing zeros in the counter.
* src/smooth/ftgrays.c (gray_TWorker): Remove `lev_stack'.
(gray_render_conic): Updated to use decrement counter of segments.
Otherwise some properties could be set to arbitrary values, which is
harmless, but querying could give wrong positive results.
* src/cff/cffdrivr.c (cff_property_set) [hinting-engine],
* src/truetype/ttdriver.c (tt_property_set) [interpreter-version]:
Only allow defined values.
This essentially moves the Gujarati script from the `Indic' hinter to
the `Latin' hinter.
* src/autofit/afblue.dat: Add blue zone data for Gujarati.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Gujarati standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Gujarati data out of
AF_CONFIG_OPTION_INDIC block.
* src/autofit/afstyles.h: Update Gujarati data; in particular, use
AF_WRITING_SYSTEM_LATIN.
As FreeType depends on zlib, if we don't install zlib (e.g., because
we defined SKIP_INSTALL_ALL), FreeType cannot be installed, too
(cmake triggers an error saying that FreeType cannot be installed
because zlib target isn't in the export set).
* CMakeLists.txt: Honor `SKIP_INSTALL_HEADERS',
`SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL' settings.
Georgian is problematic, since `uppercase' forms of Mkhedruli
(called Mtavruli) are not yet defined in Unicode, which means that
proper blue zones can't be defined. However, there is already a
proposal submitted to Unicode; see
http://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf
Additionally, due to historical reasons, Unicode treats Khutsuri as
the same script as Mkhedruli, and so does OpenType. However, since
the two scripts have completely different shapes it can happen that
blue zones differ considerably. The tag `geok' used here (derived
from ISO 15924) to differentiate the two scripts is not an OpenType
tag in use. If we now have a font that contains both glyphs for
Mkhedruli and Khutsuri, and it uses OpenType features for both also,
HarfBuzz unavoidably treats all glyphs as `geor'. As a consequence,
blue zones for `geok' are not used for glyphs involved in the
OpenType features.
An issue not yet resolved is which OpenType feature should be used
to access Mtavruli glyph shapes; right now, FreeType doesn't set up
support for them, but it is easy to add them later on as soon as
more information is available.
* src/autofit/afblue.dat: Add blue zone data for Georgian.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Georgian standard characters.
* src/autofit/afranges.c: Add Georgian data.
* src/autofit/afstyles.h: Add Georgian data.
Even if the dummy hinter is used as the handler for `none' (which
doesn't use blue zones), it is more consistent than the old value
(which was 0), pointing to Arabic...
* src/autofit/afblue.dat: Add `AF_BLUE_STRINGSET_NONE'.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afstyles.h (none_dflt): Use AF_BLUE_STRINGSET_NONE.
* src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Replace `left',
`right', and `middle' with `min', `max', and `mid' as used in other
FreeType binary search code.
(pfr_load_bitmap_metrics): Fix invalid left shift.
We did a binary search for a charcode without ensuring that the
searched data is ordered. Validating the order is now done lazily,
this is, the first access to a bitmap glyph triggers the order check
in the corresponding bitmap strike.
* src/pfr/pfrtypes.h (PFR_BitmapFlags): New values
`PFR_BITMAP_VALID_CHARCODES' and `PFR_BITMAP_CHARCODES_VALIDATED'.
* src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Make `flags' argument
a pointer. Handle new PFR_BITMAP_XXX flags.
(pfr_slot_load_bitmap): Updated.
Extra items are indicated with different bit positions.
* src/pfr/pfrtypes.h (PFR_GlyphFlags): Replace
`PFR_GLYPH_EXTRA_ITEMS' with `PFR_GLYPH_SIMPLE_EXTRA_ITEMS' and
`PFR_GLYPH_COMPOUND_EXTRA_ITEMS'.
* src/pfr/pfrgload.c (pfr_glyph_load_simple,
pfr_glyph_load_compound): Use them.
* src/pfr/pfrsbit.c (pfr_load_bitmap_metrics): Correctly handle
signed nibbles.
(pfr_slot_load_bitmap): Correctly exit frame in case of error.
Fix invalid left shifts.
* src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move
band clipping from here.
(gray_conic_to, gray_cubic_to): ... to here.
(gray_rander_line, gray_render_scanline): Initialize variables closer
to their use.
We probably did not notice this as all fonts we tested had only
tuple_coords[i] be +1 or -1 for non-intermediate tuples.
* src/truetype/ttgxvar.c (ft_var_apply_tuple): Implement it.
The goal is to avoid integer overflows in the rendering algorithms.
The limit is chosen arbitrarily at some 2^18 pixels, which should be
enough for modern devices including printers.
* src/base/ftoutln.c (FT_Outline_Render): Check CBox and reject
enormous outlines.
* src/autofit/aflatin.c (af_latin_compute_stem_width): Add argument
to pass difference between hinted and unhinted position of base
point; use this to adjust the stem width depending on the PPEM so
that it doesn't become too large under certain circumstances.
Update all callers using value 0 for this argument except...
(af_latin_align_linked_edge): Pass position delta of base point to
`af_latin_compute_stem_width'.
This essentially moves the Sinhala script from the `Indic' hinter to
the `Latin' hinter.
* src/autofit/afblue.dat: Add blue zone data for Sinhala.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Sinhala standard character and move data
out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Sinhala data out of
AF_CONFIG_OPTION_INDIC block.
* src/autofit/afstyles.h: Update Sinhala data; in particular, use
AF_WRITING_SYSTEM_LATIN.
An example that gets better rendered is glyph `uusignTaml' (glyph
index 2286) in font `FreeSerif.ttf' (Version 0412.2263) at 22ppem.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Properly
handle segments where the last point of the first segment is
identical to the first point in the second one. This can happen for
malformed fonts or spikes. We either merge the new segment with the
previous one (both segments point into the same direction), or we
discard the shorter segment if they point into different directions.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Change
some local variable names to better differentiate between values
along a segment and values orthogonal to it.
In complex glyph shapes, the original logic was too simple to cater
for situations that would actually need something similar to PS Hint
masks. This fix should alleviate the worst cases.
* src/autofit/aflatin.c (af_latin_hint_edges): Don't allow
complete disappearance of stems.
This essentially moves the Tamil script from the `Indic' hinter to
the `Latin' hinter.
* src/autofit/afblue.dat: Add blue zone data for Tamil.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Tamli standard character and move data
out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Tamil data out of
AF_CONFIG_OPTION_INDIC block.
* src/autofit/afstyles.h: Update Tamil data; in particular, use
AF_WRITING_SYSTEM_LATIN.
This essentially moves the Malayalam script from the `Indic' hinter
to the `Latin' hinter.
* src/autofit/afblue.dat: Add blue zone data for Malayalam.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Malayalam standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Malayalam data out of
AF_CONFIG_OPTION_INDIC block.
* src/autofit/afstyles.h: Update Malayalam data; in particular, use
AF_WRITING_SYSTEM_LATIN.
Now all glyphs of MM CFFs like `ITCGaramondMM-It.otf' can be
displayed.
* src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_store,
cff_op_load>: Partially implement it.
* src/cff/cffparse.c (cff_parser_init): Add new parameter to pass
the number of Multiple Master axes.
Update all callers.
(cff_parse_multiple_master): Get number of axes.
(cff_parser_run) <opcode 31>: Updated.
* src/cff/cffparse.h: Updated.
(CFF_ParserRec): Add `num_axes' field.
* src/cff/cffload.c: Updated.
* src/cff/cfftypes.h (CFF_FontRecDictRec): Add `num_axes' field.
We need this to properly trace Multiple Master CFFs, which contain
two SIDs that are charstrings.
This commit makes FreeType also show the last SID, omitted
previously due to a bug.
* src/cff/cfftypes.h (CFF_FontRec): Add `string_pool_size' field.
* src/cff/cffload.c (cff_index_get_pointers): Add argument to return
the pool size.
Update all callers.
* src/cff/cffobjs.c (cff_face_init) [FT_DEBUG_LEVEL_TRACE]: Directly
access `cff->strings' to display the non-default strings.
The new code only displays the first master in the font.
* src/cff/cffgload.c (cff_decode_parse_charstrings): Add new
parameter to allow function calls from dictionaries also.
<cff_op_blend>: Partially implement it.
Update all callers.
* src/cff/cffgload.h: Updated.
* src/cff/cffparse.c (cff_parser_init): Add new parameter to pass the
number of Multiple Master designs.
Update all callers.
(cff_parse_multiple_master): New function to rudimentarily parse
operator.
(cff_parser_run): Handle `T2' operator.
* src/cff/cffparse.h: Updated.
(CFF_ParserRec): Add `num_designs' field.
* src/cff/cffload.c: Updated.
* src/cff/cfftoken.h: Handle `MultipleMaster' operator.
* src/cff/cfftypes.h (CFF_FontRecDictRec): Add `num_designs' field.
* src/sfnt/sfobjs.c (sfnt_init_face): Don't handle `fvar' table for
MM CFFs.
This essentially moves the Kannada script from the `Indic' hinter to
the `Latin' hinter.
* src/autofit/afblue.dat: Add blue zone data for Kannada.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Kannada standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Kannada data out of
AF_CONFIG_OPTION_INDIC block.
* src/autofit/afstyles.h: Update Kannada data; in particular, use
AF_WRITING_SYSTEM_LATIN.
We need this for backwards compatibility.
Problem reported by John Emmas <johne53@tiscali.co.uk>.
* include/freetype/fterrors.h: Fix inclusion guard so that
undefining either `FTERRORS_H_' or `__FTERRORS_H__' works as
expected.
Patch taken from ttfautohint, commit
071ae2c00e0d67f9d19418f4fade1c23d27dc185.
There were two bugs.
- We now use non-standard script tags like `khms' for special
purposes. However, HarfBuzz maps such tags to `DFLT', and
without this commit the associated lookups were incorrectly
assigned to the non-standard tags.
- Let's assume we have a Bengali font, and the font's `DFLT'
script tag handles the necessary lookups for Bengali, too.
Without this commit, the `DFLT' lookups were assigned to
ttfautohint's default script (usually `latn') before the
standard lookups for Bengali were handled.
We now have the following order while searching for covered
glyph indices.
special features of scripts (e.g. `sups' for Cyrillic)
Unicode mappings of scripts
remaining features of scripts (especially important for Indic
scripts)
default features of default script
* src/autofit/afshaper.c, src/autofit/afshaper.h
(af_shaper_get_coverage): Add boolean parameter to indicate default
script.
Update all callers.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Fix search order for coverages.
* src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): Enable filter
in addition to setting weights.
(FT_Library_SetLcdFilter): Clean out FT_FORCE_LIGHT_LCD_FILTER and
FT_FORCE_LEGACY_LCD_FILTER.
* include/freetype/ftlcdfil.h: Documentation update.
Such macro names are reserved for both C and C++.
* src/cache/ftccache.h: s/_FTC_FACE_ID_HASH/FTC_FACE_ID_HASH/.
Update all callers.
(FTC_CACHE_LOOKUP_CMP): Replace `_XXX' with `XXX_'.
* src/cache/ftcmru.c (FTC_MRULIST_LOOKUP_CMP): Ditto.
Such macro names are reserved for both C and C++.
* include/freetype/ftimage.h, src/raster/ftraster.c,
src/smooth/ftgrays.c, src/smooth/ftgrays.h:
s/_STANDALONE_/STANDALONE_/.
* src/cff/cf2intrp.c (cf2_interpT2CharString) [cf2_cmdEXTENDEDNMBR,
default]: `|' is not guaranteed to be processed from left to right
by the compiler. However, the code repeatedly calls
`cf2_buf_readByte' to get the arguments to `|' ... Fix this.
This improves rendering of scripts like Bengali or Devanagari.
* src/autofit/afhints.c (af_axis_hints_new_edge): Add parameter to
pass top-to-bottom hinting flag. This makes the function sort edges
in descending vertical position.
* src/autofit/afhints.c: Updated.
* src/autofit/aflatin.c (af_latin_hints_compute_edges,
af_latin_hint_edges): Use `top_to_bottom_hinting' flag.
* src/autofit/afcjk.c (af_cjk_hints_compute_edges),
src/autofit/aflatin2.c (af_latin2_hints_compute_edges): Updated.
Right now, it does nothing.
* src/autofit/afscript.h: Add another parameter to `SCRIPT',
specifying hinting direction.
* src/autofit/afglobal.c, scr/autofit/afglobal.h,
src/autofit/afpic.c, src/autofit/afranges.h, src/autofit/afshaper.c,
src/autofit/aftypes.h: Extend `SCRIPT' definitions.
We now use a hash to map from subr indices to array elements holding
the subroutines, if necessary.
* include/freetype/internal/t1types.h: Include FT_INTERNAL_HASH_H.
(T1_FontRec): Add `subrs_hash' field.
* include/freetype/internal/psaux.h: Include FT_INTERNAL_HASH_H.
(T1_DecoderRec): Add `subrs_hash' field.
* src/type1/t1load.h (T1_LoaderRec): Add `subrs_hash' field.
* src/type1/t1driver.c: Include FT_INTERNAL_HASH_H.
(t1_ps_get_font_value) [PS_DICT_SUBR]: Look up hash if necessary.
* src/type1/t1load.c: Include FT_INTERNAL_HASH_H.
(parse_subrs): Use hash for subr indices that exceed the allocated
number of subr slots.
(t1_init_loader): Remove unnecessary code.
(t1_done_loader, T1_Open_Face): Updated.
* src/type1/t1gload.c (T1_Compute_Max_Advance, T1_Get_Advances,
T1_Load_Glyph): Updated.
* src/type1/t1objs.c (T1_Face_Done): Updated.
* src/psaux/t1decode.c: Include FT_INTERNAL_HASH_H.
(t1_decoder_parse_charstrings) [op_callsubr]: Look up hash if
necessary.
* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/base/fthash.c (hash_num_lookup, hash_num_compare): New
functions.
(ft_hash_init): Add argument to select between number and string
hashing.
(ft_hash_num_insert, ft_hash_num_lookup): New functions.
* include/freetype/internal/fthash.h: Updated.
* src/bdf/bdflib.c (_bdf_parse_start): Updated.
* include/freetype/internal/fthash.c (FT_Hash_LookupFunc,
FT_Hash_CompareFunc, FT_Hash_FreeFunc): New typedefs.
(FT_HashRec): Add `lookup', `compare', and `free' fields.
* src/base/fthash.c (hash_str_lookup, hash_str_compare,
hash_str_free): New functions.
(ft_hash_init): Set function pointers.
(hash_bucket, ft_hash_free): Use them.
We want to support both an integer and a string key later on.
* include/freetype/internal/fthash.h (FT_Hashkey): New union.
(FT_HashnodeRec): Updated.
(ft_hash_insert, ft_hash_lookup): Renamed to ...
(ft_hash_str_insert, ft_hash_str_lookup): ... this.
* src/base/fthash.c (hash_bucket): Updated.
(ft_hash_insert, ft_hash_lookup): Renamed to ...
(hash_insert, hash_lookup): ... this.
(ft_hash_str_insert, ft_hash_str_lookup): New wrapper functions.
* src/bdf/bdflib.c: Updated.
* src/bdf/bdf.h: Include FT_INTERNAL_HASH_H.
(hashnode, hashtable): Removed.
(bdf_font_t): Use `FT_HashRec' type for `proptbl'.
* src/bdf/bdflib.c: Remove all hash functions.
Update code for new hash structure and function names.
This essentially moves the Bengali script from the `Indic' hinter to
the `Latin' hinter.
* src/autofit/afblue.dat: Add blue zone data for Bengali.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Bengali standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.
* src/autofit/afranges.c: Move Bengali data out of
AF_CONFIG_OPTION_INDIC block.
* src/autofit/afstyles.h: Update Bengali data; in particular, use
AF_WRITING_SYSTEM_LATIN.
The BDF specification only allows decimal numbers, no octal or
hexidecimal decoding is needed.
* src/bdf/bdflib.c (_bdf_atoul, _bdf_atol, _bdf_atous,
_bdf_atos): Remove unused code and parameters.
Update all callers.
(odigits): Remove.
* src/base/ftobjs.c (open_face_PS_from_sfnt_stream):
`ft_lookup_PS_in_sfnt_stream' returns offset and and length from
user supplied data. Use of this these values must be checked.
This was removed while rewriting the HarfBuzz interface.
* src/autofit/afglobal.h (AF_FaceGlobalsRec): Add `hb_buf' field to
hold internal HarfBuzz buffer, needed for feature comparison.
* src/autofit/afglobal.c (af_face_globals_new,
af_face_globals_free): Initialize and destroy `hb_buf'.
* src/autofit/afshaper.c (af_shaper_get_cluster): Compare character
(cluster) with and without applied feature.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Fix tracing
message.
This feature is mainly for Khmer: The idea is to avoid a clash
between the top of subscript glyphs and the bottom of normal
baseline glyphs.
This only works for character clusters mapped to multiple glyphs.
* src/autofit/afblue.dat: Add subscript top blue zone for Khmer.
* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_SUB_TOP): New
macro.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/aflatin.h (AF_LATIN_IS_SUB_TOP_BLUE,
AF_LATIN_BLUE_SUB_TOP): New macros.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Handle new
blue zone property.
Update tracing messages.
(af_latin_metrics_scale_dim): Handle new blue zone property.
(af_latin_hints_compute_blue_edges): Updated.
We split Khmer into two auto-hinter scripts: `Khmer' (`khmr') and
`Khmer symbols' (`khms', U+19E0-U+19FF).
* src/autofit/afblue.dat: Add blue zone data for Khmer.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
* src/autofit/afscript.h: Add Khmer standard characters.
* src/autofit/afranges.c: Add Khmer data.
* src/autofit/afstyles.h: Add Khmer data.
Scripts like Khmer have blue zones that can't be directly
represented by Unicode characters. Instead, it is necessary to let
HarfBuzz convert character clusters into proper glyph representation
forms, then deriving the blue zone information from the resulting
glyphs.
* src/autofit/hbshim.c, src/autofit/hbshim.h: Replaced by...
* src/autofit/afshaper.c, src/autofit/afshaper.h: ... these two new
files, providing a new API to access HarfBuzz.
The new API manages a HarfBuzz buffer with `af_shaper_buf_create'
and `af_shaper_buf_destroy'. The buffer receives a UTF8 encoded
string with function `af_shaper_get_cluster', and the resulting
glyph data (indices, advance widths, vertical offsets) can be
iteratively accessed with function `af_shaper_get_elem'.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits):
Updated.
* include/freetype/internal/fttrace.h: s/afharfbuzz/afshaper/.
* src/autofit/afglobal.c: s/hbshim.h/afshaper.h/.
(af_face_globals_compute_style_coverage): Updated.
* src/autofit/afglocal.h: s/hbshim.h/afshaper.h/.
* src/autofit/autofit.c: s/hbshim.c/afshaper.c/.
* src/autofit/Jamfile, src/autofit/rules.mk (AUTOF_DRV_SRC):
Updated.
This is more flexible; additionally, it would allow character
clusters.
* src/autofit/aftypes.h (SCRIPT, AF_DEFINE_SCRIPT_CLASS): Updated.
(AF_ScriptClassRec): Replace `standard_char[123]' with
`standard_charstring'.
* src/autofit/afscript.h: Replace last three character arguments
of the `SCRIPT' calls with a string parameter, holding the standard
characters (in UTF-8 encoding) separated with spaces.
* src/autofit/afglobal.c, src/autofit/afglobal.h,
src/autofit/afpic.c, src/autofit/afranges.c, src/autofit/hbshim.c
(SCRIPT): Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Updated.