diff options
author | Glenn Adams <gadams@apache.org> | 2014-08-17 18:56:01 +0000 |
---|---|---|
committer | Glenn Adams <gadams@apache.org> | 2014-08-17 18:56:01 +0000 |
commit | 49c8708241bc45067382b90d76fdf4a85e5f1cae (patch) | |
tree | 2e43cf24b3cc461b561a2b8683ebd80e0c3da2dc /src/java/org/apache/fop/fonts | |
parent | 5f66eef3fe635d61f3e6408d101a87b57409aa5c (diff) | |
download | xmlgraphics-fop-49c8708241bc45067382b90d76fdf4a85e5f1cae.tar.gz xmlgraphics-fop-49c8708241bc45067382b90d76fdf4a85e5f1cae.zip |
Add verbose (-v) flag to FontList tool that shows URI of font resource.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1618496 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fonts')
-rw-r--r-- | src/java/org/apache/fop/fonts/CustomFont.java | 11 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/FontMetrics.java | 9 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/LazyFont.java | 6 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/MutableFont.java | 6 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/truetype/OFFontLoader.java | 1 |
5 files changed, 31 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/fonts/CustomFont.java b/src/java/org/apache/fop/fonts/CustomFont.java index 5c0673b04..fffb429ed 100644 --- a/src/java/org/apache/fop/fonts/CustomFont.java +++ b/src/java/org/apache/fop/fonts/CustomFont.java @@ -42,6 +42,7 @@ public abstract class CustomFont extends Typeface /** Fallback thickness for underline and strikeout when not provided by the font. */ private static final int DEFAULT_LINE_THICKNESS = 50; + private URI fontFileURI; private String fontName; private String fullName; private Set<String> familyNames; @@ -89,6 +90,11 @@ public abstract class CustomFont extends Typeface /** {@inheritDoc} */ + public URI getFontURI() { + return fontFileURI; + } + + /** {@inheritDoc} */ public String getFontName() { return fontName; } @@ -326,6 +332,11 @@ public abstract class CustomFont extends Typeface /* ---- MutableFont interface ---- */ /** {@inheritDoc} */ + public void setFontURI(URI uri) { + this.fontFileURI = uri; + } + + /** {@inheritDoc} */ public void setFontName(String name) { this.fontName = name; } diff --git a/src/java/org/apache/fop/fonts/FontMetrics.java b/src/java/org/apache/fop/fonts/FontMetrics.java index 159d321f7..ed59cf5af 100644 --- a/src/java/org/apache/fop/fonts/FontMetrics.java +++ b/src/java/org/apache/fop/fonts/FontMetrics.java @@ -20,17 +20,22 @@ package org.apache.fop.fonts; import java.awt.Rectangle; +import java.net.URI; import java.util.Map; import java.util.Set; - - /** * Main interface for access to font metrics. */ public interface FontMetrics { /** + * Returns the URI of the font file from which these metrics were loaded. + * @return the font file's URI + */ + URI getFontURI(); + + /** * Returns the "PostScript" font name (Example: "Helvetica-BoldOblique"). * @return the font name */ diff --git a/src/java/org/apache/fop/fonts/LazyFont.java b/src/java/org/apache/fop/fonts/LazyFont.java index a392ae6f4..acce1e0f9 100644 --- a/src/java/org/apache/fop/fonts/LazyFont.java +++ b/src/java/org/apache/fop/fonts/LazyFont.java @@ -189,6 +189,12 @@ public class LazyFont extends Typeface implements FontDescriptor, Substitutable, // ---- FontMetrics interface ---- /** {@inheritDoc} */ + public URI getFontURI() { + load(true); + return realFont.getFontURI(); + } + + /** {@inheritDoc} */ public String getFontName() { load(true); return realFont.getFontName(); diff --git a/src/java/org/apache/fop/fonts/MutableFont.java b/src/java/org/apache/fop/fonts/MutableFont.java index 9ea323ebf..f02eb2b49 100644 --- a/src/java/org/apache/fop/fonts/MutableFont.java +++ b/src/java/org/apache/fop/fonts/MutableFont.java @@ -31,6 +31,12 @@ import java.util.Set; public interface MutableFont { /** + * Sets the URI from which this font is or will be loaded. + * @param uri URI from which font is or will be loaded + */ + void setFontURI(URI uri); + + /** * Sets the "PostScript" font name (Example: "Helvetica-BoldOblique"). * @param name font name */ diff --git a/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java b/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java index 4216cf290..7c8774933 100644 --- a/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java +++ b/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java @@ -141,6 +141,7 @@ public class OFFontLoader extends FontLoader { returnFont = singleFont; } + returnFont.setFontURI(fontFileURI); returnFont.setFontName(otf.getPostScriptName()); returnFont.setFullName(otf.getFullName()); returnFont.setFamilyNames(otf.getFamilyNames()); |