From cdc74a4cea3b2e79fc9a3cf7b15f83302a59401d Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Mon, 21 Aug 2017 11:52:08 +0000 Subject: [PATCH] FOP-2733: Reduce dependency on Avalon Framework git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1805622 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/fonts/CIDFontType.java | 23 ++++++++++++------- .../main/java/org/apache/fop/pdf/PDFText.java | 8 +++---- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/fop-core/src/main/java/org/apache/fop/fonts/CIDFontType.java b/fop-core/src/main/java/org/apache/fop/fonts/CIDFontType.java index 20a94b9dd..9068ac53f 100644 --- a/fop-core/src/main/java/org/apache/fop/fonts/CIDFontType.java +++ b/fop-core/src/main/java/org/apache/fop/fonts/CIDFontType.java @@ -19,32 +19,32 @@ package org.apache.fop.fonts; -import org.apache.avalon.framework.ValuedEnum; - /** * This class enumerates all supported CID font types. */ -public class CIDFontType extends ValuedEnum { +public enum CIDFontType { /** * CID Font Type 0 (based on Type 1 format) */ - public static final CIDFontType CIDTYPE0 = new CIDFontType("CIDFontType0", 0); + CIDTYPE0("CIDFontType0", 0), /** * CID Font Type 2 (based on TrueType format) */ - public static final CIDFontType CIDTYPE2 = new CIDFontType("CIDFontType2", 2); + CIDTYPE2("CIDFontType2", 2); + private final String name; + private final int value; /** * Construct a CID font type. * @param name a type name * @param value a type value - * @see org.apache.avalon.framework.Enum#Enum(String) */ - protected CIDFontType(String name, int value) { - super(name, value); + CIDFontType(String name, int value) { + this.name = name; + this.value = value; } @@ -79,4 +79,11 @@ public class CIDFontType extends ValuedEnum { } } + public String getName() { + return name; + } + + public int getValue() { + return value; + } } diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFText.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFText.java index 2d09e27a9..927540f89 100644 --- a/fop-core/src/main/java/org/apache/fop/pdf/PDFText.java +++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFText.java @@ -21,8 +21,6 @@ package org.apache.fop.pdf; import java.io.ByteArrayOutputStream; -import org.apache.avalon.framework.CascadingRuntimeException; - /** * This class represents a simple number object. It also contains contains some * utility methods for outputting numbers to PDF. @@ -101,7 +99,7 @@ public class PDFText extends PDFObject { try { uniBytes = text.getBytes("UTF-16"); } catch (java.io.UnsupportedEncodingException uee) { - throw new CascadingRuntimeException("Incompatible VM", uee); + throw new RuntimeException("Incompatible VM", uee); } return toHex(uniBytes); } else { @@ -179,7 +177,7 @@ public class PDFText extends PDFObject { try { return text.getBytes("UnicodeBig"); } catch (java.io.UnsupportedEncodingException uee) { - throw new CascadingRuntimeException("Incompatible VM", uee); + throw new RuntimeException("Incompatible VM", uee); } } @@ -195,7 +193,7 @@ public class PDFText extends PDFObject { final char[] a = {c}; uniBytes = new String(a).getBytes("UTF-16BE"); } catch (java.io.UnsupportedEncodingException uee) { - throw new CascadingRuntimeException("Incompatible VM", uee); + throw new RuntimeException("Incompatible VM", uee); } for (byte uniByte : uniBytes) { -- 2.39.5