src/psaux


Log

Author Commit Date CI Message
Werner Lemberg 9adc3b35 2019-08-26T20:36:19 * src/psaux/cffdecode.c (cff_operator_seac): Fix numeric overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16470
Werner Lemberg 05439f5c 2019-07-04T14:28:04 [psaux] (2/2) Handle fonts that use SEAC for ligatures (#56580). The same as previous commit but for the old engine. * src/psaux/t1decode.c (t1operator_seac): Implement it.
Chris Liddell f2b64583 2019-07-04T14:04:52 [psaux] (1/2) Handle fonts that use SEAC for ligatures (#56580). As originally intended, a Type 1 SEAC charstring would be used for an accented glyph (like `acaron' or `uumlaut'), where the advance width of the SEAC glyph is the same as that of the `base' glyph (like `a' or `u'). In this case it is not uncommon for the SEAC glyph to not use an (H)SBW opcode of its own but to rely on the value from the base glyph. However, out-of-spec fonts also use SEAC glyphs for ligatures (like `oe' or `fi'), and in those cases the overall advance width is greater than that of the `base' glyph. For this reason we have to allow that the SEAC glyph can have an (H)SBW value of its own, and if it has, retain this value, rather than the one from the base glyph. * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escSEAC>: Implement it.
Alexei Podtelezhnikov 78c02bc1 2019-06-10T23:09:49 [type1,type42] Use `const' for string literals. * include/freetype/internal/psaux.h (PS_Table_FuncsRec): Updated. * include/freetype/internal/t1types.h (T1_EncodingRec): Updated. * src/psaux/psobjs.[ch] (ps_table_add): Updated. * src/type1/t1load.c (T1_Open_Face, parse_encoding): Updated. * src/type42/t42objs.c (T42_Open_Face): Updated. * src/type42/t42parse.c (t42_parse_encoding): Updated. * src/cff/cffobjs.c (cff_face_init): Minor.
Werner Lemberg 9159128a 2019-05-29T07:45:54 Silence gcc 7's fall-through warnings in `switch' blocks. Instead of an intentionally missing `break' statement there must be a comment line containing `fall through' (and nothing else) right before the next `case' statement. See https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them
Werner Lemberg 03f3f8ab 2019-05-13T06:53:19 * src/psaux/psfont.c (cf2_font_setup): Fix compiler warning.
Alexei Podtelezhnikov 300458eb 2019-05-03T23:16:42 Miscellaneous macro updates. * src/base/ftoutln.c (SCALED): Updated. * src/smooth/ftgrays.c (SCALED): Ditto. (FLOOR, ROUND, CEILING): Removed. * src/psaux/psfixed.h (cf2_fracToFixed): Updated.
Sebastian Rasmussen 6a4718a3 2019-03-05T17:25:19 Fix use of uninitialized memory. * src/psaux/psintrp.c (cf2_interpT2CharString): The call to `cf2_arrstack_setCount' may fail because the allocator ran out of memory. When this happens the stack is still written to before the error condition is checked. This means that FreeType writes outside of allocated memory. This commit moves the error check prior to the stack assignment, hence the function now properly returns with an error condition.
Werner Lemberg 75859970 2019-02-23T10:07:09 Update all copyright notices.
Armin Hasitzka 5e3a38b1 2019-02-21T10:04:28 [psaux] Mask numeric overflow. * src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Mask numeric overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13041
Werner Lemberg de8de1ce 2019-02-20T12:48:36 Minor (whitespace, spelling, doc update).
Werner Lemberg f686ad46 2019-01-22T20:31:44 Update copyright years.
Alexei Podtelezhnikov 1e7a8f30 2019-01-08T20:54:13 [psaux, type1] Align tracing.
Chris Liddell b75abeb5 2019-01-08T20:51:39 [psaux] Fix closepath (#55414). All of the Type 1 path building is done with code common to the revised CFF engine, with the exception of closepath, which was still calling ps_builder_close_contour(), thus previously cached segments were not always written to the path, and glyph corruption, or even invalid outlines were possible. * src/psauc/psinterp.c (cf2_interpT2CharString) <cf2_cmdCLOSEPATH>: Switch to calling `cf2_glyphpath_closeOpenPath'.
Werner Lemberg afa043de 2018-12-25T22:44:05 Fix links (mostly http -> https).
Werner Lemberg 5e029659 2018-12-25T19:24:06 * src/psaux/cffdecode.c (cff_operaor_seac): Fix numeric overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11915
Werner Lemberg 58e48e92 2018-11-09T12:14:35 [psaux] Add safety guard (#54985). * src/psaux/psobjs.c (cff_builder_close_contour): Do it.
Werner Lemberg 5b86f53d 2018-11-06T11:08:41 [psaux] Fix timeout in old CFF engine. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11260 * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_sqrt> [CFF_CONFIG_OPTION_OLD_ENGINE]: Fix potential endless loop.
Werner Lemberg bfe53294 2018-10-27T00:07:53 [psaux] Fix numeric overflow. Triggered by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11157 * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_blend> [CFF_CONFIG_OPTION_OLD_ENGINE]: Fix integer overflow.
Werner Lemberg 885f5b0b 2018-10-07T09:03:05 Fix handling of FT_CONFIG_OPTION_ADOBE_GLYPH_LIST (#54794). * src/cff/cffcmap.c (cff_cmap_unicode_init), src/psaux/t1cmap.c (t1_cmap_unicode_init), src/sfnt/ttcmap.c (tt_cmap_unicode_init): Check `unicodes_init' field.
Werner Lemberg 0a178144 2018-10-07T08:59:56 Whitespace.
Werner Lemberg d280ae1e 2018-10-02T20:45:16 [psaux] Fix segfault. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10768 * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_callothersubr> [CFF_CONFIG_OPTION_OLD_ENGINE]: Check argument.
Werner Lemberg 6b660f12 2018-10-02T16:48:59 [psaux] Fix numeric overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10768 * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_roll> [CFF_CONFIG_OPTION_OLD_ENGINE]: Use NEG_INT.
Werner Lemberg a9af6914 2018-09-25T09:10:09 Fix handing of `FT_Bool'. Before this commit we had code like (FT_Bool)( globals->glyph_styles[gindex] & 0x8000) Since `FT_Bool' is defined to be an `unsigned char', the code evaluated to something like (unsigned char)( 0x8532 & 0x8000) which in turn expanded to (unsigned char)( 0x8000) and finally yielded 0x00 – i.e., false – not as expected. Problem reported and analyzed by Tony Smith <tony.smith@macro4.com>. * include/freetype/fttypes.h (FT_BOOL): Add a comparison against zero so that we always have a Boolean expression. */*: Replace castings to `FT_Bool' with calls to `FT_BOOL' where possible.
Werner Lemberg 76a52465 2018-09-03T09:08:47 */*: s/PSNames/psnames/. Only tracing messages are affected.
Werner Lemberg 3915a18b 2018-08-29T06:53:54 [cff] Fix handling of `roll' op in old engine. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10080 * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_roll> [CFF_CONFIG_OPTION_OLD_ENGINE]: Use modulo for loop count, as documented in the specification.
Werner Lemberg 4dc0d48f 2018-08-18T14:39:20 [psaux] Avoid slow PS font parsing in case of error. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9955 * src/psaux/psobjs.c (ps_parser_to_bytes): Set `parser->cursor' even in case of error to avoid potential re-scanning.
Werner Lemberg 2550fc75 2018-08-18T13:38:48 [cff] Fix heap buffer overflow in old engine. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9967 * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_blend> [CFF_CONFIG_OPTION_OLD_ENGINE]: `num_designs' must be non-zero.
Werner Lemberg a0dd16fb 2018-08-15T18:13:17 Don't use `trace_' prefix for FT_COMPONENT arguments. * include/freetype/internal/ftdebug.h (FT_TRACE_COMP, FT_TRACE_COMP_): New auxiliary macros to add `trace_' prefix. (FT_TRACE): Use `FT_TRACE_COMP'. */* (FT_COMPONENT): Updated.
Werner Lemberg 1d7b034c 2018-08-14T15:48:17 Use formatting string in FT_TRACEX calls for non-simple arguments. * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_hstem, cff_op_hintmask, cff_op_hlineto, cff_op_vhcurveto>: Do it. * src/psaux/pshints.c (cf2_hintmap_build): Ditto. * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdHSTEM, cf2_cmdVSTEM, cf2_cmdHLINETO, cf2_cmdRRCURVETO, cf2_cmdCALLSUBR, cf2_escHSTEM3, cf2_cmdHINTMASK, cf2_cmdHVCURVETO>: Ditto. * src/truetype/ttinterp.c (TT_RunIns): Ditto.
Werner Lemberg 44db1add 2018-08-14T10:01:00 [cff] Fix another segv in old engine. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9872 * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) [CFF_CONFIG_OPTION_OLD_ENGINE]: Disallow invalid T1 opcodes in dictionaries.
Werner Lemberg 757bdf1a 2018-08-14T02:02:26 [cff] Fix segv. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9864 * src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_random> [CFF_CONFIG_OPTION_OLD_ENGINE]: Use top dict's `random' field directly if parsing dictionaries.
Werner Lemberg d277bfc9 2018-07-27T09:15:43 [psaux, type1]: More tracing improvements. * src/psaux/psintrp.c (cf2_interpT2CharString): Trace skipped outline commands. * src/psaux/t1decode.c (t1_decoder_parse_charstring): Fix missing case. (t1_decoder_parse_metrics): Make tracing output more compact. * src/type1/t1gload.c (T1_Compute_Max_Advance): Be less verbose. (T1_Get_Advances): Add tracing.
Werner Lemberg 8ed53468 2018-07-25T22:07:22 [psaux, type1] Trace PostScript dictionaries and other things. The tracing of /Encoding, /Subrs, and /Charstrings is rudimentary right now. * src/psaux/psobjs.c (ps_parser_load_field, ps_parser_load_field_table): Add tracing calls. * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Make tracing output more compact. * src/type1/t1gload.c (T1_Compute_Max_Advance, T1_Get_Advances): Add tracing messages. * src/type1/t1load.c (parse_blend_axis_types, parse_blend_design_positions, parse_blend_design_map, parse_weight_vector, t1_load_keyword, t1_parse_font_matrix, parse_encoding, parse_subrs, parse_charstrings, T1_Open_Face): Add tracing calls. * src/type1/t1objs.c (T1_Face_Init): Add tracing call. * src/sfnt/sfobjs.c (sfnt_init_face): Make tracing message more verbose.
Nikhil Ramakrishnan 78d85b9c 2018-06-04T18:42:29 Restore missing comment lines and other minor fixes
Werner Lemberg 9ac9060d 2018-06-03T09:01:17 [GSoC] src/*.*: Convert block comments to `light' style. This monster commit was created by applying Nikhil's scripts `docconverter.py' and `markify.py' to all C header and source files, followed up by minor manual clean-up. No change in functionality, of course. I used commit f7419907bc6044b9b7057f9789866426c804ba82 from https://github.com/nikramakrishnan/freetype-docs.git.
Werner Lemberg 49c5e24a 2018-05-15T21:55:28 [psaux] Fix compiler warning (#53915). * src/psaux/psft.c (cf2_freeT1SeacComponent): Do it.
Werner Lemberg 95149592 2018-05-02T20:27:48 Remove FT_CONFIG_OPTION_PIC and related code. */* [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.
Ewald Hew cc2f3cde 2018-01-10T13:24:56 [psaux] Correctly handle Flex features (#52846). * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdVMOVETO, cf2_cmdHMOVETO>: Do not move if doing Flex.
Ewald Hew 21bd9c2f 2018-01-07T16:38:54 [psaux] Fix Type 1 glyphs with too many stem hints. According to the CFF specification, charstrings can have up to 96 stem hints. Due to hint replacement routines in Type 1 charstrings, some glyphs are rejected by the Adobe engine, which implements the above limit. This fix turns off hinting for such glyphs. * src/psaux/pshints.c (cf2_hintmap_build): Reset the error from calling `cf2_hintmask_setAll' on a problematic Type 1 charstring and turn off hinting.
Werner Lemberg 0a0c2256 2018-01-02T09:33:57 Update copyright year.
Werner Lemberg 98ba0c4a 2017-12-08T18:38:41 New `ftdriver.h' file, covering all driver modules. 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.
Werner Lemberg d21f995a 2017-12-07T14:49:03 Fix C++ compilation. * src/psaux/psauxmod.h: Use FT_CALLBACK_TABLE macro where necessary. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix warning.
Werner Lemberg 63b91548 2017-12-07T14:33:44 Fix `make multi'. * 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'.
Werner Lemberg 87ddad20 2017-12-04T20:43:30 Update or fix links to use the https protocol instead of http.
Ewald Hew bec14f68 2017-11-22T18:57:56 * src/psaux/psft.c (cf2_setGlyphWidth): Check format before setting. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4377
Ewald Hew b9bd2d14 2017-11-22T12:32:47 [psaux] Fix CFF advance widths. (#52466) 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.
Ewald Hew cdab9cfa 2017-10-21T16:36:49 [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251) The interpreter in Type 1 mode rewinds the charstring after collecting all hints for building the initial hintmap (commit d52dd7f). However, some charstrings use `endchar' in a final subroutine call, rewinding to the start of that subroutine, and only a small section of the actual glyph is drawn. * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdENDCHAR>: Ensure we are on the top level charstring before rewinding.
Ewald Hew dff40d03 2017-10-12T18:13:21 Add T1_CONFIG_OPTION_OLD_ENGINE configuration option. 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.
Ewald Hew 78df3c27 2017-10-12T18:13:08 Extract width parsing from Type 1 parser. 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.
Werner Lemberg 179caf5a 2017-10-01T01:39:27 [psaux] Formatting, minor fixes, whitespace, copyright notices.
Werner Lemberg ec7d2e5f 2017-09-28T14:21:34 * src/psaux/psintrp.c (cf2_doStems): Fix integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3510
Ewald Hew dd40d10e 2017-09-28T10:42:23 Fix compiler warning. * src/psaux/pshints.c (cf2_hintmap_dump): Add switch for tracing code.
Werner Lemberg 12ae57d9 2017-09-26T12:53:41 Copyright notices, formatting, whitespace, minor doc fixes.
Werner Lemberg 4cdbac05 2017-09-25T09:05:00 Fix compiler warnings. * src/psaux/psft.c (cf2_initLocalRegionBuffer): Remove redundant test. * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escCALLOTHERSUBR>: Add casts. * src/psaux/psobjs.c (ps_decoder_init): Add cast.
Ewald Hew a1a6a1f6 2017-09-25T08:31:52 Minor fixes. * 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.
Ewald Hew 6e7da50b 2017-09-25T08:29:38 Documentation fixes.
Ewald Hew ebb1735a 2017-09-25T08:26:57 Move `psdecode' into `psobjs'. 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.
Ewald Hew d52dd7f3 2017-09-25T08:22:26 Fix Type 1 hinting. Type 1 hinting breaks sometimes when mid-charstring hints should have been in the initial hintmap. This fix adds a preprocessing pass that reads all hints and builds the correct initial hintmap first, before proceeding to build the glyph outline. * src/psaux/psintrp.c (cf2_interpT2CharString): New `initial_map_ready' boolean flag. Ignore outline commands and hint changes on first pass. <cf2_cmdENDCHAR>: Add section to build hintmap and rewind.
Ewald Hew 2f0e1140 2017-09-25T08:19:33 Add tracing for hints. * src/psaux/pshints.c (cf2_hintmap_dump): New function. (cf2_hintmap_insertHint): Trace incoming and inserted hints. (cf2_hintmap_build): Dump hintmap before and after hint adjustment.
Ewald Hew 999a75b6 2017-09-25T08:16:59 Minor fixes. * src/psaux/psintrp.c (cf2_interpT2CharString): Fix check for pop results. s/font->decoder/decoder/ where necessary. <cf2_cmdHSTEM, cf2_cmdVSTEM, cf2_escHSTEM3, cf2_escVSTEM3>: Use offset parameter in `cf2_doStems' instead of doing correction for left-sidebearing.
Ewald Hew 93e3cffd 2017-09-25T08:08:21 Change subfont synthesis for CID fonts. 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.
Ewald Hew d813b5da 2017-09-25T08:04:09 Extend Adobe interpreter (seac). This concludes the changes needed to add Type 1 support. * src/psaux/psintrp.c: Update includes. (cf2_interpT2CharString) <cf2_escSEAC>: Implement this similarly to implied seac for CFF. * src/psaux/t1decode.c (t1_lookup_glyph_by_stdcharcode_ps): New function to look up the glyph index. * src/psaux/psft.c (cf2_getT1SeacComponent, cf2_freeT1SeacComponent): New functions to get the charstrings for seac components. * src/psaux/t1decode.h, src/psaux/psft.h: Update declarations.
Ewald Hew d55a701d 2017-09-25T07:59:41 Extend Adobe interpreter (flex in callothersubr). * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escCALLOTHERSUBR>: Fix Flex feature handling (OtherSubrs 0, 1, 2). <cf2_cmdRMOVETO>: Do not actually move the `glyphPath' while doing flex. This is to avoid closing the current contour.
Ewald Hew 96682559 2017-09-25T07:54:02 Extend Adobe interpreter (callothersubr). * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escCALLOTHERSUBR>: Copy code from `t1_decoder_parse_charstrings' (in `t1decode.c'). OtherSubr 3 (change hints) should reset the hintmask, so that the new hints are applied. Fix function calls and stack access.
Ewald Hew 77c1b331 2017-09-25T07:50:03 Extend Adobe interpreter (pop). * src/psaux/psintrp.c (cf2_interpT2CharString): Change how unhandled OtherSubr results are stored. Implement the PostScript stack using an array. <cf2_escPOP>: Ensure that the stack is not cleared after getting `OtherSubr' results. Fix stack access.
Ewald Hew 1e4d3dc8 2017-09-25T07:47:10 Extend Adobe interpreter (callsubr). * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdCALLSUBR>: Type 1 mode. * src/psaux/psft.c (cf2_initLocalRegionBuffer): Add Type 1 mode.
Ewald Hew 4b58c518 2017-09-25T07:44:56 Extend Adobe interpreter (div, four-byte numbers). * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escDIV>: Add Type 1 mode. Type 1 requires large integers to be followed by `div'; cf. `Adobe Type 1 Font Format', section 6.2. <op == 255>: Push Type 1 four-byte numbers as `Int' always. This is to ensure `div' and `callsubr' get values they can use.
Ewald Hew 81b86c45 2017-09-25T07:14:18 Extend Adobe interpreter (hstem, vstem, hstem3, vstem3). * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdHSTEM, cf2_cmdVSTEM>: Add correction for left sidebearing in Type 1 mode. Allow adding hints mid-charstring. <cf2_escVSTEM3, cf2_escHSTEM3>: Translate into equivalent commands for three normal stem hints. This requires some recalculation of stem positions. Correction for left sidebearing.
Ewald Hew e180afa9 2017-09-25T07:11:03 Extend Adobe interpreter (hsbw, sbw). * src/psaux/psintrp.c (cf2_doStems): `hsbw' or `sbw' must be the first operation in a Type 1 charstring. (cf2_interpT2CharString): Remove unused variables. <cf2_cmdHMOVETO, cf2_cmdVMOVETO, cf2_cmdRMOVETO>: `hsbw' or `sbw' must be the first operation in a Type 1 charstring. <cf2_cmdHSBW, cf2_escSBW>: Fix data access and add correction for left sidebearing.
Ewald Hew 2f4abaec 2017-09-25T07:04:43 Extend Adobe interpreter (setcurrentpoint). * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escSETCURRENTPT>: Fix stack access.
Ewald Hew 4ed1b98d 2017-09-25T07:02:53 Extend Adobe interpreter (closepath). * src/psaux/psintrp.c (cf2_interpT2CharString) <c2f_cmdCLOSEPATH>: Use the right builder function. We can use the `haveWidth' boolean already present, instead of implementing `parse_state'.
Ewald Hew 37ed70f6 2017-09-25T06:59:26 Add Type 1 operations to Adobe CFF interpreter. The following Type 1 specific ops have been added (copied from `t1decode'): closepath vstem3 hstem3 seac sbw callothersubr pop setcurrentpoint hsbw The following require a Type 1 mode, because of differences in specification: hstem vstem vmoveto callsubr div rmoveto hmoveto Numbers The subsequent commits will implement these changes and adapt accesses of data and objects to the new interpreter. NOTE: Will not compile in the meantime! * src/psaux/psintrp.c: Add opcodes to enum. (cf2_interpT2CharString): Copy relevant code over from `t1_decoder_parse_charstrings' (in `t1decode.c').
Ewald Hew 6eb03f8f 2017-09-25T06:49:41 Add missing objects (2/2). 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.
Ewald Hew cb3f4c61 2017-09-25T06:44:51 Add missing objects for Type 1 (1/2). 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.
Ewald Hew 7e185dcd 2017-09-25T06:40:32 Allow `type1' module to use the Adobe engine. 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.
Ewald Hew 645d1b86 2017-09-25T06:28:25 Move and rename `CFF_Driver'. 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.
Ewald Hew d23affe1 2017-09-25T06:22:52 Reorganize object fields. 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.
Ewald Hew 9428ee42 2017-09-25T06:15:46 Prepare for Type 1 mode. Add some checks for Type 1 data passing through. * src/psaux/psfont.h (CF2_Font): Add `isT1' flag. * src/psaux/psfont.c (cf2_font_setup): Skip the variations and blend code which is not applicable for Type 1. * src/psaux/psft.c (cf2_decoder_parse_charstrings): Avoid accessing `decoder->cff' in Type 1 mode. Copy `is_t1' flag to `CF2_Font'.
Ewald Hew 0589e3c0 2017-09-25T06:10:20 Use the new objects. * 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.
Ewald Hew 43c01582 2017-09-24T23:00:36 Objects for new interpreter (part 2). 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.
Ewald Hew eba54c28 2017-09-24T22:49:56 Add objects for new interpreter. 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.
Ewald Hew 766f529a 2017-09-24T22:40:07 Rename files. Replace the `cf2' file name prefix with `ps' as the Adobe engine will be used for both PostScript Types 1 and 2 (CFF) instead of just CFF. s/cf2/ps/ for all following. * src/psaux/cf2*: Rename files. * src/psaux/*: Update includes. * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRC_SRC, PSAUX_DRV_H): Update file references.
Ewald Hew 8a1b5c0c 2017-09-24T22:35:47 Minor fix. Use `MultiMasters' service in `psaux' instead of a call to `cff'. The project builds if CFF_CONFIG_OPTION_OLD_ENGINE is not defined. * src/psaux/cf2ft.c: Update includes. (cf2_getNormalizedVector): Use `mm->get_var_blend' instead of `cff_get_var_blend'.
Ewald Hew b624868b 2017-09-24T22:32:40 Move `cff_random' into `psaux' service. 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.
Ewald Hew df11628b 2017-09-24T22:28:07 Move struct declarations to `freetype/internal'. 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.
Ewald Hew edacde60 2017-09-24T22:20:38 Add new service for inter-module calls. 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.
Ewald Hew 9578e07a 2017-09-24T22:05:32 Add callbacks for inter-module calls. 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.
Ewald Hew 1487be58 2017-09-24T21:56:54 Create new `PSAux' service interface entries. 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.
Ewald Hew 816c9c1f 2017-09-24T21:43:05 Move CFF builder components into `psaux' module. NOTE: Does not compile! * src/cff/cffgload.c (cff_builder_{init,done,add_point,add_point1,add_contour,start_point,close_contour}, cff_check_points): Move to... * src/psaux/psobjs.c: Here. * src/cff/cffgload.h: Move corresponding declarations to `src/psaux/psobjs.h'. * src/cff/cffgload.h (CFF_Builder): Move struct declaration to... * include/freetype/internal/psaux.h: Here.
Ewald Hew 705bbe7c 2017-09-24T21:39:20 Move CFF decoder components into `psaux' module. NOTE: Does not compile! * src/cff/cffgload.c (CFF_Operator, CFF_COUNT_{CHECK_WIDTH,EXACT,CLEAR_STACK}, cff_argument_counts, cff_operator_seac, cff_compute_bias, cff_lookup_glyph_by_stdcharcode, cff_decoder_{parse_charstrings,init,prepare}): Move to... * src/psaux/cffdecode.c: This new file. * src/cff/cffgload.h: Move corresponding declarations to... * src/psaux/cffdecode.h: This new file. * src/cff/cffgload.h (CFF_MAX_{OPERANDS,SUBRS_CALLS,TRANS_ELEMENTS}, CFF_Decoder_Zone, CFF_Decoder): Move declarations to... * include/freetype/internal/psaux.h: Here. * src/psaux/cf2ft.h: Update include. * src/psaux/psaux.c, src/psaux/rules.mk (PSAUX_DRV_SRC): Update with the new file.
Ewald Hew 62f095f0 2017-09-25T09:25:55 [psaux, cff] Move Adobe's engine components into `psaux' module. This is the first patch of a sequence to move the Type 2 charstring processing capability from the `cff' module to the `psaux' module. NOTE: Does not compile! * src/cff/cf2*: Move these files to... * src/psaux/cf2*: Here. * src/cff/Jamfile (_sources), src/cff/rules.mk (CFF_DRV_SRC, CFF_DRV_H), src/cff/cff.c, src/cff/cffgload.c: Remove file references. * src/psaux/Jamfile (_sources), src/psaux/rules.mk, src/psaux/psaux.c (PSAUX_DRV_SRC, PSAUX_DRV_H): Add file references.
Werner Lemberg dcd8de27 2017-06-09T11:21:58 */*: Remove `OVERFLOW_' prefix. This increases readability.
Werner Lemberg 4a1f1a6d 2017-06-01T13:15:54 [psaux] 32bit integer overflow tun-time errors (#46149). * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where appropriate.
Werner Lemberg 0e7b9f86 2017-05-30T22:22:19 [psaux] Correctly handle sequences of multiple number signs. * src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed): Return zero if we encounter more than a single sign.
Werner Lemberg 5412d886 2017-04-22T12:48:50 Introduce `FT_Size_InternalRec' structure. 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'.
Werner Lemberg 3774fc08 2017-03-26T08:32:09 * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=941
Werner Lemberg f958c48e 2017-03-24T09:15:10 [psaux] Better protect `flex' handling. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=935 * src/psaux/t1decode.c (t1_decoder_parse_charstrings) <callothersubr>: Since there is not a single flex operator but a series of subroutine calls, malformed fonts can call arbitrary other operators after the start of a flex, possibly adding points. For this reason we have to check the available number of points before inserting a point.
Werner Lemberg 9931175d 2017-03-18T07:06:49 Improve `make multi'. * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/sfnt/pngshim.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. * src/sfnt/ttbdf.c: Avoid empty source file. * src/sfnt/ttpost.c: Guard file with TT_CONFIG_OPTION_POSTSCRIPT_NAMES. * src/sfnt/ttsbit.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS. * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty source file. * src/truetype/ttsubpix.c: Guard file with TT_USE_BYTECODE_INTERPRETER also. * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort entries.
Werner Lemberg 563ae780 2017-01-04T20:16:34 Update copyright year.