equal
deleted
inserted
replaced
564 */ |
564 */ |
565 } |
565 } |
566 |
566 |
567 char getGlyph(int charCode) { |
567 char getGlyph(int charCode) { |
568 |
568 |
|
569 final int origCharCode = charCode; |
569 int index = 0; |
570 int index = 0; |
570 char glyphCode = 0; |
571 char glyphCode = 0; |
571 |
572 |
572 int controlGlyph = getControlCodeGlyph(charCode, true); |
573 int controlGlyph = getControlCodeGlyph(charCode, true); |
573 if (controlGlyph >= 0) { |
574 if (controlGlyph >= 0) { |
635 if (glyphCode != 0) { |
636 if (glyphCode != 0) { |
636 glyphCode = (char)(glyphCode + idDelta[index]); |
637 glyphCode = (char)(glyphCode + idDelta[index]); |
637 } |
638 } |
638 } |
639 } |
639 } |
640 } |
640 if (glyphCode != 0) { |
641 if (glyphCode == 0) { |
641 //System.err.println("cc="+Integer.toHexString((int)charCode) + " gc="+(int)glyphCode); |
642 glyphCode = getFormatCharGlyph(origCharCode); |
642 } |
643 } |
643 return glyphCode; |
644 return glyphCode; |
644 } |
645 } |
645 } |
646 } |
646 |
647 |
802 glyphIndexArray[i] = cBuffer.get(); |
803 glyphIndexArray[i] = cBuffer.get(); |
803 } |
804 } |
804 } |
805 } |
805 |
806 |
806 char getGlyph(int charCode) { |
807 char getGlyph(int charCode) { |
|
808 final int origCharCode = charCode; |
807 int controlGlyph = getControlCodeGlyph(charCode, true); |
809 int controlGlyph = getControlCodeGlyph(charCode, true); |
808 if (controlGlyph >= 0) { |
810 if (controlGlyph >= 0) { |
809 return (char)controlGlyph; |
811 return (char)controlGlyph; |
810 } |
812 } |
811 |
813 |
857 if (glyphCode != 0) { |
859 if (glyphCode != 0) { |
858 glyphCode += idDeltaArray[key]; //idDelta |
860 glyphCode += idDeltaArray[key]; //idDelta |
859 return glyphCode; |
861 return glyphCode; |
860 } |
862 } |
861 } |
863 } |
862 return 0; |
864 return getFormatCharGlyph(origCharCode); |
863 } |
865 } |
864 } |
866 } |
865 |
867 |
866 // Format 6: Trimmed table mapping |
868 // Format 6: Trimmed table mapping |
867 static class CMapFormat6 extends CMap { |
869 static class CMapFormat6 extends CMap { |
881 glyphIdArray[i] = buffer.get(); |
883 glyphIdArray[i] = buffer.get(); |
882 } |
884 } |
883 } |
885 } |
884 |
886 |
885 char getGlyph(int charCode) { |
887 char getGlyph(int charCode) { |
|
888 final int origCharCode = charCode; |
886 int controlGlyph = getControlCodeGlyph(charCode, true); |
889 int controlGlyph = getControlCodeGlyph(charCode, true); |
887 if (controlGlyph >= 0) { |
890 if (controlGlyph >= 0) { |
888 return (char)controlGlyph; |
891 return (char)controlGlyph; |
889 } |
892 } |
890 |
893 |
892 charCode = xlat[charCode]; |
895 charCode = xlat[charCode]; |
893 } |
896 } |
894 |
897 |
895 charCode -= firstCode; |
898 charCode -= firstCode; |
896 if (charCode < 0 || charCode >= entryCount) { |
899 if (charCode < 0 || charCode >= entryCount) { |
897 return 0; |
900 return getFormatCharGlyph(origCharCode); |
898 } else { |
901 } else { |
899 return glyphIdArray[charCode]; |
902 return glyphIdArray[charCode]; |
900 } |
903 } |
901 } |
904 } |
902 } |
905 } |
1030 power = 1 << highBit; |
1033 power = 1 << highBit; |
1031 extra = numGroups - power; |
1034 extra = numGroups - power; |
1032 } |
1035 } |
1033 |
1036 |
1034 char getGlyph(int charCode) { |
1037 char getGlyph(int charCode) { |
|
1038 final int origCharCode = charCode; |
1035 int controlGlyph = getControlCodeGlyph(charCode, false); |
1039 int controlGlyph = getControlCodeGlyph(charCode, false); |
1036 if (controlGlyph >= 0) { |
1040 if (controlGlyph >= 0) { |
1037 return (char)controlGlyph; |
1041 return (char)controlGlyph; |
1038 } |
1042 } |
1039 int probe = power; |
1043 int probe = power; |
1055 endCharCode[range] >= charCode) { |
1059 endCharCode[range] >= charCode) { |
1056 return (char) |
1060 return (char) |
1057 (startGlyphID[range] + (charCode - startCharCode[range])); |
1061 (startGlyphID[range] + (charCode - startCharCode[range])); |
1058 } |
1062 } |
1059 |
1063 |
1060 return 0; |
1064 return getFormatCharGlyph(origCharCode); |
1061 } |
1065 } |
1062 |
1066 |
1063 } |
1067 } |
1064 |
1068 |
1065 /* Used to substitute for bad Cmaps. */ |
1069 /* Used to substitute for bad Cmaps. */ |
1077 switch (charCode) { |
1081 switch (charCode) { |
1078 case 0x0009: |
1082 case 0x0009: |
1079 case 0x000a: |
1083 case 0x000a: |
1080 case 0x000d: return CharToGlyphMapper.INVISIBLE_GLYPH_ID; |
1084 case 0x000d: return CharToGlyphMapper.INVISIBLE_GLYPH_ID; |
1081 } |
1085 } |
1082 } else if (charCode >= 0x200c) { |
1086 } else if (noSurrogates && charCode >= 0xFFFF) { |
|
1087 return 0; |
|
1088 } |
|
1089 return -1; |
|
1090 } |
|
1091 |
|
1092 final char getFormatCharGlyph(int charCode) { |
|
1093 if (charCode >= 0x200c) { |
1083 if ((charCode <= 0x200f) || |
1094 if ((charCode <= 0x200f) || |
1084 (charCode >= 0x2028 && charCode <= 0x202e) || |
1095 (charCode >= 0x2028 && charCode <= 0x202e) || |
1085 (charCode >= 0x206a && charCode <= 0x206f)) { |
1096 (charCode >= 0x206a && charCode <= 0x206f)) { |
1086 return CharToGlyphMapper.INVISIBLE_GLYPH_ID; |
1097 return (char)CharToGlyphMapper.INVISIBLE_GLYPH_ID; |
1087 } else if (noSurrogates && charCode >= 0xFFFF) { |
1098 } |
1088 return 0; |
1099 } |
1089 } |
1100 return 0; |
1090 } |
|
1091 return -1; |
|
1092 } |
1101 } |
1093 |
1102 |
1094 static class UVS { |
1103 static class UVS { |
1095 int numSelectors; |
1104 int numSelectors; |
1096 int[] selector; |
1105 int[] selector; |