Commit Graph

5448 Commits

Author SHA1 Message Date
Dave Arnold 71b45f99b1 [cff] minor cleanup 2016-11-21 17:58:27 -08:00
Dave Arnold c7f2a52f86 [cff] minor code cleanup 2016-11-21 15:32:50 -08:00
Dave Arnold f34a28d614 [cff] delete trailing whitespace 2016-11-21 15:00:03 -08:00
Dave Arnold 410ff09eb6 Experimental fix for double adjustment of advance. 2016-11-18 18:02:10 -08:00
Dave Arnold 8dba6305da [cff] Add glyph name support for CFF2 using post table
Temporarily make sfnt_get_glyph_name() extern
Need to replace this with service interface.
2016-11-18 15:29:13 -08:00
Dave Arnold 88ad21fbe5 [cff] Make cff parser stack dynamic
Allocate and free parser->stack. Allow maxstack to increase the default.

Do validation of maxstack at parse time; make it a CALLBACK.

Defer support for > 256 FDs in cff_font_load().
2016-11-16 14:57:52 -08:00
Dave Arnold d49da66dcb [cff] Change operand stack from fixed size to dynamic
CFF becomes dynamic as well as CFF2
maxstack in Top DICT can increase the CFF2 default from 193
2016-11-15 13:57:41 -08:00
Dave Arnold dfce4760af Don't allow CFF2 charstrings to specify a width 2016-11-11 14:16:21 -08:00
Dave Arnold e3ef1df506 Disable seac for CFF2 2016-11-11 13:59:24 -08:00
Dave Arnold c156b734dd Add code to ignore operators removed from CFF2 spec
Ignored operators clear the stack.
Ignore return and endChar in CFF2.
Ignore vsindex and blend in CFF.

Add a nested switch for op2.
First op2 switch handles 4 flex operators for CFF & CFF2 and all reserved
operators common to both.
Second op2 switch handles CFF operators that were removed from CFF2.
2016-11-11 13:17:22 -08:00
Dave Arnold d5c247e923 [cff] Add support for vsindex, DICT & CharString
Add cf2_cmdVSINDEX charstring operator.
Add cff_parse_vsindex as a callback function.
Add vsindex state machine to check for vsindex after blend.

Fix stack bugs in cff_blend_doBlend.
Report errors from cff_blend_build_vector.

Minor comment and TRACE edits.
2016-11-10 13:18:38 -08:00
Dave Arnold 304f0383ef [truetype] Fix HVAR bugs with more than one data item
* src/truetype/ttgxvar.c (ft_var_load_hvar, tt_adjust_advance): rename
regionCount to regionIdxCount. Clean up some comments.
2016-11-02 15:33:13 -07:00
Dave Arnold 776a712be8 [cff] Add CFF2 blend support to cff parser.
* src/cff/cf2font.c (cf2_font_setup): before rendering a glyph, check
blend vector and reparse private DICT if it has changed.

* src/cff/cf2intrp.c (cf2_interpT2CharString): check blend vector and
build blend vector if needed at cf2_doBlend.

* src/cff/cffload.c (cff_vstore_load): fix bug parsing vstore with > 1
data item.
(cff_load_private_dict): factor out private dict parsing so we can
reparse when vector changes.

Add functions for handling CFF_Blend object.
(cff_blend_clear): clear blend stack
(cff_blend_check_vector): test if inputs have changed and blend vector
needs rebuilding.
(cff_blend_build_vector): construct blend vector from design vector
using algorithm in OpenType Font Variations Overview.
(cff_blend_doBlend): compute blended array, same as in cf2_intrp.c but
with parser blend_stack instead of charstring operand stack.

* src/cff/cffparse.c Add blend_stack alongside parser stack, so we have
a place to write blend results.
(cff_parse_num): add internal number type, opcode 255, for use with
blend_stack. Change limit check on several number parsing functions,
since stack is no longer contiguous.
(cff_parse_blend): check blend vector and re-build it if needed.
(cff_parser_run): ignore opcode 255 if it occurs in a font.

