aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fonts
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/fonts')
-rw-r--r--src/java/org/apache/fop/fonts/CustomFont.java11
-rw-r--r--src/java/org/apache/fop/fonts/FontDescriptor.java6
-rw-r--r--src/java/org/apache/fop/fonts/FontReader.java9
-rw-r--r--src/java/org/apache/fop/fonts/LazyFont.java10
-rw-r--r--src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java1
5 files changed, 26 insertions, 11 deletions
diff --git a/src/java/org/apache/fop/fonts/CustomFont.java b/src/java/org/apache/fop/fonts/CustomFont.java
index f6bb52cb3..1f782b2ea 100644
--- a/src/java/org/apache/fop/fonts/CustomFont.java
+++ b/src/java/org/apache/fop/fonts/CustomFont.java
@@ -190,12 +190,17 @@ public abstract class CustomFont extends Typeface
return fontBBox;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getFlags() {
return flags;
}
+
+ /** {@inheritDoc} */
+ public boolean isSymbolicFont() {
+ return ((getFlags() & 4) != 0) || "ZapfDingbatsEncoding".equals(getEncodingName());
+ //Note: The check for ZapfDingbats is necessary as the PFM does not reliably indicate
+ //if a font is symbolic.
+ }
/**
* Returns the font weight (100, 200...800, 900). This value may be different from the
diff --git a/src/java/org/apache/fop/fonts/FontDescriptor.java b/src/java/org/apache/fop/fonts/FontDescriptor.java
index 841d99de2..fb9c7d02e 100644
--- a/src/java/org/apache/fop/fonts/FontDescriptor.java
+++ b/src/java/org/apache/fop/fonts/FontDescriptor.java
@@ -53,7 +53,11 @@ public interface FontDescriptor extends FontMetrics {
*/
int getFlags();
-
+ /**
+ * Indicates whether the font is a symbolic font.
+ * @return true if the font is a symbolic font (i.e. Symbol or ZapfDingbats)
+ */
+ boolean isSymbolicFont();
/**
* Returns the font's bounding box.
* @return the bounding box
diff --git a/src/java/org/apache/fop/fonts/FontReader.java b/src/java/org/apache/fop/fonts/FontReader.java
index 51d90c7e5..6f148f503 100644
--- a/src/java/org/apache/fop/fonts/FontReader.java
+++ b/src/java/org/apache/fop/fonts/FontReader.java
@@ -27,8 +27,6 @@ import java.util.Set;
import javax.xml.parsers.SAXParserFactory;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.fonts.apps.TTFReader;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
@@ -36,6 +34,9 @@ import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.apps.TTFReader;
+
/**
* Class for reading a metric.xml file and creating a font object.
* Typical usage:
@@ -228,11 +229,11 @@ public class FontReader extends DefaultHandler {
if ("font-name".equals(localName)) {
returnFont.setFontName(content);
} else if ("full-name".equals(localName)) {
- multiFont.setFullName(content);
+ returnFont.setFullName(content);
} else if ("family-name".equals(localName)) {
Set s = new java.util.HashSet();
s.add(content);
- multiFont.setFamilyNames(s);
+ returnFont.setFamilyNames(s);
} else if ("ttc-name".equals(localName) && isCID) {
multiFont.setTTCName(content);
} else if ("encoding".equals(localName)) {
diff --git a/src/java/org/apache/fop/fonts/LazyFont.java b/src/java/org/apache/fop/fonts/LazyFont.java
index b4f7773a3..70b971fff 100644
--- a/src/java/org/apache/fop/fonts/LazyFont.java
+++ b/src/java/org/apache/fop/fonts/LazyFont.java
@@ -321,14 +321,18 @@ public class LazyFont extends Typeface implements FontDescriptor {
return realFontDescriptor.getAscender();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getFlags() {
load(true);
return realFontDescriptor.getFlags();
}
+ /** {@inheritDoc} */
+ public boolean isSymbolicFont() {
+ load(true);
+ return realFontDescriptor.isSymbolicFont();
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java b/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java
index 55a7ae1c0..d59fd5c7e 100644
--- a/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java
+++ b/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java
@@ -32,6 +32,7 @@ public class UnixFontDirFinder extends NativeFontDirFinder {
return new String[] {
System.getProperty("user.home") + "/.fonts", // user
"/usr/local/fonts", // local
+ "/usr/local/share/fonts", // local shared
"/usr/share/fonts", // system
"/usr/X11R6/lib/X11/fonts" // X
};