summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2015-12-16 13:46:42 +0000
committerSimon Steiner <ssteiner@apache.org>2015-12-16 13:46:42 +0000
commit7c9270c7ba0af0c4f6bb038d4b53fe6ad239c8c9 (patch)
treee58828a1f9083ad62ac4051aabaf7caeab94771d /src/java
parent86fb9989a551ff40a4c0512f550e4ece355939a1 (diff)
downloadxmlgraphics-fop-7c9270c7ba0af0c4f6bb038d4b53fe6ad239c8c9.tar.gz
xmlgraphics-fop-7c9270c7ba0af0c4f6bb038d4b53fe6ad239c8c9.zip
FOP-2552: TrueType in AFP adding extra slash to end of font uri
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1720357 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/afp/AFPResourceManager.java10
-rw-r--r--src/java/org/apache/fop/render/afp/AFPFontConfig.java30
2 files changed, 22 insertions, 18 deletions
diff --git a/src/java/org/apache/fop/afp/AFPResourceManager.java b/src/java/org/apache/fop/afp/AFPResourceManager.java
index d4df8daab..f5910d7d9 100644
--- a/src/java/org/apache/fop/afp/AFPResourceManager.java
+++ b/src/java/org/apache/fop/afp/AFPResourceManager.java
@@ -338,7 +338,8 @@ public class AFPResourceManager {
AFPResourceAccessor accessor = charSet.getResourceAccessor();
if (afpFont.getFontType() == FontType.TRUETYPE) {
- createIncludedResource(afpFont.getFontName(), accessor.resolveURI("."), accessor,
+ createIncludedResource(afpFont.getFontName(),
+ ((AFPFontConfig.AFPTrueTypeFont) afpFont).getUri(), accessor,
ResourceObject.TYPE_OBJECT_CONTAINER, true,
((AFPFontConfig.AFPTrueTypeFont) afpFont).getTTC());
} else {
@@ -414,12 +415,7 @@ public class AFPResourceManager {
ActiveEnvironmentGroup.setupTruetypeMDR(res, false);
ObjectContainer oc = factory.createObjectContainer();
- InputStream is;
- try {
- is = accessor.createInputStream(new URI("."));
- } catch (URISyntaxException e) {
- throw new IOException(e);
- }
+ InputStream is = accessor.createInputStream(uri);
if (ttc != null) {
oc.setData(extractTTC(ttc, is));
diff --git a/src/java/org/apache/fop/render/afp/AFPFontConfig.java b/src/java/org/apache/fop/render/afp/AFPFontConfig.java
index 341123331..35b2cc3f5 100644
--- a/src/java/org/apache/fop/render/afp/AFPFontConfig.java
+++ b/src/java/org/apache/fop/render/afp/AFPFontConfig.java
@@ -364,41 +364,45 @@ public final class AFPFontConfig implements FontConfig {
static final class TrueTypeFontConfig extends AFPFontConfigData {
private String characterset;
private String subfont;
+ private String fontUri;
private TrueTypeFontConfig(List<FontTriplet> triplets, String type, String codePage,
String encoding, String characterset, String name, String subfont,
boolean embeddable, String uri) {
- super(triplets, type, codePage, encoding, name, embeddable, uri);
+ super(triplets, type, codePage, encoding, name, embeddable, null);
this.characterset = characterset;
this.subfont = subfont;
+ this.fontUri = uri;
}
@Override
AFPFontInfo getFontInfo(InternalResourceResolver resourceResolver, AFPEventProducer eventProducer)
throws IOException {
- Typeface tf;
try {
- tf = new LazyFont(new EmbedFontInfo(
- new FontUris(new URI(uri), null)
+ Typeface tf = new LazyFont(new EmbedFontInfo(
+ new FontUris(new URI(fontUri), null)
, false, true, null, subfont), resourceResolver, false).getRealFont();
+
+ AFPResourceAccessor accessor = getAccessor(resourceResolver);
+ CharacterSet characterSet = CharacterSetBuilder.getDoubleByteInstance().build(characterset,
+ super.codePage, super.encoding, tf, accessor, eventProducer);
+ OutlineFont font = new AFPTrueTypeFont(super.name, super.embeddable, characterSet,
+ eventProducer, subfont, new URI(fontUri));
+ return getFontInfo(font, this);
} catch (URISyntaxException e) {
throw new IOException(e);
}
- AFPResourceAccessor accessor = getAccessor(resourceResolver);
- CharacterSet characterSet = CharacterSetBuilder.getDoubleByteInstance().build(characterset, super.codePage,
- super.encoding, tf, accessor, eventProducer);
- OutlineFont font = new AFPTrueTypeFont(super.name, super.embeddable, characterSet,
- eventProducer, subfont);
- return getFontInfo(font, this);
}
}
public static class AFPTrueTypeFont extends OutlineFont {
private String ttc;
+ private URI uri;
public AFPTrueTypeFont(String name, boolean embeddable, CharacterSet charSet, AFPEventProducer eventProducer,
- String ttc) {
+ String ttc, URI uri) {
super(name, embeddable, charSet, eventProducer);
this.ttc = ttc;
+ this.uri = uri;
}
public FontType getFontType() {
@@ -408,6 +412,10 @@ public final class AFPFontConfig implements FontConfig {
public String getTTC() {
return ttc;
}
+
+ public URI getUri() {
+ return uri;
+ }
}
static final class OutlineFontConfig extends AFPFontConfigData {