1 17 18 19 20 package org.apache.fop.fonts; 21 22 import org.apache.avalon.framework.ValuedEnum; 23 24 27 public class CIDFontType extends ValuedEnum { 28 29 32 public static final CIDFontType CIDTYPE0 = new CIDFontType("CIDFontType0", 0); 33 34 37 public static final CIDFontType CIDTYPE2 = new CIDFontType("CIDFontType2", 1); 38 39 40 43 protected CIDFontType(String name, int value) { 44 super(name, value); 45 } 46 47 48 53 public static CIDFontType byName(String name) { 54 if (name.equalsIgnoreCase(CIDFontType.CIDTYPE0.getName())) { 55 return CIDFontType.CIDTYPE0; 56 } else if (name.equalsIgnoreCase(CIDFontType.CIDTYPE2.getName())) { 57 return CIDFontType.CIDTYPE2; 58 } else { 59 throw new IllegalArgumentException ("Invalid CID font type: " + name); 60 } 61 } 62 63 64 69 public static CIDFontType byValue(int value) { 70 if (value == CIDFontType.CIDTYPE0.getValue()) { 71 return CIDFontType.CIDTYPE0; 72 } else if (value == CIDFontType.CIDTYPE2.getValue()) { 73 return CIDFontType.CIDTYPE2; 74 } else { 75 throw new IllegalArgumentException ("Invalid CID font type: " + value); 76 } 77 } 78 79 } 80 | Popular Tags |