[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 5866b66: [ftdump] Hexdump composite glyf instru
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2-demos] master 5866b66: [ftdump] Hexdump composite glyf instructions too. |
Date: |
Fri, 19 Aug 2016 03:01:10 +0000 (UTC) |
branch: master
commit 5866b6685917b91ec6f1c0c14418458d95876aa6
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>
[ftdump] Hexdump composite glyf instructions too.
* src/ftdump.c (Print_Programs): Updated.
(Print_Bytecode): Cleaned up.
---
ChangeLog | 7 +++++++
src/ftdump.c | 44 +++++++++++++++++++++++++++++++++-----------
2 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5b31753..d2bc897 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2016-08-18 Alexei Podtelezhnikov <address@hidden>
+ [ftdump] Hexdump composite glyf instructions too.
+
+ * src/ftdump.c (Print_Programs): Updated.
+ (Print_Bytecode): Cleaned up.
+
+2016-08-18 Alexei Podtelezhnikov <address@hidden>
+
[ftdump] Implement hexdump of TrueType instructions.
This is useful when searching for interesting instructions. Pushed
diff --git a/src/ftdump.c b/src/ftdump.c
index 2f242ea..7394ac6 100644
--- a/src/ftdump.c
+++ b/src/ftdump.c
@@ -543,23 +543,23 @@
{
printf( " %02hx", buffer[i] );
- if ( buffer[i] == 0x41 )
- j = -2;
- else if ( buffer[i] == 0x40 )
+ if ( buffer[i] == 0x40 )
j = -1;
- else if ( 0xB8 <= buffer[i] && buffer[i] <= 0xBF )
- j = 2 * ( buffer[i] - 0xB7 );
+ else if ( buffer[i] == 0x41 )
+ j = -2;
else if ( 0xB0 <= buffer[i] && buffer[i] <= 0xB7 )
j = buffer[i] - 0xAF;
+ else if ( 0xB8 <= buffer[i] && buffer[i] <= 0xBF )
+ j = 2 * ( buffer[i] - 0xB7 );
}
else
{
printf( "_%02hx", buffer[i] );
- if ( j == -2 )
- j = 2 * buffer[i];
- else if ( j == -1 )
+ if ( j == -1 )
j = buffer[i];
+ else if ( j == -2 )
+ j = 2 * buffer[i];
else
j--;
}
@@ -664,10 +664,32 @@
len = (FT_UInt16)buffer[loc ] << 8 |
(FT_UInt16)buffer[loc + 1];
- if ( (FT_Int16)len < 0 ) /* composite */
- continue;
+ loc += 10;
- loc += 2 * len + 10;
+ if ( (FT_Int16)len < 0 ) /* composite */
+ {
+ FT_UShort flags;
+
+
+ do
+ {
+ flags = (FT_UInt16)buffer[loc ] << 8 |
+ (FT_UInt16)buffer[loc + 1];
+
+ loc += 4;
+
+ loc += flags & FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ? 4 : 2;
+
+ loc += flags & FT_SUBGLYPH_FLAG_SCALE ? 2
+ : flags & FT_SUBGLYPH_FLAG_XY_SCALE ? 4
+ : flags & FT_SUBGLYPH_FLAG_2X2 ? 8 : 0;
+ } while ( flags & 0x20 ); /* more components */
+
+ if ( ( flags & 0x100 ) == 0 )
+ continue;
+ }
+ else
+ loc += 2 * len;
len = (FT_UInt16)buffer[loc ] << 8 |
(FT_UInt16)buffer[loc + 1];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 5866b66: [ftdump] Hexdump composite glyf instructions too.,
Alexei Podtelezhnikov <=