/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
returnFont.setFontName(content);
} else if ("ttc-name".equals(localName) && isCID) {
multiFont.setTTCName(content);
+ } else if ("encoding".equals(localName)) {
+ if (singleFont != null && singleFont.getFontType() == FontType.TYPE1) {
+ singleFont.setEncoding(content);
+ }
} else if ("cap-height".equals(localName)) {
returnFont.setCapHeight(getInt(content));
} else if ("x-height".equals(localName)) {
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
public class SingleByteFont extends CustomFont {
- private final CodePointMapping mapping
- = CodePointMapping.getMapping("WinAnsiEncoding");
+ private CodePointMapping mapping;
private String encoding = "WinAnsiEncoding";
- private int width[] = null;
-
+ private int[] width = null;
+ /**
+ * Main constructor.
+ */
+ public SingleByteFont() {
+ updateMapping();
+ }
+
+ /**
+ * Updates the mapping variable based on the encoding.
+ */
+ protected void updateMapping() {
+ mapping = CodePointMapping.getMapping(getEncoding());
+ }
+
/**
* @see org.apache.fop.fonts.FontDescriptor#isEmbeddable()
*/
return encoding;
}
+ /**
+ * Sets the encoding of the font.
+ * @param encoding the encoding (ex. "WinAnsiEncoding" or "SymbolEncoding")
+ */
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ updateMapping();
+ }
+
/**
* @see org.apache.fop.fonts.FontMetrics#getWidth(int, int)
*/
public int[] getWidths() {
int[] arr = new int[width.length];
System.arraycopy(width, 0, arr, 0, width.length - 1);
- /*
- for (int i = 0; i < arr.length; i++)
- arr[i] *= size;
- */
return arr;
}
<changes>
<release version="FOP Trunk">
+ <action context="Code" dev="JM" type="add">
+ The font loading code now reads the encoding value from the XML font metrics file
+ so that fonts like Symbol and ZapfDingbats can be embedded explicitely (Required by PDF/A).
+ </action>
<action context="Code" dev="SP" type="update">
Improvements to the code for inline block content.
</action>