* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec): Move this
structure to...
* include/freetype/freetype.h (FT_Glyph_LayerRec): ... this
header file.
(FT_Glyph_Layer): New typedef.
Update code to use it where appropriate.
* src/base/ftobjs.c (FT_Get_GlyphLayers): New function.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.
If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead. The current implementation
assumes that the foreground is black.
Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.
There are still some issues with metrics; additionally, an API to
fetch color layers is missing.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.
* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.
* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.
* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.
* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.
* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.
* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.
* src/sfnt/sfnt.c: Include `ttcolr.c'.
* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
Reported by Kiyoshi Kanazawa:
https://lists.gnu.org/archive/html/freetype-devel/2018-05/msg00008.html
Thanks to the suggestions by Alexei and Alan Coopersmith.
* builds/unix/configure.raw: Check if "-xldscope=hidden" is
accepted, and if so, it is added to CFLAGS. This is the option
making Sun / Oracle C compilers hide the symbols from global
scope.
* include/freetype/config/ftconfig.h: Use "__global" prefix
for FT_EXPORT() macro, if SunPro C is newer than Sun ONE
Studio 8 (2003).
* builds/unix/ftconfig.in: Ditto.
* builds/vms/ftconfig.h: Ditto.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
It is now widely recommended that ELF shared libraries hide symbols
except those with explicit __attribute__((visibility("default"))).
This is supported by all major compilers and should rather be an
option in libtool.
* builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility
attribute.
=======================
Tag sources with `VER-2-9'.
* docs/VERSION.TXT: Add entry for version 2.9.
* 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/windows/ftver.rc,
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.8.1/2.9/, s/281/29/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 9.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 22:0:16.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
This is necessary in case the application's memory routines differ
from FreeType. A typical example is a Python application on Windows
that calls FreeType compiled as a DLL via the `ctypes' interface.
* include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare
and define.
* docs/CHANGES: Updated.
* include/freetype/internal/ftpsprop.h: Use `FT_BASE_CALLBACK'.
(ps_property_get): Harmonize declaration with corresponding
function typedef.
* include/freety[e/internal/fttrace.h: Add `trace_psprops'.
* src/base/ftpsprop.c: Include necessary header files.
(FT_COMPONENT): Define.
(ps_property_set): Tag with `FT_BASE_CALLBACK_DEF'.
(ps_property_get): Tag with `FT_BASE_CALLBACK_DEF'.
Harmonize declaration with corresponding function typedef.
This reduces the amount of duplicated code across PostScript drivers.
* src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c
({cff,cid,t1}_property_{get,set}): Moved to...
* include/freetype/internal/ftpsprop.h: ...this new file.
(ps_property_{get,set}): New functions to replace moved ones.
* src/base/ftpsprop.c: Implement above functions.
* include/freetype/internal/internal.h (FT_INTERNAL_POSTSCRIPT_PROPS_H):
New macro.
* src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: Updated.
* src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated.
We exit early if the current design or blend coordinates are
identical to the new ones.
* src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design):
Implement it, returning internal error code -1 if there will be no
variation change.
* src/type1/t1load.c (t1_set_mm_blend): Ditto.
* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated.
This reduces redundancy and increases synergy; it also reduces the
number of header files.
* include/freetype/config/ftheader.h (FT_DRIVER_H): New macro.
(FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H,
FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to
FT_DRIVER_H.
* include/freetype/ftautoh.h, include/freetype/ftcffdrv.h,
include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h,
include/freetype/ftttdrv.h: Replaced with...
* include/freetype/ftdriver.h: ...this new file.
(FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to...
(FT_HINTING_ADOBE): ... this new macro.
(FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to...
(FT_HINTING_FREETYPE): ... this new macro.
* src/*/*: Updated accordingly.
* include/freetype/internal/fttrace.h: Remove unused tracing macros.
s/pshalgo2/pshalgo/.
Add `trace_cffdecode'.
* src/pshinter/pshalgo.c (FT_COMPONENT): Updated.
* src/cff/cffload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
* src/cff/cffobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H and
FT_SERVICE_CFF_TABLE_LOAD_H.
* src/cid/cidriver.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
* src/psaux/cffdecode.c: Include FT_FREETYPE_H and
FT_INTERNAL_DEBUG_H.
(FT_COMPONENT): Define.
* src/psaux/cffdecode.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
* src/psaux/psauxmod.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
Declare `cff_builder_funcs' and `ps_builder_funcs'.
* src/psaux/psft.c: Include `psobjs.h' and `cffdecode.h'.
* src/psaux/psobjs.c : Include `psauxmod.h'.
* builds/unix/configure.raw (ftoption_set, ftoption_unset): New
auxiliary functions to construct...
(FTOPTION_H_SED): ... this new variable.
Apply it as a sed argument while copying `ftoption.h' to the
`builds/unix' directory (using `AC_CONFIG_FILES').
Simplify code of test that checks cpp's computation of bit length
(the test previously created an empty `ftoption.h' file and deleted
it immediately afterwards); without this change, it can happen on my
GNU/Linux box that `configure's execution of `config.status' doesn't
create `ftoption.h' (no idea why this happens).
* builds/unix/install.mk (install): Install
`builds/unix/ftoption.h'.
* builds/unix/unix-def.in (DISTCLEAN): Updated.
* builds/unix/.gitignore: Updated.
Glyph advance widths were being written to the new `PS_Decoder' but not
saved to the underlying format specific decoder. This caused pure CFF
fonts to have bad advance width.
* include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width'
field to pointer.
Remove unused fields.
* src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy
to reference.
Remove unused.
* src/psaux/psft.c (cf2_setGlyphWidth): Update code.
This controls whether the old Type 1 engine gets compiled into FreeType.
It is disabled by default.
* devel/ftoption.h, include/freetype/config/ftoption.h
(T1_CONFIG_OPTION_OLD_ENGINE): New macro.
* include/freetype/internal/psaux.h (PS_Decoder): Remove unused field.
* include/freetype/internal/psaux.h, src/cid/cidgload.c
(cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c
(ps_builder_add_point), src/psaux/t1decode.c
(t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph,
t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h,
src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround
relevant code with macro.
Minor code changes.
Duplicate the fast advance width calculations from the old parser. This
is to facilitate adding options for compiling out the old parser.
* src/psaux/t1decode.{c,h} (t1_decoder_parse_metrics): New function.
* include/freetype/internal/psaux.h (T1_Decoder_Funcs): New entry
`parse_metrics'.
* src/psaux/psauxmod.c: Set the new entry.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String),
src/cid/cidgload.c (cid_load_glyph): Separate
conditional for selecting engine.
This commit completely separates the interaction between named
instances and variation functions. In particular, resetting the
variation returns to the current named instance (if set) and not to
the base font.
As a side effect, variation functions no longer change the named
instance index.
* src/cff/cffobjs.c (cff_face_init): Use MM service's `set_instance'
function.
Also apply `MVAR' table to named instances.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Add cast.
(tt_set_mm_blend): No longer check whether requested variation
coincides with a named instance.
(TT_Set_Var_Design): Use current named instance for default
coordinates.
* src/truetype/ttobjs.c (tt_face_init): Use `TT_Set_Named_Instance'.
* include/freetype/internal/cfftypes.h (CFF_FontRec): Add
`font_extra' entry.
* src/cff/cffdrivr.c (cff_ps_get_font_extra): New function to
retrieve FSType info from the embedded PostScript data.
(cff_service_ps_info): Register function.
* src/cff/cffload.c (cff_font_done): Free `font_extra'.
* src/base/ftobjs.c (FT_Load_Glyph): Preset the bitmap metrics when
appropriate but `FT_Render_Glyph' is not called.
* include/freetype/freetype.h (FT_GlyphSlotRec): Document the change.
This mainly just extracts the code for presetting the bitmap metrics
from the monochrome, grayscale, and LCD renderers into a separate
function.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): New function that
calculates prespective bitmap metrics for the given rendering mode.
* include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap):
Declare it.
* src/base/ftlcdfil.c (ft_lcd_padding): New helper function that adds
padding to CBox taking into account pecularities of LCD rendering.
* include/freetype/ftlcdfil.h (ft_lcd_padding): Declare it.
* src/raster/ftrend1.c (ft_raster1_render): Reworked to use
`ft_glyphslot_preset_bitmap'.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto.
(ft_smooth_render_lcd, ft_smooth_render_lcd): The pixel_mode setting
is moved to `ft_glyphslot_preset_bitmap'.
* include/freetype/internal/psaux.h, src/psaux/psobjs.{c,h}:
Rearrange `ps_builder_init' arguments to conventional order.
* src/psaux/psft.c (cf2_decoder_parse_charstrings): Add a check and
notice for `SubFont' in Type 1 mode.
As the former only contains a single procedure, move it into
`psobjs' for simplicity. Also change the parameter order to the
conventional one.
* src/psaux/psdecode.c (ps_decoder_init): Moved to...
* src/psaux/psobjs.c: ...Here.
* src/psaux/psdecode.h, src/psaux/psobjs.h: Ditto.
* include/freetype/internal/psaux.h (PSAux_ServiceRec): Update
`ps_decoder_init' function signature.
* src/cff/cffgload.c, src/cid/cidgload.c, src/type1/t1gload.c:
Update calls.
* src/psaux/psaux.c, src/psaux/psauxmod.c: Update includes.
* src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC):
Update file references.
Change `t1_make_subfont' to take in the Private dict record as an
argument. This is because Type 1 and CID font records in FreeType
have this in different places.
* src/psaux/psobjs.c (t1_make_subfont): Change `T1_Face' to
`FT_Face' so that CID is also accepted.
Take `PS_Private' as an argument and let caller figure out where the
Private dict actually is.
Update references.
* include/freetype/internal/psaux.h, src/psaux/psobjs.h: Update
declaration.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Update
call.
Synthesize a `SubFont' object for Type 1 fonts. This is used in the
interpreter to access Private dict data, which are stored in
different places for Type 1 and CFF. This allows the same data to
be used in either mode.
* src/psaux/psobjs.c (t1_make_subfont): New procedure to copy
required values to a dummy `CFF_SubFont' object. This is similar to
`cff_make_private_dict'.
* src/psaux/psobjs.h: Add the new declaration.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Ditto.
Add this to the PSAux Service for future use with CID fonts.
* src/type1/t1gload.c: Include FT_INTERNAL_CFF_TYPES_H.
(T1_Parse_Glyph_And_Get_Char_String): Add the call.
Move `CF2_Font' instance to `PS_Decoder'. This is the context for
the interpreter and since it is currently stored in `CFF_Font', is
unavailable in Type 1 mode.
* include/freetype/internal/psaux.h (T1_Decoder, PS_Decoder): New
`cf2_instance' field.
* src/psaux/psdecode.c (ps_decoder_init): Copy `cf2_instance' to
`PS_Decoder'.
* src/psaux/t1decode.c (t1_decoder_done): Add finalization code.
* src/psaux/psft.c (cf2_decoder_parse_charstrings): Update accesses.
Add the callback and some conditionals to switch between the two
engines.
* include/freetype/internal/psaux.h (T1_Decoder_FuncsRec): Change
function declarations.
* src/psaux/psauxmod.c (T1_Decoder_FuncsRec): Register the
callbacks.
* src/psaux/psobjs.c (ps_builder_add_point): Add conditionals for
number conversion.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add code
to choose which renderer to use.
* src/cid/cidgload.c (cid_load_glyph): Update call.
* src/base/ftobjs.c, src/psaux/psobjs.c, src/type1/t1gload.c: Update
includes.
Use the previously changed PS_Driver in type1 module to store
hinting engine configuration.
* include/freetype/ftt1drv.h: New file.
Duplicate and rename config options from CFF.
* include/freetype/config/ftheader.h (FT_TYPE1_DRIVER_H): New macro.
* src/type1/t1driver.c (t1_driver_class): Update declaration.
* src/type1/t1objs.c: Include FT_TYPE1_DRIVER_H.
(T1_Driver_Init): Update code.
This is so that we can use the same hinting engine parameters for
Type 1.
* include/freetype/internal/cffotypes.h (CFF_Driver): Rename and
move to...
* include/freetype/internal/psaux.h (PS_Driver): ...here.
* src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffload.c,
src/cff/cffobjs.c, src/cff/cffobjs.h, src/psaux/psft.c,
src/psaux/psobjs.c: Update references.
Make some fields more generic, so that we can access them the same
way regardless of Type 1 or CFF.
* include/freetype/internal/psaux.h (PS_Builder): Change `TT_Face'
to `FT_Face'.
Remove unused fields.
* src/psaux/psft.c: Update all accesses of `PS_Builder.face'.
Add some asserts to guard against casting `T1_Face' as `TT_Face'.
* src/type1/t1objs.h (T1_GlyphSlot): Reorder fields to follow
`CFF_GlyphSlot', so that we can pretend they are the same in the
interpreter.
* src/psaux/psobjs.c (ps_builder_init, ps_builder_add_point):
Updated with above changes.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix
switching between new and old engines.
* src/cff/cffgload.c, src/cff/cffparse.c: Update calls.
* src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h,
src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all
to use new objects.
Make the new objects copy over values. They are essentially wrapper
types for the different decoders/builders.
* include/freetype/internal/psaux.h: Update declarations.
(PS_Builder): Add `is_t1' flag.
(PS_Decoder_{Get,Free}_Glyph_Callback): Renamed to...
(CFF_Decoder_{Get,Free}_Glyph_Callback: ... this.
(PS_Decoder): Updated.
Add `t1_parse_callback' member.
(PSAux_ServiceRec): Add `ps_decoder_init' member.
* src/psaux/psdecode.h, src/psaux/psobjs.h: Update declarations.
* src/psaux/psdecode.c, src/psaux/psobjs.c: Implement copy with two
modes.
* src/psaux/psauxmod.c: Add builder and decoder functions to `PSAux'
service.
Introduce `PS_Decoder' and `PS_Builder' which include all fields
from either Type 1 or CFF decoders/builders.
* include/freetype/internal/psaux.h (PS_Builder, PS_Decoder): New
structs.
* src/psaux/psobjs.c, src/psaux/psobjs.h: Add `PS_Builder'
functions.
* src/psaux/psdecode.c, src/psaux/psdecode.h: New files to hold
`PS_Decoder' initialization functions.
* src/psaux/psaux.c, src/psaux/Jamfile (_sources),
src/psaux/rules.mk (PSAUX_DRV_SRC): Updated.
NOTE: Does not compile!
Minor fix to allow both `cff' and `psaux' to use `cff_random'.
* src/cff/cffload.c (cff_random): Move to...
* src/psaux/psobjs.c: Here.
* src/cff/cffload.h: Move corresponding declaration to
`src/psaux/psobjs.h'.
* include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the
function here...
* src/psaux/psauxmod.c: And here.
* src/cff/cffload.c, src/psaux/cf2intrp.c: Update code.
NOTE: Does not compile!
This is so that the CFF functions moved to `psaux' can access the
same structs that they need.
* src/cff/cfftypes.h: Moved to...
* include/freetype/internal/cfftypes.h: ...Here.
* src/cff/cffobjs.h: Moved the struct declarations to...
* include/freetype/internal/cffotypes.h: ... this new file.
* include/freetype/internal/internal.h (FT_INTERNAL_CFF_TYPES_H,
FT_INTERNAL_CFF_OBJECT_TYPES_H): New macros.
* src/cff/cffcmap.h, src/cff/cffdrivr.c, src/cff/cffgload.c,
src/cff/cffgload.h, src/cff/cffload.h, src/cff/cffobjs.c,
src/cff/cffobjs.h, src/cff/cffparse.h, src/psaux/psobjs.h,
include/freetype/internal/psaux.h,
include/freetype/internal/services/svcfftl.h: Update includes.
* src/cff/rules.mk (CFF_DRV_H): Updated.
NOTE: Does not compile!
This is to allow CFF functions moved to `psaux' to call functions
declared in `src/cff/cffload.h'.
* include/freetype/internal/services/svcfftl.h: New file, setting up
a `CFFLoad' service.
* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10,
FT_DEFINE_SERVICEDESCREC): New macros.
(FT_SERVICE_CFF_TABLE_LOAD_H): New macro.
* src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service.
* src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h
(CF2_FontRec): Add service interface.
* src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c,
src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service.
NOTE: Does not compile!
* include/freetype/internal/psaux.h: Add function pointer
declarations.
* src/psaux/cffdecode.c (cff_decoder_init): Update to take in
callbacks.
* src/psaux/cffdecode.h: Ditto.
* src/cff/cffgload.c (cff_compute_max_advance, cff_slot_load):
Update calls to pass in callbacks.
* src/psaux/cf2ft.c, src/psaux/cffdecode.c: Use them.
NOTE: Does not compile!
* include/freetype/internal/psaux.h: Include
FT_INTERNAL_TRUETYPE_TYPES_H.
(CFF_Builder_FuncsRec, CFF_Decocer_FuncsRec): New function tables.
(CFF_Builder): Updated.
Fix for forward declaration.
(PSAux_ServiceRec): New field `cff_decoder_funcs'.
* src/psaux/psauxmod.c (cff_builder_funcs, cff_decoder_funcs): New
function tables.
(PSAux_Interface): Updated.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add `psaux'
service interface.
* src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffparse.c: Update
function calls to use psaux service.
Thing are simpler with a NULL-function pointer.
* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New
pointer to the filter function.
(FT_LibraryRec): Remove unused `lcd_filter'.
(FT_Bitmap_LcdFilterFunc, ft_lcd_filter_fir): Move from here...
* include/freetype/ftlcdfil.h (FT_Bitmap_LcdFilterFunc,
ft_lcd_filter_fir): ... to here.
* src/base/ftobjs.c (ft_open_face_internal): NULL-initialize the
per-face filter.
(FT_Face_Properties): Set it.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Simplify.
* src/base/ftlcdfil.c (ft_lcd_filter_fir, FT_Libary_SetLcdFilter):
Minor.
* build/windows/vc2010/freetype.vcxproj: Use DynamicLibrary in Debug
and Release configurations.
* include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF)
[_DLL]: Use Visual C++ extensions.
The first 32bit of standard TrueType variants is 0x00010000,
`OTTO', `ttcf', `true' or `typ1'. 2 marginal dfonts on legacy Mac
OS X, Keyboard.dfont and LastResort.dfont, have the sfnt resources
starting 0xA5 followed by `kbd' or `lst'. Considering the following
data could be parsed as conventional TrueType fonts, the header
checking is updated to allow these tags. It seems that recent Mac
OS X has already switched to normal TTF for these fonts.
See the discussion at
http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3931.0
* include/freetype/tttags.h (TTAG_0xA5kbd, TTAG_0xA5lst): New header
tags for Keyboard.dfont and LastResort.dfont.
* src/sfnt/sfobjs.c (sfnt_open_font): Accept the sfnt resource
starts with TTAG_0xA5kbd or TTAG_0xA5lst.
* src/truetype/ttobjs.c (tt_face_init): Accept the face with the
format tag is TTAG_0xA5kbd or TTAG_0xA5lst.
Requested by Behdad.
Modern bitmap-only SFNTs like `NotoColorEmoji.ttf' don't contain
entries in the bitmap strike(s) for empty glyphs. Instead, they
rely that a space glyph gets created from the font's metrics data.
This commit makes FreeType behave accordingly.
* include/freetype/fterrdef.h (FT_Err_Missing_Bitmap): New error
code.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_image): Change error codes
to make a distinction between a missing bitmap in a composite and a
simple missing bitmap.
* src/truetype/ttgload.c (TT_Load_Glyph): For a missing bitmap (in a
bitmap-only font), synthesize an empty bitmap glyph if metrics are
available.
This is a new technology for LCD-optimized rendering. It capitalizes
on the fact that each color channel grid is shifted by a third of a
pixel. Therefore it is logical to render 3 separate monochrome
bitmaps shifting the outline by 1/3 pixel, and then combine them.
Importantly, the resulting output does not require additional LCD
filtering.
* src/smooth/ftsmooth.c (ft_smooth_render_generic)
[!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Implement new LCD-optimized
rendering.
* include/freetype/ftlcdfil.h, include/freetype/freetype.h,
include/freetype/config/ftoption.h, devel/ftoption.h: Updated
documentation.
The reserved `flags' field got a value in OpenType version 1.8.2;
unfortunately, the public `FT_Var_Axis' structure misses the
corresponding element. Since we can't add a new field, we add an
access function.
* src/base/ftmm.c (FT_Get_Var_Axis_Flags): New function.
* include/freetype/ftmm.h (FT_VAR_AXIS_FLAG_HIDDEN): New macro.
Updated.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Increase allocated memory
of `mmvar' to hold axis flags.
Fill the axis flags array.
* docs/CHANGES: Updated.
While clang's sanitizer recommends a cast to unsigned for safe
negation (to handle -INT_MIN), both MSVC and Visualc emit warning
C4146 if an unsigned value gets negated.
* include/freetype/internal/ftcalc.h (NEG_LONG, NEG_INT32),
src/base/ftcalc.c (FT_MOVE_SIGN): Replace negation with a
subtraction.
These versions don't produce run-time errors due to integer
overflow.
* include/freetype/internal/ftobjs.h: Include FT_INTERNAL_CALC_H.
(FT_PAD_ROUND_LONG, FT_PAD_CEIL_LONG, FT_PIX_ROUND_LONG,
FT_PIX_CEIL_LONG): New macros.
(FT_PAD_ROUND_INT32, FT_PAD_CEIL_INT32, FT_PIX_ROUND_INT32,
FT_PIX_CEIL_INT32): New macros.
This commit handles the new engine.
* include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT32,
OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, NEG_INT, NEG_LONG,
NEG_INT32): New macros.
* src/cff/cf2ft.c (cf2_getScaleAndHintFlag): Use OVERFLOW_ADD_INT32.
* src/cff/cf2hints.c (cf2_getWindingMomentum, cf2_hint_init,
cf2_hintmap_map, cf2_glyphpath_hintPoint,
cf2_glyphpath_computeIntersection, cf2_glyphpath_computeOffset,
cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): Use
OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, and
NEG_INT32 where appropriate.
* src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend,
cf2_interpT2CharString): Ditto.
Also add some other code where needed to avoid overflow.
This commit (mainly for 32bit CPUs) is the first of a series of
similar commits to handle known integer overflows. Basically, all
of them are harmless, since they affect rendering of glyphs only,
not posing security threats. It is expected that fuzzying will show
up more overflows, to be fixed in due course.
The idea is to mark places where overflows can occur, using macros
that simply cast to unsigned integers, because overflow arithmetic
is well defined in this case. Doing so suppresses run-time errors
of sanitizers without adding computational overhead.
* include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT,
OVERFLOW_SUB_INT, OVERFLOW_MUL_INT, OVERFLOW_ADD_LONG,
OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG): New macros.
* src/base/ftcalc.c (FT_RoundFix, FT_CeilFix, FT_Matrix_Multiply,
FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled,
ft_corner_orientation): Use new macros.
* src/base/ftoutln.c (FT_Outline_Get_Orientation): Use new macros.
Extra bitmap padding for LCD filtering depends on the filter. The
default 5-tap filter needs 2 extra subpixels. The light 3-tap filter
needs only 1 extra subpixel. This space could be already available
due to rounding. In order to optimize the padding, we now expand
CBox for the given filter weights before rounding.
This change breakes current Skia (and Firefox).
* include/freetype/internal/ftobjs.h (FT_LibraryRec)
[FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Remove `lcd_extra' field.
* src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights,
FT_Library_SetLcdFilter): Remove `lcd_extra' initializations.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Implement dymanic
LCD padding.
=======================
Tag sources with `VER-2-8'.
* docs/VERSION.TXT: Add entry for version 2.8.
* docs/CHANGES: Updated.
* 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.7.1/2.8/, s/271/28/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 8.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 20:0:14.
* CMakeLists.txt (VERSION_MINOR): Set to 8.
(VERSION_PATCH): Set to 0.
* include/freetype/config/ftoption.h
(AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by
default.
* src/autofit/afloader.c (af_loader_load_glyph): Use
AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code.
This mode uses fractional advance widths and doesn't scale glyphs
horizontally, only applying vertical scaling and hinting.
At the same time, the behaviour of the `light' auto-hinter gets
restored for backwards compatibility: Both vertical and horizontal
scaling is again based on rounded metrics values (this was changed
in a commit from 2017-03-30 as a side effect). To be more precise,
the behaviour is restored for TrueType fonts only; for other font
formats like Type 1, this is a new feature of the `light' hinting
mode.
* include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro.
(FT_RENDER_MODE_SLIGHT): New render mode.
* include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add
`autohint_mode' and `autohint_metrics' fields.
* src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c
(af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init):
Updated.
* src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use
`autohint_metrics'.
(af_loader_load_glyph): s/internal/slot_internal/.
Initialize `autohint_metrics' and `autohint_mode' depending on
current auto-hint mode.
Use `autohint_metrics'.
Updated.
* src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated.
* src/base/ftobjs.c (FT_Load_Glyph): Updated.
(FT_New_Size): Allocate `internal' object.
* src/pshinter/pshalgo.c (ps_hints_apply): Updated.
* src/smooth/ftsmooth.c (ft_smooth_render): Updated.
We are going to extend this later on.
* include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New
structure with a single field `module_data'.
* src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of
`FT_Size' structure.
* src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use
`size->internal->module_data' instead of `size->internal'.
* src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'.
(cff_size_init, cff_size_select, cff_size_request): Use
`size->internal->module_data' instead of `size->internal'.
* src/cif/cidobjs.c (cid_size_done, cid_size_init,
cid_size_request): Use `size->internal->module_data' instead of
`size->internal'.
* src/psaux/psobjs.c (t1_builder_ini): Use
`size->internal->module_data' instead of `size->internal'.
* src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request):
Use `size->internal->module_data' instead of `size->internal'.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=981
* include/freetype/fterrdef.h (FT_Err_DEF_In_Glyf_Bytecode): New
error code.
* src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution
of these two opcodes in `glyf' bytecode.
(TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode
in case of error since function tables can no longer be modified
(due to the changes in `Ins_FDEF' and `Ins_IDEF'). This change can
enormously speed up handling of broken fonts.
We have to make a separate case for Windows 64's LLP64 data model.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro.
* src/truetype/ttgload.c (load_truetype_glyph): Use it.
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
* include/freetype/internal/tttypes.h (TT_FaceRec): New fields
`var_postscript_prefix' and `var_postscript_prefix_len'.
* src/sfnt/sfdriver.c: Include FT_TRUETYPE_IDS_H.
(sfnt_is_alphanumeric): New wrapperfunction for `ft_isalnum'.
(get_win_string, get_apple_string): Remove `const' from return
value.
(MAX_VALUE_DESCRIPTOR_LEN, MAX_PS_NAME_LEN): New macros.
(hexdigits): New array.
(sfnt_get_var_ps_name): New function, implementing Adobe TechNote
5902 to construct a PS name for a variation font instance.
(sfnt_get_ps_name): Call `sfnt_get_var_ps_name' for font instances.
* src/sfnt/sfobjs.c (sfnt_done_face): Updated.
* src/truetype/ttgxvar.c (tt_set_mm_blend): Reset
`face->postscript_name' to trigger recalculation for new instance
parameters.
* include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func):
Add `normalizedcoords' argument.
* src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store
the design coordinates of the current instance.
Updated.
* src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to...
(tt_set_mm_blend): ... New function.
Convert data in `normalizedcoords' array to `coords' array on
demand.
(TT_Set_Var_Design): Store argument data in `coords' array.
(TT_Get_Var_Design): Get data from `coords' array.
(tt_get_var_blend): Updated.
(tt_done_blend): Updated.
* src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated.
* src/cff/cf2ft.c (cf2_getNormalizedVector): Updated.
* src/cff/cffobjs.c (cff_face_init): Updated.
We need this for support of the `random' operator.
* include/freetype/ftcffdrv.h (FT_PARAM_TAG_RANDOM_SEED): New macro.
* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New
field `random_seed'.
* src/cff/cffobjs.h (CFF_DriverRec): New field `random_seed'.
This commit provides the framework, to be filled with something
useful in the next commits.
* include/freetype/freetype.h (FT_Face_Properties): Declare.
* src/base/ftobjs.c (FT_Face_Properties): New function.