src/psaux/psintrp.c


Log

Author Commit Date CI Message
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.
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 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 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 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.
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 6e7da50b 2017-09-25T08:29:38 Documentation fixes.
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 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.