LookupsCache.java 1.3 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.fontengine.inlineformatting.infontformatting;

import com.adobe.fontengine.font.InvalidFontException;
import com.adobe.fontengine.font.opentype.LookupTable;
import java.util.HashMap;
import java.util.WeakHashMap;

final class LookupsCache {
    static final WeakHashMap lookupTableMap = new WeakHashMap();

    LookupsCache() {
    }

    static int[][] resolveFeatureTag(LookupTable table, int scriptTag, int langTag, int[] featureTags) throws InvalidFontException {
        HashMap<Integer, int[][]> scriptEntry;
        int[][] lookups;
        HashMap lookupTableEntry = (HashMap)lookupTableMap.get(table);
        if (lookupTableEntry == null) {
            lookupTableEntry = new HashMap();
            lookupTableMap.put(table, lookupTableEntry);
        }
        if ((scriptEntry = (HashMap<Integer, int[][]>)lookupTableEntry.get(new Integer(scriptTag))) == null) {
            scriptEntry = new HashMap<Integer, int[][]>();
            lookupTableEntry.put(new Integer(scriptTag), scriptEntry);
        }
        if ((lookups = (int[][])scriptEntry.get(new Integer(langTag))) == null) {
            lookups = table.resolveFeatureTag(scriptTag, langTag, featureTags);
            scriptEntry.put(new Integer(langTag), lookups);
        }
        return lookups;
    }
}