Base14Font.java 4.9 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.fontengine.fontmanagement;

import com.adobe.fontengine.font.Base14;
import com.adobe.fontengine.font.FontData;
import com.adobe.fontengine.font.FontInputStream;
import com.adobe.fontengine.font.FontLoadingException;
import com.adobe.fontengine.font.InvalidFontException;
import com.adobe.fontengine.font.UnsupportedFontException;
import com.adobe.fontengine.font.opentype.FontFactory;
import com.adobe.fontengine.font.opentype.OpenTypeFont;
import com.adobe.fontengine.fontmanagement.URLFont;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.lang.ref.SoftReference;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;

/*
 * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
 */
public final class Base14Font
extends URLFont {
    static final long serialVersionUID = 1;
    private final String mBase14CSSName;
    private final String mBase14PSName;
    private static final HashMap<String, HashMap<String, Object>> mBase14DescCache;

    public Base14Font(String resourceName, String base14CSSName, String base14PSName) {
        super(Base14.class.getResource(resourceName), 0);
        this.mBase14CSSName = base14CSSName;
        this.mBase14PSName = base14PSName;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    @Override
    protected synchronized FontData retrieveFontData() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        FontData font = null;
        try {
            font = (FontData)this.fontRef.get();
            if (font == null) {
                FontInputStream stream = new FontInputStream(this.outlineFileURL.openStream());
                try {
                    OpenTypeFont[] arr = FontFactory.load(stream, this.mBase14CSSName, this.mBase14PSName);
                    font = arr[this.index];
                    this.fontRef = new SoftReference<FontData>(font);
                }
                finally {
                    stream.close();
                }
            }
        }
        catch (IOException e) {
            throw new FontLoadingException(e);
        }
        return font;
    }

    @Override
    public String getCanonicalPath() {
        return null;
    }

    @Override
    public long getLength() {
        return 0;
    }

    @Override
    public long getLastModified() {
        return 0;
    }

    @Override
    public Object getCachedFontDescription(String key) {
        if (mBase14DescCache == null) {
            return null;
        }
        HashMap<String, Object> descMap = mBase14DescCache.get(this.mBase14PSName);
        if (descMap == null) {
            return null;
        }
        return descMap.get(key);
    }

    public Iterator<String> getCachedFontDescriptionIterator() {
        return null;
    }

    @Override
    public void setCachedFontDescription(String key, Object value) {
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Unable to fully structure code
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     * Lifted jumps to return sites
     */
    static {
        block19 : {
            inStm = null;
            objInStm = null;
            base14DescCache = null;
            inStm = Base14.class.getResourceAsStream("Base14Cache");
            objInStm = new ObjectInputStream(inStm);
            try {
                base14DescCache = (HashMap)objInStm.readObject();
            }
            catch (ClassNotFoundException e) {
                // empty catch block
            }
            try {
                if (objInStm != null) {
                    objInStm.close();
                } else if (inStm != null) {
                    inStm.close();
                }
                break block19;
            }
            catch (Exception e) {}
            ** GOTO lbl44
            catch (Exception e) {
                try {
                    if (objInStm != null) {
                        objInStm.close();
                    } else if (inStm != null) {
                        inStm.close();
                    }
                }
                catch (Exception e) {}
                catch (Throwable var4_7) {
                    try {
                        if (objInStm != null) {
                            objInStm.close();
                            throw var4_7;
                        }
                        if (inStm == null) throw var4_7;
                        inStm.close();
                        throw var4_7;
                    }
                    catch (Exception e) {
                        // empty catch block
                    }
                    throw var4_7;
                }
            }
        }
        Base14Font.mBase14DescCache = base14DescCache;
    }
}