[cff] Trace charstring nesting levels. * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdCALLGSUBR, cf2_cmdCALLSUBR, cf2_cmdRETURN>: Implement it. * src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_callsubr, cff_op_callgsubr, cff_op_return>: Ditto.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/ChangeLog b/ChangeLog
index 7a4e3b2..7d58921 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-03-27 Werner Lemberg <wl@gnu.org>
+
+ [cff] Trace charstring nesting levels.
+
+ * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdCALLGSUBR,
+ cf2_cmdCALLSUBR, cf2_cmdRETURN>: Implement it.
+
+ * src/cff/cffgload.c (cff_decoder_parse_charstrings)
+ <cff_op_callsubr, cff_op_callgsubr, cff_op_return>: Ditto.
+
2015-03-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Optimize `FT_Angle_Diff'.
diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c
index 5ee4e55..d7f7a7b 100644
--- a/src/cff/cf2intrp.c
+++ b/src/cff/cf2intrp.c
@@ -771,8 +771,9 @@
switch ( op1 )
{
case cf2_cmdCALLGSUBR:
- FT_TRACE4(( "(%d)\n",
- subrIndex + (CF2_UInt)decoder->globals_bias ));
+ FT_TRACE4(( " (idx %d, entering level %d)\n",
+ subrIndex + (CF2_UInt)decoder->globals_bias,
+ charstringIndex + 1 ));
if ( cf2_initGlobalRegionBuffer( decoder,
subrIndex,
@@ -785,8 +786,9 @@
default:
/* cf2_cmdCALLSUBR */
- FT_TRACE4(( "(%d)\n",
- subrIndex + (CF2_UInt)decoder->locals_bias ));
+ FT_TRACE4(( " (idx %d, entering level %d)\n",
+ subrIndex + (CF2_UInt)decoder->locals_bias,
+ charstringIndex + 1 ));
if ( cf2_initLocalRegionBuffer( decoder,
subrIndex,
@@ -802,7 +804,7 @@
continue; /* do not clear the stack */
case cf2_cmdRETURN:
- FT_TRACE4(( " return\n" ));
+ FT_TRACE4(( " return (leaving level %d)\n", charstringIndex ));
if ( charstringIndex < 1 )
{
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 414790a..b5bc4a2 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -2389,7 +2389,9 @@
decoder->locals_bias );
- FT_TRACE4(( " callsubr(%d)\n", idx ));
+ FT_TRACE4(( " callsubr (idx %d, entering level %d)\n",
+ idx,
+ zone - decoder->zones + 1 ));
if ( idx >= decoder->num_locals )
{
@@ -2431,7 +2433,9 @@
decoder->globals_bias );
- FT_TRACE4(( " callgsubr(%d)\n", idx ));
+ FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n",
+ idx,
+ zone - decoder->zones + 1 ));
if ( idx >= decoder->num_globals )
{
@@ -2468,7 +2472,8 @@
break;
case cff_op_return:
- FT_TRACE4(( " return\n" ));
+ FT_TRACE4(( " return (leaving level %d)\n",
+ decoder->zone - decoder->zones ));
if ( decoder->zone <= decoder->zones )
{