NameKeyedSubset.java 1.04 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.fontengine.font.cff;

import com.adobe.fontengine.font.InvalidFontException;
import com.adobe.fontengine.font.SubsetDefaultImpl;
import com.adobe.fontengine.font.UnsupportedFontException;
import com.adobe.fontengine.font.cff.NameKeyedFont;

public class NameKeyedSubset
extends SubsetDefaultImpl {
    public NameKeyedSubset(int numGlyphs, boolean doSubset) throws InvalidFontException, UnsupportedFontException {
        super(numGlyphs, doSubset);
    }

    public void addGlyphs(NameKeyedFont font, String[] glyphNames) throws InvalidFontException, UnsupportedFontException {
        for (int i = 0; i < glyphNames.length; ++i) {
            String glyphName = glyphNames[i];
            if (glyphName == null) continue;
            int fullGid = font.glyphName2gid(glyphName);
            if (fullGid == 0 && !glyphName.equals(".notdef")) {
                throw new InvalidFontException("Font does not contain required codepoint");
            }
            this.getSubsetGid(fullGid);
        }
    }
}