diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/CharFlagsTextProp.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/CharFlagsTextProp.java index a78c2c27e..f03878153 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/CharFlagsTextProp.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/CharFlagsTextProp.java @@ -35,19 +35,19 @@ public class CharFlagsTextProp extends BitMaskTextProp { public static String NAME = "char_flags"; public CharFlagsTextProp() { super(2,0xffff, NAME, new String[] { - "bold", // 0x0001 - "italic", // 0x0002 - "underline", // 0x0004 - "char_unknown_1",// 0x0008 - "shadow", // 0x0010 - "char_unknown_2",// 0x0020 - "char_unknown_3",// 0x0040 - "char_unknown_4",// 0x0080 - "strikethrough", // 0x0100 - "relief", // 0x0200 - "reset_numbering", // 0x0400 - "enable_numbering_1", // 0x0800 - "enable_numbering_2", // 0x1000 + "bold", // 0x0001 A bit that specifies whether the characters are bold. + "italic", // 0x0002 A bit that specifies whether the characters are italicized. + "underline", // 0x0004 A bit that specifies whether the characters are underlined. + "char_unknown_1", // 0x0008 Undefined and MUST be ignored. + "shadow", // 0x0010 A bit that specifies whether the characters have a shadow effect. + "fehint", // 0x0020 A bit that specifies whether characters originated from double-byte input. + "char_unknown_2", // 0x0040 Undefined and MUST be ignored. + "kumi", // 0x0080 A bit that specifies whether Kumimoji are used for vertical text. + "strikethrough", // 0x0100 Undefined and MUST be ignored. + "emboss", // 0x0200 A bit that specifies whether the characters are embossed. + "char_unknown_3", // 0x0400 Undefined and MUST be ignored. + "char_unknown_4", // 0x0800 Undefined and MUST be ignored. + "char_unknown_5", // 0x1000 Undefined and MUST be ignored. } ); } diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java index bcf4b997c..f876c7d38 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java @@ -34,6 +34,7 @@ public class TextPropCollection { private int charactersCovered; private short reservedField; private LinkedList textPropList; + private int maskSpecial = 0; /** Fetch the number of characters this styling applies to */ public int getCharactersCovered() { return charactersCovered; } @@ -94,21 +95,28 @@ public class TextPropCollection { // If we do, decode that, save it, and shuffle on for(int i=0; i= data.length) { - // Out of data, can't be any more properties to go - return bytesPassed; - } - + // Check if this property is found in the mask if((containsField & potentialProperties[i].getMask()) != 0) { + if(dataOffset+bytesPassed >= data.length) { + // Out of data, can't be any more properties to go + // remember the mask and return + maskSpecial |= potentialProperties[i].getMask(); + return bytesPassed; + } + // Bingo, data contains this property TextProp prop = (TextProp)potentialProperties[i].clone(); int val = 0; if(prop.getSize() == 2) { val = LittleEndian.getShort(data,dataOffset+bytesPassed); - } else { + } else if(prop.getSize() == 4){ val = LittleEndian.getInt(data,dataOffset+bytesPassed); - } + } else if (prop.getSize() == 0){ + //remember "special" bits. + maskSpecial |= potentialProperties[i].getMask(); + continue; + } prop.setValue(val); bytesPassed += prop.getSize(); textPropList.add(prop); @@ -161,15 +169,18 @@ public class TextPropCollection { } // Then the mask field - int mask = 0; + int mask = maskSpecial; for(int i=0; i