}
TTFMtxEntry mtxEntry = mtxTab[glyphIdx.intValue()];
long offset = glyphOffset + mtxEntry.getOffset() + 10;
- if (remappedComposites.contains(offset)) {
- return;
+
+ //Avoid duplicate remapping (see javadoc for remappedComposites above)
+ if (!remappedComposites.contains(offset)) {
+ remappedComposites.add(offset);
+ innerRemapComposite(in, glyphs, offset);
}
- remappedComposites.add(offset);
+ }
+ private void innerRemapComposite(FontFileReader in, Map<Integer, Integer> glyphs, long offset)
+ throws IOException {
Integer compositeIdx = null;
int flags = 0;
boolean moreComposites = true;
* Read a unsigned short value at given position
*/
private int readUShort(int pos) {
- int ret = (int)output[pos];
+ int ret = output[pos];
if (ret < 0) {
ret += 256;
}
ret = ret << 8;
- if ((int)output[pos + 1] < 0) {
- ret |= (int)output[pos + 1] + 256;
+ if (output[pos + 1] < 0) {
+ ret |= output[pos + 1] + 256;
} else {
- ret |= (int)output[pos + 1];
+ ret |= output[pos + 1];
}
return ret;
*/
private int maxPow2(int max) {
int i = 0;
- while (Math.pow(2, (double)i) < max) {
+ while (Math.pow(2, i) < max) {
i++;
}
}
private int log2(int num) {
- return (int)(Math.log((double)num) / Math.log(2));
+ return (int)(Math.log(num) / Math.log(2));
}
long sum = 0;
for (int i = 0; i < size; i += 4) {
- int l = (int)(output[start + i] << 24);
- l += (int)(output[start + i + 1] << 16);
- l += (int)(output[start + i + 2] << 16);
- l += (int)(output[start + i + 3] << 16);
+ int l = (output[start + i] << 24);
+ l += (output[start + i + 1] << 16);
+ l += (output[start + i + 2] << 16);
+ l += (output[start + i + 3] << 16);
sum += l;
if (sum > 0xffffffff) {
sum = sum - 0xffffffff;