aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-03-31 08:40:48 +0000
committerJeremias Maerki <jeremias@apache.org>2008-03-31 08:40:48 +0000
commit0f7b92411a4aceb705dfd1aea211b180ed90a95b (patch)
tree982cfa47b8539a23a7cc4a28a5e0b32028287570 /src/java/org/apache
parent3e8128c8d05a7f08258913a81a438d0666bdf220 (diff)
downloadxmlgraphics-fop-0f7b92411a4aceb705dfd1aea211b180ed90a95b.tar.gz
xmlgraphics-fop-0f7b92411a4aceb705dfd1aea211b180ed90a95b.zip
Added missing code for determining the PDF Flags. The removes the need to have a PFM if you have an AFM file for a Type 1 font.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@642924 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/fonts/type1/Type1FontLoader.java27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java b/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
index 8cf6f2371..3187379d5 100644
--- a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
+++ b/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
@@ -108,11 +108,6 @@ public class Type1FontLoader extends FontLoader {
throw new java.io.FileNotFoundException(
"Neither an AFM nor a PFM file was found for " + this.fontFileURI);
}
- if (pfm == null) {
- //Cannot do without the PFM for now
- throw new java.io.FileNotFoundException(
- "No PFM file was found for " + this.fontFileURI);
- }
buildFont(afm, pfm);
this.loaded = true;
}
@@ -289,7 +284,25 @@ public class Type1FontLoader extends FontLoader {
}
if (afm != null) {
- //TODO returnFont.setFlags(flags);
+ String charSet = afm.getCharacterSet();
+ int flags = 0;
+ if ("Special".equals(charSet)) {
+ flags |= 4; //bit 3: Symbolic
+ } else {
+ if (singleFont.getEncoding().mapChar('A') == 'A') {
+ //High likelyhood that the font is non-symbolic
+ flags |= 32; //bit 6: Nonsymbolic
+ } else {
+ flags |= 4; //bit 3: Symbolic
+ }
+ }
+ if (afm.getWritingDirectionMetrics(0).isFixedPitch()) {
+ flags |= 1; //bit 1: FixedPitch
+ }
+ if (afm.getWritingDirectionMetrics(0).getItalicAngle() != 0.0) {
+ flags |= 64; //bit 7: Italic
+ }
+ returnFont.setFlags(flags);
returnFont.setFirstChar(afm.getFirstChar());
returnFont.setLastChar(afm.getLastChar());
@@ -302,6 +315,7 @@ public class Type1FontLoader extends FontLoader {
}
returnFont.replaceKerningMap(afm.createXKerningMapEncoded());
} else {
+ returnFont.setFlags(pfm.getFlags());
returnFont.setFirstChar(pfm.getFirstChar());
returnFont.setLastChar(pfm.getLastChar());
for (short i = pfm.getFirstChar(); i <= pfm.getLastChar(); i++) {
@@ -309,7 +323,6 @@ public class Type1FontLoader extends FontLoader {
}
returnFont.replaceKerningMap(pfm.getKerning());
}
- returnFont.setFlags(pfm.getFlags());
}
private CodePointMapping buildCustomEncoding(String encodingName, AFMFile afm) {