select="document('glyphlist.xml')/glyphlist-set"/>
<xsl:template match="encoding-set">
-package org.apache.fop.render.pdf;
+package org.apache.fop.fonts;
+
import java.util.Map;
-import java.util.HashMap;
import java.util.Collections;
public class CodePointMapping {
private static Map mappings;
static {
- mappings = Collections.synchronizedMap(new HashMap());
+ mappings = Collections.synchronizedMap(new java.util.HashMap());
}
public static CodePointMapping getMapping(String encoding) {
CodePointMapping mapping = (CodePointMapping) mappings.get(encoding);
<xsl:variable name="glyphs" select="document('encodings.xml')/encoding-set/encoding[@id=$encoding]/glyph"/>
<xsl:template match="font-metrics">
-package org.apache.fop.render.pdf.fonts;
+package org.apache.fop.fonts.base14;
-import org.apache.fop.render.pdf.Font;
-import org.apache.fop.render.pdf.CodePointMapping;
+import org.apache.fop.fonts.FontType;
+import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.CodePointMapping;
public class <xsl:value-of select="class-name"/> extends Font {
private final static String fontName = "<xsl:value-of select="font-name"/>";
private final static int firstChar = <xsl:value-of select="first-char"/>;
private final static int lastChar = <xsl:value-of select="last-char"/>;
private final static int[] width;
- private final CodePointMapping mapping
- = CodePointMapping.getMapping("<xsl:value-of select="$encoding"/>");
+ private final CodePointMapping mapping =
+ CodePointMapping.getMapping("<xsl:value-of select="$encoding"/>");
static {
width = new int[256];
<xsl:apply-templates select="widths"/>
}
- public String encoding() {
+ public String getEncoding() {
return encoding;
}
- public String fontName() {
- return fontName;
+ public String getFontName() {
+ return fontName;
+ }
+
+ public FontType getFontType() {
+ return FontType.TYPE1;
}
public int getAscender(int size) {
return lastChar;
}
- public int width(int i,int size) {
+ public int getWidth(int i,int size) {
return size * width[i];
}
- public int[] getWidths(int size) {
+ public int[] getWidths() {
int[] arr = new int[getLastChar()-getFirstChar()+1];
System.arraycopy(width, getFirstChar(), arr, 0, getLastChar()-getFirstChar()+1);
- for( int i = 0; i < arr.length; i++) arr[i] *= size;
+ //for( int i = 0; i < arr.length; i++) arr[i] *= size;
return arr;
}
-
+
+ public boolean hasKerningInfo() {
+ return false;
+ }
+
+ public java.util.Map getKerningInfo() {
+ return java.util.Collections.EMPTY_MAP;
+ }
+
public char mapChar(char c) {
char d = mapping.mapChar(c);
- if(d != 0)
+ if(d != 0) {
return d;
- else
- return '#';
+ } else {
+ return '#';
+ }
}
}