private Map<Integer, Float> calculateCIDWidths() {
        HashMap<Integer, Float> cidWidths = new HashMap<Integer, Float>(75);
        // get width vector
        Object o = library.getObject(entries, "W");
        if (o instanceof Vector) {
            Vector cidWidth = (Vector) o;
            Object current;
            Object peek;
            Vector subWidth;
            int currentChar;
            for (int i = 0, max = cidWidth.size() - 1; i < max; i++) {
                current = cidWidth.get(i);
                peek = cidWidth.get(i + 1);
                // found format c[w1, w2 ... wn]
                if (current instanceof Integer &&
                        peek instanceof Vector) {
                    // apply Unicode mapping if any
                    currentChar = (Integer) current;
                    subWidth = (Vector) peek;
                    for (int j = 0, subMax = subWidth.size(); j < subMax; j++) {
                        if (subWidth.get(j) instanceof Integer) {
                            cidWidths.put(currentChar + j, (Integer) subWidth.get(j) / 1000f);
                        } else if (subWidth.get(j) instanceof Float) {
                            cidWidths.put(currentChar + j, (Float) subWidth.get(j) / 1000f);
                        }
                    }
                    i++;
                }
                if (current instanceof Integer &&
                        peek instanceof Integer) {
                    for (int j = (Integer) current; j <= (Integer) peek; j++) {
                        // apply Unicode mapping if any
                        currentChar = j;
                        if (cidWidth.get(i + 2) instanceof Integer){
                            cidWidths.put(currentChar, (Integer) cidWidth.get(i + 2) / 1000f);
                        }else if(cidWidth.get(i + 2) instanceof Float){
                            cidWidths.put(currentChar, (Float) cidWidth.get(i + 2) / 1000f);
                        }
                    }
                    i += 2;
                }
            }
        }
        return cidWidths;
    }