#141 cast adobe type 2 char string value to short

where the value is 28 the next two bytes indicate a short, not a 16 bit two's complement number, apparently, or i've misunderstood what the two's complement bit is about...
This commit is contained in:
Eliot Jones
2020-02-25 13:56:26 +00:00
parent 486ea446c5
commit 9f488809ac

View File

@@ -769,9 +769,7 @@ namespace UglyToad.PdfPig.Fonts.CompactFontFormat.CharStrings
{
var num = bytes[++i] << 8 | bytes[++i];
// Next 2 bytes are a 16-bit two's complement number.
// The twos complement of a number N in a B-bit system is 2^B - N. For 16 bits the result is 2^16 - num.
// A shortcut is to invert the bits of the number and add 1.
return (short) (~(num) + 1);
return (short) (num);
}
if (b >= 32 && b <= 246)