* src/cff/cfftypes.h (CFF_Blend): add object data for cff_blend_*
functions.
(CFF_SubFont): add CFF_Blend and blend_stack.
2016-11-02 15:30:36 -07:00
Dave Arnold 54d9993505 Corrections to parse fonts following 1.8 spec.
INDEX count for CFF2 is 32 bits, while CFF is 16 bits
This means INDEX header size is either 5 or 3 bytes.

CFF2 header size is 5 bytes, while CFF is 4 bytes.
In CFF2, offSize field is length of the Top DICT data and is 16 bits.

Blend operator has changed from 31 to 23.
2016-10-18 21:20:19 -07:00
Dave Arnold 4c39089a4d Add separate parsing tables for CFF2
Limit Top, Font and Private dicts to operators allowed by spec
Remove duplicate constants (CFFCODE vs CFF_CODE)
Allow more than 256 Font Dicts (subfonts) in CFF2
2016-09-29 16:54:53 -07:00
Dave Arnold dccfebc0f5 Support v10 CFF2 fonts
remove string index, font index
top dict follows header, but has no index
font dict in FDArray, but skip FDSelect when there's only one font dict
2016-09-28 15:14:28 -07:00
Dave Arnold 6a5ef34797 Test. Minor change in comment 2016-09-15 10:21:01 -07:00
Behdad Esfahbod c7f87a1f8b Fix up commit d1d88cd08dd3d438abcf7e60087c72957a50fcb1
FT_Get_Var_Design_Coordinates() was turning blending off.  Apparently
CFF implementation does not respect that, but TrueType driver does.
2016-09-14 09:41:08 +02:00
Dave Arnold d1908a107d Preliminary OpenType 1.8 support. 2016-09-14 01:14:29 +02:00
Werner Lemberg 053943a757 [truetype] Comment. 2016-07-30 00:27:48 +02:00
Werner Lemberg fae4ec0525 [sfnt, truetype] Don't abort on invalid `maxComponentDepth'.
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.
2016-07-29 06:43:32 +02:00
Werner Lemberg d9c7f5aa6e * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor.
No functional change.
2016-07-26 20:20:27 +02:00
Hin-Tak Leung 3a528bbe5a [truetype] Record the end of IDEFs.
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.
2016-07-22 06:59:36 +02:00
Werner Lemberg 7f63105c07 [truetype] Sanitizer fix, second try.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary
tests and use only one slot more.
2016-07-19 21:35:58 +02:00
Werner Lemberg 9f6426eb16 Thinko; fix previous commit. 2016-07-19 07:23:38 +02:00
Werner Lemberg e69f34b1e2 [truetype] Sanitizer fix.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Increase array
to fix nested loops.
2016-07-19 07:06:19 +02:00
Werner Lemberg a3b70d76ba [truetype] Make GETDATA work only for GX fonts.
* src/truetype/ttinterp.c (opcode_name): Updated.
(Ins_GETDATA): Only define for `TT_CONFIG_OPTION_GX_VAR_SUPPORT'.
(TT_RunIns): Updated.
2016-07-18 06:23:36 +02:00
Werner Lemberg 8c93013ca3 [truetype] Add support for Apple's
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.
2016-07-17 22:40:31 +02:00
Werner Lemberg e084360961 [truetype] Add bytecode support for GX variation fonts.
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.
2016-07-16 18:46:28 +02:00
Werner Lemberg 32a320625e [truetype] Fix GETINFO bytecode instruction.
* src/truetype/ttinterp.c (Ins_GETINFO): Fix return value for
stretching information.
2016-07-16 16:39:26 +02:00
Behdad Esfahbod 69446ddcce [truetype] Make all glyphs in `Zycon' GX font work.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary
tests.
2016-07-16 10:52:38 +02:00
Werner Lemberg a3b61253a7 [truetype] Fix GX delta tracing.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Trace
relative point movements.
2016-07-16 08:16:16 +02:00
Werner Lemberg f147fb2881 [truetype] More fixes for GX.
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'.
2016-07-16 07:06:21 +02:00
Werner Lemberg aafff57428 * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko.
`max_pos' is always larger than `min_pos' so `FT_ABS' is not needed.

