You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/03/31 10:40:50 UTC
svn commit: r642924 -
/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
Author: jeremias
Date: Mon Mar 31 01:40:48 2008
New Revision: 642924
URL: http://svn.apache.org/viewvc?rev=642924&view=rev
Log:
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.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java?rev=642924&r1=642923&r2=642924&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java Mon Mar 31 01:40:48 2008
@@ -108,11 +108,6 @@
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 @@
}
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 @@
}
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 @@
}
returnFont.replaceKerningMap(pfm.getKerning());
}
- returnFont.setFlags(pfm.getFlags());
}
private CodePointMapping buildCustomEncoding(String encodingName, AFMFile afm) {
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org