From 400e7e64a5d6d86875f3904cacd155652733cac2 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Wed, 8 Jan 2003 13:54:04 +0000 Subject: [PATCH] First part of my refactoring of fonts. TrueType font classes have moved to subpackage (like Type1 before) Lots of Javadocs Fixed Checkstyle errors git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195819 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/fonts/BFEntry.java | 55 +++ src/org/apache/fop/fonts/CIDFont.java | 64 ++++ src/org/apache/fop/fonts/CIDFontType.java | 67 ++++ src/org/apache/fop/fonts/CustomFont.java | 327 ++++++++++++++++++ src/org/apache/fop/fonts/Font.java | 40 +++ src/org/apache/fop/fonts/FontDescriptor.java | 73 ++++ src/org/apache/fop/fonts/FontMetrics.java | 95 +++++ src/org/apache/fop/fonts/FontType.java | 98 ++++++ src/org/apache/fop/fonts/LazyFont.java | 244 +++++++++++++ src/org/apache/fop/fonts/MultiByteFont.java | 316 +++++++++++++++++ src/org/apache/fop/fonts/MutableFont.java | 115 ++++++ src/org/apache/fop/fonts/SingleByteFont.java | 85 +++++ src/org/apache/fop/fonts/apps/TTFReader.java | 6 +- src/org/apache/fop/fonts/package.html | 6 + .../fonts/{ => truetype}/FontFileReader.java | 21 +- .../fonts/{ => truetype}/TTFCmapEntry.java | 4 +- .../fonts/{ => truetype}/TTFDirTabEntry.java | 8 +- .../fop/fonts/{ => truetype}/TTFFile.java | 5 +- .../fop/fonts/{ => truetype}/TTFMtxEntry.java | 13 +- .../fonts/{ => truetype}/TTFSubSetFile.java | 7 +- 20 files changed, 1620 insertions(+), 29 deletions(-) create mode 100644 src/org/apache/fop/fonts/BFEntry.java create mode 100644 src/org/apache/fop/fonts/CIDFont.java create mode 100644 src/org/apache/fop/fonts/CIDFontType.java create mode 100644 src/org/apache/fop/fonts/CustomFont.java create mode 100644 src/org/apache/fop/fonts/Font.java create mode 100644 src/org/apache/fop/fonts/FontDescriptor.java create mode 100644 src/org/apache/fop/fonts/FontMetrics.java create mode 100644 src/org/apache/fop/fonts/FontType.java create mode 100644 src/org/apache/fop/fonts/LazyFont.java create mode 100644 src/org/apache/fop/fonts/MultiByteFont.java create mode 100644 src/org/apache/fop/fonts/MutableFont.java create mode 100644 src/org/apache/fop/fonts/SingleByteFont.java create mode 100644 src/org/apache/fop/fonts/package.html rename src/org/apache/fop/fonts/{ => truetype}/FontFileReader.java (93%) rename src/org/apache/fop/fonts/{ => truetype}/TTFCmapEntry.java (95%) rename src/org/apache/fop/fonts/{ => truetype}/TTFDirTabEntry.java (89%) rename src/org/apache/fop/fonts/{ => truetype}/TTFFile.java (99%) rename src/org/apache/fop/fonts/{ => truetype}/TTFMtxEntry.java (89%) rename src/org/apache/fop/fonts/{ => truetype}/TTFSubSetFile.java (99%) diff --git a/src/org/apache/fop/fonts/BFEntry.java b/src/org/apache/fop/fonts/BFEntry.java new file mode 100644 index 000000000..726f28af0 --- /dev/null +++ b/src/org/apache/fop/fonts/BFEntry.java @@ -0,0 +1,55 @@ +/* + * $Id$ + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +/** + * This is just a holder class for bfentries. + */ +public class BFEntry { + + private int unicodeStart; + private int unicodeEnd; + private int glyphStartIndex; + + /** + * Main constructor. + * @param unicodeStart Unicode start index + * @param unicodeEnd Unicode end index + * @param glyphStartIndex glyph start index + */ + public BFEntry(int unicodeStart, int unicodeEnd, int glyphStartIndex) { + this.unicodeStart = unicodeStart; + this.unicodeEnd = unicodeEnd; + this.glyphStartIndex = glyphStartIndex; + } + + /** + * Returns the unicodeStart. + * @return the Unicode start index + */ + public int getUnicodeStart() { + return unicodeStart; + } + + /** + * Returns the unicodeEnd. + * @return the Unicode end index + */ + public int getUnicodeEnd() { + return unicodeEnd; + } + + /** + * Returns the glyphStartIndex. + * @return the glyph start index + */ + public int getGlyphStartIndex() { + return glyphStartIndex; + } + +} diff --git a/src/org/apache/fop/fonts/CIDFont.java b/src/org/apache/fop/fonts/CIDFont.java new file mode 100644 index 000000000..fc9cc90f5 --- /dev/null +++ b/src/org/apache/fop/fonts/CIDFont.java @@ -0,0 +1,64 @@ +/* + * $Id$ + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +/** + * Abstract base class for CID fonts. + */ +public abstract class CIDFont extends CustomFont { + + // ---- Required ---- + /** + * Returns the name of the base font. + * @return the name of the base font + */ + public abstract String getCidBaseFont(); + + /** + * Returns the type of the CID font. + * @return the type of the CID font + */ + public abstract CIDFontType getCIDType(); + + /** + * Returns the name of the issuer of the font. + * @return a String identifying an issuer of character collections — + * for example, Adobe + */ + public abstract String getRegistry(); + + /** + * Returns a font name for use within a registry. + * @return a String that uniquely names a character collection issued by + * a specific registry — for example, Japan1. + */ + public abstract String getOrdering(); + + /** + * Returns the supplement number of the character collection. + * @return the supplement number + */ + public abstract int getSupplement(); + + + // ---- Optional ---- + /** + * Returns the default width for this font. + * @return the default width + */ + public int getDefaultWidth() { + return 0; + } + + /** + * @see org.apache.fop.fonts.Font#isMultiByte() + */ + public boolean isMultiByte() { + return true; + } +} diff --git a/src/org/apache/fop/fonts/CIDFontType.java b/src/org/apache/fop/fonts/CIDFontType.java new file mode 100644 index 000000000..938b7ae79 --- /dev/null +++ b/src/org/apache/fop/fonts/CIDFontType.java @@ -0,0 +1,67 @@ +/* + * $Id$ + * Copyright (C) 2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +import org.apache.avalon.framework.ValuedEnum; + +/** + * This class enumerates all supported CID font types. + */ +public class CIDFontType extends ValuedEnum { + + /** + * CID Font Type 0 + */ + public static final CIDFontType CIDTYPE0 = new CIDFontType("CIDFontType0", 0); + + /** + * CID Font Type 2 + */ + public static final CIDFontType CIDTYPE2 = new CIDFontType("CIDFontType2", 1); + + + /** + * @see org.apache.avalon.framework.Enum#Enum(String) + */ + protected CIDFontType(String name, int value) { + super(name, value); + } + + + /** + * Returns the CIDFontType by name. + * @param name Name of the CID font type to look up + * @return FontType the CID font type + */ + public static CIDFontType byName(String name) { + if (name.equalsIgnoreCase(CIDFontType.CIDTYPE0.getName())) { + return CIDFontType.CIDTYPE0; + } else if (name.equalsIgnoreCase(CIDFontType.CIDTYPE2.getName())) { + return CIDFontType.CIDTYPE2; + } else { + throw new IllegalArgumentException("Invalid CID font type: " + name); + } + } + + + /** + * Returns the CID FontType by value. + * @param value Value of the CID font type to look up + * @return FontType the CID font type + */ + public static CIDFontType byValue(int value) { + if (value == CIDFontType.CIDTYPE0.getValue()) { + return CIDFontType.CIDTYPE0; + } else if (value == CIDFontType.CIDTYPE2.getValue()) { + return CIDFontType.CIDTYPE2; + } else { + throw new IllegalArgumentException("Invalid CID font type: " + value); + } + } + +} diff --git a/src/org/apache/fop/fonts/CustomFont.java b/src/org/apache/fop/fonts/CustomFont.java new file mode 100644 index 000000000..02e4cd6f0 --- /dev/null +++ b/src/org/apache/fop/fonts/CustomFont.java @@ -0,0 +1,327 @@ +/* + * $Id$ + * Copyright (C) 2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +import java.util.Map; + + +/** + * Abstract base class for custom fonts loaded from files, for example. + */ +public abstract class CustomFont extends Font + implements FontDescriptor, MutableFont { + + private String fontName = null; + private String embedFileName = null; + private String embedResourceName = null; + + private int capHeight = 0; + private int xHeight = 0; + private int ascender = 0; + private int descender = 0; + private int[] fontBBox = {0, 0, 0, 0}; + private int flags = 4; + private int stemV = 0; + private int italicAngle = 0; + private int missingWidth = 0; + private FontType fontType = FontType.TYPE1; + private int firstChar = 0; + private int lastChar = 255; + + private Map kerning = new java.util.HashMap(); + + + private boolean useKerning = true; + + + /** + * @see org.apache.fop.fonts.FontMetrics#getFontName() + */ + public String getFontName() { + return fontName; + } + + /** + * Returns an URI representing an embeddable font file. The URI will often + * be a filename or an URL. + * @return URI to an embeddable font file or null if not available. + */ + public String getEmbedFileName() { + return embedFileName; + } + + /** + * Returns the lookup name to an embeddable font file available as a + * resource. + * @todo Remove this method, this should be done using a resource: URI. + * @return the lookup name + */ + public String getEmbedResourceName() { + return embedResourceName; + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getAscender() + */ + public int getAscender() { + return ascender; + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getDescender() + */ + public int getDescender() { + return descender; + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getCapHeight() + */ + public int getCapHeight() { + return capHeight; + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getAscender(int) + */ + public int getAscender(int size) { + return size * ascender; + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getDescender(int) + */ + public int getDescender(int size) { + return size * descender; + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getCapHeight(int) + */ + public int getCapHeight(int size) { + return size * capHeight; + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getXHeight(int) + */ + public int getXHeight(int size) { + return size * xHeight; + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getFontBBox() + */ + public int[] getFontBBox() { + return fontBBox; + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getFlags() + */ + public int getFlags() { + return flags; + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getStemV() + */ + public int getStemV() { + return stemV; + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getItalicAngle() + */ + public int getItalicAngle() { + return italicAngle; + } + + /** + * Returns the width to be used when no width is available. + * @return a character width + */ + public int getMissingWidth() { + return missingWidth; + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getFontType() + */ + public FontType getFontType() { + return fontType; + } + + /** + * Returns the index of the first character defined in this font. + * @return the index of the first character + */ + public int getFirstChar() { + return 0; + // return firstChar; + /**@todo Why is this hardcoded??? This code was in SingleByteFont.java */ + } + + /** + * Returns the index of the last character defined in this font. + * @return the index of the last character + */ + public int getLastChar() { + return lastChar; + } + + /** + * Used to determine if kerning is enabled. + * @return True if kerning is enabled. + */ + public boolean isKerningEnabled() { + return useKerning; + } + + /** + * @see org.apache.fop.fonts.FontMetrics#hasKerningInfo() + */ + public final boolean hasKerningInfo() { + return (isKerningEnabled() & kerning.isEmpty()); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getKerningInfo() + */ + public final Map getKerningInfo() { + if (isKerningEnabled()) { + return kerning; + } else { + return java.util.Collections.EMPTY_MAP; + } + } + + + /* ---- MutableFont interface ---- */ + + /** + * @see org.apache.fop.fonts.MutableFont#setFontName(String) + */ + public void setFontName(String name) { + this.fontName = name; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setEmbedFileName(String) + */ + public void setEmbedFileName(String path) { + this.embedFileName = path; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setEmbedResourceName(String) + */ + public void setEmbedResourceName(String name) { + this.embedResourceName = name; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setCapHeight(int) + */ + public void setCapHeight(int capHeight) { + this.capHeight = capHeight; + } + + /** + * Returns the XHeight value of the font. + * @param xHeight the XHeight value + */ + public void setXHeight(int xHeight) { + this.xHeight = xHeight; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setAscender(int) + */ + public void setAscender(int ascender) { + this.ascender = ascender; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setDescender(int) + */ + public void setDescender(int descender) { + this.descender = descender; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setFontBBox(int[]) + */ + public void setFontBBox(int[] bbox) { + this.fontBBox = bbox; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setFlags(int) + */ + public void setFlags(int flags) { + this.flags = flags; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setStemV(int) + */ + public void setStemV(int stemV) { + this.stemV = stemV; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setItalicAngle(int) + */ + public void setItalicAngle(int italicAngle) { + this.italicAngle = italicAngle; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setMissingWidth(int) + */ + public void setMissingWidth(int width) { + this.missingWidth = width; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setFontType(FontType) + */ + public void setFontType(FontType fontType) { + this.fontType = fontType; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setFirstChar(int) + */ + public void setFirstChar(int index) { + this.firstChar = index; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setLastChar(int) + */ + public void setLastChar(int index) { + this.lastChar = index; + } + + /** + * @see org.apache.fop.fonts.MutableFont#setKerningEnabled(boolean) + */ + public void setKerningEnabled(boolean enabled) { + this.useKerning = enabled; + } + + /** + * @see org.apache.fop.fonts.MutableFont#putKerningEntry(Integer, Map) + */ + public void putKerningEntry(Integer key, Map value) { + this.kerning.put(key, value); + } + +} diff --git a/src/org/apache/fop/fonts/Font.java b/src/org/apache/fop/fonts/Font.java new file mode 100644 index 000000000..a51a54564 --- /dev/null +++ b/src/org/apache/fop/fonts/Font.java @@ -0,0 +1,40 @@ +/* + * $Id$ + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +// FOP + + +/** + * Base class for PDF font classes + */ +public abstract class Font implements FontMetrics { + + /** + * Get the encoding of the font. + * @return the encoding + */ + public abstract String getEncoding(); + + /** + * Map a Unicode character to a code point in the font. + * @param c character to map + * @return the mapped character + */ + public abstract char mapChar(char c); + + /** + * Determines whether the font is a multibyte font. + * @return True if it is multibyte + */ + public boolean isMultiByte() { + return false; + } + +} + diff --git a/src/org/apache/fop/fonts/FontDescriptor.java b/src/org/apache/fop/fonts/FontDescriptor.java new file mode 100644 index 000000000..0f929ff0d --- /dev/null +++ b/src/org/apache/fop/fonts/FontDescriptor.java @@ -0,0 +1,73 @@ +/* + * $Id$ + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +/** + * This interface enhances the font metrics interface with access methods to + * value needed to register fonts in various target formats like PDF or + * PostScript. + */ +public interface FontDescriptor extends FontMetrics { + + /** + * Returns the ascender value of the font. (Ascent in pdf spec) + * @return the ascender + */ + int getAscender(); + + + /** + * Returns the capital height of the font. + * @return the capiptal height + */ + int getCapHeight(); + + + /** + * Returns the descender value of the font. (Descent in pdf spec) + * @return the descender value + */ + int getDescender(); + + + /** + * Returns the flags for the font. (See pdf spec) + * @return the flags + */ + int getFlags(); + + + /** + * Returns the font's bounding box. + * @return the bounding box + */ + int[] getFontBBox(); + + + /** + * Returns the italic angle for the font. + * @return the italic angle + */ + int getItalicAngle(); + + + /** + * Returns the vertical stem width for the font. + * @return the vertical stem width + */ + int getStemV(); + + + /** + * Indicates if this font may be embedded. + * @return True, if embedding is possible/permitted + */ + boolean isEmbeddable(); + + +} diff --git a/src/org/apache/fop/fonts/FontMetrics.java b/src/org/apache/fop/fonts/FontMetrics.java new file mode 100644 index 000000000..4d7905117 --- /dev/null +++ b/src/org/apache/fop/fonts/FontMetrics.java @@ -0,0 +1,95 @@ +/* + * $Id$ + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +import java.util.Map; + + +/** + * Main interface for access to font metrics. + */ +public interface FontMetrics { + + /** + * Returns the font name. + * @return the font name + */ + String getFontName(); + + + /** + * Returns the type of the font. + * @return the font type + */ + FontType getFontType(); + + + /** + * Returns the ascent of the font described by this + * FontMetrics object. + * @param size font size + * @return ascent in milliponts + */ + int getAscender(int size); + + /** + * Returns the size of a capital letter measured from the font's baseline. + * @param size font size + * @return height of capital characters + */ + int getCapHeight(int size); + + + /** + * Returns the descent of the font described by this + * FontMetrics object. + * @param size font size + * @return descent in milliponts + */ + int getDescender(int size); + + + /** + * Determines the typical font height of this + * FontMetrics object + * @param size font size + * @return font height in millipoints + */ + int getXHeight(int size); + + /** + * Return the width (in 1/1000ths of point size) of the character at + * code point i. + * @param i code point index + * @param size font size + * @return the width of the character + */ + int getWidth(int i, int size); + + /** + * Return the array of widths. + *

+ * This is used to get an array for inserting in an output format. + * It should not be used for lookup. + * @return an array of widths + */ + int[] getWidths(); + + /** + * Indicates if the font has kering information. + * @return True, if kerning is available. + */ + boolean hasKerningInfo(); + + /** + * Returns the kerning map for the font. + * @return the kerning map + */ + Map getKerningInfo(); + +} diff --git a/src/org/apache/fop/fonts/FontType.java b/src/org/apache/fop/fonts/FontType.java new file mode 100644 index 000000000..cfaaa438c --- /dev/null +++ b/src/org/apache/fop/fonts/FontType.java @@ -0,0 +1,98 @@ +/* + * $Id$ + * Copyright (C) 2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +import org.apache.avalon.framework.ValuedEnum; + +/** + * This class enumerates all supported font types. + */ +public class FontType extends ValuedEnum { + + /** + * Collective identifier for "other" font types + */ + public static final FontType OTHER = new FontType("Other", 0); + /** + * Adobe Type 0 fonts + */ + public static final FontType TYPE0 = new FontType("Type0", 1); + /** + * Adobe Type 1 fonts + */ + public static final FontType TYPE1 = new FontType("Type1", 2); + /** + * Adobe Multiple Master Type 1 fonts + */ + public static final FontType MMTYPE1 = new FontType("MMType1", 3); + /** + * Adobe Type 3 fonts ("user-defined" fonts) + */ + public static final FontType TYPE3 = new FontType("Type3", 4); + /** + * TrueType fonts + */ + public static final FontType TRUETYPE = new FontType("TrueType", 5); + + + /** + * @see org.apache.avalon.framework.Enum#Enum(String) + */ + protected FontType(String name, int value) { + super(name, value); + } + + + /** + * Returns the FontType by name. + * @param name Name of the font type to look up + * @return the font type + */ + public static FontType byName(String name) { + if (name.equalsIgnoreCase(FontType.OTHER.getName())) { + return FontType.OTHER; + } else if (name.equalsIgnoreCase(FontType.TYPE0.getName())) { + return FontType.TYPE0; + } else if (name.equalsIgnoreCase(FontType.TYPE1.getName())) { + return FontType.TYPE1; + } else if (name.equalsIgnoreCase(FontType.MMTYPE1.getName())) { + return FontType.MMTYPE1; + } else if (name.equalsIgnoreCase(FontType.TYPE3.getName())) { + return FontType.TYPE3; + } else if (name.equalsIgnoreCase(FontType.TRUETYPE.getName())) { + return FontType.TRUETYPE; + } else { + throw new IllegalArgumentException("Invalid font type: " + name); + } + } + + + /** + * Returns the FontType by value. + * @param value Value of the font type to look up + * @return the font type + */ + public static FontType byValue(int value) { + if (value == FontType.OTHER.getValue()) { + return FontType.OTHER; + } else if (value == FontType.TYPE0.getValue()) { + return FontType.TYPE0; + } else if (value == FontType.TYPE1.getValue()) { + return FontType.TYPE1; + } else if (value == FontType.MMTYPE1.getValue()) { + return FontType.MMTYPE1; + } else if (value == FontType.TYPE3.getValue()) { + return FontType.TYPE3; + } else if (value == FontType.TRUETYPE.getValue()) { + return FontType.TRUETYPE; + } else { + throw new IllegalArgumentException("Invalid font type: " + value); + } + } + +} diff --git a/src/org/apache/fop/fonts/LazyFont.java b/src/org/apache/fop/fonts/LazyFont.java new file mode 100644 index 000000000..7f90f924b --- /dev/null +++ b/src/org/apache/fop/fonts/LazyFont.java @@ -0,0 +1,244 @@ +/* + * $Id$ + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +//Java +import java.util.Map; + +//FOP +import org.apache.fop.render.pdf.FontReader; + +/** + * This class is used to defer the loading of a font until it is really used. + */ +public class LazyFont extends Font implements FontDescriptor { + + private String metricsFileName = null; + private String fontEmbedPath = null; + private boolean useKerning = false; + + private boolean isMetricsLoaded = false; + private Font realFont = null; + private FontDescriptor realFontDescriptor = null; + + /** + * Main constructor + * @param fontEmbedPath path to embeddable file (may be null) + * @param metricsFileName path to the metrics XML file + * @param useKerning True, if kerning should be enabled + */ + public LazyFont(String fontEmbedPath, String metricsFileName, boolean useKerning) { + this.metricsFileName = metricsFileName; + this.fontEmbedPath = fontEmbedPath; + this.useKerning = useKerning; + } + + private void load() { + if (!isMetricsLoaded) { + isMetricsLoaded = true; + try { + /**@todo Possible thread problem here */ + + FontReader reader = new FontReader(metricsFileName); + reader.setKerningEnabled(useKerning); + reader.setFontEmbedPath(fontEmbedPath); + realFont = reader.getFont(); + if (realFont instanceof FontDescriptor) { + realFontDescriptor = (FontDescriptor) realFont; + } + // System.out.println("Metrics " + metricsFileName + " loaded."); + } catch (Exception ex) { + /**@todo Log this exception */ + //log.error("Failed to read font metrics file " + // + metricsFileName + // + " : " + ex.getMessage()); + } + } + } + + /** + * Gets the real font. + * @return the real font + */ + public Font getRealFont() { + load(); + return realFont; + } + + // ---- Font ---- + /** + * @see org.apache.fop.fonts.Font#getEncoding() + */ + public String getEncoding() { + load(); + return realFont.getEncoding(); + } + + /** + * @see org.apache.fonts.pdf.Font#mapChar(char) + */ + public char mapChar(char c) { + load(); + return realFont.mapChar(c); + } + + /** + * @see org.apache.fop.fonts.Font#isMultiByte() + */ + public boolean isMultiByte() { + return realFont.isMultiByte(); + } + + // ---- FontMetrics interface ---- + /** + * @see org.apache.fop.fonts.FontMetrics#getFontName() + */ + public String getFontName() { + load(); + return realFont.getFontName(); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getAscender(int) + */ + public int getAscender(int size) { + load(); + return realFont.getAscender(size); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getCapHeight(int) + */ + public int getCapHeight(int size) { + load(); + return realFont.getCapHeight(size); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getDescender(int) + */ + public int getDescender(int size) { + load(); + return realFont.getDescender(size); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getXHeight(int) + */ + public int getXHeight(int size) { + load(); + return realFont.getXHeight(size); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getWidth(int, int) + */ + public int getWidth(int i, int size) { + load(); + return realFont.getWidth(i, size); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getWidths() + */ + public int[] getWidths() { + load(); + return realFont.getWidths(); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#hasKerningInfo() + */ + public boolean hasKerningInfo() { + load(); + return realFont.hasKerningInfo(); + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getKerningInfo() + */ + public Map getKerningInfo() { + load(); + return realFont.getKerningInfo(); + } + + // ---- FontDescriptor interface ---- + /** + * @see org.apache.fop.fonts.FontDescriptor#getCapHeight() + */ + public int getCapHeight() { + load(); + return realFontDescriptor.getCapHeight(); + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getDescender() + */ + public int getDescender() { + load(); + return realFontDescriptor.getDescender(); + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getAscender() + */ + public int getAscender() { + load(); + return realFontDescriptor.getAscender(); + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getFlags() + */ + public int getFlags() { + load(); + return realFontDescriptor.getFlags(); + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getFontBBox() + */ + public int[] getFontBBox() { + load(); + return realFontDescriptor.getFontBBox(); + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getItalicAngle() + */ + public int getItalicAngle() { + load(); + return realFontDescriptor.getItalicAngle(); + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getStemV() + */ + public int getStemV() { + load(); + return realFontDescriptor.getStemV(); + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#getFontType() + */ + public FontType getFontType() { + load(); + return realFontDescriptor.getFontType(); + } + + /** + * @see org.apache.fop.fonts.FontDescriptor#isEmbeddable() + */ + public boolean isEmbeddable() { + load(); + return realFontDescriptor.isEmbeddable(); + } + +} + diff --git a/src/org/apache/fop/fonts/MultiByteFont.java b/src/org/apache/fop/fonts/MultiByteFont.java new file mode 100644 index 000000000..1384d3405 --- /dev/null +++ b/src/org/apache/fop/fonts/MultiByteFont.java @@ -0,0 +1,316 @@ +/* + * $Id$ + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +//Java +import java.util.Map; + +//FOP +import org.apache.fop.pdf.PDFWArray; + +/** + * Generic MultiByte (CID) font + */ +public class MultiByteFont extends CIDFont { + + private static int uniqueCounter = 1; + + + private String ttcName = null; + private String encoding = "Identity-H"; + + private String embedResourceName = null; + + private int defaultWidth = 0; + private CIDFontType cidType = CIDFontType.CIDTYPE2; + + private String namePrefix = null; // Quasi unique prefix + private PDFWArray warray = new PDFWArray(); + private int width[] = null; + + private BFEntry[] bfentries = null; + + /** + * usedGlyphs contains orginal, new glyph index + */ + private Map usedGlyphs = new java.util.HashMap(); + + /** + * usedGlyphsIndex contains new glyph, original index + */ + private Map usedGlyphsIndex = new java.util.HashMap(); + private int usedGlyphsCount = 0; + + + /** + * Default constructor + */ + public MultiByteFont() { + // Make sure that the 3 first glyphs are included + usedGlyphs.put(new Integer(0), new Integer(0)); + usedGlyphsIndex.put(new Integer(0), new Integer(0)); + usedGlyphsCount++; + usedGlyphs.put(new Integer(1), new Integer(1)); + usedGlyphsIndex.put(new Integer(1), new Integer(1)); + usedGlyphsCount++; + usedGlyphs.put(new Integer(2), new Integer(2)); + usedGlyphsIndex.put(new Integer(2), new Integer(2)); + usedGlyphsCount++; + + // Create a quasiunique prefix for fontname + int cnt = 0; + synchronized (this.getClass()) { + cnt = uniqueCounter++; + } + int ctm = (int)(System.currentTimeMillis() & 0xffff); + namePrefix = new String(cnt + "E" + Integer.toHexString(ctm)); + + setFontType(FontType.TYPE0); + } + + /** + * @see org.apache.fop.fonts.CIDFont#getDefaultWidth() + */ + public int getDefaultWidth() { + return defaultWidth; + } + + /** + * @see org.apache.fop.fonts.CIDFont#getRegistry() + */ + public String getRegistry() { + return "Adobe"; + } + + /** + * @see org.apache.fop.fonts.CIDFont#getOrdering() + */ + public String getOrdering() { + return "UCS"; + } + + /** + * @see org.apache.fop.fonts.CIDFont#getSupplement() + */ + public int getSupplement() { + return 0; + } + + /** + * @see org.apache.fop.fonts.CIDFont#getCIDType() + */ + public CIDFontType getCIDType() { + return cidType; + } + + /** + * Sets the CIDType. + * @param cidType The cidType to set + */ + public void setCIDType(CIDFontType cidType) { + this.cidType = cidType; + } + + /** + * @see org.apache.fop.fonts.CIDFont#getCidBaseFont() + */ + public String getCidBaseFont() { + if (isEmbeddable()) { + return namePrefix + super.getFontName(); + } else { + return super.getFontName(); + } + } + +/* unused + public PDFWArray getWidthsAsPDFWArray() { + if (isEmbeddable()) { + // Create widths for reencoded chars + warray = new PDFWArray(); + int[] tmpWidth = new int[usedGlyphsCount]; + + for (int i = 0; i < usedGlyphsCount; i++) { + Integer nw = (Integer)usedGlyphsIndex.get(new Integer(i)); + int nwx = (nw == null) ? 0 : nw.intValue(); + tmpWidth[i] = width[nwx]; + } + warray.addEntry(0, tmpWidth); + } + return warray; + }*/ + + /** + * @see org.apache.fop.fonts.FontDescriptor#isEmbeddable() + */ + public boolean isEmbeddable() { + if (getEmbedFileName() == null + && embedResourceName == null) { + return false; + } else { + return true; + } + } + + /** + * @see org.apache.fop.fonts.Font#getEncoding() + */ + public String getEncoding() { + return encoding; + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getFontName() + */ + public String getFontName() { + if (isEmbeddable()) { + return namePrefix + super.getFontName(); + } else { + return super.getFontName(); + } + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getWidth(int, int) + */ + public int getWidth(int i, int size) { + if (isEmbeddable()) { + Integer idx = (Integer)usedGlyphsIndex.get(new Integer(i)); + return size * width[idx.intValue()]; + } else { + return size * width[i]; + } + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getWidths() + */ + 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; + } + + /** + * Remaps a codepoint based. + * @param i codepoint to remap + * @return new codepoint + */ +/* unused + public Integer reMap(Integer i) { + if (isEmbeddable()) { + Integer ret = (Integer)usedGlyphsIndex.get(i); + if (ret == null) { + ret = i; + } + return ret; + } else { + return i; + } + + } +*/ + + /** + * @see org.apache.fop.fonts.Font#mapChar(char) + */ + public char mapChar(char c) { + int idx = (int)c; + int retIdx = 0; + + for (int i = 0; (i < bfentries.length) && retIdx == 0; i++) { + if (bfentries[i].getUnicodeStart() <= idx + && bfentries[i].getUnicodeEnd() >= idx) { + retIdx = bfentries[i].getGlyphStartIndex() + idx + - bfentries[i].getUnicodeStart(); + } + } + + if (isEmbeddable()) { + // Reencode to a new subset font or get + // the reencoded value + Integer newIdx = (Integer)usedGlyphs.get(new Integer(retIdx)); + if (newIdx == null) { + usedGlyphs.put(new Integer(retIdx), + new Integer(usedGlyphsCount)); + usedGlyphsIndex.put(new Integer(usedGlyphsCount), + new Integer(retIdx)); + retIdx = usedGlyphsCount; + // System.out.println(c+"("+(int)c+") = "+retIdx); + usedGlyphsCount++; + } else { + retIdx = newIdx.intValue(); + } + } + + return (char)retIdx; + } + + /** + * Sets the bfentries. + * @param bfentries The bfentries to set + */ + public void setBFEntries(BFEntry[] bfentries) { + this.bfentries = bfentries; + } + + /** + * Sets the defaultWidth. + * @param defaultWidth The defaultWidth to set + */ + public void setDefaultWidth(int defaultWidth) { + this.defaultWidth = defaultWidth; + } + + /** + * Returns the TrueType Collection Name. + * @return the TrueType Collection Name + */ + public String getTTCName() { + return ttcName; + } + + /** + * Sets the the TrueType Collection Name. + * @param ttcName the TrueType Collection Name + */ + public void setTTCName(String ttcName) { + this.ttcName = ttcName; + } + + /** + * Adds a new CID width entry to the font. + * @param cidWidthIndex index + * @param wds array of widths + */ + public void addCIDWidthEntry(int cidWidthIndex, int[] wds) { + this.warray.addEntry(cidWidthIndex, wds); + } + + + /** + * Sets the width array. + * @param wds array of widths. + */ + public void setWidthArray(int[] wds) { + this.width = wds; + } + + /** + * Returns a Map of used Glyphs. + * @return Map Map of used Glyphs + */ + public Map getUsedGlyphs() { + return usedGlyphs; + } + +} + diff --git a/src/org/apache/fop/fonts/MutableFont.java b/src/org/apache/fop/fonts/MutableFont.java new file mode 100644 index 000000000..f13c568af --- /dev/null +++ b/src/org/apache/fop/fonts/MutableFont.java @@ -0,0 +1,115 @@ +/* + * $Id$ + * Copyright (C) 2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +import java.util.Map; + + +/** + * This interface is used to set the values of a font during configuration time. + */ +public interface MutableFont { + + /** + * Sets the font name. + * @param name font name + */ + void setFontName(String name); + + /** + * Sets the path to the embeddable font file. + * @param path URI to the file + */ + void setEmbedFileName(String path); + + /** + * Sets the resource name of the embeddable font file. + * @param name resource name + */ + void setEmbedResourceName(String name); + + /** + * Sets the capital height value. + * @param capHeight capital height + */ + void setCapHeight(int capHeight); + + /** + * Sets the ascent value. + * @param ascender ascent height + */ + void setAscender(int ascender); + + /** + * Sets the descent value. + * @param descender descent value + */ + void setDescender(int descender); + + /** + * Sets the font's bounding box + * @param bbox bounding box + */ + void setFontBBox(int[] bbox); + + /** + * Sets the font's flags + * @param flags flags + */ + void setFlags(int flags); + + /** + * Sets the font's StemV value. + * @param stemV StemV + */ + void setStemV(int stemV); + + /** + * Sets the font's italic angle. + * @param italicAngle italic angle + */ + void setItalicAngle(int italicAngle); + + /** + * Sets the font's default width + * @param width default width + */ + void setMissingWidth(int width); + + /** + * Sets the font type. + * @param fontType font type + */ + void setFontType(FontType fontType); + + /** + * Sets the index of the first character in the character table. + * @param index index of first character + */ + void setFirstChar(int index); + + /** + * Sets the index of the last character in the character table. + * @param index index of the last character + */ + void setLastChar(int index); + + /** + * Enables/disabled kerning. + * @param enabled True if kerning should be enabled if available + */ + void setKerningEnabled(boolean enabled); + + /** + * Adds an entry to the kerning table. + * @param key Kerning key + * @param value Kerning value + */ + void putKerningEntry(Integer key, Map value); + +} diff --git a/src/org/apache/fop/fonts/SingleByteFont.java b/src/org/apache/fop/fonts/SingleByteFont.java new file mode 100644 index 000000000..9ad776f98 --- /dev/null +++ b/src/org/apache/fop/fonts/SingleByteFont.java @@ -0,0 +1,85 @@ +/* + * $Id$ + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.fonts; + +/** + * Generic SingleByte font + */ +public class SingleByteFont extends CustomFont { + + private final CodePointMapping mapping + = CodePointMapping.getMapping("WinAnsiEncoding"); + + private String encoding = "WinAnsiEncoding"; + + private int width[] = null; + + + /** + * @see org.apache.fop.fonts.FontDescriptor#isEmbeddable() + */ + public boolean isEmbeddable() { + return (getEmbedFileName() == null && getEmbedResourceName() == null) ? false + : true; + } + + /** + * @see org.apache.fop.fonts.Font#getEncoding() + */ + public String getEncoding() { + return encoding; + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getWidth(int, int) + */ + public int getWidth(int i, int size) { + return size * width[i]; + } + + /** + * @see org.apache.fop.fonts.FontMetrics#getWidths() + */ + 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; + } + + /** + * @see org.apache.fop.fonts.Font#mapChar(char) + */ + public char mapChar(char c) { + char d = mapping.mapChar(c); + if (d != 0) { + return d; + } else { + return '#'; + } + } + + /* ---- single byte font specific setters --- */ + + /** + * Sets a width for a character. + * @param index index of the character + * @param width the width of the character + */ + public void setWidth(int index, int width) { + if (this.width == null) { + this.width = new int[256]; + } + this.width[index] = width; + } + +} + diff --git a/src/org/apache/fop/fonts/apps/TTFReader.java b/src/org/apache/fop/fonts/apps/TTFReader.java index 239221492..424104bd9 100644 --- a/src/org/apache/fop/fonts/apps/TTFReader.java +++ b/src/org/apache/fop/fonts/apps/TTFReader.java @@ -25,9 +25,9 @@ import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.avalon.framework.logger.Logger; //FOP -import org.apache.fop.fonts.FontFileReader; -import org.apache.fop.fonts.TTFCmapEntry; -import org.apache.fop.fonts.TTFFile; +import org.apache.fop.fonts.truetype.FontFileReader; +import org.apache.fop.fonts.truetype.TTFCmapEntry; +import org.apache.fop.fonts.truetype.TTFFile; /** * A tool which reads TTF files and generates diff --git a/src/org/apache/fop/fonts/package.html b/src/org/apache/fop/fonts/package.html new file mode 100644 index 000000000..33e1e2cb3 --- /dev/null +++ b/src/org/apache/fop/fonts/package.html @@ -0,0 +1,6 @@ + +org.apache.fop.fonts Package + +

Classes for font handling. Subpackages contain command line applications for font metrics generation, font parsing classes etc.

+ + \ No newline at end of file diff --git a/src/org/apache/fop/fonts/FontFileReader.java b/src/org/apache/fop/fonts/truetype/FontFileReader.java similarity index 93% rename from src/org/apache/fop/fonts/FontFileReader.java rename to src/org/apache/fop/fonts/truetype/FontFileReader.java index ff205a79c..a1c8ea5ff 100644 --- a/src/org/apache/fop/fonts/FontFileReader.java +++ b/src/org/apache/fop/fonts/truetype/FontFileReader.java @@ -1,19 +1,20 @@ /* * $Id$ - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ -package org.apache.fop.fonts; +package org.apache.fop.fonts.truetype; import java.io.InputStream; -import java.io.OutputStream; import java.io.File; import java.io.IOException; +import org.apache.fop.util.StreamUtilities; + /** - * Reads a file into an array and + * Reads a TrueType font file into a byte array and * provides file like functions for array access. */ public class FontFileReader { @@ -31,7 +32,7 @@ public class FontFileReader { private void init(InputStream in) throws java.io.IOException { java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream(); try { - copyStream(in, bout); + StreamUtilities.streamCopy(in, bout); this.file = bout.toByteArray(); this.fsize = this.file.length; this.current = 0; @@ -40,16 +41,6 @@ public class FontFileReader { } } - /**@todo Use method from Avalon Excalibur IO or Jakarta Commons IO*/ - private void copyStream(InputStream in, OutputStream out) throws IOException { - final int bufferSize = 2048; - final byte[] buf = new byte[bufferSize]; - int bytesRead; - while ((bytesRead = in.read(buf)) != -1) { - out.write(buf, 0, bytesRead); - } - } - /** * Constructor * diff --git a/src/org/apache/fop/fonts/TTFCmapEntry.java b/src/org/apache/fop/fonts/truetype/TTFCmapEntry.java similarity index 95% rename from src/org/apache/fop/fonts/TTFCmapEntry.java rename to src/org/apache/fop/fonts/truetype/TTFCmapEntry.java index d3e900d9f..cda19c1c5 100644 --- a/src/org/apache/fop/fonts/TTFCmapEntry.java +++ b/src/org/apache/fop/fonts/truetype/TTFCmapEntry.java @@ -1,11 +1,11 @@ /* * $Id$ - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ -package org.apache.fop.fonts; +package org.apache.fop.fonts.truetype; /** * The CMap entry contains information of a Unicode range and the diff --git a/src/org/apache/fop/fonts/TTFDirTabEntry.java b/src/org/apache/fop/fonts/truetype/TTFDirTabEntry.java similarity index 89% rename from src/org/apache/fop/fonts/TTFDirTabEntry.java rename to src/org/apache/fop/fonts/truetype/TTFDirTabEntry.java index 2c6213336..74db0274e 100644 --- a/src/org/apache/fop/fonts/TTFDirTabEntry.java +++ b/src/org/apache/fop/fonts/truetype/TTFDirTabEntry.java @@ -1,14 +1,18 @@ /* * $Id$ - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ -package org.apache.fop.fonts; +package org.apache.fop.fonts.truetype; import java.io.IOException; + +/** + * This class represents an entry to a TrueType font's Dir Tab. + */ class TTFDirTabEntry { private byte[] tag = new byte[4]; diff --git a/src/org/apache/fop/fonts/TTFFile.java b/src/org/apache/fop/fonts/truetype/TTFFile.java similarity index 99% rename from src/org/apache/fop/fonts/TTFFile.java rename to src/org/apache/fop/fonts/truetype/TTFFile.java index cef0b414b..c62b52b51 100644 --- a/src/org/apache/fop/fonts/TTFFile.java +++ b/src/org/apache/fop/fonts/truetype/TTFFile.java @@ -1,11 +1,11 @@ /* * $Id$ - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ -package org.apache.fop.fonts; +package org.apache.fop.fonts.truetype; import java.io.IOException; import java.util.Iterator; @@ -15,6 +15,7 @@ import java.util.List; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.avalon.framework.logger.Logger; +import org.apache.fop.fonts.Glyphs; /** * Reads a TrueType file or a TrueType Collection. diff --git a/src/org/apache/fop/fonts/TTFMtxEntry.java b/src/org/apache/fop/fonts/truetype/TTFMtxEntry.java similarity index 89% rename from src/org/apache/fop/fonts/TTFMtxEntry.java rename to src/org/apache/fop/fonts/truetype/TTFMtxEntry.java index 747be55f8..965844cc8 100644 --- a/src/org/apache/fop/fonts/TTFMtxEntry.java +++ b/src/org/apache/fop/fonts/truetype/TTFMtxEntry.java @@ -1,14 +1,17 @@ /* * $Id$ - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ -package org.apache.fop.fonts; +package org.apache.fop.fonts.truetype; import java.util.List; +/** + * This class represents a TrueType Mtx Entry. + */ class TTFMtxEntry { private int wx; @@ -20,6 +23,12 @@ class TTFMtxEntry { private long offset; private byte found = 0; + /** + * Returns a String representation of this object. + * + * @param t TTFFile to use for unit conversion + * @return String String representation + */ public String toString(TTFFile t) { return "Glyph " + name + " index: " + index + " bbox [ " + t.convertTTFUnit2PDFUnit(boundingBox[0]) + " " diff --git a/src/org/apache/fop/fonts/TTFSubSetFile.java b/src/org/apache/fop/fonts/truetype/TTFSubSetFile.java similarity index 99% rename from src/org/apache/fop/fonts/TTFSubSetFile.java rename to src/org/apache/fop/fonts/truetype/TTFSubSetFile.java index 7a1a98e95..8014cf48e 100644 --- a/src/org/apache/fop/fonts/TTFSubSetFile.java +++ b/src/org/apache/fop/fonts/truetype/TTFSubSetFile.java @@ -1,20 +1,21 @@ /* * $Id$ - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ -package org.apache.fop.fonts; +package org.apache.fop.fonts.truetype; import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.List; + /** * Reads a TrueType file and generates a subset - * that can be used to embed a TrueType CID font + * that can be used to embed a TrueType CID font. * TrueType tables needed for embedded CID fonts are: * "head", "hhea", "loca", "maxp", "cvt ", "prep", "glyf", "hmtx" and "fpgm". * The TrueType spec can be found at the Microsoft -- 2.39.5