ansiIndex = new java.util.HashMap();
for (int i = 32; i < Glyphs.WINANSI_ENCODING.length; i++) {
Integer ansi = new Integer(i);
- Integer uni = new Integer((int)Glyphs.WINANSI_ENCODING[i]);
+ Integer uni = new Integer(Glyphs.WINANSI_ENCODING[i]);
List v = (List)ansiIndex.get(uni);
if (v == null) {
* @return int The CapHeight
*/
public int getCapHeight() {
- return (int)convertTTFUnit2PDFUnit(capHeight);
+ return convertTTFUnit2PDFUnit(capHeight);
}
/**
* @return int The XHeight
*/
public int getXHeight() {
- return (int)convertTTFUnit2PDFUnit(xHeight);
+ return convertTTFUnit2PDFUnit(xHeight);
}
/**
*/
public int[] getFontBBox() {
final int[] fbb = new int[4];
- fbb[0] = (int)convertTTFUnit2PDFUnit(fontBBox1);
- fbb[1] = (int)convertTTFUnit2PDFUnit(fontBBox2);
- fbb[2] = (int)convertTTFUnit2PDFUnit(fontBBox3);
- fbb[3] = (int)convertTTFUnit2PDFUnit(fontBBox4);
+ fbb[0] = convertTTFUnit2PDFUnit(fontBBox1);
+ fbb[1] = convertTTFUnit2PDFUnit(fontBBox2);
+ fbb[2] = convertTTFUnit2PDFUnit(fontBBox3);
+ fbb[3] = convertTTFUnit2PDFUnit(fontBBox4);
return fbb;
}
* @return int The LowerCaseAscent
*/
public int getLowerCaseAscent() {
- return (int)convertTTFUnit2PDFUnit(ascender);
+ return convertTTFUnit2PDFUnit(ascender);
}
/**
* @return int The LowerCaseDescent
*/
public int getLowerCaseDescent() {
- return (int)convertTTFUnit2PDFUnit(descender);
+ return convertTTFUnit2PDFUnit(descender);
}
/**
public int[] getWidths() {
int[] wx = new int[mtxTab.length];
for (int i = 0; i < wx.length; i++) {
- wx[i] = (int)convertTTFUnit2PDFUnit(mtxTab[i].getWx());
+ wx[i] = convertTTFUnit2PDFUnit(mtxTab[i].getWx());
}
return wx;
* @return int Standard width
*/
public int getCharWidth(int idx) {
- return (int)convertTTFUnit2PDFUnit(ansiWidth[idx]);
+ return convertTTFUnit2PDFUnit(ansiWidth[idx]);
}
/**
adjTab = new java.util.HashMap();
}
adjTab.put(new Integer(j),
- new Integer((int)convertTTFUnit2PDFUnit(kpx)));
+ new Integer(convertTTFUnit2PDFUnit(kpx)));
kerningTab.put(iObj, adjTab);
}
}
System.out.println("Family name: " + familyName);
System.out.println("Subfamily name: " + subFamilyName);
System.out.println("Notice: " + notice);
- System.out.println("xHeight: " + (int)convertTTFUnit2PDFUnit(xHeight));
- System.out.println("capheight: " + (int)convertTTFUnit2PDFUnit(capHeight));
+ System.out.println("xHeight: " + convertTTFUnit2PDFUnit(xHeight));
+ System.out.println("capheight: " + convertTTFUnit2PDFUnit(capHeight));
int italic = (int)(italicAngle >> 16);
System.out.println("Italic: " + italic);
System.out.println();
System.out.println("Ascender: " + convertTTFUnit2PDFUnit(ascender));
System.out.println("Descender: " + convertTTFUnit2PDFUnit(descender));
- System.out.println("FontBBox: [" + (int)convertTTFUnit2PDFUnit(fontBBox1)
- + " " + (int)convertTTFUnit2PDFUnit(fontBBox2) + " "
- + (int)convertTTFUnit2PDFUnit(fontBBox3) + " "
- + (int)convertTTFUnit2PDFUnit(fontBBox4) + "]");
+ System.out.println("FontBBox: [" + convertTTFUnit2PDFUnit(fontBBox1)
+ + " " + convertTTFUnit2PDFUnit(fontBBox2) + " "
+ + convertTTFUnit2PDFUnit(fontBBox3) + " "
+ + convertTTFUnit2PDFUnit(fontBBox4) + "]");
}
/**
/**
* Create an empty loca table without updating checksum
*/
- private void createLoca(int size) throws IOException {
+ private void createLoca(int size) {
pad4();
locaOffset = currentPos;
writeULong(locaDirOffset + 4, currentPos);
//log.error("TrueType warning: " + ex.getMessage());
}
- try {
- createLoca(glyphs.size()); // create empty loca table
- } catch (IOException ex) {
- // Loca is optional (only required for OpenType (MS) fonts)
- //log.error("TrueType warning: " + ex.getMessage());
- }
+ createLoca(glyphs.size()); // create empty loca table
try {
createGlyf(in, glyphs);
* 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;