Reported by Alexei.
2016-07-16 06:41:39 +02:00
Nikolaus Waxweiler 86eb43a994 * src/truetype/ttinterp.c (Ins_MIRP): Fix copy-and-paste error.
Problem reported by Hin-Tak Leung.
2016-07-16 06:37:57 +02:00
Werner Lemberg 1831e6f068 [autofit] Update and improve segment and edge tracing.
* 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.
2016-07-15 10:35:32 +02:00
Werner Lemberg 894c0228ca [autofit] For edges, reject segments wider than 1px (#41334).
* 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.
2016-07-15 10:23:11 +02:00
Werner Lemberg ff655437e3 * include/freetype/freetype.h (FT_IS_NAMED_INSTANCE): New macro. 2016-07-14 15:01:55 +02:00
Werner Lemberg ee3f36f6b3 [sfnt] Fix `face_index' value in `FT_Face' for named instances.
* src/sfnt/sfobjc.s (sfnt_init_face): Don't strip off higher 16bits.
2016-07-14 10:25:20 +02:00
Werner Lemberg 631e218147 * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix tracing. 2016-07-14 06:25:05 +02:00
Behdad Esfahbod 0f9ddf20c8 [truetype] Fix gxvar delta interpolation.
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.
2016-07-14 06:08:39 +02:00
Werner Lemberg 4261103e35 Minor. 2016-07-14 06:03:52 +02:00
Werner Lemberg 17fa9f714f Merge branch '2.6.5'. 2016-07-12 08:06:23 +02:00
Werner Lemberg f9b1871ded * Version 2.6.5 released.
=========================

Tag sources with `VER-2-6-5'.

* include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Comment out.

* docs/VERSION.TXT: Add entry for version 2.6.5.

* 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.4/2.6.5/, s/264/265/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 5.

* builds/unix/configure.raw (version_info): Set to 18:5:12.
* CMakeLists.txt (VERSION_PATCH): Set to 5.

* docs/CHANGES: Updated.
2016-07-12 06:18:49 +02:00
Werner Lemberg 605946af6d Conditionally compile environment support.
* include/freetype/internal/ftobjs.h, src/autofit/afmodule.c,
src/base/ftobjs.c, src/cff/cffdrivr.c, src/truetype/ttdriver.c:
Decorate with `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' where
necessary.
2016-07-11 16:14:36 +02:00
Werner Lemberg 8f8ae8c52d Handle properties in `FREETYPE_PROPERTIES' environment variable.
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'.
2016-07-11 15:11:38 +02:00
Werner Lemberg c3e83b4662 Replace calls to `atol' with `strtol'.
We later on need strtol's `endptr' feature.

* include/freetype/config/ftstdlib.h (ft_atol): Replace with...
(ft_strtol): ... this.

* src/base/ftdbgmem.c (ft_mem_debug_init): Updated.
* src/cid/cidparse.c (cid_parser_new): Ditto.
* src/type42/t42drivr.c (t42_get_name_index), src/type42/t42objs.c
(T42_GlyphSlot_Load): Ditto.
2016-07-11 05:56:26 +02:00
Werner Lemberg 84d3df7501 Implement handling of `FREETYPE_PROPERTIES' environment variable.
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.
2016-07-11 00:12:11 +02:00
Werner Lemberg c3beb30a21 Add function `ft_property_string_set'.
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.
2016-07-10 07:11:45 +02:00
suzuki toshiya 83c877f11c [mac] Fix ftexport.sym target in Jamfile.
* 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.
2016-07-09 13:45:50 +09:00