diff --git a/lib/ttf.jar b/lib/ttf.jar index 4cae30b29..4c9f4963a 100644 Binary files a/lib/ttf.jar and b/lib/ttf.jar differ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java index 37bc23c6d..e801010c5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java @@ -36,7 +36,6 @@ import com.jpexs.helpers.Helper; import fontastic.FGlyph; import fontastic.FPoint; import fontastic.Fontastic; -import fontastic.PVector; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -187,19 +186,19 @@ public class FontExporter { @Override public void moveTo(double x, double y) { finalizePath(); - path.add(new FPoint(new PVector(transformX(x), transformY(y)))); + path.add(new FPoint(transformX(x), transformY(y))); } @Override public void lineTo(double x, double y) { - path.add(new FPoint(new PVector(transformX(x), transformY(y)))); + path.add(new FPoint(transformX(x), transformY(y))); } @Override public void curveTo(double controlX, double controlY, double anchorX, double anchorY) { path.add(new FPoint( - new PVector(transformX(anchorX), transformY(anchorY)), - new PVector(transformX(controlX), transformY(controlY)) + new FPoint(transformX(anchorX), transformY(anchorY)), + new FPoint(transformX(controlX), transformY(controlY)) )); } diff --git a/libsrc/ttf/src/fontastic/FContour.java b/libsrc/ttf/src/fontastic/FContour.java index 63f44d05a..38745865c 100644 --- a/libsrc/ttf/src/fontastic/FContour.java +++ b/libsrc/ttf/src/fontastic/FContour.java @@ -46,27 +46,20 @@ public class FContour { this.points = new ArrayList<>(); } - FContour(PVector[] points) { + FContour(FPoint[] points) { this.points = new ArrayList<>(); - for (PVector p : points) { - this.points.add(new FPoint(p)); + for (FPoint p : points) { + this.points.add(p); } } - FContour(PVector[] points, PVector[] controlpoints) { + FContour(FPoint[] points, FPoint[] controlpoints) { this.points = new ArrayList<>(); for (int i=0; i(); - for (int i=0; i getPoints() { return points; } @@ -76,10 +69,10 @@ public class FContour { return pointsArray; } - public void setPoints(PVector[] points) { + public void setPoints(FPoint[] points) { this.points = new ArrayList<>(); - for (PVector p : points) { - this.points.add(new FPoint(p)); + for (FPoint p : points) { + this.points.add(p); } } diff --git a/libsrc/ttf/src/fontastic/FGlyph.java b/libsrc/ttf/src/fontastic/FGlyph.java index b2b0a53c7..e5dacaf7b 100644 --- a/libsrc/ttf/src/fontastic/FGlyph.java +++ b/libsrc/ttf/src/fontastic/FGlyph.java @@ -52,15 +52,11 @@ public class FGlyph { contours.add(new FContour()); } - public void addContour(PVector[] points) { - contours.add(new FContour(points)); - } - public void addContour(FPoint[] points) { contours.add(new FContour(points)); } - public void addContour(PVector[] points, PVector[] controlPoints) { + public void addContour(FPoint[] points, FPoint[] controlPoints) { contours.add(new FContour(points, controlPoints)); } @@ -97,10 +93,6 @@ public class FGlyph { return contours.size(); } - public void setContour(int index, PVector[] points) { - contours.set(index, new FContour(points)); - } - public void setContour(int index, FPoint[] points) { contours.set(index, new FContour(points)); } diff --git a/libsrc/ttf/src/fontastic/FPoint.java b/libsrc/ttf/src/fontastic/FPoint.java index e2bd71bcb..c6d98b023 100644 --- a/libsrc/ttf/src/fontastic/FPoint.java +++ b/libsrc/ttf/src/fontastic/FPoint.java @@ -35,42 +35,45 @@ package fontastic; * Stores a point with x and y coordinates and optional PVector controlPoint1 and controlPoint2. * */ -public class FPoint extends PVector { +public class FPoint { - public PVector controlPoint; + public double x; + public double y; + + public FPoint controlPoint; private boolean hasControlPoint; public FPoint() { } - public FPoint(PVector point) { + public FPoint(FPoint point) { this.x = point.x; this.y = point.y; this.hasControlPoint = false; } - public FPoint(float x, float y) { + public FPoint(double x, double y) { this.x = x; this.y = y; this.hasControlPoint = false; } - public FPoint(PVector point, PVector controlPoint) { + public FPoint(FPoint point, FPoint controlPoint) { this.x = point.x; this.y = point.y; this.controlPoint = controlPoint; this.hasControlPoint = true; } - public void setControlPoint(PVector controlPoint1) { + public void setControlPoint(FPoint controlPoint1) { this.controlPoint = controlPoint1; this.hasControlPoint = true; } public void setControlPoint(float x, float y) { - this.controlPoint = new PVector(x,y); + this.controlPoint = new FPoint(x, y); this.hasControlPoint = true; } diff --git a/libsrc/ttf/src/fontastic/Fontastic.java b/libsrc/ttf/src/fontastic/Fontastic.java index bf07e4c77..45f5106f9 100644 --- a/libsrc/ttf/src/fontastic/Fontastic.java +++ b/libsrc/ttf/src/fontastic/Fontastic.java @@ -32,11 +32,7 @@ import org.doubletype.ossa.adapter.*; import java.io.*; import java.util.ArrayList; -import java.util.Map; import java.util.List; -import java.util.Scanner; -import java.util.regex.Pattern; -import java.util.regex.Matcher; /** * Fontastic A font file writer to create TTF and WOFF (Webfonts). @@ -45,55 +41,30 @@ import java.util.regex.Matcher; */ public class Fontastic { - private org.doubletype.ossa.module.TypefaceFile typeface; private org.doubletype.ossa.Engine m_engine; - private String fontname; + private String fontName; private List glyphs; private int advanceWidth = 512; - private File ttffile; - private File outfile; + private File ttfFile; + private File outFile; private File tempDir; - public final static String VERSION = "0.4"; - - /** - * Uppercase alphabet 26 characters * - */ - public final static char alphabet[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - 'U', 'V', 'W', 'X', 'Y', 'Z'}; - /** - * Lowercase alphabet 26 characters * - */ - public final static char alphabetLc[] = {'a', 'b', 'c', 'd', 'e', 'f', - 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', - 't', 'u', 'v', 'w', 'x', 'y', 'z'}; - - /** - * Return the version of the library. - * - * @return String - */ - public static String version() { - return VERSION; - } - /** * Constructor * * @example Fontastic f = new Fontastic(this, "MyFont"); * - * @param theParent Your processing sketch (this). - * @param fontname Font name + * @param fontName Font name + * @param outFile * */ - public Fontastic(String fontname, File outfile) throws IOException { - this.fontname = fontname; - this.outfile = outfile; + public Fontastic(String fontName, File outFile) throws IOException { + this.fontName = fontName; + this.outFile = outFile; intitialiseFont(); this.glyphs = new ArrayList<>(); } @@ -104,7 +75,7 @@ public class Fontastic { * @return String */ public String getFontname() { - return fontname; + return fontName; } private static File createTempDirectory() @@ -132,27 +103,17 @@ public class Fontastic { private void intitialiseFont() throws IOException { tempDir = createTempDirectory(); - /*if (!tempDir.exists()) { - if(!tempDir.mkdirs()){ - if (!tempDir.exists()) { - throw new IOException("Cannot create temp dir"); - } - } - } else { - //deleteFolderContents(tempDir, false); - }*/ - - m_engine = Engine.getSingletonInstance(); - m_engine.buildNewTypeface(fontname, tempDir); + m_engine = new Engine(); + m_engine.buildNewTypeface(fontName, tempDir); - this.setFontFamilyName(fontname); + this.setFontFamilyName(fontName); this.setVersion("CC BY-SA 3.0 http://creativecommons.org/licenses/by-sa/3.0/"); // default // license - String directoryName = tempDir + File.separator + "bin" + File.separator; + String directoryName = tempDir + File.separator; - ttffile = new File(directoryName + fontname + ".ttf"); + ttfFile = new File(directoryName + fontName + ".ttf"); } /** @@ -160,12 +121,11 @@ public class Fontastic { * template for previewing the WOFF. If debug is set (default is true) then * you'll see the .ttf and .woff file name in the console. */ - public void buildFont() throws FileNotFoundException { + public void buildFont() { // Create TTF file with doubletype //m_engine.fireAction(); //m_engine.addDefaultGlyphs(); - List glyphFiles = new ArrayList<>(glyphs.size()); for (FGlyph glyph : glyphs) { m_engine.checkUnicodeBlock(glyph.getGlyphChar()); @@ -200,18 +160,16 @@ public class Fontastic { glyphFile.addContour(econtour); } - - glyphFiles.add(glyphFile); } m_engine.getTypeface().addRequiredGlyphs(); - m_engine.buildTrueType(false); + m_engine.buildTrueType(); // End TTF creation - if(outfile.exists()){ - outfile.delete(); + if(outFile.exists()){ + outFile.delete(); } - ttffile.renameTo(outfile); + ttfFile.renameTo(outFile); cleanup(); } @@ -229,14 +187,14 @@ public class Fontastic { /** * Sets the author of the font. */ - public void setAuthor(String author) throws FileNotFoundException { + public void setAuthor(String author) { m_engine.setAuthor(author); } /** * Sets the copyright year of the font. */ - public void setCopyrightYear(String copyrightYear) throws FileNotFoundException { + public void setCopyrightYear(String copyrightYear) { m_engine.setCopyrightYear(copyrightYear); } @@ -244,7 +202,7 @@ public class Fontastic { * Sets the version of the font (default is "0.1"). */ public void setVersion(String version) { - m_engine.getTypeface().getGlyph().getHead().setVersion(version); + m_engine.getTypeface().setVersion(version); } /** @@ -252,14 +210,14 @@ public class Fontastic { * changed with setFontFamilyName() it won't affect folder the font is * stored in. */ - public void setFontFamilyName(String fontFamilyName) throws FileNotFoundException { + public void setFontFamilyName(String fontFamilyName) { m_engine.setFontFamilyName(fontFamilyName); } /** * Sets the sub family of the font. */ - public void setSubFamily(String subFamily) throws FileNotFoundException { + public void setSubFamily(String subFamily) { m_engine.getTypeface().setSubFamily(subFamily); } @@ -267,21 +225,21 @@ public class Fontastic { * Sets the license of the font (default is "CC BY-SA 3.0 * http://creativecommons.org/licenses/by-sa/3.0/") */ - public void setTypefaceLicense(String typefaceLicense) throws FileNotFoundException { + public void setTypefaceLicense(String typefaceLicense) { m_engine.setTypefaceLicense(typefaceLicense); } /** * Sets the baseline of the font. */ - public void setBaseline(float baseline) throws FileNotFoundException { + public void setBaseline(float baseline) { m_engine.setBaseline(baseline); } /** * Sets the meanline of the font. */ - public void setMeanline(float meanline) throws FileNotFoundException { + public void setMeanline(float meanline) { m_engine.setMeanline(meanline); } @@ -294,7 +252,7 @@ public class Fontastic { this.advanceWidth = advanceWidth; } - public void setTopSideBearing(float topSideBearing) throws FileNotFoundException { + public void setTopSideBearing(float topSideBearing) { try { m_engine.getTypeface().setTopSideBearing(topSideBearing); } catch (OutOfRangeException e) { @@ -305,7 +263,7 @@ public class Fontastic { } } - public void setBottomSideBearing(float bottomSideBearing) throws FileNotFoundException { + public void setBottomSideBearing(float bottomSideBearing) { try { m_engine.getTypeface().setBottomSideBearing(bottomSideBearing); } catch (OutOfRangeException e) { @@ -316,7 +274,7 @@ public class Fontastic { } } - public void setAscender(float ascender) throws FileNotFoundException { + public void setAscender(float ascender) { try { m_engine.getTypeface().setAscender(ascender); } catch (OutOfRangeException e) { @@ -327,7 +285,7 @@ public class Fontastic { } } - public void setDescender(float descender) throws FileNotFoundException { + public void setDescender(float descender) { try { m_engine.getTypeface().setDescender(descender); } catch (OutOfRangeException e) { @@ -338,7 +296,7 @@ public class Fontastic { } } - public void setXHeight(float xHeight) throws FileNotFoundException { + public void setXHeight(float xHeight) { try { m_engine.getTypeface().setXHeight(xHeight); } catch (OutOfRangeException e) { @@ -357,7 +315,7 @@ public class Fontastic { * // 2 px setBottomSideBearing(0); // 0px * */ - public void setDefaultMetrics() throws FileNotFoundException { + public void setDefaultMetrics() { m_engine.getTypeface().setDefaultMetrics(); } @@ -383,7 +341,7 @@ public class Fontastic { * * @param c Character of the glyph. * - * @param FContour Shape of the glyph as FContour. + * @param contour Shape of the glyph as FContour. * * @return The glyph FGlyph that has been created. You can use this to store * the glyph and add contours afterwards. Alternatively, you can call @@ -405,7 +363,7 @@ public class Fontastic { * * @param c Character of the glyph. * - * @param FContour [] Shape of the glyph in an array of FContour. + * @param contours Shape of the glyph in an array of FContour. * * @return The FGlyph that has been created. You can use this to store the * glyph and add contours afterwards. Alternatively, you can call @@ -417,7 +375,6 @@ public class Fontastic { glyphs.add(glyph); for (FContour contour : contours) { - // if (debug) System.out.println(p.x + " - " + p.y); glyph.addContour(contour); } glyph.setAdvanceWidth(advanceWidth); @@ -471,7 +428,7 @@ public class Fontastic { * @return The .ttf file name, which is being created when you call build() */ public String getTTFfilename() { - return ttffile.toString(); + return ttfFile.toString(); } private static void deleteFolderContents(File folder, diff --git a/libsrc/ttf/src/fontastic/PVector.java b/libsrc/ttf/src/fontastic/PVector.java deleted file mode 100644 index 42786aab2..000000000 --- a/libsrc/ttf/src/fontastic/PVector.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package fontastic; - -/** - * - * @author JPEXS - */ -public class PVector { - public double x; - public double y; - - public PVector() { - } - - - - public PVector(double x, double y) { - this.x = x; - this.y = y; - } - -} diff --git a/libsrc/ttf/src/fontatest/FontaTest.java b/libsrc/ttf/src/fontatest/FontaTest.java index 801ba5211..3753646f5 100644 --- a/libsrc/ttf/src/fontatest/FontaTest.java +++ b/libsrc/ttf/src/fontatest/FontaTest.java @@ -1,31 +1,30 @@ -package fontatest; - -import fontastic.FPoint; -import fontastic.Fontastic; -import fontastic.PVector; -import java.io.File; -import java.io.IOException; - - -public class FontaTest { - - /** - * @param args the command line arguments - */ - public static void main(String[] args) throws IOException { - File file=new File("example.ttf"); - file.delete(); - Fontastic f = new Fontastic("ExampleFont",file); - f.setAuthor("Nobody"); - FPoint[] points = new FPoint[]{ // Define a PVector array containing the points of the shape - new FPoint(0, 0), - new FPoint(512,0), - //new FPoint(256, 1024), - new FPoint(new PVector(256,1024), new PVector(512,512)), - new FPoint(0, 0) - }; - f.addGlyph('P').addContour(points); // Assign contour to character A - f.buildFont(); - } - -} +package fontatest; + +import fontastic.FPoint; +import fontastic.Fontastic; +import java.io.File; +import java.io.IOException; + + +public class FontaTest { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws IOException { + File file=new File("example.ttf"); + file.delete(); + Fontastic f = new Fontastic("ExampleFont",file); + f.setAuthor("Nobody"); + FPoint[] points = new FPoint[]{ // Define a FPoint array containing the points of the shape + new FPoint(0, 0), + new FPoint(512,0), + //new FPoint(256, 1024), + new FPoint(new FPoint(256,1024), new FPoint(512,512)), + new FPoint(0, 0) + }; + f.addGlyph('P').addContour(points); // Assign contour to character A + f.buildFont(); + } + +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/ActiveList.java b/libsrc/ttf/src/org/doubletype/ossa/ActiveList.java deleted file mode 100644 index dfacfb5fa..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/ActiveList.java +++ /dev/null @@ -1,199 +0,0 @@ - /* - * $Id: ActiveList.java,v 1.7 2004/11/15 03:39:38 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import java.util.*; - -import org.doubletype.ossa.adapter.*; - -/** - * @author e.e - */ -public class ActiveList { - private static ActiveList s_actives = null; - - public static ActiveList getSingletonInstance() { - if (s_actives == null) - s_actives = new ActiveList(); - - return s_actives; - } - - // -------------------------------------------------------------- - - public ArrayList m_activeObjects = new ArrayList<>(); - - public void unselectAll() { - m_activeObjects.clear(); - } - - public boolean hasSelected() { - return size() > 0; - } - - public int size() { - return m_activeObjects.size(); - } - - public GlyphObject get(int a_index) { - return m_activeObjects.get(a_index); - } - - public boolean isSelected(Object a_value) { - int i; - - // use equal method to compare this will catch XContour etc... - for (i = 0; i < size(); i++) { - if (get(i) == a_value) { - return true; - } // if - } // for i - - return false; - } - - public void addActive(GlyphObject a_object) { - if (isSelected(a_object)) { - return; - } // if - - m_activeObjects.add(a_object); - } - - public void setActives(ActiveList a_actives) { - unselectAll(); - - int i; - for (i = 0; i < a_actives.size(); i++) { - addActive(a_actives.get(i)); - } // for i - } - - private GlyphObject getTheActive() { - GlyphObject retval = null; - - if (m_activeObjects.size() == 1) { - retval = get(0); - } // if - - return retval; - } - - public boolean hasActiveModule() { - return (getTheActive() instanceof EModuleInvoke); - } - - public EModuleInvoke getActiveModule() { - if (hasActiveModule()) { - return (EModuleInvoke) getTheActive(); - } else { - return null; - } // if-else - } - - public boolean hasActiveContour() { - return (getTheActive() instanceof EContour); - } - - public EContour getActiveContour() { - if (getTheActive() instanceof EContour) { - return (EContour) getTheActive(); - } else { - return null; - } // if-else - } - - public boolean hasActiveInclude() { - return (getTheActive() instanceof EIncludeInvoke); - } - - public EIncludeInvoke getActiveInclude() { - if (hasActiveInclude()) { - return (EIncludeInvoke) getTheActive(); - } // if - - return null; - } - - public boolean hasActiveControlPoint() { - return (getTheActive() instanceof EControlPoint); - } - - public EControlPoint getActiveControlPoint() { - if (hasActiveControlPoint()) { - return (EControlPoint) getTheActive(); - } // if - - return null; - } - - public boolean hasActivePoint() { - return (getTheActive() instanceof EContourPoint); - } - - public EContourPoint getActivePoint() { - if (hasActivePoint()) { - return (EContourPoint) getTheActive(); - } else { - return null; - } // if - } - - public boolean hasActiveHint() { - return (getTheActive() instanceof EHint); - } - - public String getSelectedAsString() { - String retval = ""; - - if (!hasSelected()) { - return retval; - } // if - - retval = ""; - - int i; - for (i = 0; i < size(); i++) { - GlyphObject active = get(i); - retval += active.toString(); - } // for i - - retval += ""; - - return retval; - } - -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/AppSettings.java b/libsrc/ttf/src/org/doubletype/ossa/AppSettings.java deleted file mode 100644 index f5ca77e1e..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/AppSettings.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - */ -package org.doubletype.ossa; - -import java.io.*; -import java.util.Properties; - -/** - * @author e.e - */ -public class AppSettings extends Object { - private static String k_lastTypefaceFile = "lastTypefaceFile"; - - private static File s_fileName = new File("./.properties"); - private static Properties s_properties; - - public static String getLastTypefaceDir() { - loadPropertyFile(); - return s_properties.getProperty(k_lastTypefaceFile, "./"); - } - - public static void setLastTypefaceDir(String a_value) { - loadPropertyFile(); - s_properties.setProperty(k_lastTypefaceFile, a_value); - savePropertyFile(); - } - - private static void loadPropertyFile() { - if (s_properties != null) { - return; - } // if - - s_properties = new Properties(); - if (s_fileName.exists()) { - try { - s_properties.load(new FileInputStream(s_fileName)); - } catch (IOException e) { - e.printStackTrace(); - } // try-catch - } // if - } - - private static void savePropertyFile() { - if (s_properties == null) { - return; - } // if - - try { - s_properties.store(new FileOutputStream(s_fileName), - "DoubleType AppSetting File"); - } catch (IOException e) { - e.printStackTrace(); - } // try-catch - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/Engine.java b/libsrc/ttf/src/org/doubletype/ossa/Engine.java index 16e459f68..768b428f4 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/Engine.java +++ b/libsrc/ttf/src/org/doubletype/ossa/Engine.java @@ -35,23 +35,13 @@ package org.doubletype.ossa; -import java.awt.*; -import java.awt.datatransfer.*; -import java.awt.event.*; -import java.awt.geom.*; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; import java.io.*; -import java.net.MalformedURLException; import java.util.logging.Level; import java.util.logging.Logger; -import javax.swing.*; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.*; -import javax.swing.event.*; -import org.doubletype.ossa.adapter.*; import org.doubletype.ossa.module.*; import org.doubletype.ossa.truetype.*; @@ -59,252 +49,14 @@ import org.doubletype.ossa.truetype.*; * @author e.e */ public class Engine { - // -------------------------------------------------------------- - - // used by findFile - public static final int USER_CANCELLED = -1; - public static final int FILE_NOT_FOUND = 0; - public static final int FILE_FOUND = 1; - - // used by Find - public static final int SEARCH_BY_EXAMPLE = 0; - public static final int SEARCH_UNICODE = 1; - public static final int SEARCH_JIS_CODE = 2; - - // public static final double k_fontSizes [] = {9, 10, 11, 12, 14, 18, 24, 36, 72}; - public static final int k_defaultPixelSize = 16; - public static final int k_resolutions [] = {96, 72, 75, 100}; - public static final int k_defaultResolution = 96; - public static final int k_zooms [] = {25, 50, 100}; - public static final int k_defaultZoom = 100; - - // -------------------------------------------------------------- - - private static int s_em = 1024; - private static Engine s_singleton = null; - - public static Engine getSingletonInstance() { - if (s_singleton == null) - s_singleton = new Engine(); - return s_singleton; - } - - public static int getEm() { - return TTPixelSize.getEm(); - } - - // -------------------------------------------------------------- - - private UiBridge m_ui; - private TypefaceFile m_typeface; private GlyphFile m_root; - private ActiveList m_actives; - private ArrayList m_listeners = new ArrayList<>(); - - private String m_foundFileName; - private Clipboard m_clipboard; - private JFileChooser m_gifChooser; - private JFileChooser m_chooser; - - private Action m_deleteAction; - private Action m_addPointAction; - private Action m_toggleAction; - private Action m_hintAction; - private Action m_contourAction; - private Action m_moduleAction; - private Action m_includeAction; - private Action m_selectNextAction; - private Action m_roundAction; - private Action m_propertyAction; - private Action m_convertControlPointAction; - private Action m_convertContourAction; - - private String m_msgAlreadyExists = " already exists!"; - private String m_msgNoTypeface = "no typeface"; - private String m_msgEmptyGlyphTitle = "glyph title is empty"; - private String m_msgGlyphName = "glyph name?"; - private String m_msgCircular = "circular include!"; - private String m_msgNoJis = "Charset ISO-2022-JP is not supported.\n" - + "Please include charsets.jar in classpath."; // -------------------------------------------------------------- - private Engine() { - //GlyphFactory.setFactory(new EGlyphFactory()); - - - - m_typeface = null; - m_root = null; - - m_clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - m_actives = ActiveList.getSingletonInstance(); - - initActions(); + public Engine() { } - private void initActions() { - - } - - public Action [] buildCommands() { - ArrayList actions = buildCommandsArrayList(); - Action [] retval = new Action[actions.size()]; - int i; - for (i = 0; i < actions.size(); i++) { - retval[i] = (Action) actions.get(i); - } // for i - - return retval; - } - - private ArrayList buildCommandsArrayList() { - ArrayList retval = new ArrayList<>(); - - if (m_root == null) { - return retval; - } // if - - if (m_actives.hasActiveContour()) { - retval.add(m_convertContourAction); - } - - if (m_actives.hasActiveControlPoint()) { - EControlPoint controlPoint = m_actives.getActiveControlPoint(); - retval.add(m_convertControlPointAction); - } - - if (m_actives.hasActivePoint()) { - EContourPoint point = m_actives.getActivePoint(); - - retval.add(m_toggleAction); - - if (!point.isRounded()) { - retval.add(m_hintAction); - } // if - - if (!point.hasHintForCurrentPpem()) { - retval.add(m_roundAction); - } // if - } // if - - if (m_actives.size() > 0) { - // retval.add(m_propertyAction); - retval.add(m_deleteAction); - } // if - - if (m_actives.hasActivePoint()) { - retval.add(m_addPointAction); - } // if - - /*if (!GlyphAction.isPointVisible()) { - retval.add(m_moduleAction); - retval.add(m_contourAction); - retval.add(m_includeAction); - } // if*/ - - return retval; - } - - public void localize(ResourceBundle a_bundle) { - m_msgAlreadyExists = a_bundle.getString("msgAlreadyExists"); - m_msgNoTypeface = a_bundle.getString("msgNoTypeface"); - m_msgEmptyGlyphTitle = a_bundle.getString("msgEmptyGlyphTitle"); - m_msgGlyphName = a_bundle.getString("msgGlyphName"); - m_msgCircular = a_bundle.getString("msgCircular"); - } - - private void showPropertyDialog() { - if (m_actives.size() != 1) { - return; - } // if - - m_ui.showPropertyDialog(m_actives.get(0)); - } - - public void setUi(UiBridge a_ui) { - m_ui = a_ui; - } - - - - public void selectNext() { - if (m_root == null) { - return; - } // if - - m_root.selectNext(); - } - - public void delete() { - if (m_root == null) - return; - if (!m_actives.hasSelected()) { - return; - } // if - - m_root.remove(); - } - - public void cutToClipboard() { - if (m_root == null) - return; - if (!m_actives.hasSelected()) { - return; - } // if - - copyToClipboard(); - delete(); - } - - public void copyToClipboard() { - if (m_root == null) - return; - if (!m_actives.hasSelected()) { - return; - } // if - - String s = m_actives.getSelectedAsString(); - if (s.equals("")) { - return; - } // if - - StringSelection selection = new StringSelection(s); - - try { - m_clipboard.setContents(selection, selection); - } catch (Exception e) { - e.printStackTrace(); - } // try-catch - } - - public void pasteFromClipboard() { - if (m_root == null) - return; - Transferable content = null; - String s = ""; - - try { - content = m_clipboard.getContents(this); - if (content == null) - return; - s = (String) content.getTransferData(DataFlavor.stringFlavor); - if (s.equals("")) { - return; - } // if - } catch (Exception e) { - e.printStackTrace(); - return; - } // try-catch - - try { - m_root.addObjectFromClipboard(s); - } catch (GlyphFile.CircularIncludeException e) { - Logger.getLogger(Engine.class.getName()).log(Level.SEVERE, m_msgCircular, e); - } - } - public void setAdvanceWidth(int a_value) { if (m_root == null) return; @@ -312,34 +64,10 @@ public class Engine { m_root.setAdvanceWidth(a_value); } - public void moveLeft() { - move(new Point2D.Double(-1, 0)); - } - - public void moveUp() { - move(new Point2D.Double(0, 1)); - } - - public void moveDown() { - move(new Point2D.Double(0, -1)); - } - - public void moveRight() { - move(new Point2D.Double(1, 0)); - } - - private void move(Point2D a_delta) { - if (m_root == null) { - return; - } // if - - m_root.move(a_delta); - } - public void buildNewTypeface(String a_name, File a_dir) throws FileNotFoundException { if (a_name == null || a_name.equals("")) { return; - } // if + } TypefaceFile typeface = new TypefaceFile(a_name, a_dir); typeface.setAuthor("no body"); @@ -353,68 +81,20 @@ public class Engine { setTypeface(typeface); } - public void addDefaultGlyphs() throws FileNotFoundException { + public void addDefaultGlyphs() { m_typeface.addRequiredGlyphs(); m_typeface.addBasicLatinGlyphs(); } - public void openTypeface() throws FileNotFoundException { - if (m_chooser == null) { - m_chooser = new JFileChooser(new File(AppSettings.getLastTypefaceDir())); - } // if - - m_chooser.setFileFilter(new TypefaceFileFilter()); - int returnVal = m_chooser.showOpenDialog(null); - - if (returnVal != JFileChooser.APPROVE_OPTION) { - return; - } // if - - AppSettings.setLastTypefaceDir(m_chooser.getSelectedFile().toString()); - openTypeface(m_chooser.getSelectedFile()); - } - - private void openTypeface(File a_file) throws FileNotFoundException { - setTypeface(new TypefaceFile(a_file)); - - if (m_typeface.addRequiredGlyphs()) { - } // if - } - public void setTypeface(TypefaceFile a_typeface) { m_typeface = a_typeface; } - public void changeUnicode(long a_unicode) throws FileNotFoundException { - if (m_typeface == null || m_root == null) { - return; - } // if - - m_typeface.setGlyphUnicode(m_root, a_unicode); - } - - public int findFile(long a_unicode) { - if (m_typeface == null) - return USER_CANCELLED; - - m_foundFileName = m_typeface.unicodeToFileName(a_unicode); - if (m_foundFileName != null) { - return FILE_FOUND; - } // if - - return FILE_NOT_FOUND; - } - - public String getFoundFileName() { - return m_foundFileName; - } - - /** * Create glyph out of given unicode, and add it to the typeface. * @param a_unicode */ - public GlyphFile addNewGlyph(long a_unicode) throws FileNotFoundException { + public GlyphFile addNewGlyph(long a_unicode) { GlyphFile retval; retval = m_typeface.createGlyph(a_unicode); @@ -423,7 +103,7 @@ public class Engine { return retval; } - public void checkUnicodeBlock(long a_unicode) throws FileNotFoundException { + public void checkUnicodeBlock(long a_unicode) { TTUnicodeRange range = TTUnicodeRange.of(a_unicode); if (range == null){ return; @@ -435,53 +115,26 @@ public class Engine { m_typeface.addUnicodeRange(range.toString()); } - private void addGlyphToTypeface(GlyphFile a_file) throws FileNotFoundException { + private void addGlyphToTypeface(GlyphFile a_file) { m_typeface.addGlyph(a_file); setRoot(a_file); } - public GlyphFile openGlyphFile(String a_fileName) { - ModuleManager manager = ModuleManager.getSingletonInstance(); - GlyphFile retval = manager.getReloadedGlyphFile(a_fileName); - setRoot(retval); - - return retval; - } - - public void removeGlyphFromTypeface(String a_fileName) { + public void buildTrueType() { if (m_typeface == null) return; - m_typeface.removeGlyph(a_fileName); - } - - public Font buildTrueType(boolean a_isDebug) { - Font retval = null; - - if (m_typeface == null) - return retval; - try { - m_typeface.buildTTF(a_isDebug); - retval = m_typeface.getFont(); + m_typeface.buildTTF(); + m_typeface.getFont(); } catch (Exception e) { Logger.getLogger(Engine.class.getName()).log(Level.SEVERE, null,e); } // try-catch - return retval; - } - - public void saveGlyph() throws FileNotFoundException { - if (m_root == null) - return; - - if (m_root.getGlyphTitle().equals("")) { - Logger.getLogger(Engine.class.getName()).log(Level.SEVERE, m_msgEmptyGlyphTitle); - return; - } // if + return; } public TypefaceFile getTypeface() { @@ -501,84 +154,69 @@ public class Engine { m_root = a_file; } - public String includeFileName() { - String retval = ""; - - JFileChooser chooser = new JFileChooser(getGlyphPath()); - chooser.setFileFilter(new GlyphFileFilter()); - - int returnVal = chooser.showOpenDialog(null); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - retval = chooser.getSelectedFile().getName().toString(); - } // if - - return retval; - } - - public void addCodePage(String a_codePage) throws FileNotFoundException { + public void addCodePage(String a_codePage) { if (m_typeface == null) { return; - } // if + } m_typeface.addCodePage(a_codePage); } - public void removeCodePage(String a_codePage) throws FileNotFoundException { + public void removeCodePage(String a_codePage) { if (m_typeface == null) { return; - } // if + } m_typeface.removeCodePage(a_codePage); } - public void setAuthor(String a_value) throws FileNotFoundException { + public void setAuthor(String a_value) { if (m_typeface == null) { return; - } // if + } m_typeface.setAuthor(a_value); } - public void setCopyrightYear(String a_value) throws FileNotFoundException { + public void setCopyrightYear(String a_value) { if (m_typeface == null) { return; - } // if + } m_typeface.setCopyrightYear(a_value); } - public void setFontFamilyName(String a_value) throws FileNotFoundException { + public void setFontFamilyName(String a_value) { if (m_typeface == null) { return; - } // if + } m_typeface.setFontFamilyName(a_value); } - public void setTypefaceLicense(String a_value) throws FileNotFoundException { + public void setTypefaceLicense(String a_value) { if (m_typeface == null) { return; - } // if + } m_typeface.setLicense(a_value); } - public void setBaseline(double a_value) throws FileNotFoundException { + public void setBaseline(double a_value) { if (m_typeface == null) { return; - } // if + } double min = m_typeface.getBottomSideBearing(); double max = m_typeface.getMeanline(); if (a_value < min) { a_value = min; - } // if + } if (a_value > max) { a_value = max; - } // if + } try { m_typeface.setDescender(a_value - min); @@ -591,10 +229,10 @@ public class Engine { } // try-catch } - public void setMeanline(double a_value) throws FileNotFoundException { + public void setMeanline(double a_value) { if (m_typeface == null) { return; - } // if + } double min = m_typeface.getBaseline(); double max = m_typeface.getEm() @@ -602,11 +240,11 @@ public class Engine { if (a_value < min) { a_value = min; - } // if + } if (a_value > max) { a_value = max; - } // if + } try { m_typeface.setXHeight(a_value - min); @@ -615,83 +253,4 @@ public class Engine { e.printStackTrace(); } // try-catch } - - public void mousePressed(MouseEvent a_event) { - - } - - - public void mouseDragged(MouseEvent a_event) { - - } - - public void mouseReleased(MouseEvent a_event) { - - } - - public void setAction(String a_key) { - - } - - public void keyPressed(KeyEvent a_event) { - if (a_event.getModifiers() == 0) { - if (a_event.getKeyCode() == KeyEvent.VK_TAB) { - - m_selectNextAction.actionPerformed(null); - } // if - } else if (a_event.getModifiers() == KeyEvent.SHIFT_MASK) { - - } // if - } - - private JFileChooser createImageChooser() { - JFileChooser retval; - - retval = new JFileChooser(new File(AppSettings.getLastTypefaceDir())); - retval.setFileFilter(new javax.swing.filechooser.FileFilter() { - public boolean accept(File a_file) { - if (a_file.isDirectory()) - return true; - - String s = a_file.toString().toLowerCase(); - if (s.endsWith(".gif") - || s.endsWith(".jpg") - || s.endsWith(".jpeg") - || s.endsWith(".png")) - return true; - - return false; - } - - //The description of this filter - public String getDescription() { - return "Image Files"; - } - }); - - return retval; - } - - - - - public ArrayList getPixelSizes() { - return TTPixelSize.getList(); - } - - class MyTreeListener implements TreeSelectionListener { - public void valueChanged(TreeSelectionEvent a_event) { - TreePath path = a_event.getPath(); - Object obj = path.getLastPathComponent(); - String s = obj.toString(); - - TreePath parent = path.getParentPath(); - if (parent != null) { - obj = parent.getLastPathComponent(); - s = obj.toString() + "->" + s; - } // if - - } - } - } diff --git a/libsrc/ttf/src/org/doubletype/ossa/GlyphColor.java b/libsrc/ttf/src/org/doubletype/ossa/GlyphColor.java deleted file mode 100644 index fa6bb987a..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/GlyphColor.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $Id: GlyphColor.java,v 1.6 2004/07/11 06:25:11 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import java.awt.*; - - -/** - * @author e.e - */ -public class GlyphColor { - public static Color MAROON = new Color(120, 21, 11); - public static Color ORANGE = new Color(231, 113, 18); // (238, 176, 55); - public static Color OLIVE = new Color(98, 106, 7); - public static Color INDIGO = new Color(22, 16, 149); - public static Color GREEN = new Color(21, 142, 5); - public static Color RED = new Color(250, 0, 0); - public static Color GRAY = new Color(0x33, 0x33, 0x33); - public static Color CYAN = new Color(15, 187, 157); // 15, 108, 140 - public static Color AZURE = new Color(0x00, 0x66, 0xcc); - public static Color TAN = new Color(0xcc, 0x99, 0x66); - public static Color SILVER = new Color(0xe0, 0xdf, 0xe3); - - - public static Color BACKGROUND = Color.WHITE; - public static Color CROSS = Color.LIGHT_GRAY; - public static Color POINT = ORANGE; - public static Color NUMBER = Color.GRAY; - public static Color SELECTED = RED; - public static Color CONTOUR = AZURE; - public static Color HINT = OLIVE; - public static Color INCLUDE = OLIVE; - public static Color MODULE = MAROON; -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/GlyphFileFilter.java b/libsrc/ttf/src/org/doubletype/ossa/GlyphFileFilter.java deleted file mode 100644 index b93ba5a42..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/GlyphFileFilter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: GlyphFileFilter.java,v 1.2 2004/01/20 03:35:27 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import java.io.File; -import javax.swing.filechooser.FileFilter; - -/** - * @author e.e - */ -public class GlyphFileFilter extends FileFilter { - public boolean accept(File a_file) { - if (a_file.isDirectory()) { - return false; - } // if - - if (! (a_file.toString().toLowerCase().endsWith(".glyph"))) - return false; - - return true; - } - - //The description of this filter - public String getDescription() { - return "glyph files"; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/ImageSizer.java b/libsrc/ttf/src/org/doubletype/ossa/ImageSizer.java deleted file mode 100644 index dd409e8f7..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/ImageSizer.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: ImageSizer.java,v 1.1 2004/03/04 12:52:50 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import java.awt.*; -import java.awt.image.*; - -/** - * @author e.e - */ -public class ImageSizer { - private Dimension m_size = new Dimension(-1, -1); - private boolean m_isImcomplete; - - private ImageObserver m_observer = new ImageObserver() { - public synchronized boolean imageUpdate( - Image a_image, - int a_flag, - int a_x, - int a_y, - int a_width, - int a_height) { - if ((a_flag & WIDTH) != 0) - m_size.width = a_width; - if ((a_flag & HEIGHT) != 0) - m_size.height = a_height; - if ((a_flag & (ERROR | ABORT)) != 0) - m_isImcomplete = true; - - boolean retval = !resultKnown(); - if (!retval) { - notifyAll(); - } // if - - return retval; - } - }; - - public ImageSizer(Image a_image) { - m_size.width = a_image.getWidth(m_observer); - m_size.height = a_image.getHeight(m_observer); - } - - private boolean resultKnown() { - return m_size.width != -1 - && m_size.height != -1 - || m_isImcomplete; - } - - //returns null iff error or abort - public Dimension getImageSize() throws InterruptedException { - synchronized (m_observer) { - while (!resultKnown()) - m_observer.wait(); - return m_isImcomplete ? null : new Dimension(m_size); - } - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/Memento.java b/libsrc/ttf/src/org/doubletype/ossa/Memento.java deleted file mode 100644 index 19661eedc..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/Memento.java +++ /dev/null @@ -1,89 +0,0 @@ - /* - * $Id: Memento.java,v 1.1 2004/09/05 17:08:03 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003 - 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import java.io.*; -import java.util.zip.*; - -/** - * @author e.e - */ -public class Memento { - private String m_description; - private byte [] m_compressed; - private int m_originalSize; - private long m_entryTime; - - public Memento(String a_description, byte [] a_data) { - m_description = a_description; - m_originalSize = a_data.length; - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(out); - - try { - zip.putNextEntry(new ZipEntry(a_description)); - zip.write(a_data); - zip.closeEntry(); - zip.close(); - } - catch (IOException ioe) { - ioe.printStackTrace(); - } - - m_compressed = out.toByteArray(); - m_entryTime = System.currentTimeMillis(); - } - - public InputStream getData() { - ZipInputStream zip = null; - - try { - zip = new ZipInputStream( - new ByteArrayInputStream(m_compressed)); - ZipEntry entry = zip.getNextEntry(); - } - catch (IOException ioe) { - ioe.printStackTrace(); - } - - return zip; - } - - public String toString() { - return m_description; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/ModuleManager.java b/libsrc/ttf/src/org/doubletype/ossa/ModuleManager.java deleted file mode 100644 index f1a6e7f92..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/ModuleManager.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $Id: ModuleManager.java,v 1.5 2004/01/14 06:49:39 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import java.util.*; -import org.doubletype.ossa.module.*; -import java.io.*; - -/** - * @author e.e - */ -public class ModuleManager { - private static ModuleManager s_singleton = null; - - public static ModuleManager getSingletonInstance() { - if (s_singleton == null) - s_singleton = new ModuleManager(); - return s_singleton; - } - - - private Hashtable m_modules = new Hashtable<>(); - private Hashtable m_files = new Hashtable<>(); - - private ModuleManager() { - } - - public void clear() { - m_modules.clear(); - m_files.clear(); - } - - public GlyphModule getModule(String a_name) throws Exception { - if (m_modules.containsKey(a_name)) { - return (GlyphModule) m_modules.get(a_name); - } // if - - GlyphModule retval; - - retval = (GlyphModule) Class.forName(a_name).newInstance(); - m_modules.put(a_name, retval); - - return retval; - } - - public GlyphFile getGlyphFile(String a_name) { - if (m_files.containsKey(a_name)) { - return (GlyphFile) m_files.get(a_name); - } // if - - return getReloadedGlyphFile(a_name); - } - - public GlyphFile getReloadedGlyphFile(String a_name) { - GlyphFile retval; - - Engine engine = Engine.getSingletonInstance(); - retval = new GlyphFile(new File(engine.getGlyphPath(), a_name)); - m_files.put(a_name, retval); - - return retval; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/MyTableModel.java b/libsrc/ttf/src/org/doubletype/ossa/MyTableModel.java deleted file mode 100644 index 24f671dd6..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/MyTableModel.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: MyTableModel.java,v 1.1 2004/02/09 05:34:17 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import javax.swing.table.*; -import org.doubletype.ossa.module.*; - -/** - * @author e.e - */ -public class MyTableModel extends AbstractTableModel { - protected Engine m_engine; - protected GlyphFile m_file = null; - - protected MyTableModel(Engine a_engine) { - m_engine = a_engine; - } - - public int getColumnCount() { - return 2; - } - - public int getRowCount() { - reset(); - - return 0; - } - - public Object getValueAt(int a_row, int a_column) { - reset(); - - Object retval = null; - - return retval; - } - - protected void reset() { - - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/Renderer.java b/libsrc/ttf/src/org/doubletype/ossa/Renderer.java deleted file mode 100644 index 623e6739f..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/Renderer.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: Renderer.java,v 1.1 2004/06/18 09:14:01 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -/** - * @author e.e - */ -public interface Renderer { - boolean isRenderNeeded(); - void render(java.awt.Graphics2D a_graphics); -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/Tabbable.java b/libsrc/ttf/src/org/doubletype/ossa/Tabbable.java deleted file mode 100644 index bc9f0e23c..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/Tabbable.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.doubletype.ossa; - -public interface Tabbable { - boolean isClosable(); -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/TabbedPaneCloseButtonUI.java b/libsrc/ttf/src/org/doubletype/ossa/TabbedPaneCloseButtonUI.java deleted file mode 100644 index 0d9504efc..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/TabbedPaneCloseButtonUI.java +++ /dev/null @@ -1,188 +0,0 @@ -// http://forums.sun.com/thread.jspa?forumID=257&threadID=453521 - -package org.doubletype.ossa; - -import java.awt.Color; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -import javax.swing.plaf.basic.BasicTabbedPaneUI; - -public class TabbedPaneCloseButtonUI extends BasicTabbedPaneUI { - private final int k_xButtonOffset = 19; - private final int k_yButtonOffset = 4; - private final int k_wButton = 14; // was 13 - private final int k_hButton = 13; // was 12 - - private int m_lastKnownSelected = -1; - private Color m_red = new Color(217, 76, 74); - private Color m_selectedColor = Color.white; - private Color m_unselectedColor = new Color(160, 197, 241); - - public TabbedPaneCloseButtonUI() { - super(); - } - - protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) - { - if (isSelected) - { - g.setColor(m_selectedColor); - } - else - { - g.setColor(m_unselectedColor); - } - - g.fillRect(x, y, w, h); - } - - protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) - { - return fontHeight + 4; - } - - protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) - { - g.setColor(darkShadow); - g.drawLine(x, y + h - 2, x, y); - g.drawLine(x, y, x + w, y); - g.drawLine(x + w, y + h - 2, x + w, y); - } - - protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, - int tabIndex, Rectangle iconRect, Rectangle textRect) { - - super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect); - } - - protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) - { - } - - protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - { - if (selectedIndex < 0) { - return; - } // if - - Rectangle rect = getTabBounds(selectedIndex, calcRect); - g.setColor(darkShadow); - g.drawLine(x, y, rect.x, y); - g.drawLine(rect.x + rect.width, y, x + w, y); - g.setColor(m_selectedColor); - g.drawLine(rect.x + 1, y, rect.x + rect.width -1, y); - } - - protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - { - } - - protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - { - } - - protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - { - } - - protected void paintText(Graphics g, int tabPlacement, java.awt.Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) - { - if (tabPane.getComponentAt(tabIndex) instanceof Tabbable) { - Tabbable tabbable = (Tabbable) tabPane.getComponentAt(tabIndex); - if (!tabbable.isClosable()) { - super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected); - return; - } // if - } // if - - if (isSelected) // isSelected - { - super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected); - Rectangle rect = rects[tabIndex]; - g.setColor(m_red); - int xButton = rect.x + rect.width - k_xButtonOffset; // -19 - int yButton = rect.y + k_yButtonOffset; // +4 - g.fillRect(xButton, yButton, k_wButton, k_hButton); - g.setColor(Color.white); - g.drawLine(xButton + 3, rect.y + 7, xButton + 9, rect.y + 13); - g.drawLine(xButton + 9, rect.y + 7, xButton + 3, rect.y + 13); - g.drawLine(xButton + 4, rect.y + 7, xButton + 10, rect.y + 13); - g.drawLine(xButton + 10, rect.y + 7, xButton + 4, rect.y + 13); - - m_lastKnownSelected = tabIndex; - } - else - { - super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected); - } - } - - protected int calculateTabWidth(int tabPlacement, int tabIndex, - FontMetrics metrics) { - if (tabPane.getComponentAt(tabIndex) instanceof Tabbable) { - Tabbable tabbable = (Tabbable) tabPane.getComponentAt(tabIndex); - if (!tabbable.isClosable()) { - return super.calculateTabWidth(tabPlacement, tabIndex, metrics); - } // if - } // if - - return super.calculateTabWidth(tabPlacement, tabIndex, metrics) + 34; // +24 - } - - protected MouseListener createMouseListener() { - return new MyMouseHandler(); - } - - class MyMouseHandler extends MouseHandler { - private int m_selectedOnPressed = -1; - - public MyMouseHandler() { - super(); - } - - public void mousePressed(MouseEvent e) { - m_selectedOnPressed = m_lastKnownSelected; - super.mousePressed(e); - } - - public void mouseReleased(MouseEvent e) { - int x = e.getX(); - int y = e.getY(); - int tabIndex = -1; - int tabCount = tabPane.getTabCount(); - for (int i = 0; i < tabCount; i++) { - if (rects[i].contains(x, y)) { - tabIndex = i; - break; - } // if - } // for i - - // skip if this is not current. - if (tabPane.getSelectedIndex() != tabIndex) { - return; - } // if - - if (m_selectedOnPressed != tabIndex) { - return; - } // if - - if (tabIndex >= 0 && !e.isPopupTrigger()) { - Rectangle tabRect = rects[tabIndex]; - y = y - tabRect.y; - - int xButton = tabRect.x + tabRect.width - k_xButtonOffset; - if ((x >= xButton + 1) - && (x <= xButton + k_wButton - 2) - && (y >= k_yButtonOffset + 1) - && (y <= k_yButtonOffset + k_hButton - 2)) { - tabPane.remove(tabIndex); - } - } - } - } - -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/TypefaceFileFilter.java b/libsrc/ttf/src/org/doubletype/ossa/TypefaceFileFilter.java deleted file mode 100644 index 446cdad16..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/TypefaceFileFilter.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: TypefaceFileFilter.java,v 1.1 2004/01/20 03:35:27 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import java.io.File; -import javax.swing.filechooser.FileFilter; - -/** - * @author e.e - */ -public class TypefaceFileFilter extends FileFilter { - public boolean accept(File a_file) { - if (a_file.isDirectory()) - return true; - - if (! (a_file.toString().toLowerCase().endsWith(".dtyp"))) - return false; - - return true; - } - - //The description of this filter - public String getDescription() { - return "typeface files"; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/UiBridge.java b/libsrc/ttf/src/org/doubletype/ossa/UiBridge.java deleted file mode 100644 index c49d75c7d..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/UiBridge.java +++ /dev/null @@ -1,12 +0,0 @@ -/* - */ -package org.doubletype.ossa; - -import org.doubletype.ossa.adapter.*; - -/** - * @author e.e - */ -public interface UiBridge { - void showPropertyDialog(GlyphObject a_object); -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/UnicodeBuilder.java b/libsrc/ttf/src/org/doubletype/ossa/UnicodeBuilder.java deleted file mode 100644 index b10718938..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/UnicodeBuilder.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * $Id: UnicodeBuilder.java,v 1.1 2004/09/11 10:09:07 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.util.logging.Level; -import java.util.logging.Logger; - - -/** - * @author e.e - */ -public class UnicodeBuilder { - public static final String k_jisCharset = "ISO-2022-JP"; - - /** - * pops dialog and asks user for unicode. - * @return true on success, false otherwise. - */ - public static Long askUnicode() { - Engine engine = Engine.getSingletonInstance(); - - throw new UnsupportedOperationException(); - } - - public static Long build(String a_value, int a_option) { - if (a_value == null - || a_value.length() == 0) { - return null; - } // if - - switch (a_option) { - case Engine.SEARCH_BY_EXAMPLE: { - return buildByExample(a_value); - } // case - - case Engine.SEARCH_UNICODE: { - return buildByUnicode(a_value); - } // case - - case Engine.SEARCH_JIS_CODE: { - return buildByJisCode(a_value); - } // case - } // switch - - return null; - } - - private static Long buildByExample(String a_value) { - if (a_value.length() > 1) { - return null; - } // if - - return new Long((long) a_value.charAt(0)); - } - - private static Long buildByUnicode(String a_value) { - if (a_value.length() == 1) { - return buildByExample(a_value); - } // if - - try { - return new Long(Long.parseLong(a_value, 16)); - } catch (NumberFormatException e) { - Logger.getLogger(Engine.class.getName()).log(Level.SEVERE, null,e); - } - - return null; - } - - private static Long buildByJisCode(String a_value) { - if (a_value.length() == 1) { - return buildByExample(a_value); - } // if - - try { - Long retval = jisX0208ToUnicode(Long.parseLong(a_value, 16)); - - if (retval == null) { - Logger.getLogger(Engine.class.getName()).log(Level.SEVERE, "Bad JIS Code."); - } // if - - return retval; - } catch (NumberFormatException e) { - Logger.getLogger(Engine.class.getName()).log(Level.SEVERE, null, e); - } // try - - return null; - } - - /** - * converts JIS X0208 code into unicode using ISO-2022-JP decoder. - * @param a_value JIS code - * @return unicode - */ - public static Long jisX0208ToUnicode(long a_value) { - if (!isJisSupported()) { - return null; - } // if - - Charset jis = Charset.forName(k_jisCharset); - ByteBuffer in = ByteBuffer.allocate(5); - CharsetDecoder jisDecoder; - jisDecoder = jis.newDecoder(); - - long high = (0xff00 & a_value) >> 8; - long low = 0x00ff & a_value; - - if (high < 0x21 || high > 0x7e || low < 0x21 || high > 0x7e) { - return null; - } // if - - char c = (char) a_value; - - in.rewind(); - in.put((byte) 0x1b); - in.put((byte) 0x24); - in.put((byte) 0x40); - - in.putChar(c); - in.position(0); - - try { - CharBuffer out = jisDecoder.decode(in); - if (out.length() > 0) { - return new Long(out.get(0)); - } // if - } catch (CharacterCodingException e) { - e.printStackTrace(); - } // try-catch - - return null; - } - - public static boolean isJisSupported() { - return Charset.isSupported(k_jisCharset); - } - - /** - * - */ - public UnicodeBuilder() { - super(); - // TODO Auto-generated constructor stub - } - -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/CubicSegment.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/CubicSegment.java index 44c33e025..fd6c14485 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/CubicSegment.java +++ b/libsrc/ttf/src/org/doubletype/ossa/adapter/CubicSegment.java @@ -1,398 +1,200 @@ -/* - * $Id: CubicSegment.java,v 1.2 2004/12/27 04:56:02 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.util.*; -import java.awt.geom.*; - -import org.doubletype.ossa.xml.*; - -/** - * @author e.e - */ -public class CubicSegment { - public static final int LINE = 0; - public static final int CURVE = 1; - - private static final double k_tolerance = 5; - private static final double k_minTolerance = 10; - private static final int k_maxTrial = 3; - - /** - * converts cubic contour into cubic segments. - * @param a_contour - * @return - */ - public static ArrayList toSegments(EContour a_contour) { - ArrayList retval = new ArrayList<>(); - XContourPoint [] points = a_contour.getContourPoint(); - if (points.length < 2) { - return retval; - } // if - - EContourPoint startPoint = (EContourPoint) points[points.length - 1]; - for (int i = 0; i < points.length; i++) { - EContourPoint endPoint = (EContourPoint) points[i]; - retval.add(new CubicSegment(startPoint, endPoint)); - startPoint = endPoint; - } // for - - return retval; - } - - /** - * converts cubic segments into cubic contour. - * @param a_segments - * @return - */ - public static EContour toContour(ArrayList a_segments) { - EContour retval = new EContour(); - retval.setType(EContour.k_cubic); - - EControlPoint controlPoint1 = null; - for (int i = 0; i < a_segments.size(); i++) { - CubicSegment segment = (CubicSegment) a_segments.get(i); - EContourPoint startPoint = (EContourPoint) segment.m_startPoint.clone(); - - if (controlPoint1 != null) { - startPoint.setControlPoint1(controlPoint1); - controlPoint1 = null; - } // if - - if (segment.m_controlPoint1 != null) { - EControlPoint controlPoint2 = new EControlPoint(false, - segment.m_controlPoint1.getX(), - segment.m_controlPoint1.getY()); - startPoint.setControlPoint2(controlPoint2); - } // if - - retval.addContourPoint(startPoint); - - if (segment.m_controlPoint2 != null) { - controlPoint1 = new EControlPoint(true, - segment.m_controlPoint2.getX(), - segment.m_controlPoint2.getY()); - } - } // for i - - return retval; - } - - private EContourPoint m_startPoint = null; - private EContourPoint m_controlPoint1 = null; - private EContourPoint m_controlPoint2 = null; - private EContourPoint m_endPoint = null; - - private int m_type = LINE; - - - public CubicSegment(EContourPoint a_startPoint, EContourPoint a_endPoint) { - m_startPoint = a_startPoint; - m_endPoint = a_endPoint; - - if ((!a_startPoint.hasControlPoint2()) && (!a_endPoint.hasControlPoint1())) { - m_type = LINE; - return; - } // if - - if (a_startPoint.hasControlPoint2() || a_endPoint.hasControlPoint1()) { - m_type = CURVE; - - if (a_startPoint.hasControlPoint2()) { - m_controlPoint1 = (EContourPoint) a_startPoint.getControlPoint2().getContourPoint(); - } else { - m_controlPoint1 = a_startPoint; - } // if-else - - if (a_endPoint.hasControlPoint1()) { - m_controlPoint2 = (EContourPoint) a_endPoint.getControlPoint1().getContourPoint(); - } else { - m_controlPoint2 = a_endPoint; - } // if-else - } // if - } - - public CubicSegment(EContourPoint a_startPoint, EContourPoint a_controlPoint1, - EContourPoint a_controlPoint2, EContourPoint a_endPoint) { - m_startPoint = a_startPoint; - m_controlPoint1 = a_controlPoint1; - m_controlPoint2 = a_controlPoint2; - m_endPoint = a_endPoint; - m_type = CURVE; - } - - public ArrayList toQuadraticSegments() { - ArrayList retval = new ArrayList<>(); - - if (m_type == LINE) { - retval.add(new QuadraticSegment(m_startPoint, null, m_endPoint)); - return retval; - } // if - - return toQuadraticSegments(0); - } - - //JPEXS start - private static Point2D.Double movePoint(Point2D point, double dx, double dy) { - return new Point2D.Double(point.getX() + dx, point.getY() + dy); - } - - private static Point2D getMidPoint(Point2D p0, Point2D p1) { - return getPointOnSegment(p0, p1, 0.5); - } - - private static Point2D getPointOnSegment(Point2D p0, Point2D p1, double ratio) { - double x = p0.getX() + ((p1.getX() - p0.getX()) * ratio); - double y = p0.getY() + ((p1.getY() - p0.getY()) * ratio); - return new Point2D.Double(x, y); - } - private static double[][] approximateCubic(double[] cubicControlPointCoords) { - if (cubicControlPointCoords.length < 8) { - throw new IllegalArgumentException("Must have at least 8 coordinates"); - } - - //extract point objects from source array - Point2D p0 = new Point2D.Double(cubicControlPointCoords[0], cubicControlPointCoords[1]); - Point2D p1 = new Point2D.Double(cubicControlPointCoords[2], cubicControlPointCoords[3]); - Point2D p2 = new Point2D.Double(cubicControlPointCoords[4], cubicControlPointCoords[5]); - Point2D p3 = new Point2D.Double(cubicControlPointCoords[6], cubicControlPointCoords[7]); - - //calculates the useful base points - Point2D pa = getPointOnSegment(p0, p1, 3.0 / 4.0); - Point2D pb = getPointOnSegment(p3, p2, 3.0 / 4.0); - - //get 1/16 of the [P3, P0] segment - double dx = (p3.getX() - p0.getX()) / 16.0; - double dy = (p3.getY() - p0.getY()) / 16.0; - - //calculates control point 1 - Point2D pc1 = getPointOnSegment(p0, p1, 3.0 / 8.0); - - //calculates control point 2 - Point2D pc2 = getPointOnSegment(pa, pb, 3.0 / 8.0); - pc2 = movePoint(pc2, -dx, -dy); - - //calculates control point 3 - Point2D pc3 = getPointOnSegment(pb, pa, 3.0 / 8.0); - pc3 = movePoint(pc3, dx, dy); - - //calculates control point 4 - Point2D pc4 = getPointOnSegment(p3, p2, 3.0 / 8.0); - - //calculates the 3 anchor points - Point2D pa1 = getMidPoint(pc1, pc2); - Point2D pa2 = getMidPoint(pa, pb); - Point2D pa3 = getMidPoint(pc3, pc4); - - //return the points for the four quadratic curves - return new double[][]{ - {pc1.getX(), pc1.getY(), pa1.getX(), pa1.getY()}, - {pc2.getX(), pc2.getY(), pa2.getX(), pa2.getY()}, - {pc3.getX(), pc3.getY(), pa3.getX(), pa3.getY()}, - {pc4.getX(), pc4.getY(), p3.getX(), p3.getY()}}; - } - - //JPEXS end - - private ArrayList toQuadraticSegments(int a_trial) { - ArrayList retval = new ArrayList<>(); - - a_trial++; - - double[][] quadCoords =approximateCubic(new double[]{m_startPoint.getX(),m_startPoint.getY(),m_controlPoint1.getX(),m_controlPoint1.getY(),m_controlPoint2.getX(),m_controlPoint2.getY(),m_endPoint.getX(),m_endPoint.getY()}); - EContourPoint lastPoint=m_startPoint; - for (int i = 0; i < quadCoords.length; i++) { - retval.add(new QuadraticSegment( - lastPoint, - new EContourPoint(quadCoords[i][0], quadCoords[i][1], true), - new EContourPoint(quadCoords[i][2], quadCoords[i][3], false))); - lastPoint = new EContourPoint(quadCoords[i][2],quadCoords[i][3],true); - } - /*EContourPoint intersection = calculateIntersection(); - - double deltaX = 0.125 * (m_startPoint.getX() + m_endPoint.getX() + 4 * intersection.getX() - - 3 * (m_controlPoint1.getX() + m_controlPoint2.getX())); - double deltaY = 0.125 * (m_startPoint.getY() + m_endPoint.getY() + 4 * intersection.getY() - - 3 * (m_controlPoint1.getY() + m_controlPoint2.getY())); - double deltaSqr = (deltaX * deltaX + deltaY * deltaY); - - if (deltaSqr > (k_minTolerance * k_minTolerance) - || ((a_trial < k_maxTrial) && (deltaSqr > (k_tolerance * k_tolerance)))) { - return toSplitQuadraticSegments(a_trial); - } // if - - retval.add(new QuadraticSegment(m_startPoint, intersection, m_endPoint));*/ - return retval; - } - - private ArrayList toSplitQuadraticSegments(int a_trial) { - EContourPoint p01 = midPoint(m_startPoint, m_controlPoint1); - EContourPoint p12 = midPoint(m_controlPoint1, m_controlPoint2); - EContourPoint p23 = midPoint(m_controlPoint2, m_endPoint); - - EContourPoint pA = midPoint(p01, p12); - EContourPoint pB = midPoint(p12, p23); - - EContourPoint pAB = midPoint(pA, pB); - - CubicSegment firstCubicSegment = new CubicSegment(m_startPoint, p01, pA, pAB); - CubicSegment secondCubicSegment = new CubicSegment(pAB, pB, p23, m_endPoint); - - ArrayList firstHalf = firstCubicSegment.toQuadraticSegments(a_trial); - ArrayList secondHalf = secondCubicSegment.toQuadraticSegments(a_trial); - - firstHalf.addAll(secondHalf); - - return firstHalf; - } - - private EContourPoint midPoint(EContourPoint a_start, EContourPoint a_end) { - Point2D p = calculateMidPoint(a_start, a_end); - EContourPoint retval = new EContourPoint(p.getX(), p.getY(), true); - - ArrayList ppems = getPpems(a_start, a_end); - EPoint startPoint, endPoint; - for (int i = 0; i < ppems.size(); i++) { - Long ppemObject = (Long) ppems.get(i); - long ppem = ppemObject.longValue(); - - if (retval.hasHintForPpem(ppem)) { - continue; - } // if - - startPoint = a_start.getHintIfPossible(ppem); - endPoint = a_end.getHintIfPossible(ppem); - - p = calculateMidPoint(startPoint, endPoint); - EHint hint = new EHint(p.getX(), p.getY(), ppem); - retval.addHint(hint); - } // for i - - return retval; - } - - private Point2D calculateMidPoint(EPoint a_p1, EPoint a_p2) { - Point2D retval = new Point2D.Double((a_p1.getX() + a_p2.getX()) / 2.0, - (a_p1.getY() + a_p2.getY()) / 2.0); - return retval; - } - - /** - * calculate intersection of line (a_start, a_controlPoint1) and - * line (a_end, a_controlPoint2) - * @return - */ - private EContourPoint calculateIntersection() { - EContourPoint retval = new EContourPoint(m_startPoint.getX(), m_startPoint.getY(), false); - Point2D intersection = calculateIntersection(m_startPoint, m_controlPoint1, m_controlPoint2, m_endPoint); - retval.getPoint2d().setX(intersection.getX()); - retval.getPoint2d().setY(intersection.getY()); - - EPoint startPoint, controlPoint1, controlPoint2, endPoint; - ArrayList ppems = getPpems(m_startPoint, m_controlPoint1, m_controlPoint2, m_endPoint); - for (int i = 0; i < ppems.size(); i++) { - Long ppemObject = (Long) ppems.get(i); - long ppem = ppemObject.longValue(); - - if (retval.hasHintForPpem(ppem)) { - continue; - } // if - - startPoint = m_startPoint.getHintIfPossible(ppem); - controlPoint1 = m_controlPoint1.getHintIfPossible(ppem); - controlPoint2 = m_controlPoint2.getHintIfPossible(ppem); - endPoint = m_endPoint.getHintIfPossible(ppem); - - Point2D p = calculateIntersection(startPoint, controlPoint1, controlPoint2, endPoint); - EHint hint = new EHint(p.getX(), p.getY(), ppem); - retval.addHint(hint); - } // for i - - return retval; - } - - private Point2D calculateIntersection(EPoint a_p1, EPoint a_p2, EPoint a_p3, EPoint a_p4) { - Point2D retval = new Point2D.Double(a_p1.getX(), a_p1.getY()); - - double deltaX1 = a_p2.getX() - a_p1.getX(); - double deltaX2 = a_p3.getX() - a_p4.getX(); - if (deltaX1 == 0) { - deltaX1 = 0.1; - } // if - if (deltaX2 == 0) { - deltaX2 = 0.2; - } // if - - double incline1 = (a_p2.getY() - a_p1.getY()) / deltaX1; - double incline2 = (a_p3.getY() - a_p4.getY()) / deltaX2; - if (incline1 == incline2) { - return retval; - } // if - - double x = (-incline2 * a_p4.getX() + a_p4.getY() - +incline1 * a_p1.getX() - a_p1.getY()) / (incline1 - incline2); - double y = incline1 * (x - a_p1.getX()) + a_p1.getY(); - - retval.setLocation(x, y); - return retval; - } - - private ArrayList getPpems(EContourPoint a_start, EContourPoint a_end) { - ArrayList retval = new ArrayList<>(); - collectPpemsFromHints(retval, a_start.getHint()); - collectPpemsFromHints(retval, a_end.getHint()); - return retval; - } - - private void collectPpemsFromHints(ArrayList a_ppems, XHint[] a_hints) { - for (XHint hint: a_hints) { - if (!a_ppems.contains(hint.getPpem())) { - a_ppems.add(hint.getPpem()); - } // if - } // for i - } - - private ArrayList getPpems(EContourPoint a_start, EContourPoint a_controlPoint1, - EContourPoint a_controlPoint2, EContourPoint a_end) { - ArrayList retval = new ArrayList<>(); - collectPpemsFromHints(retval, a_start.getHint()); - collectPpemsFromHints(retval, a_controlPoint1.getHint()); - collectPpemsFromHints(retval, a_controlPoint2.getHint()); - collectPpemsFromHints(retval, a_end.getHint()); - return retval; - } - -} +/* + * $Id: CubicSegment.java,v 1.2 2004/12/27 04:56:02 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2004, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + +package org.doubletype.ossa.adapter; + +import java.util.*; +import java.awt.geom.*; + +/** + * @author e.e + */ +public class CubicSegment { + public static final int LINE = 0; + public static final int CURVE = 1; + + /** + * converts cubic contour into cubic segments. + * @param a_contour + * @return + */ + public static ArrayList toSegments(EContour a_contour) { + ArrayList retval = new ArrayList<>(); + ArrayList points = a_contour.getContourPoints(); + if (points.size() < 2) { + return retval; + } + + EContourPoint startPoint = (EContourPoint) points.get(points.size() - 1); + for (int i = 0; i < points.size(); i++) { + EContourPoint endPoint = (EContourPoint) points.get(i); + retval.add(new CubicSegment(startPoint, endPoint)); + startPoint = endPoint; + } // for + + return retval; + } + + private EContourPoint m_startPoint = null; + private EContourPoint m_controlPoint1 = null; + private EContourPoint m_controlPoint2 = null; + private EContourPoint m_endPoint = null; + + private int m_type = LINE; + + + public CubicSegment(EContourPoint a_startPoint, EContourPoint a_endPoint) { + m_startPoint = a_startPoint; + m_endPoint = a_endPoint; + + if ((!a_startPoint.hasControlPoint2()) && (!a_endPoint.hasControlPoint1())) { + m_type = LINE; + return; + } + + if (a_startPoint.hasControlPoint2() || a_endPoint.hasControlPoint1()) { + m_type = CURVE; + + if (a_startPoint.hasControlPoint2()) { + m_controlPoint1 = a_startPoint.getControlPoint2().getContourPoint(); + } else { + m_controlPoint1 = a_startPoint; + } + + if (a_endPoint.hasControlPoint1()) { + m_controlPoint2 = a_endPoint.getControlPoint1().getContourPoint(); + } else { + m_controlPoint1 = a_endPoint; + } + } + } + + public CubicSegment(EContourPoint a_startPoint, EContourPoint a_controlPoint1, + EContourPoint a_controlPoint2, EContourPoint a_endPoint) { + m_startPoint = a_startPoint; + m_controlPoint1 = a_controlPoint1; + m_controlPoint2 = a_controlPoint2; + m_endPoint = a_endPoint; + m_type = CURVE; + } + + public ArrayList toQuadraticSegments() { + ArrayList retval = new ArrayList<>(); + + if (m_type == LINE) { + retval.add(new QuadraticSegment(m_startPoint, null, m_endPoint)); + return retval; + } + + return toQuadraticSegments(0); + } + + //JPEXS start + private static Point2D.Double movePoint(Point2D point, double dx, double dy) { + return new Point2D.Double(point.getX() + dx, point.getY() + dy); + } + + private static Point2D getMidPoint(Point2D p0, Point2D p1) { + return getPointOnSegment(p0, p1, 0.5); + } + + private static Point2D getPointOnSegment(Point2D p0, Point2D p1, double ratio) { + double x = p0.getX() + ((p1.getX() - p0.getX()) * ratio); + double y = p0.getY() + ((p1.getY() - p0.getY()) * ratio); + return new Point2D.Double(x, y); + } + private static double[][] approximateCubic(double[] cubicControlPointCoords) { + if (cubicControlPointCoords.length < 8) { + throw new IllegalArgumentException("Must have at least 8 coordinates"); + } + + //extract point objects from source array + Point2D p0 = new Point2D.Double(cubicControlPointCoords[0], cubicControlPointCoords[1]); + Point2D p1 = new Point2D.Double(cubicControlPointCoords[2], cubicControlPointCoords[3]); + Point2D p2 = new Point2D.Double(cubicControlPointCoords[4], cubicControlPointCoords[5]); + Point2D p3 = new Point2D.Double(cubicControlPointCoords[6], cubicControlPointCoords[7]); + + //calculates the useful base points + Point2D pa = getPointOnSegment(p0, p1, 3.0 / 4.0); + Point2D pb = getPointOnSegment(p3, p2, 3.0 / 4.0); + + //get 1/16 of the [P3, P0] segment + double dx = (p3.getX() - p0.getX()) / 16.0; + double dy = (p3.getY() - p0.getY()) / 16.0; + + //calculates control point 1 + Point2D pc1 = getPointOnSegment(p0, p1, 3.0 / 8.0); + + //calculates control point 2 + Point2D pc2 = getPointOnSegment(pa, pb, 3.0 / 8.0); + pc2 = movePoint(pc2, -dx, -dy); + + //calculates control point 3 + Point2D pc3 = getPointOnSegment(pb, pa, 3.0 / 8.0); + pc3 = movePoint(pc3, dx, dy); + + //calculates control point 4 + Point2D pc4 = getPointOnSegment(p3, p2, 3.0 / 8.0); + + //calculates the 3 anchor points + Point2D pa1 = getMidPoint(pc1, pc2); + Point2D pa2 = getMidPoint(pa, pb); + Point2D pa3 = getMidPoint(pc3, pc4); + + //return the points for the four quadratic curves + return new double[][]{ + {pc1.getX(), pc1.getY(), pa1.getX(), pa1.getY()}, + {pc2.getX(), pc2.getY(), pa2.getX(), pa2.getY()}, + {pc3.getX(), pc3.getY(), pa3.getX(), pa3.getY()}, + {pc4.getX(), pc4.getY(), p3.getX(), p3.getY()}}; + } + + //JPEXS end + + private ArrayList toQuadraticSegments(int a_trial) { + ArrayList retval = new ArrayList<>(); + + double[][] quadCoords =approximateCubic(new double[]{m_startPoint.getX(),m_startPoint.getY(),m_controlPoint1.getX(),m_controlPoint1.getY(),m_controlPoint2.getX(),m_controlPoint2.getY(),m_endPoint.getX(),m_endPoint.getY()}); + EContourPoint lastPoint=m_startPoint; + for (int i = 0; i < quadCoords.length; i++) { + retval.add(new QuadraticSegment( + lastPoint, + new EContourPoint(quadCoords[i][0], quadCoords[i][1], true), + new EContourPoint(quadCoords[i][2], quadCoords[i][3], false))); + lastPoint = new EContourPoint(quadCoords[i][2],quadCoords[i][3],true); + } + return retval; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/EContour.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/EContour.java index 793b5d894..6e2c1b84a 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/EContour.java +++ b/libsrc/ttf/src/org/doubletype/ossa/adapter/EContour.java @@ -1,243 +1,86 @@ -/* - * $Id: EContour.java,v 1.11 2004/12/17 04:13:17 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.awt.*; -import java.awt.geom.*; -import java.util.ArrayList; - -import org.doubletype.ossa.xml.*; -import org.doubletype.ossa.*; -import org.doubletype.ossa.module.Rectangle; - -/** - * @author e.e - */ -public class EContour extends XContour implements GlyphObject, PointAggregate { - public static final String k_quadratic = "quadratic"; - public static final String k_cubic = "cubic"; - public static final int k_defaultPixelSize = 16; - - public static EContour createAt(Point2D a_point) { - EContour retval = new EContour(); - retval.setType(k_cubic); - - EContourPoint point; - double x, y; - - x = a_point.getX(); - y = a_point.getY(); - point = new EContourPoint(x, y, true); - retval.addContourPoint(point); - - - x += Rectangle.k_defaultPen; - point = new EContourPoint(x, y, true); - retval.addContourPoint(point); - - y += Rectangle.k_defaultPen; - point = new EContourPoint(x, y, true); - retval.addContourPoint(point); - - x -= Rectangle.k_defaultPen; - point = new EContourPoint(x, y, true); - retval.addContourPoint(point); - - return retval; - } - - // -------------------------------------------------------------- - - public EContour() { - initDefaults(); - } - - public EContour(RStack a_stack) { - super(a_stack); - initDefaults(); - } - - /** set default values - */ - private void initDefaults() { - if (getType() == null) { - setType(k_quadratic); - } // if - } - - public boolean isCubic() { - return getType().equals(k_cubic); - } - - public EContour transpose(AffineTransform a_trans) { - EContour retval = new EContour(); - retval.setType(this.getType()); - - XContourPoint[] points = getContourPoint(); - int i; - for (i = 0; i < points.length; i++) { - EContourPoint point = (EContourPoint) points[i]; - retval.addContourPoint(point.transpose(a_trans)); - } // if - - return retval; - } - - // -------------------------------------------------------------- - - public void display(Graphics2D g, AffineTransform a_trans) { - g.setColor(GlyphColor.CONTOUR); - - if (isSelected()) { - g.setColor(GlyphColor.SELECTED); - } // if - - int ppem =EContour.k_defaultPixelSize; - g.draw(toShape(a_trans, ppem)); - } - - public boolean isSelected() { - return EObject.getActives().isSelected(this); - } - - public Shape toShape(AffineTransform a_trans, int a_ppem) { - return transpose(a_trans).toShape(a_ppem); - } - - private Shape toShape(int a_ppem) { - Emulator emulator = Emulator.getInstance(); - - return emulator.createShape(this, a_ppem); - } - - public void move(Point2D a_delta) { - movePoints(getContourPoint(), a_delta); - } - - private void movePoints(XContourPoint [] a_points, Point2D a_delta) { - int i; - for (i = 0; i < a_points.length; i++) { - EContourPoint point = (EContourPoint) a_points[i]; - EObject.movePoint(point, a_delta); - } // for i - } - - public void remove() { - XBody parent = (XBody) rGetParentRNode(); - parent.removeContour(this); - } - - // PointAggregate - public void removePoint(EContourPoint a_point) { - removeContourPoint(a_point); - - if (getContourPoint().length < 2) { - remove(); - } // if - } - - // PointAggregate - public void movePoint(EContourPoint a_point, Point2D a_delta) { - EObject.movePoint(a_point, a_delta); - } - - // PointAggregate - public GlyphObject insertPoint(EContourPoint a_point) { - int i; - int len = getContourPoint().length; - - for (i = 0; i < len; i++) { - if (getContourPoint(i) == a_point) { - break; - } // if - } // for - - EContourPoint nextPoint; - nextPoint = (EContourPoint) getContourPoint((i + 1) % len); - - double x = (a_point.getX() + nextPoint.getX()) / 2; - double y = (a_point.getY() + nextPoint.getY()) / 2; - - EContourPoint retval = new EContourPoint(x, y, true); - addContourPoint(i + 1, retval); - - return retval; - } - - public boolean hit(Rectangle2D a_rect, AffineTransform a_trans) { - return EObject.hit(this, a_rect, a_trans); - } - - public void convert() { - XBody parent = (XBody) rGetParentRNode(); - - if (isCubic()) { - parent.addContour(toQuadratic()); - } else { - parent.addContour(toCubic()); - } // else - - remove(); - } - - public EContour toQuadratic() { - if (!isCubic()) { - return this; - } // if - - ArrayList quadraticSegments = new ArrayList<>(); - for (CubicSegment segment: CubicSegment.toSegments(this)) { - quadraticSegments.addAll(segment.toQuadraticSegments()); - } // for i - - return QuadraticSegment.toContour(quadraticSegments); - } - - public EContour toCubic() { - if (isCubic()) { - return this; - } // if - - ArrayList quadraticSegments = QuadraticSegment.toSegments(this); - ArrayList cubicSegments = new ArrayList<>(); - for (int i = 0; i < quadraticSegments.size(); i++) { - QuadraticSegment quadraticSegment = (QuadraticSegment) quadraticSegments.get(i); - cubicSegments.add(quadraticSegment.toCubicSegment()); - } // for i - - return CubicSegment.toContour(cubicSegments); - } -} +/* + * $Id: EContour.java,v 1.11 2004/12/17 04:13:17 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + +package org.doubletype.ossa.adapter; + +import java.util.ArrayList; + +/** + * @author e.e + */ +public class EContour { + public static final String k_quadratic = "quadratic"; + public static final String k_cubic = "cubic"; + + private String type; + private ArrayList m_contourPoints = new ArrayList<>(); + + // -------------------------------------------------------------- + + public EContour() { + setType(k_quadratic); + } + + public boolean isCubic() { + return type.equals(k_cubic); + } + + public void setType(String a_type) { + type = a_type; + } + + public void addContourPoint(EContourPoint a_point) { + m_contourPoints.add(a_point); + } + + public ArrayList getContourPoints() { + return m_contourPoints; + } + + // -------------------------------------------------------------- + + public EContour toQuadratic() { + if (!isCubic()) { + return this; + } + + ArrayList quadraticSegments = new ArrayList<>(); + for (CubicSegment segment: CubicSegment.toSegments(this)) { + quadraticSegments.addAll(segment.toQuadraticSegments()); + } + + return QuadraticSegment.toContour(quadraticSegments); + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/EContourPoint.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/EContourPoint.java index e28994177..07563d1a1 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/EContourPoint.java +++ b/libsrc/ttf/src/org/doubletype/ossa/adapter/EContourPoint.java @@ -1,419 +1,100 @@ -/* - * $Id: EContourPoint.java,v 1.10 2004/12/27 04:56:02 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import org.doubletype.ossa.*; -import org.doubletype.ossa.xml.*; -import java.awt.*; -import java.awt.geom.*; - -/** - * @author e.e - */ -public class EContourPoint extends XContourPoint implements GlyphObject, EPoint { - public static String k_on = "on"; - public static String k_off = "off"; - public static String k_true = "true"; - public static String k_false = "false"; - - private int m_number = 0; - - /** offset of this from the global coord. - * For contours, it will be 0. - * For module invoke, it will be pos.x. - */ - private double m_xOffset = 0; - private double m_yOffset = 0; - - private Point2D m_adjusted; - - public EContourPoint() { - super(); - } - - public EContourPoint(RStack a_stack) { - super(a_stack); - correctControlPoint(); - } - - public EContourPoint(double a_x, double a_y, boolean a_isOn) { - setPoint2d(new XPoint2d()); - getPoint2d().setX(a_x); - getPoint2d().setY(a_y); - - setOn(a_isOn); - } - - /** Move the second control point if it was incorrectly set to the first one. - * - */ - private void correctControlPoint() { - if (!hasControlPoint1()) { - return; - } // if - - EControlPoint controlPoint = (EControlPoint) getControlPoint1(); - if (controlPoint.isFirst()) { - return; - } // if - - setControlPoint2(controlPoint); - setControlPoint1(null); - } - - public EContourPoint transpose(AffineTransform a_trans) { - EContourPoint retval = new EContourPoint(); - - retval.setPoint2d(EObject.createTransform(getPoint2d(), a_trans)); - retval.setOn(isOn()); - retval.setRounded(isRounded()); - - if (hasControlPoint1()) { - EControlPoint controlPoint = (EControlPoint) getControlPoint1(); - retval.setControlPoint1(controlPoint.transpose(a_trans)); - } // if - if (hasControlPoint2()) { - EControlPoint controlPoint = (EControlPoint) getControlPoint2(); - retval.setControlPoint2(controlPoint.transpose(a_trans)); - } // if - - int i; - XHint [] hints = getHint(); - for (i = 0; i < hints.length; i++) { - EHint hint = (EHint) hints[i]; - retval.addHint(hint.createTransform(a_trans)); - } // for i - - return retval; - } - - public void setNumber(int a_number) { - m_number = a_number; - } - - public void setOffset(double a_x, double a_y) { - m_xOffset = a_x; - m_yOffset = a_y; - } - - private AffineTransform buildOffsetTrans(AffineTransform a_trans) { - if (m_xOffset == 0 && m_yOffset == 0) { - return a_trans; - } // if - - AffineTransform retval = (AffineTransform) a_trans.clone(); - retval.translate(m_xOffset, m_yOffset); - - return retval; - } - public static final int k_defaultPixelSize = 16; - - public void display(Graphics2D g, AffineTransform a_trans) { - AffineTransform trans = buildOffsetTrans(a_trans); - - int ppem = k_defaultPixelSize; - Shape rect = toShape(trans, ppem); - g.setColor(GlyphColor.POINT); - if (isRounded()) { - g.setColor(GlyphColor.GRAY); - } // if - - if (isSelected()) { - g.setColor(GlyphColor.SELECTED); - } // if - - if (isOn()) - g.fill(rect); - else - g.draw(rect); - } - - - - public boolean isSelected() { - return EObject.getActives().isSelected(this); - } - - public void resetAdjusted() { - setAdjusted(getX(), getY()); - } - - public void roundAdjusted(int a_ppem) { - if (!isRounded()) { - return; - } // if - - setAdjusted(round(getX(), a_ppem), - round(getY(), a_ppem)); - } - - public void hintAdjusted(int a_ppem) { - if (!hasHintForPpem(a_ppem)) { - return; - } // if - - EHint hint = getHintForPpem(a_ppem); - setAdjusted(hint.getX(), hint.getY()); - } - - public void setAdjusted(double a_x, double a_y) { - m_adjusted = new Point2D.Double(a_x, a_y); - } - - public Point2D getAdjusted() { - return m_adjusted; - } - - public Shape toShape(AffineTransform a_trans, int a_ppem) { - return EObject.toShape(getPoint2d(), a_trans); - } - - public double getX() { - return getPoint2d().getX(); - } - - public double getY() { - return getPoint2d().getY(); - } - - public boolean isOn() { - return getType().equals(k_on); - } - - public boolean isRounded() { - return getRounded(); - } - - public void toggleRounded() { - if (hasHintForCurrentPpem()) { - return; - } // if - - setRounded(!isRounded()); - } - - public Point2D toPoint2D() { - return new Point2D.Double(getX(), getY()); - } - - public boolean hasHint() { - return (getHint().length > 0); - } - - public boolean hasHintForCurrentPpem() { - return hasHintForPpem(EContour.k_defaultPixelSize); - } - - public boolean hasHintForPpem(long a_ppem) { - return getHintForPpem(a_ppem) != null; - } - - public EPoint getHintIfPossible(long a_ppem) { - if (hasHintForPpem(a_ppem)) { - return getHintForPpem(a_ppem); - } // if - - return this; - } - - public EHint getCurrentHint() { - return getHintForPpem(EContour.k_defaultPixelSize); - } - - public EHint getHintForPpem(long a_ppem) { - int i; - XHint[] hints = getHint(); - for (i = 0; i < hints.length; i++) { - EHint hint = (EHint) hints[i]; - if (hint.getPpem() == a_ppem) { - return hint; - } // if - } // for i - - return null; - } - - public EHint addHint(int a_ppem) { - if (hasHintForPpem(a_ppem)) { - return getHintForPpem(a_ppem); - } // if - - EHint retval = new EHint(getX() + Engine.getEm() / a_ppem, getY(), a_ppem); - addHint(retval); - return retval; - } - - public GlyphObject add() { - return getParent().insertPoint(this); - } - - public void remove() { - getParent().removePoint(this); - } - - public PointAggregate getParent() { - if (rGetParentRNode() instanceof EControlPoint) { - EControlPoint controlPoint = (EControlPoint) rGetParentRNode(); - return controlPoint.getParent().getParent(); - } - - if (rGetParentRNode() instanceof PointAggregate) { - return (PointAggregate) rGetParentRNode(); - } // if - - return (PointAggregate) rGetParentRNode(); - } - - public XContourPoint cloneAt(Point2D a_point) { - EContourPoint retval = (EContourPoint) clone(); - Point2D delta = new Point2D.Double(a_point.getX() - this.getX(), a_point.getY() - this.getY()); - EObject.movePoint(retval, delta); - return retval; - } - - /** Moves point by the specified delta. A GlyphObject method. - * Delegates the implementation to the host since a point - * moves differently depending on the host. - * For example the first point hosted by a module invoke would - * always be (0, 0) so the invoke position would move instead. - */ - public void move(Point2D a_delta) { - PointAggregate parent = (PointAggregate) rGetParentRNode(); - parent.movePoint(this, a_delta); - } - - public void toggleOnCurve() { - if (isControlPoint()) { - return; - } // if - - if (getParent() instanceof EContour) { - EContour contour = (EContour) getParent(); - if (contour.isCubic()) { - toggleCubicControlPoint(); - return; - } // if - } // if - - setOn(!isOn()); - } - - public boolean isControlPoint() { - return (getParent() instanceof EContourPoint); - } - - private void toggleCubicControlPoint() { - if (hasControlPoint1() || hasControlPoint2()) { - setControlPoint1(null); - setControlPoint2(null); - } else { - setControlPoint1(new EControlPoint(true, getX() + 100, getY())); - setControlPoint2(new EControlPoint(false, getX() - 100, getY())); - } // if - } - - public boolean hasControlPoint1() { - return (getControlPoint1() != null); - } - - public boolean hasControlPoint2() { - return (getControlPoint2() != null); - } - - public void setOn(boolean a_isOnCurve) { - if (a_isOnCurve) { - setType(k_on); - } else { - setType(k_off); - } // if - } - - public boolean hitHint(Rectangle2D a_rect, AffineTransform a_trans) { - int ppem = EContour.k_defaultPixelSize; - if (!hasHintForPpem(ppem)) - return false; - - EHint hint = getHintForPpem(ppem); - - Shape hitArea = hint.toShape(a_trans, ppem); - if (!hitArea.intersects(a_rect)) { - return false; - } // if - - EObject.getActives().addActive(hint); - return true; - } - - public boolean hit(Rectangle2D a_rect, AffineTransform a_trans) { - return EObject.hit(this, a_rect, buildOffsetTrans(a_trans)); - } - - /** Round the value after converting to pixel coordinate system. - */ - private double round(double a_value, long a_ppem) { - double em = Engine.getEm(); - double funitInGrid = em / a_ppem; - - double pixelValue = a_value / funitInGrid; - return funitInGrid * roundSymetric(pixelValue); - } - - /** round symetrically about zero. - * Math.round(0.5) returns 1. Math.round(-0.5) returns 0, - * since it's Math.floor(a_value + -0.5). - * -0.5 should round to -1 if it's symetric about zero. - * @param a_value number to be rounded. - * @return round value. - */ - private int roundSymetric(double a_value) { - if (a_value < 0) { - int retval = (int) Math.round(-a_value); - return -retval; - } else { - return (int) Math.round(a_value); - } // if-else - } - - public void removeControlPoint(EControlPoint a_point) { - if (hasControlPoint1() && (getControlPoint1() == a_point)) { - setControlPoint1(null); - } // if - - if (hasControlPoint2() && (getControlPoint2() == a_point)) { - setControlPoint2(null); - } // if - } +/* + * $Id: EContourPoint.java,v 1.10 2004/12/27 04:56:02 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2004, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + +package org.doubletype.ossa.adapter; + +/** + * @author e.e + */ +public class EContourPoint implements EPoint { + private boolean isOn; + private double x; + private double y; + private EControlPoint controlPoint1; + private EControlPoint controlPoint2; + + public EContourPoint() { + super(); + } + + public EContourPoint(double a_x, double a_y, boolean a_isOn) { + x = a_x; + y = a_y; + + setOn(a_isOn); + } + + public static final int k_defaultPixelSize = 16; + + public double getX() { + return x; + } + + public double getY() { + return y; + } + + public EControlPoint getControlPoint1() { + return controlPoint1; + } + + public EControlPoint getControlPoint2() { + return controlPoint2; + } + + public void setControlPoint1(EControlPoint a_point) { + controlPoint1 = a_point; + } + + public void setControlPoint2(EControlPoint a_point) { + controlPoint2 = a_point; + } + + public boolean hasControlPoint1() { + return getControlPoint1() != null; + } + + public boolean hasControlPoint2() { + return getControlPoint2() != null; + } + + public boolean isOn() { + return isOn; + } + + public void setOn(boolean a_isOnCurve) { + isOn = a_isOnCurve; + } } \ No newline at end of file diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/EControlPoint.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/EControlPoint.java index 70ed77625..d4c3e59f2 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/EControlPoint.java +++ b/libsrc/ttf/src/org/doubletype/ossa/adapter/EControlPoint.java @@ -1,244 +1,67 @@ -/* - * $Id: EControlPoint.java,v 1.6 2004/12/27 04:56:02 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Shape; -import java.awt.geom.AffineTransform; -import java.awt.geom.Line2D; -import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; - -import org.doubletype.ossa.GlyphColor; -import org.doubletype.ossa.xml.*; - -/** - * @author e.e - */ -public class EControlPoint extends XControlPoint implements GlyphObject, EPoint { - private static final String k_true = "true"; - - private double m_xOffset = 0; - private double m_yOffset = 0; - - public EControlPoint(boolean a_isFirst, double a_x, double a_y) { - setSmooth(true); - setFirst(a_isFirst); - setContourPoint(new EContourPoint(a_x, a_y, false)); - } - - /** - * - */ - public EControlPoint() { - super(); - } - - /** - * @param stack - */ - public EControlPoint(RStack stack) { - super(stack); - } - - public boolean isSelected() { - return EObject.getActives().isSelected(this); - } - - /** toggle smooth-ness - */ - public void convert() { - EContourPoint parent = getParent(); - boolean value = !getSmooth(); - parent.getControlPoint1().setSmooth(value); - parent.getControlPoint2().setSmooth(value); - move(new Point2D.Double(0, 0)); - } - - public boolean isFirst() { - return getFirst(); - } - - public boolean hit(Rectangle2D a_rect, AffineTransform a_trans) { - return EObject.hit(this, a_rect, buildOffsetTrans(a_trans)); - } - - public void setOffset(double a_x, double a_y) { - m_xOffset = a_x; - m_yOffset = a_y; - } - - private AffineTransform buildOffsetTrans(AffineTransform a_trans) { - if (m_xOffset == 0 && m_yOffset == 0) { - return a_trans; - } // if - - AffineTransform retval = (AffineTransform) a_trans.clone(); - retval.translate(m_xOffset, m_yOffset); - - return retval; - } - - public void remove() { - getParent().removeControlPoint(this); - } - - public EContourPoint getParent() { - return (EContourPoint) rGetParentRNode(); - } - - public Shape toShape(AffineTransform a_trans, int a_ppem) { - return EObject.toShape(getContourPoint().getPoint2d(), a_trans); - } - - public void move(Point2D a_delta) { - // if the parent is active, she will move this. - if (getParent().isSelected()) { - return; - } // if - - EObject.movePoint((EContourPoint) getContourPoint(), a_delta); - - if (isSmooth() && hasSibling()) { - smoothSibling(); - } // if - } - - public void rotateTo45() { - double theta = getTheta() + Math.PI / 8; - theta = Math.PI / 4 * Math.floor(theta / (Math.PI / 4)); - - rotateToTheta(theta); - if (isSmooth() && hasSibling()) { - smoothSibling(); - } // if - } - - private void smoothSibling() { - getSibling().rotateToTheta(getTheta() + Math.PI); - } - - private double getTheta() { - EContourPoint parent = getParent(); - return Math.atan2(getY() - parent.getY(), - getX() - parent.getX()); - } - - private void rotateToTheta(double a_theta) { - EContourPoint parent = getParent(); - double d = parent.toPoint2D().distance(toPoint2D()); - double x = parent.getX() + Math.cos(a_theta) * d; - double y = parent.getY() + Math.sin(a_theta) * d; - Point2D delta = new Point2D.Double(x - getX(), y - getY()); - EObject.movePoint((EContourPoint) getContourPoint(), delta); - } - - public Point2D toPoint2D() { - EContourPoint point = (EContourPoint) getContourPoint(); - return point.toPoint2D(); - } - - public boolean isSmooth() { - return getSmooth(); - } - - public boolean hasSibling() { - EContourPoint parent = getParent(); - if (parent.getControlPoint1() == this) { - return parent.hasControlPoint2(); - } else { - return parent.hasControlPoint1(); - } // if - } - - public EControlPoint getSibling() { - EContourPoint parent = getParent(); - if (parent.getControlPoint1() == this) { - return (EControlPoint) parent.getControlPoint2(); - } else { - return (EControlPoint) parent.getControlPoint1(); - } // if - } - - public void display(Graphics2D g, AffineTransform a_trans) { - AffineTransform trans = buildOffsetTrans(a_trans); - displayLine(g, trans); - - Shape rect = toShape(trans, EContour.k_defaultPixelSize); - g.setColor(GlyphColor.POINT); - if (isSelected()) { - g.setColor(GlyphColor.SELECTED); - } // if - - g.draw(rect); - } - - private void displayLine(Graphics2D g, AffineTransform a_trans) { - EContourPoint parent = getParent(); - Line2D line = new Line2D.Double(parent.getX(), - parent.getY(), - getX(), - getY()); - AffineTransform oldTrans = g.getTransform(); - - g.transform(a_trans); - g.setColor(Color.BLACK); - g.draw(line); - g.setTransform(oldTrans); - } - - public EControlPoint transpose(AffineTransform a_trans) { - EControlPoint retval = new EControlPoint(); - EContourPoint point = (EContourPoint) getContourPoint(); - retval.setContourPoint(point.transpose(a_trans)); - retval.setSmooth(getSmooth()); - - return retval; - } - - - public double getX() { - EContourPoint point = (EContourPoint) getContourPoint(); - return point.getX(); - } - - public double getY() { - EContourPoint point = (EContourPoint) getContourPoint(); - return point.getY(); - } -} - +/* + * $Id: EControlPoint.java,v 1.6 2004/12/27 04:56:02 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + +package org.doubletype.ossa.adapter; + +import java.awt.Shape; +import java.awt.geom.AffineTransform; + +/** + * @author e.e + */ +public class EControlPoint implements EPoint { + + private EContourPoint contourPoint; + + /** + * + */ + public EControlPoint(double x, double y) { + contourPoint = new EContourPoint(x, y, false); + } + + public double getX() { + return contourPoint.getX(); + } + + public double getY() { + return contourPoint.getY(); + } + + public EContourPoint getContourPoint() { + return contourPoint; + } +} + diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/EGlyphFactory.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/EGlyphFactory.java deleted file mode 100644 index 4575f06e8..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/EGlyphFactory.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * $Id: EGlyphFactory.java,v 1.3 2004/11/10 01:49:49 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import org.doubletype.ossa.xml.*; - -/** - * @author e.e - */ -public class EGlyphFactory extends DefaultGlyphFactory { - public static IGlyphFactory s_factory = null; - - public static IGlyphFactory getFactory() { - if (s_factory == null) { - s_factory = new EGlyphFactory(); - } // if - - return s_factory; - } - - public EGlyphFactory() { - } - - public XModule createXModule() { - return new EModuleInvoke(); - } - - public Class getXModuleClass() { - return (EModuleInvoke.class); - } - - public XContour createXContour() { - return new EContour(); - } - - public Class getXContourClass() { - return (EContour.class); - } - - public XInclude createXInclude() { - return new EIncludeInvoke(); - } - - public Class getXIncludeClass() { - return (EIncludeInvoke.class); - } - - public XHint createXHint() { - return new EHint(); - } - - public Class getXHintClass() { - return (EHint.class); - } - - public XContourPoint createXContourPoint() { - return new EContourPoint(); - } - - public XContourPoint createXContourPoint(RStack a_stack) { - return new EContourPoint(a_stack); - } - - public Class getXContourPointClass() { - return (EContourPoint.class); - } - - public XControlPoint createXControlPoint() { - return new EControlPoint(); - } - - - public Class getXControlPointClass() { - return (EControlPoint.class); - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/EHint.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/EHint.java deleted file mode 100644 index fedad33ca..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/EHint.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * $Id: EHint.java,v 1.4 2004/12/27 04:56:03 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.awt.*; -import java.awt.geom.*; - -import org.doubletype.ossa.xml.*; -import org.doubletype.ossa.*; - -/** - * @author e.e - */ -public class EHint extends XHint implements GlyphObject, EPoint { - /** offset of this from the global coord. - * For contours, it will be 0. - * For module invoke, it will be pos.x. - * @see EContourPoint - */ - private double m_xOffset = 0; - private double m_yOffset = 0; - - public EHint() { - } - - public EHint(double a_x, double a_y, long a_ppem) { - XPoint2d point = new XPoint2d(); - point.setX(a_x); - point.setY(a_y); - - setPoint2d(point); - setPpem(a_ppem); - } - - public void setOffset(double a_x, double a_y) { - m_xOffset = a_x; - m_yOffset = a_y; - } - - private AffineTransform buildOffsetTrans(AffineTransform a_trans) { - if (m_xOffset == 0 && m_yOffset == 0) { - return a_trans; - } // if - - AffineTransform retval = (AffineTransform) a_trans.clone(); - retval.translate(m_xOffset, m_yOffset); - - return retval; - } - - public void display(Graphics2D g, AffineTransform a_trans) { - AffineTransform trans = buildOffsetTrans(a_trans); - - EContourPoint point = (EContourPoint) rGetParentRNode(); - - Shape rect = toShape(trans, EContour.k_defaultPixelSize); - Line2D line = new Line2D.Double(point.getX(), - point.getY(), - getX(), - getY()); - - AffineTransform oldTrans = g.getTransform(); - - g.transform(trans); - g.setColor(Color.BLACK); - g.draw(line); - g.setTransform(oldTrans); - - g.setColor(GlyphColor.HINT); - if (isSelected()) { - g.setColor(GlyphColor.SELECTED); - } // if - - if (point.isOn()) - g.fill(rect); - else - g.draw(rect); - } - - public boolean isSelected() { - return EObject.getActives().isSelected(this); - } - - public Shape toShape(AffineTransform a_trans, int a_ppem) { - return EObject.toShape(getPoint2d(), a_trans); - } - - public double getX() { - return getPoint2d().getX(); - } - - public double getY() { - return getPoint2d().getY(); - } - - public Point2D toPoint2D() { - return new Point2D.Double(getX(), getY()); - } - - /** - * @see org.doubletype.ossa.adapter.DObject#move(java.awt.geom.Point2D) - */ - public void move(Point2D a_delta) { - EObject.movePoint(getPoint2d(), a_delta); - - double gridWidth = ((double) Engine.getEm()) / getPpem(); - EContourPoint point = (EContourPoint) rGetParentRNode(); - - XPoint2d posHint = getPoint2d(); - XPoint2d posPoint = point.getPoint2d(); - double xDelta = posHint.getX() - posPoint.getX(); - double yDelta = posHint.getY() - posPoint.getY(); - - xDelta = correctDelta(xDelta, gridWidth); - yDelta = correctDelta(yDelta, gridWidth); - - posHint.setX(posPoint.getX() + xDelta); - posHint.setY(posPoint.getY() + yDelta); - } - - private double correctDelta(double a_delta, double a_width) { - double retval = a_delta; - - if (retval > a_width) { - retval = a_width; - } // if - - if (retval < -a_width) { - retval = -a_width; - } // if - - return retval; - } - - /** - * @see org.doubletype.ossa.adapter.DObject#remove() - */ - public void remove() { - getParent().removeHint(this); - } - - public EContourPoint getParent() { - return (EContourPoint) rGetParentRNode(); - } - - public PointAggregate getPointHost() { - return getParent().getParent(); - } - - public boolean hit(Rectangle2D a_rect, AffineTransform a_trans) { - return EObject.hit(this, a_rect, buildOffsetTrans(a_trans)); - } - - public EHint createTransform(AffineTransform a_trans) { - EHint retval = new EHint(); - - retval.setPpem(getPpem()); - retval.setPoint2d(EObject.createTransform(getPoint2d(), a_trans)); - - return retval; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/EIncludeInvoke.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/EIncludeInvoke.java deleted file mode 100644 index 2210d11d0..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/EIncludeInvoke.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * $Id: EIncludeInvoke.java,v 1.1 2004/09/04 21:54:07 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.awt.*; -import java.awt.geom.*; -import org.doubletype.ossa.xml.*; -import org.doubletype.ossa.*; -import org.doubletype.ossa.module.*; -import java.util.*; - -/** - * @author e.e - */ -public class EIncludeInvoke extends XInclude implements VarStackFrame, GlyphObject { - public static EIncludeInvoke create(String a_fileName) { - EIncludeInvoke retval = new EIncludeInvoke(); - retval.setHref(a_fileName); - retval.setInvoke(EObject.createInvoke(new Point2D.Double())); - - return retval; - } - - /** environment with invoke args. */ - private Hashtable m_augmented = new Hashtable<>(); - private VarStack m_stack = VarStack.getSingletonInstance(); - - public EIncludeInvoke() { - } - - public EIncludeInvoke(RStack a_stack) { - setup(a_stack); - } - - public void display(Graphics2D g, AffineTransform a_trans) { - g.setColor(GlyphColor.INCLUDE); - if (isSelected()) { - g.setColor(GlyphColor.SELECTED); - } // if - - g.draw(toShape(a_trans,EContour.k_defaultPixelSize)); - } - - public boolean isSelected() { - return EObject.getActives().isSelected(this); - } - - public Shape toShape(AffineTransform a_trans, int a_ppem) { - Shape retval; - - ModuleManager manager = ModuleManager.getSingletonInstance(); - GlyphFile file = manager.getGlyphFile(getHref()); - - XPoint2d pos = getInvoke().getInvokePos().getPoint2d(); - - AffineTransform trans = new AffineTransform(); - trans.setTransform(a_trans); - trans.translate(pos.getX(), pos.getY()); - - m_stack.push(this); - retval = file.toShape(trans); - m_stack.pop(); - - return retval; - } - - public GlyphModule getModule() { - ModuleManager manager = ModuleManager.getSingletonInstance(); - return manager.getGlyphFile(getHref()); - } - - // for var stack frame - public boolean hasVariable(String a_name) { - return m_augmented.containsKey(a_name); - } - - // for var stack frame. - public double getValue(String a_name) { - Double d = (Double) m_augmented.get(a_name); - return d.doubleValue(); - } - - // for var stack frame. - public void beforePush() { - getModule().beforePush(); - loadInvoke(getInvoke()); - } - - public void remove() { - XBody parent = (XBody) rGetParentRNode(); - parent.removeInclude(this); - } - - public void move(Point2D a_delta) { - XPoint2d point = getInvoke().getInvokePos().getPoint2d(); - EObject.movePoint(point, a_delta); - } - - /** - * loads invoke arguments into this module to build augmented environment. - * @param a_invoke - */ - private void loadInvoke(XInvoke a_invoke) { - copyVarsToAug(); - - int i; - XInvokeVarg [] vargs = a_invoke.getInvokeVarg(); - for (i = 0; i < vargs.length; i++) { - loadVarg(vargs[i]); - } // for i - } - - private void loadVarg(XInvokeVarg a_varg) { - String name = a_varg.getName(); - String src = a_varg.getSrc(); - GlyphModule module = getModule(); - - if (!module.hasVariable(name)) { - return; - } // if - - double value = m_stack.get(src); - m_augmented.put(name, new Double(value)); - } - - private void copyVarsToAug() { - m_augmented.clear(); - m_augmented.putAll(getModule().getVars()); - } - - public boolean hit(Rectangle2D a_rect, AffineTransform a_trans) { - return EObject.hit(this, a_rect, a_trans); - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/EModuleInvoke.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/EModuleInvoke.java deleted file mode 100644 index 25962b6c5..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/EModuleInvoke.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * $Id: EModuleInvoke.java,v 1.4 2004/11/08 06:29:51 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import org.doubletype.ossa.*; -import org.doubletype.ossa.module.*; -import org.doubletype.ossa.xml.*; -import java.awt.geom.*; -import java.awt.*; -import java.util.*; - -/** - * @author e.e - */ -public class EModuleInvoke extends XModule implements VarStackFrame, GlyphObject, PointAggregate { - public static EModuleInvoke create() { - return createAt(new Point2D.Double(0, 254.0)); - } - - public static EModuleInvoke createAt(Point2D a_point) { - EModuleInvoke retval = new EModuleInvoke(); - - retval.setName(org.doubletype.ossa.module.Rectangle.class.getName()); - retval.setInvoke(EObject.createInvoke(a_point)); - - double x, y; - XContourPoint point; - - x = 0.0; - y = 0.0; - point = new EContourPoint(x, y, true); - retval.addContourPoint(point); - - - x += 426.0; - point = new EContourPoint(x, y, true); - retval.addContourPoint(point); - - y -= 254.0; - point = new EContourPoint(x, y, true); - retval.addContourPoint(point); - - x -= 426.0; - point = new EContourPoint(x, y, true); - retval.addContourPoint(point); - - return retval; - } - - - /** environment with invoke args. */ - private Hashtable m_augmented = new Hashtable<>(); - private VarStack m_stack = VarStack.getSingletonInstance(); - - // -------------------------------------------------------------- - - public EModuleInvoke() { - } - - public EModuleInvoke(RStack a_stack) { - setup(a_stack); - } - - // -------------------------------------------------------------- - - public void display(Graphics2D g, AffineTransform a_trans) { - if (isSelected()) { - g.setColor(GlyphColor.SELECTED); - } else { - g.setColor(GlyphColor.MODULE); - } // if - - g.draw(toShape(a_trans, EContour.k_defaultPixelSize)); - } - - public boolean isSelected() { - return EObject.getActives().isSelected(this); - } - - public Shape toShape(AffineTransform a_trans, int a_ppem) { - EContour contour = toContour(a_trans); - return contour.toShape(new AffineTransform(), a_ppem); - } - - // -------------------------------------------------------------- - - public EContour toContour(AffineTransform a_trans) { - EContour retval; - - GlyphModule module = getModule(); - - m_stack.push(this); - EContour untransContour = module.toContour(this); - m_stack.pop(); - - XPoint2d pos = getInvoke().getInvokePos().getPoint2d(); - AffineTransform trans = (AffineTransform) a_trans.clone(); - trans.translate(pos.getX(), pos.getY()); - - retval = untransContour.transpose(trans); - - return retval; - } - - public GlyphModule getModule() { - return getModuleForName(getName()); - } - - private GlyphModule getModuleForName(String a_name) { - GlyphModule retval = null; - - try { - ModuleManager manager = ModuleManager.getSingletonInstance(); - retval = manager.getModule(a_name); - } catch (Exception e) { - e.printStackTrace(); - } // try-catch - - return retval; - } - - public void remove() { - XBody parent = (XBody) rGetParentRNode(); - parent.removeModule(this); - } - - public void move(Point2D a_delta) { - XPoint2d point = getInvoke().getInvokePos().getPoint2d(); - EObject.movePoint(point, a_delta); - } - - // PointAggregate - public void removePoint(EContourPoint a_point) { - boolean isFirst = (a_point == getContourPoint(0)); - removeContourPoint(a_point); - - GlyphModule module = getModuleForName(getName()); - - if (getContourPoint().length < module.getMinimumPointCount()) - { - remove(); - return; - } // if - - if (!isFirst) { - return; - } // if - - EContourPoint newFirst = (EContourPoint) getContourPoint(0); - Point2D pos = newFirst.toPoint2D(); - Point2D delta = new Point2D.Double(-pos.getX(), -pos.getY()); - moveModulePoints(delta); - move(pos); - } - - public void moveModulePoints(Point2D a_delta) { - XContourPoint [] points = getContourPoint(); - - int i; - for (i = 0; i < points.length; i++) { - EContourPoint point = (EContourPoint) points[i]; - EObject.movePoint(point, a_delta); - } // for i - } - - // for var stack frame - public boolean hasVariable(String a_name) { - return m_augmented.containsKey(a_name); - } - - // for var stack frame. - public double getValue(String a_name) { - Double d = (Double) m_augmented.get(a_name); - return d.doubleValue(); - } - - // for var stack frame. - public void beforePush() { - loadInvoke(getInvoke()); - } - - /** - * loads invoke arguments into this module to build augmented environment. - * @param a_invoke - */ - private void loadInvoke(XInvoke a_invoke) { - copyVarsToAug(); - - // load varg - int i; - XInvokeVarg [] vargs = a_invoke.getInvokeVarg(); - for (i = 0; i < vargs.length; i++) { - loadVarg(vargs[i]); - } // for i - } - - private void loadVarg(XInvokeVarg a_varg) { - String name = a_varg.getName(); - String src = a_varg.getSrc(); - GlyphModule module = getModule(); - - if (!module.hasVariable(name)) { - System.out.println(name + " does not exist in " - + module.toString()); - - return; - } // if - - double value = m_stack.get(src); - m_augmented.put(name, new Double(value)); - } - - private void copyVarsToAug() { - m_augmented.clear(); - m_augmented.putAll(getModule().getVars()); - } - - public void movePoint(EContourPoint a_point, Point2D a_delta) { - EObject.movePoint(a_point, a_delta); - - if (a_point != getContourPoint(0)) { - return; - } // if - - Point2D negative = new Point2D.Double(-a_delta.getX(), -a_delta.getY()); - moveModulePoints(negative); - move(a_delta); - } - - public GlyphObject insertPoint(EContourPoint a_point) { - int i; - int len = getContourPoint().length; - - for (i = 0; i < len; i++) { - if (getContourPoint(i) == a_point) { - break; - } // if - } // for - - EContourPoint nextPoint; - nextPoint = (EContourPoint) getContourPoint((i + 1) % len); - - double x = (a_point.getX() + nextPoint.getX()) / 2; - double y = (a_point.getY() + nextPoint.getY()) / 2; - - EContourPoint retval = new EContourPoint(x, y, true); - addContourPoint(i + 1, retval); - - return retval; - } - - public boolean hit(Rectangle2D a_rect, AffineTransform a_trans) { - return EObject.hit(this, a_rect, a_trans); - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/EObject.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/EObject.java deleted file mode 100644 index 5f5f7e0c2..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/EObject.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * $Id: EObject.java,v 1.2 2004/11/08 06:29:51 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.awt.geom.*; -import java.awt.*; - -import org.doubletype.ossa.*; -import org.doubletype.ossa.truetype.TTPixelSize; -import org.doubletype.ossa.xml.*; - -/** Decorator class of xml objects. - * @author e.e - */ -public abstract class EObject { - public static final String k_on = "on"; - public static final String k_off = "off"; - - private static ActiveList s_actives = null; - - - static ActiveList getActives() { - if (s_actives == null) { - s_actives = ActiveList.getSingletonInstance(); - } // if - - return s_actives; - } - - static Shape toShape(XPoint2d a_point, AffineTransform a_trans) { - - double ratio= EContour.k_defaultPixelSize/TTPixelSize.getEm(); - - double x = a_point.getX(); - double y = a_point.getY(); - double e = 3 / ratio; - Point2D source, dest; - source = new Point2D.Double(x, y); - dest = new Point2D.Double(); - dest = a_trans.transform(source, dest); - x = dest.getX(); - y = dest.getY(); - - return new Rectangle2D.Double(x - e, y - e, 2 * e + 1, 2 * e + 1); - } - - static void movePoint(XPoint2d a_point, Point2D a_delta) { - double x = a_point.getX() + a_delta.getX(); - double y = a_point.getY() + a_delta.getY(); - - a_point.setX(x); - a_point.setY(y); - } - - /** - * move the point and hint - * @param a_point - * @param a_delta - */ - public static void movePoint(EContourPoint a_point, Point2D a_delta) { - movePoint(a_point.getPoint2d(), a_delta); - - XHint [] hints = a_point.getHint(); - for (int i = 0; i < hints.length; i++) { - XHint hint = hints[i]; - movePoint(hint.getPoint2d(), a_delta); - } // for i - - if (a_point.hasControlPoint1()) { - EContourPoint point = (EContourPoint) a_point.getControlPoint1().getContourPoint(); - movePoint(point, a_delta); - } // if - if (a_point.hasControlPoint2()) { - EContourPoint point = (EContourPoint) a_point.getControlPoint2().getContourPoint(); - movePoint(point, a_delta); - } // if - } - - public static boolean hit(GlyphObject a_object, Rectangle2D a_rect, AffineTransform a_trans) { - int ppem = EContour.k_defaultPixelSize; - Shape hitArea = a_object.toShape(a_trans, ppem); - if (!hitArea.intersects(a_rect)) { - return false; - } // if - - EObject.getActives().addActive(a_object); - return true; - } - - public static XInvoke createInvoke(Point2D a_point) { - XInvoke retval = new XInvoke(); - retval.setInvokePos(createInvokePos(a_point.getX(), a_point.getY())); - return retval; - } - - public static XPoint2d createTransform(XPoint2d a_point, AffineTransform a_trans) { - XPoint2d retval = new XPoint2d(); - - double x = a_point.getX(); - double y = a_point.getY(); - Point2D source = new Point2D.Double(x, y); - Point2D dest = new Point2D.Double(); - a_trans.transform(source, dest); - - retval.setX(dest.getX()); - retval.setY(dest.getY()); - - return retval; - } - - private static XInvokePos createInvokePos(double a_x, double a_y) { - XInvokePos retval = new XInvokePos(); - retval.setPoint2d(createPoint2d(a_x, a_y)); - return retval; - } - - - private static XPoint2d createPoint2d(double a_x, double a_y) { - XPoint2d retval = new XPoint2d(); - retval.setX(a_x); - retval.setY(a_y); - return retval; - } - -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/Emulator.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/Emulator.java deleted file mode 100644 index f7ccb1598..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/Emulator.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * $Id: Emulator.java,v 1.6 2004/12/27 04:56:02 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.awt.*; -import java.awt.geom.*; -import java.util.*; -import java.util.List; -import org.doubletype.ossa.xml.*; - -/** Emulator emulates font engine. - * @author e.e - */ -public class Emulator { - private static Emulator s_instance = null; - - // singleton pattern - public static Emulator getInstance() { - if (s_instance == null) { - s_instance = new Emulator(); - } // if - - return s_instance; - } - - private Emulator() { - super(); - } - - public Shape createShape(EContour a_contour, int a_ppem) { - if (a_contour.isCubic()) { - // return createBezierCurve(a_contour); - EContour contour = a_contour.toQuadratic(); - return createShape(contour, a_ppem); - } // if - - return concretePointsToShape(createConcretePoints( - createAdjustedPoints(a_contour, a_ppem))); - } - - private Shape createBezierCurve(EContour a_contour) { - GeneralPath retval = new GeneralPath(); - XContourPoint [] points = a_contour.getContourPoint(); - - if (points.length < 2) { - return retval; - } // if - - EContourPoint startPoint = (EContourPoint) points[points.length - 1]; - retval.moveTo((float) startPoint.getX(), (float) startPoint.getY()); - - for (int i = 0; i < points.length; i++) { - EContourPoint toPoint = (EContourPoint) points[i]; - EControlPoint controlPoint1 = (EControlPoint) startPoint.getControlPoint2(); - EControlPoint controlPoint2 = (EControlPoint) toPoint.getControlPoint1(); - - // line segment - if ((controlPoint1 == null) && (controlPoint2 == null)) { - retval.lineTo((float) toPoint.getX(), (float) toPoint.getY()); - - } // if - - if ((controlPoint1 != null) && (controlPoint2 == null)) { - retval.curveTo((float) controlPoint1.getX(), (float) controlPoint1.getY(), - (float) toPoint.getX(), (float) toPoint.getY(), - (float) toPoint.getX(), (float) toPoint.getY()); - } // if - - if ((controlPoint1 == null) && (controlPoint2 != null)) { - retval.curveTo((float) startPoint.getX(), (float) startPoint.getY(), - (float) controlPoint2.getX(), (float) controlPoint2.getY(), - (float) toPoint.getX(), (float) toPoint.getY()); - } // if - - if ((controlPoint1 != null) && (controlPoint2 != null)) { - retval.curveTo((float) controlPoint1.getX(), (float) controlPoint1.getY(), - (float) controlPoint2.getX(), (float) controlPoint2.getY(), - (float) toPoint.getX(), (float) toPoint.getY()); - } // if - - startPoint = toPoint; - } // for - - return retval; - } - - private Shape concretePointsToShape(List a_listOfPoints) { - GeneralPath retval = new GeneralPath(); - EContourPoint p; - - if (a_listOfPoints.size() < 3) - return retval; - - p = (EContourPoint) a_listOfPoints.get(0); - retval.moveTo((float) p.getX(), (float) p.getY()); - - int i = 0; - while (i < a_listOfPoints.size() - 1) { - i++; - EContourPoint nextPoint = (EContourPoint) a_listOfPoints.get(i); - - if (nextPoint.isOn()) { - retval.lineTo((float) nextPoint.getX(), (float) nextPoint.getY()); - } else { - EContourPoint controlPoint = nextPoint; - i++; - EContourPoint toPoint = (EContourPoint) a_listOfPoints.get(i); - - retval.quadTo((float) controlPoint.getX(), - (float) controlPoint.getY(), - (float) toPoint.getX(), (float) toPoint.getY()); - } // if-else - } // for - - return retval; - } - - private List createConcretePoints(List a_points) { - List retval = new ArrayList<>(); - - if (a_points.size() < 3) - return retval; - - EContourPoint lastPoint = (EContourPoint) a_points.get(a_points.size() - 1); - for (int i = 0; i < a_points.size(); i++) { - EContourPoint point = (EContourPoint) a_points.get(i); - - if (!point.isOn() && !lastPoint.isOn()) { - double xMidpoint = (point.getX() + lastPoint.getX()) / 2; - double yMidpoint = (point.getY() + lastPoint.getY()) / 2; - retval.add(new EContourPoint(xMidpoint, yMidpoint, true)); - } // if - - retval.add(new EContourPoint(point.getX(), point.getY(), point.isOn())); - lastPoint = point; - } // for i - - // all contours should start with on-curve point - // move off-curve point to the end if a contour starts with one. - EContourPoint point = (EContourPoint) retval.get(0); - if (!point.isOn()) { - retval.remove(0); - retval.add(point); - } // if - - point = (EContourPoint) retval.get(0); - retval.add(point); - - return retval; - } - - private List createAdjustedPoints(EContour a_contour, int a_ppem) { - List retval = new ArrayList<>(); - - XContourPoint [] points = a_contour.getContourPoint(); - if (points.length < 3) { - return retval; - } // if - - boolean isRounded = false; - for (int i = 0; i < points.length; i++) { - EContourPoint point = (EContourPoint) points[i]; - point.resetAdjusted(); - - if (point.isRounded()) { - isRounded = true; - point.roundAdjusted(a_ppem); - } // if - - retval.add(point); - } // for i - - if (isRounded) { - interpolate(retval, true); - interpolate(retval, false); - } // if - - for (int i = 0; i < retval.size(); i++) { - EContourPoint point = (EContourPoint) retval.get(i); - if (point.hasHintForPpem(a_ppem)) { - point.hintAdjusted(a_ppem); - } // if - } // for i - - return promoteAdjustedToMain(retval); - } - - private List promoteAdjustedToMain(List a_points) { - List retval = new ArrayList<>(); - for (int i = 0; i < a_points.size(); i++) { - EContourPoint original = (EContourPoint) a_points.get(i); - EContourPoint adjusted = new EContourPoint(original.getAdjusted().getX(), - original.getAdjusted().getY(), - original.isOn()); - - retval.add(adjusted); - } // for i - - return retval; - } - - private void interpolate(List a_points, boolean a_isX) { - Collection sorted = sortPoints(a_points, a_isX); - - Iterator itr = sorted.iterator(); - - EContourPoint first = (EContourPoint) itr.next(); - if (!first.isRounded()) { - shiftPoint(first, a_points, a_isX); - } // if - - EContourPoint second = (EContourPoint) itr.next(); - EContourPoint third = null; - while (itr.hasNext()) { - third = (EContourPoint) itr.next(); - - if (!second.isRounded()) { - if (first.isRounded() - && third.isRounded()) { - interpolate(first, second, third, a_isX); - } else { - shiftPoint(second, a_points, a_isX); - } // if-else - } // if - - first = second; - second = third; - } // while - - EContourPoint last = third; - if (!last.isRounded()) { - shiftPoint(last, a_points, a_isX); - } // if - } - - private Collection sortPoints(List a_points, boolean a_isX) { - Map sorted = new TreeMap<>(); - - for (int i = 0; i < a_points.size(); i++) { - EContourPoint original = (EContourPoint) a_points.get(i); - Double value = new Double(getPointValue(original, a_isX)); - - while (sorted.containsKey(value)) { - value = new Double(value.doubleValue() + 0.01); - } // while - sorted.put(value, original); - } // for i - - return sorted.values(); - } - - private void interpolate(EContourPoint a_first, EContourPoint a_second, EContourPoint a_third, boolean a_isX) { - double firstValue = getPointValue(a_first, a_isX); - double secondValue = getPointValue(a_second, a_isX); - double thirdValue = getPointValue(a_third, a_isX); - double adjustedFirst = getAdjustedValue(a_first, a_isX); - double adjustedThird = getAdjustedValue(a_third, a_isX); - - double ratio = (secondValue - firstValue) / (thirdValue - firstValue); - - secondValue = adjustedFirst + ratio * (adjustedThird - adjustedFirst); - setAdjusted(a_second, secondValue, a_isX); - } - - private void shiftPoint(EContourPoint a_point, List a_points, boolean a_isX) { - EContourPoint closest = closestTouchedPoint(a_point, a_points); - if (closest == null) { - return; - } // if - - double delta = getAdjustedValue(closest, a_isX) - getPointValue(closest, a_isX); - double value = getPointValue(a_point, a_isX) + delta; - setAdjusted(a_point, value, a_isX); - } - - private void setAdjusted(EContourPoint a_point, double a_value, boolean a_isX) { - double x = a_point.getX(); - double y = a_point.getY(); - - if (a_isX) { - x = a_value; - } else { - y = a_value; - } // if-else - - a_point.setAdjusted(x, y); - } - - private double getPointValue(EContourPoint a_point, boolean a_isX) { - if (a_isX) { - return a_point.getX(); - } else { - return a_point.getY(); - } // if-else - } - - private double getAdjustedValue(EContourPoint a_point, boolean a_isX) { - if (a_isX) { - return a_point.getAdjusted().getX(); - } else { - return a_point.getAdjusted().getY(); - } // if-else - } - - private EContourPoint closestTouchedPoint(EContourPoint a_point, List a_points) { - EContourPoint retval = null; - double min = Double.MAX_VALUE; - for (int i = 0; i < a_points.size(); i++) { - EContourPoint target = (EContourPoint) a_points.get(i); - if (target == a_point) { - continue; - } // if - - if (!target.isRounded()) { - continue; - } // if - - double d = a_point.toPoint2D().distance(target.toPoint2D()); - if (d < min) { - min = d; - retval = target; - } // if - - } // for i - - return retval; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/GlyphObject.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/GlyphObject.java deleted file mode 100644 index 2a7e70724..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/GlyphObject.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: GlyphObject.java,v 1.1 2004/09/04 21:54:06 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.awt.*; -import java.awt.geom.*; - -/** - * @author e.e - */ -public interface GlyphObject { - void move(Point2D a_delta); - void remove(); - Shape toShape(AffineTransform a_trans, int a_ppem); - boolean isSelected(); - void display(Graphics2D g, AffineTransform a_trans); - boolean hit(Rectangle2D a_rect, AffineTransform a_trans); -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/PointAggregate.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/PointAggregate.java deleted file mode 100644 index b1b6a5003..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/PointAggregate.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * $Id: PointAggregate.java,v 1.2 2004/09/18 07:30:44 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.awt.geom.*; -import org.doubletype.ossa.xml.*; - -/** - * @author e.e - */ -public interface PointAggregate { - void removePoint(EContourPoint a_point); - void movePoint(EContourPoint a_point, Point2D a_delta); - GlyphObject insertPoint(EContourPoint a_point); - XContourPoint[] getContourPoint(); -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/adapter/QuadraticSegment.java b/libsrc/ttf/src/org/doubletype/ossa/adapter/QuadraticSegment.java index 758a160cd..6ab69facd 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/adapter/QuadraticSegment.java +++ b/libsrc/ttf/src/org/doubletype/ossa/adapter/QuadraticSegment.java @@ -1,188 +1,187 @@ -/* - * $Id: QuadraticSegment.java,v 1.1 2004/12/15 11:54:18 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.adapter; - -import java.util.*; - -import org.doubletype.ossa.xml.XContourPoint; - -/** - * @author e.e - */ -public class QuadraticSegment { - public static final int LINE = 0; - public static final int CURVE = 1; - - /** - * converts quadratic contour into a list of quadratic segments. - * @param a_contour - * @return - */ - public static ArrayList toSegments(EContour a_contour) { - ArrayList retval = new ArrayList<>(); - - ArrayList points = toConcreatePoints(a_contour); - if (points.size() < 3) { - return retval; - } // if - - for (int i = 0; i < points.size() - 1; i++) { - EContourPoint startPoint = (EContourPoint) points.get(i); - EContourPoint nextPoint = (EContourPoint) points.get(i + 1); - - // if this is a line segment - if (nextPoint.isOn()) { - retval.add(new QuadraticSegment(startPoint, null, nextPoint)); - } else { - EContourPoint offCurvePoint = nextPoint; - i++; - nextPoint = (EContourPoint) points.get(i + 1); - retval.add(new QuadraticSegment(startPoint, offCurvePoint, nextPoint)); - } // if-else - } // for i - - return retval; - } - - /** - * converts a list of quadratic segments into a quadratic contour. - * @param a_segments - * @return - */ - public static EContour toContour(ArrayList a_segments) { - EContour retval = new EContour(); - retval.setType(EContour.k_quadratic); - - for (QuadraticSegment segment: a_segments) { - EContourPoint startPoint = (EContourPoint) segment.m_startPoint.clone(); - startPoint.setControlPoint1(null); - startPoint.setControlPoint2(null); - - if (segment.m_type == LINE) { - retval.addContourPoint(startPoint); - - } else { - retval.addContourPoint(startPoint); - retval.addContourPoint(segment.m_offCurvePoint); - } - } // for i - - return retval; - } - - /** - * converts quadratic contour to concreate points by inserting - * on-curve point between off-curve points. - * @param a_contour - * @return - */ - private static ArrayList toConcreatePoints(EContour a_contour) { - ArrayList retval = new ArrayList<>(); - - XContourPoint [] points = a_contour.getContourPoint(); - if (points.length < 3) - return retval; - - EContourPoint fromPoint = (EContourPoint) points[points.length - 1]; - for (XContourPoint point: points) { - EContourPoint toPoint = (EContourPoint) point; - if (!toPoint.isOn() && !fromPoint.isOn()) { - double xMidpoint = (toPoint.getX() + fromPoint.getX()) / 2; - double yMidpoint = (toPoint.getY() + fromPoint.getY()) / 2; - retval.add(new EContourPoint(xMidpoint, yMidpoint, true)); - } // if - - retval.add(toPoint); - fromPoint = toPoint; - } // for i - - // all contours should start with on-curve point - // move off-curve point to the end if a contour starts with one. - EContourPoint firstPoint = (EContourPoint) retval.get(0); - if (!firstPoint.isOn()) { - retval.remove(0); - retval.add(firstPoint); - } // if - - retval.add(retval.get(0)); - - return retval; - } - - private EContourPoint m_startPoint; - private EContourPoint m_offCurvePoint; - private EContourPoint m_endPoint; - - private int m_type = LINE; - - /** - * - */ - public QuadraticSegment(EContourPoint a_startPoint, EContourPoint a_offCurvePoint, - EContourPoint a_endPoint) { - m_startPoint = a_startPoint; - m_offCurvePoint = a_offCurvePoint; - m_endPoint = a_endPoint; - - if (m_offCurvePoint != null) { - m_type = CURVE; - } // if - } - - /** - * Convert quadratic segment to cubic. - * @param a_segment - * @return - */ - public CubicSegment toCubicSegment() { - // if the segment is a line - if (m_type == LINE) { - return new CubicSegment(m_startPoint, m_endPoint); - } // if - - double x, y; - x = m_startPoint.getX() + 2.0 / 3.0 * (m_offCurvePoint.getX() - m_startPoint.getX()); - y = m_startPoint.getY() + 2.0 / 3.0 * (m_offCurvePoint.getY() - m_startPoint.getY()); - EContourPoint controlPoint1 = new EContourPoint(x, y, false); - - x = m_offCurvePoint.getX() + 1.0 / 3.0 * (m_endPoint.getX() - m_offCurvePoint.getX()); - y = m_offCurvePoint.getY() + 1.0 / 3.0 * (m_endPoint.getY() - m_offCurvePoint.getY()); - EContourPoint controlPoint2 = new EContourPoint(x, y, false); - - return new CubicSegment(m_startPoint, controlPoint1, controlPoint2, m_endPoint); - } - -} +/* + * $Id: QuadraticSegment.java,v 1.1 2004/12/15 11:54:18 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2004, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + +package org.doubletype.ossa.adapter; + +import java.util.*; + +/** + * @author e.e + */ +public class QuadraticSegment { + public static final int LINE = 0; + public static final int CURVE = 1; + + /** + * converts quadratic contour into a list of quadratic segments. + * @param a_contour + * @return + */ + public static ArrayList toSegments(EContour a_contour) { + ArrayList retval = new ArrayList<>(); + + ArrayList points = toConcreatePoints(a_contour); + if (points.size() < 3) { + return retval; + } + + for (int i = 0; i < points.size() - 1; i++) { + EContourPoint startPoint = (EContourPoint) points.get(i); + EContourPoint nextPoint = (EContourPoint) points.get(i + 1); + + // if this is a line segment + if (nextPoint.isOn()) { + retval.add(new QuadraticSegment(startPoint, null, nextPoint)); + } else { + EContourPoint offCurvePoint = nextPoint; + i++; + nextPoint = (EContourPoint) points.get(i + 1); + retval.add(new QuadraticSegment(startPoint, offCurvePoint, nextPoint)); + } + } + + return retval; + } + + /** + * converts a list of quadratic segments into a quadratic contour. + * @param a_segments + * @return + */ + public static EContour toContour(ArrayList a_segments) { + EContour retval = new EContour(); + retval.setType(EContour.k_quadratic); + + for (QuadraticSegment segment: a_segments) { + EContourPoint p = segment.m_startPoint; + EContourPoint startPoint = new EContourPoint(p.getX(), p.getY(), p.isOn()); + startPoint.setControlPoint1(null); + startPoint.setControlPoint2(null); + + if (segment.m_type == LINE) { + retval.addContourPoint(startPoint); + + } else { + retval.addContourPoint(startPoint); + retval.addContourPoint(segment.m_offCurvePoint); + } + } + + return retval; + } + + /** + * converts quadratic contour to concreate points by inserting + * on-curve point between off-curve points. + * @param a_contour + * @return + */ + private static ArrayList toConcreatePoints(EContour a_contour) { + ArrayList retval = new ArrayList<>(); + + ArrayList points = a_contour.getContourPoints(); + if (points.size() < 3) + return retval; + + EContourPoint fromPoint = (EContourPoint) points.get(points.size() - 1); + for (EContourPoint point: points) { + EContourPoint toPoint = (EContourPoint) point; + if (!toPoint.isOn() && !fromPoint.isOn()) { + double xMidpoint = (toPoint.getX() + fromPoint.getX()) / 2; + double yMidpoint = (toPoint.getY() + fromPoint.getY()) / 2; + retval.add(new EContourPoint(xMidpoint, yMidpoint, true)); + } + + retval.add(toPoint); + fromPoint = toPoint; + } + + // all contours should start with on-curve point + // move off-curve point to the end if a contour starts with one. + EContourPoint firstPoint = (EContourPoint) retval.get(0); + if (!firstPoint.isOn()) { + retval.remove(0); + retval.add(firstPoint); + } + + retval.add(retval.get(0)); + + return retval; + } + + private EContourPoint m_startPoint; + private EContourPoint m_offCurvePoint; + private EContourPoint m_endPoint; + + private int m_type = LINE; + + /** + * + */ + public QuadraticSegment(EContourPoint a_startPoint, EContourPoint a_offCurvePoint, + EContourPoint a_endPoint) { + m_startPoint = a_startPoint; + m_offCurvePoint = a_offCurvePoint; + m_endPoint = a_endPoint; + + if (m_offCurvePoint != null) { + m_type = CURVE; + } + } + + /** + * Convert quadratic segment to cubic. + * @param a_segment + * @return + */ + public CubicSegment toCubicSegment() { + // if the segment is a line + if (m_type == LINE) { + return new CubicSegment(m_startPoint, m_endPoint); + } + + double x, y; + x = m_startPoint.getX() + 2.0 / 3.0 * (m_offCurvePoint.getX() - m_startPoint.getX()); + y = m_startPoint.getY() + 2.0 / 3.0 * (m_offCurvePoint.getY() - m_startPoint.getY()); + EContourPoint controlPoint1 = new EContourPoint(x, y, false); + + x = m_offCurvePoint.getX() + 1.0 / 3.0 * (m_endPoint.getX() - m_offCurvePoint.getX()); + y = m_offCurvePoint.getY() + 1.0 / 3.0 * (m_endPoint.getY() - m_offCurvePoint.getY()); + EContourPoint controlPoint2 = new EContourPoint(x, y, false); + + return new CubicSegment(m_startPoint, controlPoint1, controlPoint2, m_endPoint); + } + +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/GlyphFile.java b/libsrc/ttf/src/org/doubletype/ossa/module/GlyphFile.java index bdd5d618b..fa55c4126 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/module/GlyphFile.java +++ b/libsrc/ttf/src/org/doubletype/ossa/module/GlyphFile.java @@ -33,102 +33,33 @@ package org.doubletype.ossa.module; -import org.doubletype.ossa.*; -import org.doubletype.ossa.xml.*; import org.doubletype.ossa.adapter.*; import org.doubletype.ossa.truetype.*; import java.io.*; import java.awt.*; -import java.awt.geom.*; -import javax.xml.transform.*; -import javax.xml.transform.stream.*; -import javax.xml.transform.dom.*; -import java.net.*; import java.util.*; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.w3c.dom.*; -import javax.xml.parsers.*; -import org.xml.sax.*; +import java.util.List; /** * @author e.e */ -public class GlyphFile extends GlyphModule { - protected static String s_emptyFileName = "empty.glyph"; - private static final String k_dotGlyph = ".glyph"; - private static Transformer s_transformer = null; +public class GlyphFile { + private long m_unicode; + private String m_author; + private String m_copyrightYear; + private String m_license; + private Integer m_advanceWidth = null; + private List contours = new ArrayList<>(); - static { - GlyphFactory.setFactory(EGlyphFactory.getFactory()); - } - - public static File createFileName(File a_dir, String a_name) { - return new File(a_dir, a_name + k_dotGlyph); - } - - /** - * http://www.atmarkit.co.jp/fxml/rensai2/xmltool04/02.html - * @return - */ - private static Transformer getTransformer() { - if (s_transformer == null) { - TransformerFactory transFactory - = TransformerFactory.newInstance(); - try { - s_transformer = transFactory.newTransformer(); - } - catch (TransformerConfigurationException e) { - } - - s_transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - s_transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - } // if - - return s_transformer; - } - - private static XStartGlyphElement loadGlyphElement(URL a_url) { - IGlyphFactory factory = GlyphFactory.getFactory(); - - XStartGlyphElement retval = null; - - try { - retval = factory.createXStartGlyphElement(a_url); - } catch( SAXException | ParserConfigurationException | IOException e) { - e.printStackTrace(); - } - - return retval; - } - - private static XStartGlyphElement loadGlyphElement(InputStream a_in) { - IGlyphFactory factory = GlyphFactory.getFactory(); - XStartGlyphElement retval = null; - - try { - retval = factory.createXStartGlyphElement(a_in); - } catch( SAXException | ParserConfigurationException | IOException e) { - e.printStackTrace(); - } - - return retval; - } // -------------------------------------------------------------- - protected XStartGlyphElement m_glyph; - protected File m_fileName; protected long m_modifiedTime = 0; protected long m_savedTime = 0; private final int k_halfWidth = 512; private final int k_fullWidth = 1024; - private String m_selectedNodeName = ""; - private boolean m_isMoving = false; - private PointAggregate m_pointHost; // -------------------------------------------------------------- @@ -136,68 +67,25 @@ public class GlyphFile extends GlyphModule { /** * creates new file */ - public GlyphFile(File a_dir, String a_name, long a_unicode) { + public GlyphFile(File a_dir, long a_unicode) { super(); - m_fileName = createFileName(a_dir, a_name); + init(); + setUnicode(a_unicode); - init(getClass().getResource(s_emptyFileName)); - setGlyphTitle(a_name); - setUnicode(Long.toHexString(a_unicode)); - - /*int eastAsianWidth = UCharacter.getIntPropertyValue( - (int) a_unicode, - 0x1004); //UProperty.EAST_ASIAN_WIDTH); - */ - int eastAsianWidth = 5; //?? - if (eastAsianWidth == 5 || eastAsianWidth == 1) { - setAdvanceWidth(k_fullWidth); - } // if + setAdvanceWidth(k_fullWidth); } /** * creates new file * @param a_dir parent dir - * @param a_name glyph name */ - public GlyphFile(File a_dir, String a_name) throws FileNotFoundException { + public GlyphFile(File a_dir) { super(); - init(getClass().getResource(s_emptyFileName)); - setGlyphTitle(a_name); - m_fileName = createFileName(a_dir, a_name); + init(); } - /** - * opens existing file - * @param a_file - */ - public GlyphFile(File a_file) { - super(); - - m_fileName = a_file; - - URL url = null; - - try { - url = a_file.toURI().toURL(); - } catch(MalformedURLException e) { - e.printStackTrace(); - } - - init(url); - } - - protected GlyphFile(URL a_url) { - super(); - init(a_url); - } - - private void init(URL a_url) { - m_glyph = loadGlyphElement(a_url); - ModuleManager.getSingletonInstance().clear(); - - //m_display = Engine.getSingletonInstance().getDisplay(); - + private void init() { m_savedTime = m_modifiedTime; } @@ -233,635 +121,98 @@ public class GlyphFile extends GlyphModule { } public void beforePush() { - loadVar(); - } - - public void restore(Memento a_memento) { - m_glyph = loadGlyphElement(a_memento.getData()); - ModuleManager.getSingletonInstance().clear(); } // -------------------------------------------------------------- - public XStartGlyphElement getGlyph() { - return m_glyph; - } - - // -------------------------------------------------------------- - - public void saveGlyphFile(OutputStream a_output) { - try { - Transformer transformer = getTransformer(); - Document document = m_glyph.makeDocument(); - DOMSource source = new DOMSource(document); - StreamResult result = new StreamResult(a_output); - transformer.transform(source, result); - } catch (ParserConfigurationException | TransformerException e) { - e.printStackTrace(); - } - - m_savedTime = System.currentTimeMillis(); - m_modifiedTime = m_savedTime; - } - - public Memento createMemento(String a_description) { - m_modifiedTime = System.currentTimeMillis(); - byte [] bytes = m_glyph.makeTextDocument().getBytes(); - return new Memento(a_description, bytes); - } - public boolean hasUnsavedChange() { return (m_savedTime != m_modifiedTime); } public void setAuthor(String a_value) { - m_glyph.getHead().setAuthor(a_value); + m_author = a_value; } public String getAuthor() { - return m_glyph.getHead().getAuthor(); + return m_author; } public void setCopyrightYear(String a_value) { - m_glyph.getHead().setCopyright(a_value); + m_copyrightYear = a_value; } public String getCopyrightYear() { - return m_glyph.getHead().getCopyright(); + return m_copyrightYear; } public void setAdvanceWidth(int a_width) { - m_glyph.getHead().setAdvanceWidth(a_width); + m_advanceWidth = a_width; } public int getAdvanceWidth() { - if (!m_glyph.getHead().checkAdvanceWidth()) { - setAdvanceWidth(k_halfWidth); - } // if + if (m_advanceWidth == null) { + return k_halfWidth; + } - return (int) m_glyph.getHead().getAdvanceWidth(); - } - - public Iterator createIterator() { - return new GlyphIterator(this); + return m_advanceWidth; } - // -------------------------------------------------------------- - - public void display(Graphics2D g, AffineTransform a_trans) - { - Iterator i = createIterator(); - while (i.hasNext()) { - GlyphObject object = (GlyphObject) i.next(); - object.display(g, a_trans); - } // while - } - // -------------------------------------------------------------- public static final int k_defaultPixelSize = 16; //PPM - /** converts this glyph into Shape. - * It could be called for root's preview mode or by include invoke. - * Pushing either this GlyphFile or DIncludeInvoke should be - * handled before this. - */ - public Shape toShape(AffineTransform a_trans) { - - - int ppem = k_defaultPixelSize; - - GeneralPath retval = new GeneralPath(); - Iterator i = createIterator(); - while (i.hasNext()) { - GlyphObject object = (GlyphObject) i.next(); - - if (object instanceof EContourPoint - || object instanceof EHint) { - continue; - } // if - - retval.append(object.toShape(a_trans, ppem), false); - } // if - - return retval; - } - // -------------------------------------------------------------- /** * Generates array of XContour from local contours and modules. * Used for TTF building. */ - private XContour [] toContours() { - XContour [] retval; - ArrayList list = new ArrayList<>(); - XContour [] contours = m_glyph.getBody().getContour(); - for (int i = 0; i < contours.length; i++) { - EContour contour = (EContour) contours[i]; + private EContour [] toContours() { + EContour [] retval; + ArrayList list = new ArrayList<>(); + for (EContour contour : contours) { list.add(contour.toQuadratic()); - } // for i - - XModule [] modules = m_glyph.getBody().getModule(); - for (int i = 0; i < modules.length; i++) { - EModuleInvoke module = (EModuleInvoke) modules[i]; - - // push and pop happens inside toContour - list.add(module.toContour(new AffineTransform())); - } // for i + } if (list.size() == 0) return null; - retval = new XContour[list.size()]; + retval = new EContour[list.size()]; for (int i = 0; i < list.size(); i++) { retval[i] = list.get(i); - } // for i + } return retval; } // -------------------------------------------------------------- - public boolean isMoving() { - return m_isMoving; - } - - // -------------------------------------------------------------- - - public void beginMove() { - m_isMoving = true; - } - - // -------------------------------------------------------------- - - public void endMove() { - if (!m_isMoving) { - return; - } // if - - m_isMoving = false; - } - - // -------------------------------------------------------------- - - public void move(Point2D a_delta) { - int i; - for (i = 0; i < m_actives.size(); i++) { - GlyphObject active = m_actives.get(i); - active.move(a_delta); - } // for i - } - - - // -------------------------------------------------------------- - - public void fitMove() { - if (m_actives.hasActiveControlPoint()) { - EControlPoint controlPoint = m_actives.getActiveControlPoint(); - controlPoint.rotateTo45(); - } // if - } - - // -------------------------------------------------------------- - - public boolean isHittingSelected(Point2D a_point) { - ActiveList oldActiveObjects = new ActiveList(); - oldActiveObjects.setActives(m_actives); - - m_actives.unselectAll(); - hit(a_point, false, false); - - int i, j; - for (i = 0; i < m_actives.size(); i++) { - GlyphObject selected = m_actives.get(i); - for (j = 0; j < oldActiveObjects.size(); j++) { - GlyphObject old = oldActiveObjects.get(j); - - if (selected == old) { - m_actives.setActives(oldActiveObjects); - return true; - } // if - } // for j - } // for i - - m_actives.setActives(oldActiveObjects); - - return false; - } - - // -------------------------------------------------------------- - - /** hits a point to add them in active object queue. - * @param a_single when it is true, the method returns after - * finding the first hit. - */ - public boolean hit(Point2D a_point, - boolean a_isAppend, - boolean a_isSelectOnlyOne) { - if (a_point == null) { - return false; - } // if - - Rectangle2D rect = new Rectangle2D.Double( - a_point.getX(), a_point.getY(), - 1.0, 1.0); - return hit(rect, a_isAppend, a_isSelectOnlyOne); - } - - public void selectNext() { - Iterator i = new SelectionIterator(this); - - if (m_actives.size() == 1) { - boolean isFound = false; - - // loop the iterator in reverse order of drawing - while (i.hasNext()) { - GlyphObject object = (GlyphObject) i.next(); - - if (m_actives.isSelected(object)) { - isFound = true; - continue; - } // if - - if (!isFound) { - continue; - } // if - - m_actives.unselectAll(); - m_actives.addActive(object); - return; - } // while i - } // if - - i = new SelectionIterator(this); - if (i.hasNext()) { - GlyphObject object = (GlyphObject) i.next(); - m_actives.unselectAll(); - m_actives.addActive(object); - return; - } // if - } - - // -------------------------------------------------------------- - - public boolean hit(Rectangle2D a_rect, - boolean a_isAppend, - boolean a_single) { - - - if (!a_isAppend) { - m_actives.unselectAll(); - } // if - - return hitObjects(a_rect, a_single); - } - - // -------------------------------------------------------------- - - private boolean hitObjects(Rectangle2D a_rect, boolean a_isSelectOnlyOne) { - boolean retval = false; - - Iterator i = new SelectionIterator(this); - - // loop the iterator in reverse order of drawing - while (i.hasNext()) { - GlyphObject object = (GlyphObject) i.next(); - - if (!object.hit(a_rect, new AffineTransform())) { - continue; - } // if - - retval = true; - - if (a_isSelectOnlyOne) { - return true; - } // if - } // while i - - return retval; - } - - // -------------------------------------------------------------- - - /** used for cut and paste. - */ - public void addObjectFromClipboard(String a_value) throws CircularIncludeException { - Reader reader = new StringReader(a_value); - Document document = null; - try { - document = UJAXP.getDocument(reader); - } catch (Exception e) { - e.printStackTrace(); - return; - } // try-catch - - Element root = document.getDocumentElement(); - if (!root.getNodeName().equals("clipboard")) { - return; - } // if - - Node child; - for (child = root.getFirstChild(); child != null; - child = child.getNextSibling()) { - if (!(child instanceof Element)) { - continue; - } // if - Element element = (Element) child; - - IGlyphFactory factory = GlyphFactory.getFactory(); - - - if (XModule.isMatch(element)) { - EModuleInvoke module = (EModuleInvoke) factory.createXModule(element); - addModule(module); - continue; - } // if - - if (XContour.isMatch(element)) { - EContour contour = (EContour) factory.createXContour(element); - addContour(contour); - continue; - } // if - - if (XInclude.isMatch(element)) { - EIncludeInvoke include = (EIncludeInvoke) factory.createXInclude(element); - addInclude(include); - continue; - } // if - } // while - } - - // -------------------------------------------------------------- - - private boolean isCircularInclude(String a_href) { - if (getShortFileName().equals(a_href)) { - return true; - } // if - - ModuleManager manager = ModuleManager.getSingletonInstance(); - XInclude [] includes = m_glyph.getBody().getInclude(); - int i; - for (i = 0; i < includes.length; i++) { - XInclude include = includes[i]; - GlyphFile child = manager.getGlyphFile(include.getHref()); - - if (child.isCircularInclude(a_href)) { - return true; - } // if - } // for i - - return false; - } - - // -------------------------------------------------------------- - - public void addInclude(String a_fileName) throws CircularIncludeException { - addInclude(EIncludeInvoke.create(a_fileName)); - } - - public void addInclude(XInclude a_include) throws CircularIncludeException { - if (isCircularInclude(a_include.getHref())) { - throw new CircularIncludeException(); - } // if - - m_actives.unselectAll(); - m_actives.addActive((GlyphObject) a_include); - m_glyph.getBody().addInclude(a_include); - } - - // -------------------------------------------------------------- - - /** - * pasted module from clipboard or ModuleInvokeAction - * @param a_module - */ - public XModule addModule(EModuleInvoke a_module) { - m_actives.unselectAll(); - m_actives.addActive(a_module); - m_glyph.getBody().addModule(a_module); - - return a_module; - } - - // -------------------------------------------------------------- - /** add contour from clipboard or ContourAction * @param a_contour */ public void addContour(EContour a_contour) { - m_actives.unselectAll(); - m_actives.addActive(a_contour); - m_glyph.getBody().addContour(a_contour); + contours.add(a_contour); } // -------------------------------------------------------------- - public void addPoint() { - if (!m_actives.hasActivePoint()) { - return; - } // if - - EContourPoint contourPoint = m_actives.getActivePoint(); - m_actives.unselectAll(); - m_actives.addActive(contourPoint.add()); + public long getUnicode() { + return m_unicode; } - // -------------------------------------------------------------- - - public void addHint(int a_ppem) { - if (!m_actives.hasActivePoint()) - return; - - EContourPoint contourPoint = m_actives.getActivePoint(); - m_actives.unselectAll(); - m_actives.addActive(contourPoint.addHint(a_ppem)); - - if (contourPoint.hasControlPoint1()) { - EContourPoint p = (EContourPoint) contourPoint.getControlPoint1().getContourPoint(); - m_actives.addActive(p.addHint(a_ppem)); - } // if - - if (contourPoint.hasControlPoint2()) { - EContourPoint p = (EContourPoint) contourPoint.getControlPoint2().getContourPoint(); - m_actives.addActive(p.addHint(a_ppem)); - } // if - } - - public void toggleRounded() { - if (!m_actives.hasActivePoint()) - return; - - EContourPoint contourPoint = m_actives.getActivePoint(); - contourPoint.toggleRounded(); - } - - public void convertControlPoint() { - if (!m_actives.hasActiveControlPoint()) { - return; - } // if - - EControlPoint controlPoint = m_actives.getActiveControlPoint(); - controlPoint.convert(); - } - - public void convertContour() { - if (!m_actives.hasActiveContour()) { - return; - } // if - - EContour contour = m_actives.getActiveContour(); - contour.convert(); - } - - // -------------------------------------------------------------- - - public void remove() { - if (!m_actives.hasSelected()) - return; - - int i; - for (i = 0; i < m_actives.size(); i++) { - GlyphObject active = m_actives.get(i); - active.remove(); - } // for i - - m_actives.unselectAll(); - } - - // -------------------------------------------------------------- - - public void toggleOnOff() { - if (!m_actives.hasSelected()) - return; - - int i; - for (i = 0; i < m_actives.size(); i++) { - GlyphObject active = m_actives.get(i); - if (!(active instanceof EContourPoint)) { - continue; - } // if - - EContourPoint point = (EContourPoint) active; - point.toggleOnCurve(); - } // for i - } - - private void loadVar() { - XParamListParam [] params = m_glyph.getHead().getHeadGlobal().getParamListParam(); - int i; - for (i = 0; i < params.length; i++) { - XParamListParam param = params[i]; - addVar(param.getName(), param.getContent()); - } // for i - } - - public String getSelectedNodeName() { - return m_selectedNodeName; - } - - public void addFileVar() { - XParamListParam param = new XParamListParam(); - param.setName("New parameter"); - param.setContent(0.0); - - m_glyph.getHead().getHeadGlobal().addParamListParam(param); - } - - public void removeFileVar(int a_index) { - m_glyph.getHead().getHeadGlobal().removeParamListParam(a_index); - } - - - public void addInvokeArg(int a_type) { - - } - - public void removeInvokeArg(int a_type, int a_index) { - - } - - public String getIncludeName() { - String retval = ""; - - if (!m_actives.hasActiveInclude()) - return retval; - retval = m_actives.getActiveInclude().getHref(); - - return retval; - } - - public void setIncludeName(String a_name) { - if (!m_actives.hasActiveInclude()) - return; - - m_actives.getActiveInclude().setHref(a_name); - } - - public void setGlyphTitle(String a_title) { - m_glyph.getHead().setTitle(a_title); - } - - public String getGlyphTitle() { - String retval = ""; - - retval = m_glyph.getHead().getTitle(); - - if (retval.equals("empty")) { - retval = ""; - } // if - - return retval; - } - - public String getModuleName() { - String retval = ""; - - if (!m_actives.hasActiveModule()) - return retval; - retval = m_actives.getActiveModule().getName(); - - return retval; - } - - public String getUnicode() { - return getUnicodeAsString(); - } - - public String getUnicodeAsString() { - return m_glyph.getHead().getUnicode(); - } - - public long getUnicodeAsLong() { - long retval = -1; - - String s = getUnicodeAsString(); - if (s.equals("")) { - return retval; - } // if - - try { - retval = Long.parseLong(s, 16); - } catch (NumberFormatException e) { - retval = -1; - } // try-catch - - return retval; - } - - protected void setUnicode(String a_unicode) { - m_glyph.getHead().setUnicode(a_unicode); + protected void setUnicode(long a_unicode) { + m_unicode = a_unicode; } public boolean isSimple() { - return (m_glyph.getBody().getInclude().length == 0); + return true; } public boolean isWhiteSpace() { - long unicode = getUnicodeAsLong(); + long unicode = getUnicode(); if (unicode == 0x0020 || unicode == 0x00a0 @@ -871,69 +222,21 @@ public class GlyphFile extends GlyphModule { || unicode == 0xfeff) { return true; - } // if + } return false; } - public String getShortFileName() { - return m_fileName.getName(); - } - public void setLicense(String a_value) { - m_glyph.getHead().setLicense(a_value); + m_license = a_value; } public String getLicense() { - return m_glyph.getHead().getLicense(); - } - - public PointAggregate getPointHost() { - return m_pointHost; - } - - public void buildPointHost() { - m_pointHost = null; - - /*if (!GlyphAction.isPointVisible()) { - return; - } // if*/ - - int i; - for (i = 0; i < m_actives.size(); i++) { - GlyphObject object = (GlyphObject) m_actives.get(i); - PointAggregate host = null; - - if (object instanceof EContourPoint) { - EContourPoint point = (EContourPoint) object; - host = point.getParent(); - - if (host instanceof EContourPoint) { - EContourPoint hostPoint = (EContourPoint) host; - host = hostPoint.getParent(); - } // if - } else if (object instanceof EHint) { - EHint hint = (EHint) object; - host = hint.getPointHost(); - } // if-else - - if (host == null) { - continue; - } // if - - if (m_pointHost == null) { - m_pointHost = host; - } else { - if (m_pointHost != host) { - m_pointHost = null; - return; - } // if - } // if - } // while + return m_license; } public boolean isRequiredGlyph() { - long unicode = getUnicodeAsLong(); + long unicode = getUnicode(); return (unicode == TTUnicodeRange.k_notDef || unicode == TTUnicodeRange.k_null @@ -943,10 +246,10 @@ public class GlyphFile extends GlyphModule { public TTGlyph toSimpleGlyph() { // convert the file into array of contours - XContour [] contours = toContours(); + EContour [] contours = toContours(); if ((contours == null) && (!isRequiredGlyph())) { return null; - } // if + } TTGlyph retval = new TTGlyph(); retval.setSimple(true); @@ -954,50 +257,22 @@ public class GlyphFile extends GlyphModule { if (contours == null) { return retval; - } // if + } ArrayList points = new ArrayList<>(); for (int i = 0; i < contours.length; i++) { - XContour contour = contours[i]; - XContourPoint [] contourPoints = contour.getContourPoint(); - for (int j = 0; j < contourPoints.length; j++) { - points.add((EContourPoint) contourPoints[j]); + EContour contour = contours[i]; + ArrayList contourPoints = contour.getContourPoints(); + for (int j = 0; j < contourPoints.size(); j++) { + points.add((EContourPoint) contourPoints.get(j)); } // for j retval.addEndPoint(points.size() - 1); - } // for i + } for (EContourPoint point: points) { loadContourPoint(retval, point); } // for point - boolean hasGridfit = false; - // I need int i here. - for (int i = 0; i < points.size(); i++) { - EContourPoint point = points.get(i); - - if (!point.isRounded()) { - continue; - } // if - - hasGridfit = true; - loadGridfit(retval, point, i); - } // for i - - if (hasGridfit) { - retval.addInstruction(TTGlyph.IUP1); - retval.addInstruction(TTGlyph.IUP0); - } // if - - // I need int i here. - for (int i = 0; i < points.size(); i++) { - EContourPoint point = points.get(i); - if (point.getHint().length == 0) { - continue; - } // if - - loadHint(retval, point, i); - } // for i - return retval; } @@ -1008,72 +283,9 @@ public class GlyphFile extends GlyphModule { int flag = 0; if (a_point.isOn()) { flag = TTGlyph.k_onCurve; - } // if + } a_glyph.addPoint(p); a_glyph.addFlag(flag); } - - private void loadGridfit(TTGlyph a_glyph, EContourPoint a_point, int a_index) { - if (!a_point.isRounded()) { - return; - } // if - - a_glyph.addInstruction(TTGlyph.PUSHB000); - a_glyph.addInstruction(a_index); - a_glyph.addInstruction(TTGlyph.MDAP1); - } - - - private void loadHint(TTGlyph a_glyph, EContourPoint a_point, int a_index) { - double x = a_point.getX(); - double y = a_point.getY(); - - XHint [] hints = a_point.getHint(); - - for (int i = 0; i < hints.length; i++) { - EHint hint = (EHint) hints[i]; - double xHint = hint.getX(); - double yHint = hint.getY(); - - if (x == xHint && y == yHint) { - continue; - } // if - - double xDelta = xHint - x; - double yDelta = yHint - y; - int instruction = TTGlyph.DELTAP1; - double deltaStep = ((double) Engine.getEm()) / hint.getPpem() / 8; - int xShift = (int) Math.round(xDelta / deltaStep); - int yShift = (int) Math.round(yDelta / deltaStep); - - if (xShift == 0 && yShift == 0) { - continue; - } // if - - a_glyph.addInstruction(TTGlyph.PUSHB000); - a_glyph.addInstruction((int) hint.getPpem()); - a_glyph.addInstruction(TTGlyph.SDB); - - if (xShift != 0) { - a_glyph.addInstruction(TTGlyph.SVTCA1); - a_glyph.addInstruction(TTGlyph.PUSHB010); - a_glyph.addInstruction(TTGlyph.toDeltaArg(0, xShift)); - a_glyph.addInstruction(a_index); - a_glyph.addInstruction(1); - a_glyph.addInstruction(TTGlyph.DELTAP1); - } // if - - if (yShift != 0) { - a_glyph.addInstruction(TTGlyph.SVTCA0); - a_glyph.addInstruction(TTGlyph.PUSHB010); - a_glyph.addInstruction(TTGlyph.toDeltaArg(0, yShift)); - a_glyph.addInstruction(a_index); - a_glyph.addInstruction(1); - a_glyph.addInstruction(TTGlyph.DELTAP1); - } // if - } // for i - } - - public class CircularIncludeException extends Exception {} } \ No newline at end of file diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/GlyphIterator.java b/libsrc/ttf/src/org/doubletype/ossa/module/GlyphIterator.java deleted file mode 100644 index 0c2f1816a..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/module/GlyphIterator.java +++ /dev/null @@ -1,237 +0,0 @@ - /* - * $Id: GlyphIterator.java,v 1.11 2004/12/27 04:56:03 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.module; - -import java.util.*; - -import org.doubletype.ossa.xml.*; -import org.doubletype.ossa.adapter.*; - -/** Iterates through contours, module invokes, then include invokes. - * Used in GlyphFile display - * @author e.e - */ -public class GlyphIterator implements Iterator { - protected GlyphFile m_file; - private int m_index = 0; - protected List m_list = new ArrayList<>(); - - public GlyphIterator(GlyphFile a_file) { - m_file = a_file; - buildList(); - } - - protected void buildList() { - addIncludes(); - addContours(); - addModules(); - - } - - protected void addContours() { - XContour [] contours = m_file.getGlyph().getBody().getContour(); - for (int i = 0; i < contours.length; i++) { - m_list.add(contours[i]); - } // for i - } - - protected void addControlPoints() { - XContour [] contours = m_file.getGlyph().getBody().getContour(); - for (int i = 0; i < contours.length; i++) { - EContour contour = (EContour) contours[i]; - if (!contour.isCubic()) { - continue; - } // if - - addControlPoints(contour, 0, 0); - } // for i - } - - private void addControlPoints(PointAggregate a_object, double a_x, double a_y) { - XContourPoint [] points = a_object.getContourPoint(); - - for (int i = 0; i < points.length; i++) { - EContourPoint point = (EContourPoint) points[i]; - - if (!isPointVisible(point)) { - continue; - } // if - - if (point.hasControlPoint1()) { - EControlPoint controlPoint = (EControlPoint) point.getControlPoint1(); - controlPoint.setOffset(a_x, a_y); - m_list.add(controlPoint); - } // if - - if (point.hasControlPoint2()) { - EControlPoint controlPoint = (EControlPoint) point.getControlPoint2(); - controlPoint.setOffset(a_x, a_y); - m_list.add(controlPoint); - } // if - } // for j - } - - protected void addHints() { - XContour [] contours = m_file.getGlyph().getBody().getContour(); - for (int i = 0; i < contours.length; i++) { - addHints((EContour) contours[i], 0, 0); - } // for i - - XModule [] modules = m_file.getGlyph().getBody().getModule(); - for (int i = 0; i < modules.length; i++) { - EModuleInvoke module = (EModuleInvoke) modules[i]; - double x = module.getInvoke().getInvokePos().getPoint2d().getX(); - double y = module.getInvoke().getInvokePos().getPoint2d().getY(); - - addHints(module, x, y); - } // for i - } - - private void addHints(PointAggregate a_object, double a_x, double a_y) { - XContourPoint [] points = a_object.getContourPoint(); - - for (int i = 0; i < points.length; i++) { - EContourPoint point = (EContourPoint) points[i]; - - if (!isPointVisible(point)) { - continue; - } // if - - if (point.hasHintForCurrentPpem()) { - EHint hint = point.getCurrentHint(); - hint.setOffset(a_x, a_y); - m_list.add(hint); - } // if - - if (point.hasControlPoint1()) { - EContourPoint p = (EContourPoint) point.getControlPoint1().getContourPoint(); - if (p.hasHintForCurrentPpem()) { - EHint hint = p.getCurrentHint(); - hint.setOffset(a_x, a_y); - m_list.add(hint); - } // if - } - - if (point.hasControlPoint2()) { - EContourPoint p = (EContourPoint) point.getControlPoint2().getContourPoint(); - if (p.hasHintForCurrentPpem()) { - EHint hint = p.getCurrentHint(); - hint.setOffset(a_x, a_y); - m_list.add(hint); - } // if - } // if - } // for j - } - - private boolean isPointVisible(EContourPoint a_point) { - if (m_file.getPointHost() == null) { - return true; - } // if - - if (m_file.getPointHost() == a_point.getParent()) { - return true; - } // if - - return false; - } - - protected void addPoints() { - XContour [] contours = m_file.getGlyph().getBody().getContour(); - for (int i = 0; i < contours.length; i++) { - addPoints((EContour) contours[i], 0, 0); - } // for i - - XModule [] modules = m_file.getGlyph().getBody().getModule(); - for (int i = 0; i < modules.length; i++) { - EModuleInvoke module = (EModuleInvoke) modules[i]; - double x = module.getInvoke().getInvokePos().getPoint2d().getX(); - double y = module.getInvoke().getInvokePos().getPoint2d().getY(); - - addPoints(module, x, y); - } // for i - } - - private void addPoints(PointAggregate a_object, double a_x, double a_y) { - XContourPoint [] points = a_object.getContourPoint(); - - for (int i = 0; i < points.length; i++) { - EContourPoint point = (EContourPoint) points[i]; - - if (!isPointVisible(point)) { - continue; - } // if - - point.setNumber(i); - point.setOffset(a_x, a_y); - m_list.add(point); - } // for j - } - - protected void addModules() { - XModule [] modules = m_file.getGlyph().getBody().getModule(); - for (int i = 0; i < modules.length; i++) { - m_list.add(modules[i]); - } // for i - } - - protected void addIncludes() { - XInclude [] includes = m_file.getGlyph().getBody().getInclude(); - for (int i = 0; i < includes.length; i++) { - m_list.add(includes[i]); - } // for i; - } - - /* (non-Javadoc) - * @see java.util.Iterator#remove() - */ - public void remove() { - - } - - /* (non-Javadoc) - * @see java.util.Iterator#hasNext() - */ - public boolean hasNext() { - return m_index < m_list.size(); - } - - /* (non-Javadoc) - * @see java.util.Iterator#next() - */ - public Object next() { - return m_list.get(m_index++); - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/GlyphModule.java b/libsrc/ttf/src/org/doubletype/ossa/module/GlyphModule.java deleted file mode 100644 index 0027252aa..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/module/GlyphModule.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * $Id: GlyphModule.java,v 1.12 2004/09/04 21:54:19 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.module; - -import org.doubletype.ossa.adapter.*; -import org.doubletype.ossa.*; -import java.util.*; - -/** - * @author e.e - */ -public class GlyphModule implements VarStackFrame { - protected VarStack m_stack = VarStack.getSingletonInstance(); - private Hashtable m_vars = new Hashtable<>(); - protected ActiveList m_actives = ActiveList.getSingletonInstance(); - - // -------------------------------------------------------------- - - public GlyphModule() { - } - - public Hashtable getVars() { - return m_vars; - } - - // for var stack frame - public boolean hasVariable(String a_name) { - return m_vars.containsKey(a_name); - } - - // for var stack frame. - public double getValue(String a_name) { - Double d = (Double) m_vars.get(a_name); - return d.doubleValue(); - } - - // for var stack frame. - public void beforePush() { - } - - /** - * Base for generating contours from modules. - * @param a_moduleInvoke - * @return XContour object which represents the module. - */ - public EContour toContour(EModuleInvoke a_moduleInvoke) { - throw new RuntimeException("Unimplemented contour creation."); - } - - public void addVar(String a_name, double a_value) { - m_vars.put(a_name, new Double(a_value)); - } - - public int getMinimumPointCount() { - return 2; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/Rectangle.java b/libsrc/ttf/src/org/doubletype/ossa/module/Rectangle.java deleted file mode 100644 index 813dfcbb8..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/module/Rectangle.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * $Id: Rectangle.java,v 1.16 2004/09/04 21:54:19 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.module; - -import org.doubletype.ossa.xml.*; -import org.doubletype.ossa.adapter.*; - -import java.awt.geom.*; - -/** - * @author e.e - * - */ -public class Rectangle extends GlyphModule { - public static final double k_defaultPen = 68.0; - public static final double k_defaultWeight = 1.0; - public static final String k_weight = "weight"; - - public Rectangle() { - super(); - - addVar(k_weight, k_defaultWeight); - } - - public EContour toContour(EModuleInvoke a_moduleInvoke) { - int i; - EContour retval = new EContour(); - XContourPoint[] points = a_moduleInvoke.getContourPoint(); - - // can't make rectangle with one or zero point - if (points.length < 2) { - retval.addContourPoint(new EContourPoint(0, 0, true)); - return retval; - } // if - - double pen = m_stack.get(k_weight) * k_defaultPen; - boolean steeps[] = new boolean[points.length - 1]; - double thetas[] = new double[points.length - 1]; - Point2D outStartPoints[] = new Point2D[points.length - 1]; - Point2D inStartPoints[] = new Point2D[points.length - 1]; - Point2D outPoints [] = new Point2D[points.length]; - Point2D inPoints[] = new Point2D[points.length]; - - // treat each segment as a vector (start point and theta) - for (i = 0; i < points.length - 1; i++) { - EContourPoint start = (EContourPoint) points[i]; - EContourPoint end = (EContourPoint) points[i + 1]; - - // calculate theta of the vector - double theta; - if (start.toPoint2D().distance(end.toPoint2D()) > 0) { - theta = Math.atan2(end.getY() - start.getY(), - end.getX() - start.getX()); - } else { - theta = 0.0; - } // if - - thetas[i] = theta; - outStartPoints[i] = start.toPoint2D(); - - // turn the vector 90 degrees clockwise to create the - // starting point of the parallel vector (in-vector) - inStartPoints[i] = new Point2D.Double(start.getX() + (pen * Math.cos(theta - Math.PI / 2)), - start.getY() + (pen * Math.sin(theta - Math.PI / 2)) ); - } // for i - - for (i = 0; i < points.length; i++) { - EContourPoint point = (EContourPoint) points[i]; - - if (i == 0) { - // dynamically generate the point using vertical line thru p0 and the ideal line. - double cuttingTheta; - if (isSteep(thetas[i])) { - cuttingTheta = 0.0; - } else { - cuttingTheta = Math.PI / 2; - } // if-else - - outPoints[i] = getIntersection(point.toPoint2D(), cuttingTheta, - outStartPoints[i], thetas[i]); - inPoints[i] = getIntersection(point.toPoint2D(), cuttingTheta, - inStartPoints[i], thetas[i]); - continue; - } else if (i == points.length - 1) { - // vertial and ideal. - double cuttingTheta; - if (isSteep(thetas[i - 1])) { - cuttingTheta = 0.0; - } else { - cuttingTheta = Math.PI / 2; - } // if - - outPoints[i] = getIntersection(point.toPoint2D(), cuttingTheta, - outStartPoints[i - 1], thetas[i - 1]); - inPoints[i] = getIntersection(point.toPoint2D(), cuttingTheta, - inStartPoints[i - 1], thetas[i - 1]); - - continue; - } // if - - if (thetas[i - 1] != thetas[i]) { - outPoints[i] = getIntersection(outStartPoints[i - 1], thetas[i - 1], - outStartPoints[i], thetas[i]); - inPoints[i] = getIntersection(inStartPoints[i - 1], thetas[i - 1], - inStartPoints[i], thetas[i]); - } else { - outPoints[i] = outStartPoints[i]; - inPoints[i] = inStartPoints[i]; - } // if - } // for i - - for (i = 0; i < points.length; i++) { - EContourPoint point = (EContourPoint) points[i]; - - retval.addContourPoint(i, point.cloneAt(outPoints[i])); - retval.addContourPoint(i + 1, point.cloneAt(inPoints[i])); - } // if - - return retval; - } - - private boolean isSteep(double a_theta) { - return (a_theta > (Math.PI / 4) && a_theta < (3 * Math.PI / 4)) - || (a_theta < (-Math.PI / 4) && a_theta > (-3 * Math.PI / 4)); - } - - /** - * Intersection of two lines line0 and line1, defined by a point and slope. - * @param a_p0 a point line0 goes thru. - * @param a_theta0 the slope of line0, given in radian. - * @param a_p1 a point line1 goes thru. - * @param a_theta1 the slope of line1, given in radian. - * @return the intersection of line0 and line1, if any; a_p1, otherwise. - */ - private Point2D getIntersection(Point2D a_p0, double a_theta0, - Point2D a_p1, double a_theta1) { - Point2D retval = new Point2D.Double(); - retval.setLocation(a_p1); - - if (a_theta0 == a_theta1) - return retval; - - double cos0 = Math.cos(a_theta0); - double sin0 = Math.sin(a_theta0); - double cos1 = Math.cos(a_theta1); - double sin1 = Math.sin(a_theta1); - double deltaX = a_p1.getX() - a_p0.getX(); - double deltaY = a_p1.getY() - a_p0.getY(); - - double r1 = (cos0 * deltaY - sin0 * deltaX) - / (sin0 * cos1 - cos0 * sin1); - double x = a_p1.getX() + cos1 * r1; - double y = a_p1.getY() + sin1 * r1; - - retval.setLocation(x, y); - - return retval; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/SelectionIterator.java b/libsrc/ttf/src/org/doubletype/ossa/module/SelectionIterator.java deleted file mode 100644 index 14bb377b4..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/module/SelectionIterator.java +++ /dev/null @@ -1,69 +0,0 @@ - /* - * $Id: SelectionIterator.java,v 1.2 2004/11/08 06:29:52 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.module; - -import java.util.*; - -import org.doubletype.ossa.adapter.*; -import org.doubletype.ossa.xml.IRNode; - - -/** - * @author e.e - */ -public class SelectionIterator extends GlyphIterator implements Iterator { - - /** - * @param a_file - */ - public SelectionIterator(GlyphFile a_file) { - super(a_file); - } - - protected void buildList() { - super.buildList(); - - List reverseList = new ArrayList<>(); - for (int i = m_list.size() - 1; i >= 0; i--) { - IRNode object = m_list.get(i); - - - reverseList.add(object); - } // for i - - m_list = reverseList; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/TypefaceFile.java b/libsrc/ttf/src/org/doubletype/ossa/module/TypefaceFile.java index b08e580e3..fe5e3824a 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/module/TypefaceFile.java +++ b/libsrc/ttf/src/org/doubletype/ossa/module/TypefaceFile.java @@ -37,8 +37,6 @@ import java.io.*; import java.util.*; import org.doubletype.ossa.*; -import org.doubletype.ossa.xml.*; -import org.doubletype.ossa.adapter.*; import org.doubletype.ossa.truetype.*; import java.awt.*; import java.util.List; @@ -54,23 +52,29 @@ public class TypefaceFile extends GlyphFile { private final double k_defaultBottomSideBearing = 0; // 0 px private final double k_em = 1024; private final int k_defaultAdvanceWidth = 512; - private final String k_dotDtyp = ".dtyp"; private final String k_dotTtf = ".ttf"; private File m_dir; - private Hashtable m_nameToIndeces = new Hashtable<>(); private File m_ttfFile; private Font m_font = null; - private File m_binFolder; - private Map m_glyphFiles = new HashMap<>(); - + private List m_glyphFiles = new ArrayList<>(); + private List m_unicodeRanges = new ArrayList<>(); + private List m_codePages = new ArrayList<>(); + private String m_fontFamilyName; + private String m_subFamily; + private String m_version; + private Double m_topSideBearing = null; + private Double m_ascender = null; + private Double m_xHeight = null; + private Double m_descender = null; + private Double m_bottomSideBearing = null; + private String m_name; + public TypefaceFile(String a_name, File a_dir) throws FileNotFoundException { - super(TypefaceFile.class.getResource(s_emptyFileName)); + super(a_dir); m_dir = a_dir; - setGlyphTitle(a_name); - - m_fileName = new File(m_dir, a_name + k_dotDtyp); + m_name = a_name; initFileName(); } @@ -78,62 +82,61 @@ public class TypefaceFile extends GlyphFile { super(a_file); m_dir = a_file.getParentFile(); - m_fileName = a_file; + m_name = a_file.getName(); initFileName(); } private void initFileName() { - m_binFolder = new File(m_dir, "bin"); - if (!m_binFolder.exists()) { - m_binFolder.mkdir(); - } // if - String fileName = getGlyphTitle() + k_dotTtf; - m_ttfFile = new File(m_binFolder, fileName); + String fileName = m_name + k_dotTtf; + m_ttfFile = new File(m_dir, fileName); } public GlyphFile createGlyph(long a_unicode) { - String name = Character.getName((int) a_unicode); - if (name == null) { - name = "NAC_" + Long.toHexString(a_unicode); - } // if - - name = name.replace(' ', '_'); - return new GlyphFile( - getGlyphPath(), name, a_unicode); + return new GlyphFile(getGlyphPath(), a_unicode); } + private GlyphFile getGlyphFileByUnicode(long code) { + for (GlyphFile glyphFile : m_glyphFiles) { + if (glyphFile.getUnicode() == code) { + return glyphFile; + } + } + + return null; + } + public boolean addRequiredGlyphs() { boolean retval = false; - if (unicodeToFileName(TTUnicodeRange.k_notDef) == null) { - GlyphFile glyph = new GlyphFile(getGlyphPath(), "NOTDEF", TTUnicodeRange.k_notDef); + if (getGlyphFileByUnicode(TTUnicodeRange.k_notDef) == null) { + GlyphFile glyph = new GlyphFile(getGlyphPath(), TTUnicodeRange.k_notDef); glyph.initNotDef(k_defaultAdvanceWidth); addGlyph(0, glyph); retval = true; - } // if + } - if (unicodeToFileName(TTUnicodeRange.k_null) == null) { - GlyphFile glyph = new GlyphFile(getGlyphPath(), "NULL", TTUnicodeRange.k_null); + if (getGlyphFileByUnicode(TTUnicodeRange.k_null) == null) { + GlyphFile glyph = new GlyphFile(getGlyphPath(), TTUnicodeRange.k_null); glyph.initNullGlyph(); addGlyph(1, glyph); retval = true; - } // if + } - if (unicodeToFileName(TTUnicodeRange.k_cr) == null) { - GlyphFile glyph = new GlyphFile(getGlyphPath(), "CR", TTUnicodeRange.k_cr); + if (getGlyphFileByUnicode(TTUnicodeRange.k_cr) == null) { + GlyphFile glyph = new GlyphFile(getGlyphPath(), TTUnicodeRange.k_cr); glyph.initSpace(k_defaultAdvanceWidth); addGlyph(2, glyph); retval = true; - } // if + } - if (unicodeToFileName(TTUnicodeRange.k_space) == null) { - GlyphFile glyph = new GlyphFile(getGlyphPath(), "SPACE", TTUnicodeRange.k_space); + if (getGlyphFileByUnicode(TTUnicodeRange.k_space) == null) { + GlyphFile glyph = new GlyphFile(getGlyphPath(), TTUnicodeRange.k_space); glyph.initSpace(k_defaultAdvanceWidth); addGlyph(3, glyph); retval = true; - } // if + } return retval; } @@ -146,175 +149,97 @@ public class TypefaceFile extends GlyphFile { for (long i = range.getStartCode(); i <= range.getEndCode(); i++) { if (i != 0x0020) { addGlyph(createGlyph(i)); - } // if - } // for i + } + } } public File getGlyphPath() { return m_dir; } - public String unicodeToFileName(long a_unicode) { - for (XGlyphFile glyphFile: m_glyph.getBody().getGlyphFile()) { - if (glyphFile.getUnicode() == a_unicode) { - return glyphFile.getHref(); - } // if - } // for i - - return null; - } - /** * change glyph's unicode mapping. * @param a_glyphFile * @param a_unicode */ public void setGlyphUnicode(GlyphFile a_glyphFile, long a_unicode) { - int i; - XGlyphFile [] glyphFiles = m_glyph.getBody().getGlyphFile(); - for (i = 0; i < glyphFiles.length; i++) { - XGlyphFile glyphFile = glyphFiles[i]; - - if (glyphFile.getHref().equals( - a_glyphFile.getShortFileName())) { - continue; - } // if - - glyphFile.setUnicode(a_unicode); - a_glyphFile.setUnicode(Long.toHexString(a_unicode)); - - return; - } // for i + a_glyphFile.setUnicode(a_unicode); } public void addGlyph(GlyphFile a_file) { - String shortFileName = a_file.getShortFileName(); - m_glyphFiles.put(shortFileName, a_file); - XGlyphFile xglyphFile = new XGlyphFile(); - xglyphFile.setHref(shortFileName); - xglyphFile.setUnicode(a_file.getUnicodeAsLong()); - m_glyph.getBody().addGlyphFile(xglyphFile); + m_glyphFiles.add(a_file); } public void addGlyph(int a_index, GlyphFile a_file) { - String shortFileName = a_file.getShortFileName(); - m_glyphFiles.put(shortFileName, a_file); - XGlyphFile xglyphFile = new XGlyphFile(); - xglyphFile.setHref(shortFileName); - xglyphFile.setUnicode(a_file.getUnicodeAsLong()); - m_glyph.getBody().addGlyphFile(a_index, xglyphFile); - } - - public void removeGlyph(String a_fileName) { - for (XGlyphFile file: m_glyph.getBody().getGlyphFile()) { - if (file.getHref().equals(a_fileName)) { - m_glyph.getBody().removeGlyphFile(file); - return; - } // if - } - } - - public ArrayList getChildFileNames() { - ArrayList retval = new ArrayList<>(); - XGlyphFile [] files = m_glyph.getBody().getGlyphFile(); - - for (int i = 0; i < files.length; i++) { - XGlyphFile file = files[i]; - retval.add(file.getHref()); - } // for i - - return retval; + m_glyphFiles.add(a_index, a_file); } public Object [] getCodePages() { int i; Object [] retval; - String [] codePages = m_glyph.getHead().getCodePage(); - retval = new Object[codePages.length]; - for (i = 0; i < codePages.length; i++) { - retval[i] = codePages[i]; - } // for i + retval = new Object[0]; return retval; } public boolean containsUnicodeRange(String a_unicodeRange) { - int i; - String [] unicodeRanges = m_glyph.getHead().getUnicodeRange(); - - for (i = 0; i < unicodeRanges.length; i++) { - if (unicodeRanges[i].equals(a_unicodeRange)) { - return true; - } // if - } // for i - - return false; + return m_unicodeRanges.contains(a_unicodeRange); } public void addUnicodeRange(String a_unicodeRange) { if (containsUnicodeRange(a_unicodeRange)) { return; - } // if + } - m_glyph.getHead().addUnicodeRange(a_unicodeRange); + m_unicodeRanges.add(a_unicodeRange); } public boolean containsCodePage(String a_codePage) { - int i; - String [] codePages = m_glyph.getHead().getCodePage(); - - for (i = 0; i < codePages.length; i++) { - if (codePages[i].equals(a_codePage)) { - return true; - } // if - } // for i - - return false; + return m_codePages.contains(a_codePage); } public void addCodePage(String a_codePage) { if (containsCodePage(a_codePage)) { return; - } // if + } - m_glyph.getHead().addCodePage(a_codePage); + m_codePages.add(a_codePage); } public void removeCodePage(String a_codePage) { if (!containsCodePage(a_codePage)) { return; - } // if + } - m_glyph.getHead().removeCodePage(a_codePage); + m_codePages.remove(a_codePage); } public void setFontFamilyName(String a_value) { - m_glyph.getHead().setFontFamily(a_value); + m_fontFamilyName = a_value; } public String getFontFamilyName() { - return m_glyph.getHead().getFontFamily(); + return m_fontFamilyName; } public String getVersion() { - if (m_glyph.getHead().getVersion() == null) { - m_glyph.getHead().setVersion("0.1"); - } // if - - return m_glyph.getHead().getVersion(); + return m_version == null ? "0.1" : m_version; + } + + public void setVersion(String a_value) { + m_version = a_value; } public void setSubFamily(String a_value) { - m_glyph.getHead().setFontSubFamily(a_value); + m_subFamily = a_value; } public void setDefaultMetrics() { - XHead head = m_glyph.getHead(); - head.setTopSideBearing(k_defaultTopSideBearing); - head.setAscender(k_defaultAscender); - head.setXHeight(k_defaultXHeight); - head.setDescender(k_defaultDescender); - head.setBottomSideBearing(k_defaultBottomSideBearing); + m_topSideBearing = k_defaultTopSideBearing; + m_ascender = k_defaultAscender; + m_xHeight = k_defaultXHeight; + m_descender = k_defaultDescender; + m_bottomSideBearing = k_defaultBottomSideBearing; } public double getEm() { @@ -339,78 +264,78 @@ public class TypefaceFile extends GlyphFile { } public double getTopSideBearing() { - if (!m_glyph.getHead().checkTopSideBearing()) { + if (m_topSideBearing == null) { setDefaultMetrics(); - } // if + } - return m_glyph.getHead().getTopSideBearing(); + return m_topSideBearing; } public double getAscender() { - if (!m_glyph.getHead().checkAscender()) { + if (m_ascender == null) { setDefaultMetrics(); - } // if + } - return m_glyph.getHead().getAscender(); + return m_ascender; } public double getXHeight() { - if (!m_glyph.getHead().checkXHeight()) { + if (m_xHeight == null) { setDefaultMetrics(); - } // if + } - return m_glyph.getHead().getXHeight(); + return m_xHeight; } public double getDescender() { - if (!m_glyph.getHead().checkDescender()) { + if (m_descender == null) { setDefaultMetrics(); - } // if + } - return m_glyph.getHead().getDescender(); + return m_descender; } public double getBottomSideBearing() { - if (!m_glyph.getHead().checkBottomSideBearing()) { + if (m_bottomSideBearing == null) { setDefaultMetrics(); - } // if + } - return m_glyph.getHead().getBottomSideBearing(); + return m_bottomSideBearing; } public void setTopSideBearing(double a_value) throws OutOfRangeException { checkBoundary(a_value); - m_glyph.getHead().setTopSideBearing(a_value); + m_topSideBearing = a_value; } private void checkBoundary(double a_value) throws OutOfRangeException { if (a_value > k_em || a_value < 0) { throw new OutOfRangeException(a_value); - } // if + } } public void setAscender(double a_value) throws OutOfRangeException { checkBoundary(a_value); - m_glyph.getHead().setAscender(a_value); + m_ascender = a_value; } public void setXHeight(double a_value) throws OutOfRangeException { checkBoundary(a_value); if (a_value > getAscender()) { throw new OutOfRangeException(a_value); - } // if + } - m_glyph.getHead().setXHeight(a_value); + m_xHeight = a_value; } public void setDescender(double a_value) throws OutOfRangeException { checkBoundary(a_value); - m_glyph.getHead().setDescender(a_value); + m_descender = a_value; } public void setBottomSideBearing(double a_value) throws OutOfRangeException { checkBoundary(a_value); - m_glyph.getHead().setBottomSideBearing(a_value); + m_bottomSideBearing = a_value; } public double getBodyHeight() { @@ -422,27 +347,19 @@ public class TypefaceFile extends GlyphFile { /** * Calls FontFileWriter to produce TrueType font file. */ - public void buildTTF(boolean a_isDebug) throws Exception { + public void buildTTF() throws Exception { String randomString = UUID.randomUUID().toString().substring(0, 4); - File tempFile = new File(m_binFolder, - getGlyphTitle() + "_" + randomString + k_dotTtf); + File tempFile = new File(m_dir, + m_name + "_" + randomString + k_dotTtf); File target; String fontFamilyName; - if (a_isDebug) { - target = tempFile; - fontFamilyName = getGlyphTitle() + " " + randomString; - } else { - target = m_ttfFile; - fontFamilyName = getFontFamilyName(); - } // if-else + target = m_ttfFile; + fontFamilyName = getFontFamilyName(); target.delete(); FontFileWriter writer; - ModuleManager.getSingletonInstance().clear(); - m_stack.clear(); - m_stack.push(this); try (RandomAccessFile randomAccessFile = new RandomAccessFile(target, "rw")) { writer = new FontFileWriter(randomAccessFile); @@ -460,17 +377,14 @@ public class TypefaceFile extends GlyphFile { loadGlyphs(writer); writer.write(); } - if (!a_isDebug && target.exists()) { + if (target.exists()) { copyFile(target, tempFile); - } // if + } FileInputStream in = new FileInputStream(tempFile); m_font = Font.createFont(Font.TRUETYPE_FONT, (InputStream) in); in.close(); - - ModuleManager.getSingletonInstance().clear(); - m_stack.pop(); // pop this } private void copyFile(File a_in, File a_out) throws Exception { @@ -491,45 +405,30 @@ public class TypefaceFile extends GlyphFile { } private void loadCodePages(FontFileWriter a_writer) { - for (String codePageName: m_glyph.getHead().getCodePage()) { + for (String codePageName: m_codePages) { TTCodePage codePage = TTCodePage.forName(codePageName); if (codePage == null) { continue; - } // if + } a_writer.setCodeRangeFlag(codePage.getOsTwoFlag()); } // for codePageName } private void loadUnicodeRanges(FontFileWriter a_writer) { - String [] unicodeRanges = m_glyph.getHead().getUnicodeRange(); - int i; - for (i = 0; i < unicodeRanges.length; i++) { - if (!TTUnicodeRange.find(unicodeRanges[i])) { + for (String unicodeRange : m_unicodeRanges) { + if (!TTUnicodeRange.find(unicodeRange)) { continue; - } // if + } a_writer.addUnicodeRange(TTUnicodeRange.getLastFound()); - } // for i + } } private void loadGlyphs(FontFileWriter a_writer) throws Exception { - m_nameToIndeces.clear(); - - for (String fileName: getChildFileNames()) { - GlyphFile glyphFile = nameToGlyphFile(fileName); - loadGlyph(glyphFile, glyphFile, a_writer); - } // for - } - - private GlyphFile nameToGlyphFile(String a_fileName) throws FileNotFoundException { - if (!m_glyphFiles.containsKey(a_fileName)) { - throw new FileNotFoundException(a_fileName); - } // if - - GlyphFile retval = m_glyphFiles.get(a_fileName); - - return retval; + for (GlyphFile glyphFile : m_glyphFiles) { + loadGlyph(glyphFile, a_writer); + } } /** @@ -538,49 +437,35 @@ public class TypefaceFile extends GlyphFile { * @param a_writer * @throws Exception */ - private void loadGlyph(GlyphFile a_glyphFile, VarStackFrame a_frame, FontFileWriter a_writer) throws Exception { - if (m_nameToIndeces.containsKey(a_glyphFile.getShortFileName())) { - return; - } // if - - /* - if (a_glyphFile.getUnicodeAsLong() == TTUnicodeRange.k_null) { - return; - } // if - */ - + private void loadGlyph(GlyphFile a_glyphFile, FontFileWriter a_writer) throws Exception { TTGlyph glyph = null; - m_stack.push(a_frame); if (a_glyphFile.isSimple()) { // glyph will be null if it is empty glyph = a_glyphFile.toSimpleGlyph(); } else { glyph = createCompoundGlyph(a_glyphFile, a_writer); - } // if - - m_stack.pop(); + } if (glyph == null && a_glyphFile.isWhiteSpace()) { glyph = new TTGlyph(); - } // if + } if (glyph == null) { return; - } // if + } int glyphIndex = a_writer.addGlyph(glyph); - m_nameToIndeces.put(a_glyphFile.getShortFileName(), glyphIndex); - long unicode = a_glyphFile.getUnicodeAsLong(); + long unicode = a_glyphFile.getUnicode(); - if (unicode != -1 && glyph != null) { + if (unicode != -1) { long existingIndex = a_writer.getCharacterMapping(unicode); if (existingIndex != 0) { throw new Exception(Long.toHexString(unicode) + " is mapped already."); - } // if + } a_writer.addCharacterMapping(unicode, glyphIndex); - } // if + } } private TTGlyph createCompoundGlyph(GlyphFile a_glyphFile, @@ -599,25 +484,9 @@ public class TypefaceFile extends GlyphFile { locs.add(new Point(0, 0)); indeces.add(glyphIndex); - } // if + } - XInclude [] includes = a_glyphFile.m_glyph.getBody().getInclude(); - int i; - for (i = 0; i < includes.length; i++) { - EIncludeInvoke include = (EIncludeInvoke) includes[i]; - GlyphFile glyphFile = nameToGlyphFile(include.getHref()); - - // load the glyph included in this one - loadGlyph(glyphFile, include, a_writer); - Integer n = m_nameToIndeces.get(glyphFile.getShortFileName()); - if (n == null) { - continue; - } // if - - indeces.add(n); - XPoint2d pos = include.getInvoke().getInvokePos().getPoint2d(); - locs.add(new Point((int) pos.getX(), (int) pos.getY())); - } // for i + int i = 0; int flag = TTGlyph.ARG_1_AND_2_ARE_WORDS | TTGlyph.ARGS_ARE_XY_VALUES @@ -632,14 +501,14 @@ public class TypefaceFile extends GlyphFile { numOfCompositeContours += glyph.getNumOfCompositeContours(); if (glyph.getComponentDepth() > componentDepth) { componentDepth = glyph.getComponentDepth(); - } // if + } retval.addGlyfIndex(glyfIndex); if (i < indeces.size() - 1) { retval.addFlag(flag | TTGlyph.MORE_COMPONENTS); } else { retval.addFlag(flag); - } // if-else + } Point loc = locs.get(i); retval.addArg1(loc.x); diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/VarStack.java b/libsrc/ttf/src/org/doubletype/ossa/module/VarStack.java deleted file mode 100644 index 2f8526487..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/module/VarStack.java +++ /dev/null @@ -1,112 +0,0 @@ - /* - * $Id: VarStack.java,v 1.1 2004/04/21 10:54:41 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.module; - -import java.util.*; - -/** - * @author e.e - */ -public class VarStack { - private static VarStack s_varstack = null; - - public static VarStack getSingletonInstance() { - if (s_varstack == null) - s_varstack = new VarStack(); - - return s_varstack; - } - - // -------------------------------------------------------------- - - private ArrayList m_stack = new ArrayList<>(); - - // -------------------------------------------------------------- - - public void push(VarStackFrame a_frame) { - a_frame.beforePush(); - m_stack.add(a_frame); - } - - public VarStackFrame pop() { - VarStackFrame retval = peek(); - if (retval == null) { - return retval; - } // if - - m_stack.remove(retval); - - return retval; - } - - public VarStackFrame peek() { - if (m_stack.size() <= 0) { - return null; - } // if - - return (VarStackFrame) m_stack.get(m_stack.size() - 1); - } - - public void clear() { - m_stack.clear(); - } - - public int size() { - return m_stack.size(); - } - - /** - * goes through the var stack and returns the variable value - * @param a_name name of the variable - * @return the value of the variable - */ - public double get(String a_name) { - int i; - double retval = 0.0; - - for (i = 0; i < m_stack.size(); i++) { - VarStackFrame frame - = (VarStackFrame) m_stack.get(m_stack.size() - i - 1); - if (!frame.hasVariable(a_name)) { - continue; - } // if - - return frame.getValue(a_name); - } // for i - - return retval; - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/VarStackFrame.java b/libsrc/ttf/src/org/doubletype/ossa/module/VarStackFrame.java deleted file mode 100644 index aa27f9709..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/module/VarStackFrame.java +++ /dev/null @@ -1,53 +0,0 @@ - /* - * $Id: VarStackFrame.java,v 1.1 2004/04/21 10:55:02 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.module; - -/** - * @author e.e - */ -public interface VarStackFrame { - /** - * tests if the variable is declared in this module. - * @param a_name name of the variable - * @return true, if declared; false, otherwise. - */ - boolean hasVariable(String a_name); - double getValue(String a_name); - - /** fired before push by the var stack. - */ - void beforePush(); -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/empty.glyph b/libsrc/ttf/src/org/doubletype/ossa/module/empty.glyph deleted file mode 100644 index 6fdefeb4d..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/module/empty.glyph +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - Nobody - 2004 - temp - Regular - All rights reserved. - - - - - - - - - - diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/CmapWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/CmapWriter.java index c752b193c..b76c0721e 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/CmapWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/CmapWriter.java @@ -93,7 +93,7 @@ public class CmapWriter extends FontFormatWriter { { m_unicodes.add(unicode); } // for unicode - } // for i + } m_startCodes.add(k_tableEnd); m_endCodes.add(k_tableEnd); @@ -106,7 +106,7 @@ public class CmapWriter extends FontFormatWriter { if (m_isIncludeVersion0) { storeVersion0(); - } // if + } storeVersion4(); reset(); @@ -118,19 +118,19 @@ public class CmapWriter extends FontFormatWriter { writeUInt16(TTName.k_macintosh); writeUInt16(TTName.k_macRomanEncode); writeUInt32(size() + 4 + 8); - } // if + } writeUInt16(TTName.k_microsoft); writeUInt16(TTName.k_winUnicodeEncode); int version4Offset = size() + 4; if (m_isIncludeVersion0) { version4Offset += m_version0.length; - } // if + } writeUInt32(version4Offset); if (m_isIncludeVersion0) { m_buffer.write(m_version0); - } // if + } m_buffer.write(m_version4); pad(); @@ -139,7 +139,7 @@ public class CmapWriter extends FontFormatWriter { private int getNumOfEncoding() { if (m_isIncludeVersion0) { return 2; - } // if + } return 1; } @@ -164,7 +164,7 @@ public class CmapWriter extends FontFormatWriter { if (m_unicode2glyph.containsKey(a_key)) { retval = m_unicode2glyph.get(a_key); - } // if + } return retval; } @@ -208,8 +208,8 @@ public class CmapWriter extends FontFormatWriter { } else { writeUInt8((int) getGlyfIndex((long) i)); - } // if - } // for i + } + } } private void writeVersion4() throws IOException { @@ -220,7 +220,7 @@ public class CmapWriter extends FontFormatWriter { for (i = 0; i < segCount; i++) { Long n = (Long) m_endCodes.get(i); writeUInt16(n.intValue()); - } // for i + } // reserverdPad writeUInt16(0); @@ -229,13 +229,13 @@ public class CmapWriter extends FontFormatWriter { for (i = 0; i < segCount; i++) { Long n = m_startCodes.get(i); writeUInt16(n.intValue()); - } // for i + } // idDelta for (i = 0; i < segCount; i++) { Long n = m_idDeltas.get(i); writeInt16(n.intValue()); - } // for i + } // idRangeOffset for (i = 0; i < segCount; i++) { @@ -247,7 +247,7 @@ public class CmapWriter extends FontFormatWriter { for (i = 0; i < m_unicodes.size(); i++) { Long unicode = m_unicodes.get(i); writeUInt16((int) getGlyfIndex(unicode)); - } // for i + } byte [] bytes = m_bytes.toByteArray(); @@ -287,7 +287,7 @@ public class CmapWriter extends FontFormatWriter { writeUInt32(startCharCode.get(i)); writeUInt32(endCharCode.get(i)); writeUInt32(startGlyphCode.get(i)); - } // for i + } } /** diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFileWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFileWriter.java index 78a4c2681..4d182d965 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFileWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFileWriter.java @@ -269,7 +269,7 @@ public class FontFileWriter extends FontFormatWriter { // padding is always 4 zeros for (int i = 0; i < 4; i++) { writeUInt8(0); - } // for i + } } private int getSearchRange(int a_value) { diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFormatWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFormatWriter.java index 2d2030cc8..c4f3dd3e0 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFormatWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFormatWriter.java @@ -1,173 +1,173 @@ -/* - * $Id: FontFormatWriter.java,v 1.6 2004/01/28 11:44:08 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.truetype; - -import java.io.*; -import java.util.*; - -/** - * @author e.e - */ -public class FontFormatWriter { - protected DataOutputStream m_buffer; - protected ByteArrayOutputStream m_bytes; - private int m_offset; - - public FontFormatWriter() { - init(); - } - - protected void init() { - m_bytes = new ByteArrayOutputStream(); - m_buffer = new DataOutputStream(m_bytes); - m_offset = 0; - } - - public void write() throws IOException { - } - - public byte[] toByteArray() { - return m_bytes.toByteArray(); - } - - /** - * Size of buffer in bytes. - * @return size of buffer in bytes. - */ - public int size() { - return m_bytes.size(); - } - - public void reset() { - m_bytes.reset(); - } - - protected void writeFixed32(double a_value) throws IOException { - final int k_denom = 16384; - - short mantissa = (short) Math.floor(a_value); - int fraction = (int) ((a_value - mantissa) * k_denom); - if (fraction > k_denom) { - fraction = 0; - mantissa++; - } // if - - m_buffer.writeShort(mantissa); - m_buffer.writeShort(fraction); - } - - protected void writeUInt16(int a_value) throws IOException { - writeInt16((short) (0xffff & a_value)); - } - - protected void writeInt16(int a_value) throws IOException { - m_buffer.writeShort((short) a_value); - } - - protected void writeFWord(int a_value) throws IOException { - writeInt16(a_value); - } - - protected void writeUFWord(int a_value) throws IOException { - writeUInt16(a_value); - } - - protected void writeUInt32 (long a_value) throws IOException { - writeInt32((int) (0xffffffff & a_value)); - } - - protected void writeInt32(int a_value) throws IOException { - m_buffer.writeInt(a_value); - } - - protected void writeUInt8(int a_byte) throws IOException { - m_buffer.writeByte(a_byte); - } - - protected void writeTag(String a_value) throws IOException { - String s = a_value + " "; - - int i; - for (i = 0; i < 4; i++) { - writeUInt8(s.charAt(i)); - } // for i - } - - protected void writeLongDateTime(Date a_date) throws IOException { - long sec = a_date.getTime() / 1000; - sec += (1970 - 1904) * 365 * 24 * 60 * 60; - m_buffer.writeLong(sec); - } - - protected String getTag() { - throw new RuntimeException("unimplemnted call to getTag"); - } - - protected long getCheckSum() { - long retval = 0; - byte [] bytes = toByteArray(); - - for (int i = 0; i < bytes.length / 4; i++) { - long n = 0; - for (int j = 0; j < 4; j++) { - n += bytes[4 * i + j] << ((4 - j) * 8); - } // for j - retval += n; - } // for i - - return retval; - } - - protected void pad() throws IOException { - int align = 4; - int numOfPad = align - toByteArray().length % align; - if (numOfPad == align) - return; - - int i; - for (i = 0; i < numOfPad; i++) { - writeUInt8(0); - } // for i - } - - public int getOffset() { - return m_offset; - } - - public void setOffset(int a_value) { - m_offset = a_value; - } -} +/* + * $Id: FontFormatWriter.java,v 1.6 2004/01/28 11:44:08 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + +package org.doubletype.ossa.truetype; + +import java.io.*; +import java.util.*; + +/** + * @author e.e + */ +public class FontFormatWriter { + protected DataOutputStream m_buffer; + protected ByteArrayOutputStream m_bytes; + private int m_offset; + + public FontFormatWriter() { + init(); + } + + protected void init() { + m_bytes = new ByteArrayOutputStream(); + m_buffer = new DataOutputStream(m_bytes); + m_offset = 0; + } + + public void write() throws IOException { + } + + public byte[] toByteArray() { + return m_bytes.toByteArray(); + } + + /** + * Size of buffer in bytes. + * @return size of buffer in bytes. + */ + public int size() { + return m_bytes.size(); + } + + public void reset() { + m_bytes.reset(); + } + + protected void writeFixed32(double a_value) throws IOException { + final int k_denom = 16384; + + short mantissa = (short) Math.floor(a_value); + int fraction = (int) ((a_value - mantissa) * k_denom); + if (fraction > k_denom) { + fraction = 0; + mantissa++; + } + + m_buffer.writeShort(mantissa); + m_buffer.writeShort(fraction); + } + + protected void writeUInt16(int a_value) throws IOException { + writeInt16((short) (0xffff & a_value)); + } + + protected void writeInt16(int a_value) throws IOException { + m_buffer.writeShort((short) a_value); + } + + protected void writeFWord(int a_value) throws IOException { + writeInt16(a_value); + } + + protected void writeUFWord(int a_value) throws IOException { + writeUInt16(a_value); + } + + protected void writeUInt32 (long a_value) throws IOException { + writeInt32((int) (0xffffffff & a_value)); + } + + protected void writeInt32(int a_value) throws IOException { + m_buffer.writeInt(a_value); + } + + protected void writeUInt8(int a_byte) throws IOException { + m_buffer.writeByte(a_byte); + } + + protected void writeTag(String a_value) throws IOException { + String s = a_value + " "; + + int i; + for (i = 0; i < 4; i++) { + writeUInt8(s.charAt(i)); + } + } + + protected void writeLongDateTime(Date a_date) throws IOException { + long sec = a_date.getTime() / 1000; + sec += (1970 - 1904) * 365 * 24 * 60 * 60; + m_buffer.writeLong(sec); + } + + protected String getTag() { + throw new RuntimeException("unimplemnted call to getTag"); + } + + protected long getCheckSum() { + long retval = 0; + byte [] bytes = toByteArray(); + + for (int i = 0; i < bytes.length / 4; i++) { + long n = 0; + for (int j = 0; j < 4; j++) { + n += bytes[4 * i + j] << ((4 - j) * 8); + } // for j + retval += n; + } + + return retval; + } + + protected void pad() throws IOException { + int align = 4; + int numOfPad = align - m_bytes.size() % align; + if (numOfPad == align) + return; + + int i; + for (i = 0; i < numOfPad; i++) { + writeUInt8(0); + } + } + + public int getOffset() { + return m_offset; + } + + public void setOffset(int a_value) { + m_offset = a_value; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/GlyfWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/GlyfWriter.java index a0e650029..16b9ca46f 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/GlyfWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/GlyfWriter.java @@ -71,7 +71,7 @@ public class GlyfWriter extends FontFormatWriter { TTGlyph glyph = m_glyphs.get(i); writeGlyph(glyph); m_hdmx.updatePixelWidth(i, glyph); - } // for i + } m_loca.m_offsets.add(size()); } @@ -97,13 +97,13 @@ public class GlyfWriter extends FontFormatWriter { if (a_glyph == null) { return; - } // if + } if (a_glyph.isSimple()) { writeSimpleGlyph(a_glyph); } else { writeCompoundGlyph(a_glyph); - } // if-else + } pad(); } @@ -115,7 +115,7 @@ public class GlyfWriter extends FontFormatWriter { private void writeSimpleGlyph(TTGlyph a_glyph) throws IOException { if (a_glyph.getNumOfContours() == 0) { return; - } // if + } m_maxp.updateNumOfContours(a_glyph.getNumOfContours()); writeInt16(a_glyph.getNumOfContours()); @@ -124,7 +124,7 @@ public class GlyfWriter extends FontFormatWriter { int i; for (i = 0; i < a_glyph.getNumOfContours(); i++) { writeUInt16(a_glyph.getEndPoint(i)); - } // for i + } int numOfInst = a_glyph.getNumOfInstructions(); m_maxp.updateSizeOfInstructions(numOfInst); @@ -132,12 +132,12 @@ public class GlyfWriter extends FontFormatWriter { writeUInt16(numOfInst); for (i = 0; i < numOfInst; i++) { writeUInt8(a_glyph.getInstruction(i)); - } // for i + } for (i = 0; i < a_glyph.getNumOfFlags(); i++) { int flag = a_glyph.getFlag(i); writeUInt8(flag); - } // for i + } // update num of points m_maxp.updateNumOfPoints(a_glyph.getNumOfPoints()); @@ -148,7 +148,7 @@ public class GlyfWriter extends FontFormatWriter { writeInt16(point.x - lastX); lastX = point.x; - } // for i + } int lastY = 0; for (i = 0; i < a_glyph.getNumOfPoints(); i++) { @@ -156,7 +156,7 @@ public class GlyfWriter extends FontFormatWriter { writeInt16(point.y - lastY); lastY = point.y; - } // for i + } } /** @@ -181,7 +181,7 @@ public class GlyfWriter extends FontFormatWriter { writeUInt16(a_glyph.getGlyfIndex(i)); writeInt16(a_glyph.getArg1(i)); writeInt16(a_glyph.getArg2(i)); - } // for i + } } /** diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/HdmxWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/HdmxWriter.java index 1ba5a6c3f..83561fd20 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/HdmxWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/HdmxWriter.java @@ -1,117 +1,117 @@ -/* - * $Copyright: copyright (c) 2003-2008, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; -import java.util.*; - -/** - * HtmxWriter depends on GlyfWriter. - * - * @author e.e - */ -public class HdmxWriter extends FontFormatWriter { - static public int getNumOfPixelSizes() { - return TTPixelSize.getList().size(); - } - - static public ArrayList getPixelSizes() { - return TTPixelSize.getList(); - } - - private int m_numGlyphs = 98; // set by GlyfWriter - - public HdmxWriter() { - super(); - } - - /** set the number of glyphs in the font */ - public void setNumGlyphs(int a_value) { - m_numGlyphs = a_value; - - for (TTPixelSize pixelSize: getPixelSizes()) { - pixelSize.setPixelWidthsSize(a_value); - } // for pixelSize - } - - public void updatePixelWidth(int a_glyphIndex, TTGlyph a_glyph) { - double advanceWidth = a_glyph.getAdvanceWidth(); - double em = TTPixelSize.getEm(); - - for (TTPixelSize pixelSize: TTPixelSize.getList()) { - int width = (int) Math.round(((double) pixelSize.getPixel() * advanceWidth) / em); - pixelSize.setPixelWidth(a_glyphIndex, width); - } // pixelSize - } - - /** - * writes htmx record. - * The size of a device record is calculated to align it to 32bit boundary. - */ - public void write() throws IOException { - int numOfPads = 4 - ((m_numGlyphs + 2) % 4); - if (numOfPads == 4) { - numOfPads = 0; - } // if - int size = m_numGlyphs + 2 + numOfPads; // 2 comes from the ppem and max - - // format version number - writeInt16(0); - - // number of device records - writeInt16(getNumOfPixelSizes()); - //System.out.printf("num of pixel sizes %d\n", getNumOfPixelSizes()); - // size of device record - writeInt32(size); - //System.out.printf("num of glyphs %d\n", m_numGlyphs); - for (TTPixelSize pixelSize: getPixelSizes()) { - writeUInt8(pixelSize.getPixel()); - writeUInt8(pixelSize.getMaxPixelWidth()); - for (int pixelWidth: pixelSize.getPixelWidths()) { - writeUInt8(pixelWidth); - } // for pixelWidth - - for (int j = 0; j < numOfPads; j++) { - writeUInt8(0); - } // for j - } // for pixelSize - - pad(); - } - - protected String getTag() { - return "hdmx"; - } -} +/* + * $Copyright: copyright (c) 2003-2008, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; +import java.util.*; + +/** + * HtmxWriter depends on GlyfWriter. + * + * @author e.e + */ +public class HdmxWriter extends FontFormatWriter { + static public int getNumOfPixelSizes() { + return TTPixelSize.getList().size(); + } + + static public ArrayList getPixelSizes() { + return TTPixelSize.getList(); + } + + private int m_numGlyphs = 98; // set by GlyfWriter + + public HdmxWriter() { + super(); + } + + /** set the number of glyphs in the font */ + public void setNumGlyphs(int a_value) { + m_numGlyphs = a_value; + + for (TTPixelSize pixelSize: getPixelSizes()) { + pixelSize.setPixelWidthsSize(a_value); + } // for pixelSize + } + + public void updatePixelWidth(int a_glyphIndex, TTGlyph a_glyph) { + double advanceWidth = a_glyph.getAdvanceWidth(); + double em = TTPixelSize.getEm(); + + for (TTPixelSize pixelSize: TTPixelSize.getList()) { + int width = (int) Math.round(((double) pixelSize.getPixel() * advanceWidth) / em); + pixelSize.setPixelWidth(a_glyphIndex, width); + } // pixelSize + } + + /** + * writes htmx record. + * The size of a device record is calculated to align it to 32bit boundary. + */ + public void write() throws IOException { + int numOfPads = 4 - ((m_numGlyphs + 2) % 4); + if (numOfPads == 4) { + numOfPads = 0; + } + int size = m_numGlyphs + 2 + numOfPads; // 2 comes from the ppem and max + + // format version number + writeInt16(0); + + // number of device records + writeInt16(getNumOfPixelSizes()); + //System.out.printf("num of pixel sizes %d\n", getNumOfPixelSizes()); + // size of device record + writeInt32(size); + //System.out.printf("num of glyphs %d\n", m_numGlyphs); + for (TTPixelSize pixelSize: getPixelSizes()) { + writeUInt8(pixelSize.getPixel()); + writeUInt8(pixelSize.getMaxPixelWidth()); + for (int pixelWidth: pixelSize.getPixelWidths()) { + writeUInt8(pixelWidth); + } // for pixelWidth + + for (int j = 0; j < numOfPads; j++) { + writeUInt8(0); + } // for j + } // for pixelSize + + pad(); + } + + protected String getTag() { + return "hdmx"; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/HeadWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/HeadWriter.java index 3b23d4e49..80c13c4f6 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/HeadWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/HeadWriter.java @@ -1,156 +1,156 @@ -/* - * $Id: HeadWriter.java,v 1.7 2004/09/26 09:15:48 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; -import java.util.*; -import java.awt.*; - -/** - * @author e.e - */ -public class HeadWriter extends FontFormatWriter { - static public final int k_yZeroIsBaseLine = 0x1; // bit 0 - static public final int k_xLeftMostBlackIsLsb = 0x2; // bit 1 - static public final int k_scaledPointDiffer = 0x4; // bit 2 - static public final int k_useIntegerScaling = 0x8; // bit 3 - - // used by microsoft - static public final int k_scaleLinear = 0x10; - - // for vertical fonts - static public final int k_xZeroIsBaseLine = 0x20; - // 0x40 - static public final int k_linguisticRendering = 0x80; - static public final int k_defaultMetamorphosis = 0x100; - static public final int k_rightToLeft = 0x200; - static public final int k_indicRearrangement = 0x400; - - - private final long k_magicNumber = 0x5f0f3cf5; - - private long m_checkSumAdjustment = 0; - private Point m_min = new Point(0, 0); - private Point m_max = new Point(0, 0); - - public HeadWriter() { - super(); - } - - void setCheckSumAdjustment(long a_value) { - m_checkSumAdjustment = a_value; - } - - public Point getMin() { - return m_min; - } - - public Point getMax() { - return m_max; - } - - public void updateMin(Point a_value) { - if (a_value.x < m_min.x) { - m_min.x = a_value.x; - } // if - - if (a_value.y < m_min.y) { - m_min.y = a_value.y; - } // if - } - - public void updateMax(Point a_value) { - if (a_value.x > m_max.x) { - m_max.x = a_value.x; - } // if - - if (a_value.y > m_max.y) { - m_max.y = a_value.y; - } // if - } - - public void write() throws IOException { - // table version number - writeFixed32(1.0); - - // fontRevision - writeFixed32(1.0); - - writeUInt32(m_checkSumAdjustment); - writeUInt32(k_magicNumber); - - // LSB is the distance from 0, 0 to the left of the glyph bounds. - // flags - writeUInt16(k_yZeroIsBaseLine - | k_xLeftMostBlackIsLsb - | k_scaledPointDiffer);; - - // unitsPerEm - writeUInt16(1024); - - // created, modified - writeLongDateTime(new Date()); - writeLongDateTime(new Date()); - - writeFWord(m_min.x); - writeFWord(m_min.y); - writeFWord(m_max.x); - writeFWord(m_max.y); - - // macStyle - writeUInt16(0); - - // lowestRecPPEM - writeUInt16(11); - - // font direction hint - // 2, for strongly left to right - // but also contains neutrals - writeInt16(2); - - // indexToLocFormat. 1, for long - writeInt16(1); - - // glyfDataFormat - writeInt16(0); - pad(); - } - - protected String getTag() { - return "head"; - } -} +/* + * $Id: HeadWriter.java,v 1.7 2004/09/26 09:15:48 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; +import java.util.*; +import java.awt.*; + +/** + * @author e.e + */ +public class HeadWriter extends FontFormatWriter { + static public final int k_yZeroIsBaseLine = 0x1; // bit 0 + static public final int k_xLeftMostBlackIsLsb = 0x2; // bit 1 + static public final int k_scaledPointDiffer = 0x4; // bit 2 + static public final int k_useIntegerScaling = 0x8; // bit 3 + + // used by microsoft + static public final int k_scaleLinear = 0x10; + + // for vertical fonts + static public final int k_xZeroIsBaseLine = 0x20; + // 0x40 + static public final int k_linguisticRendering = 0x80; + static public final int k_defaultMetamorphosis = 0x100; + static public final int k_rightToLeft = 0x200; + static public final int k_indicRearrangement = 0x400; + + + private final long k_magicNumber = 0x5f0f3cf5; + + private long m_checkSumAdjustment = 0; + private Point m_min = new Point(0, 0); + private Point m_max = new Point(0, 0); + + public HeadWriter() { + super(); + } + + void setCheckSumAdjustment(long a_value) { + m_checkSumAdjustment = a_value; + } + + public Point getMin() { + return m_min; + } + + public Point getMax() { + return m_max; + } + + public void updateMin(Point a_value) { + if (a_value.x < m_min.x) { + m_min.x = a_value.x; + } + + if (a_value.y < m_min.y) { + m_min.y = a_value.y; + } + } + + public void updateMax(Point a_value) { + if (a_value.x > m_max.x) { + m_max.x = a_value.x; + } + + if (a_value.y > m_max.y) { + m_max.y = a_value.y; + } + } + + public void write() throws IOException { + // table version number + writeFixed32(1.0); + + // fontRevision + writeFixed32(1.0); + + writeUInt32(m_checkSumAdjustment); + writeUInt32(k_magicNumber); + + // LSB is the distance from 0, 0 to the left of the glyph bounds. + // flags + writeUInt16(k_yZeroIsBaseLine + | k_xLeftMostBlackIsLsb + | k_scaledPointDiffer);; + + // unitsPerEm + writeUInt16(1024); + + // created, modified + writeLongDateTime(new Date()); + writeLongDateTime(new Date()); + + writeFWord(m_min.x); + writeFWord(m_min.y); + writeFWord(m_max.x); + writeFWord(m_max.y); + + // macStyle + writeUInt16(0); + + // lowestRecPPEM + writeUInt16(11); + + // font direction hint + // 2, for strongly left to right + // but also contains neutrals + writeInt16(2); + + // indexToLocFormat. 1, for long + writeInt16(1); + + // glyfDataFormat + writeInt16(0); + pad(); + } + + protected String getTag() { + return "head"; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/HheaWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/HheaWriter.java index 7c75f8748..8320314fe 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/HheaWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/HheaWriter.java @@ -1,108 +1,108 @@ -/* - * $Id: HheaWriter.java,v 1.5 2004/09/26 09:15:48 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; - -/** - * HheaWriter depends on HtmxWriter. - * @author e.e - */ -public class HheaWriter extends FontFormatWriter { - private GlyfWriter m_glyf; - private HeadWriter m_head; - - private int m_lineGap = 0; - private int m_maxAdvanceWidth = 0; - private int m_minRightSideBearing = 0; - - public HheaWriter(GlyfWriter a_glyf, HeadWriter a_head) { - super(); - - m_glyf = a_glyf; - m_head = a_head; - } - - public void setLineGap(int a_value) { - m_lineGap = a_value; - } - - public void setMaxAdvanceWidth(int a_value) { - m_maxAdvanceWidth = a_value; - } - - public void setMinRightSideBearing(int a_value) { - m_minRightSideBearing = a_value; - } - - public void write() throws IOException { - // table version number - writeFixed32(1.0); - - writeFWord(m_head.getMax().y); - writeFWord(m_head.getMin().y); - writeFWord(m_lineGap); - writeUFWord(m_maxAdvanceWidth); - - int minLeftSideBearing = m_head.getMin().x; - writeFWord(minLeftSideBearing); - writeFWord(m_minRightSideBearing); - - int xMaxExtent = m_head.getMax().x - m_head.getMin().x; - writeFWord(xMaxExtent); - - // caratSlopeRise - writeInt16(1); - writeInt16(0); - - // reserved - for (int i = 0; i < 5; i++) { - writeInt16(0); - } // for i - - writeInt16(0); - - int numOfHMetrics = m_glyf.numOfGlyph(); - writeUInt16(numOfHMetrics); - - pad(); - } - - protected String getTag() { - return "hhea"; - } -} +/* + * $Id: HheaWriter.java,v 1.5 2004/09/26 09:15:48 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; + +/** + * HheaWriter depends on HtmxWriter. + * @author e.e + */ +public class HheaWriter extends FontFormatWriter { + private GlyfWriter m_glyf; + private HeadWriter m_head; + + private int m_lineGap = 0; + private int m_maxAdvanceWidth = 0; + private int m_minRightSideBearing = 0; + + public HheaWriter(GlyfWriter a_glyf, HeadWriter a_head) { + super(); + + m_glyf = a_glyf; + m_head = a_head; + } + + public void setLineGap(int a_value) { + m_lineGap = a_value; + } + + public void setMaxAdvanceWidth(int a_value) { + m_maxAdvanceWidth = a_value; + } + + public void setMinRightSideBearing(int a_value) { + m_minRightSideBearing = a_value; + } + + public void write() throws IOException { + // table version number + writeFixed32(1.0); + + writeFWord(m_head.getMax().y); + writeFWord(m_head.getMin().y); + writeFWord(m_lineGap); + writeUFWord(m_maxAdvanceWidth); + + int minLeftSideBearing = m_head.getMin().x; + writeFWord(minLeftSideBearing); + writeFWord(m_minRightSideBearing); + + int xMaxExtent = m_head.getMax().x - m_head.getMin().x; + writeFWord(xMaxExtent); + + // caratSlopeRise + writeInt16(1); + writeInt16(0); + + // reserved + for (int i = 0; i < 5; i++) { + writeInt16(0); + } + + writeInt16(0); + + int numOfHMetrics = m_glyf.numOfGlyph(); + writeUInt16(numOfHMetrics); + + pad(); + } + + protected String getTag() { + return "hhea"; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/HmtxWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/HmtxWriter.java index f8a487329..f74bab3d2 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/HmtxWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/HmtxWriter.java @@ -1,89 +1,89 @@ -/* - * $Id: HmtxWriter.java,v 1.10 2004/10/04 02:25:39 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; - -/** - * HtmxWriter depends on GlyfWriter. - * - * @author e.e - */ -public class HmtxWriter extends FontFormatWriter { - HheaWriter m_hhea; - GlyfWriter m_glyf; - - public HmtxWriter(GlyfWriter a_glyf, HheaWriter a_hhea) { - super(); - - m_hhea = a_hhea; - m_glyf = a_glyf; - } - - public void write() throws IOException { - int i; - - TTGlyph glyphZero = m_glyf.getGlyph(0); - int maxWidth = glyphZero.getAdvanceWidth(); - int minRightSideBearing = glyphZero.getRightSideBearing(); - for (i = 0; i < m_glyf.numOfGlyph(); i++) { - TTGlyph glyph = m_glyf.getGlyph(i); - - if (glyph.getAdvanceWidth() > maxWidth) { - maxWidth = glyph.getAdvanceWidth(); - } // if - - if (glyph.getRightSideBearing() < minRightSideBearing) { - minRightSideBearing = glyph.getRightSideBearing(); - } // if - - writeUFWord(glyph.getAdvanceWidth()); - writeFWord(glyph.getLeftSideBearing()); - } // for i - - writeFWord(0); - - m_hhea.setMaxAdvanceWidth(maxWidth); - m_hhea.setMinRightSideBearing(minRightSideBearing); - - pad(); - } - - protected String getTag() { - return "hmtx"; - } -} +/* + * $Id: HmtxWriter.java,v 1.10 2004/10/04 02:25:39 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; + +/** + * HtmxWriter depends on GlyfWriter. + * + * @author e.e + */ +public class HmtxWriter extends FontFormatWriter { + HheaWriter m_hhea; + GlyfWriter m_glyf; + + public HmtxWriter(GlyfWriter a_glyf, HheaWriter a_hhea) { + super(); + + m_hhea = a_hhea; + m_glyf = a_glyf; + } + + public void write() throws IOException { + int i; + + TTGlyph glyphZero = m_glyf.getGlyph(0); + int maxWidth = glyphZero.getAdvanceWidth(); + int minRightSideBearing = glyphZero.getRightSideBearing(); + for (i = 0; i < m_glyf.numOfGlyph(); i++) { + TTGlyph glyph = m_glyf.getGlyph(i); + + if (glyph.getAdvanceWidth() > maxWidth) { + maxWidth = glyph.getAdvanceWidth(); + } + + if (glyph.getRightSideBearing() < minRightSideBearing) { + minRightSideBearing = glyph.getRightSideBearing(); + } + + writeUFWord(glyph.getAdvanceWidth()); + writeFWord(glyph.getLeftSideBearing()); + } + + writeFWord(0); + + m_hhea.setMaxAdvanceWidth(maxWidth); + m_hhea.setMinRightSideBearing(minRightSideBearing); + + pad(); + } + + protected String getTag() { + return "hmtx"; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/LocaWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/LocaWriter.java index 4a2056d0b..857634e6b 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/LocaWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/LocaWriter.java @@ -1,67 +1,67 @@ -/* - * $Id: LocaWriter.java,v 1.3 2004/01/15 07:06:27 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; -import java.util.*; - -/** - * @author e.e - */ -public class LocaWriter extends FontFormatWriter { - public ArrayList m_offsets = new ArrayList<>(); - - public LocaWriter() { - super(); - } - - public void write() throws IOException { - // assume glyf table is already written, - // and offsets are stored in m_offsets - - int i; - for (i = 0; i < m_offsets.size(); i++) { - writeUInt32(m_offsets.get(i)); - } // for i - - pad(); - } - - protected String getTag() { - return "loca"; - } -} +/* + * $Id: LocaWriter.java,v 1.3 2004/01/15 07:06:27 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; +import java.util.*; + +/** + * @author e.e + */ +public class LocaWriter extends FontFormatWriter { + public ArrayList m_offsets = new ArrayList<>(); + + public LocaWriter() { + super(); + } + + public void write() throws IOException { + // assume glyf table is already written, + // and offsets are stored in m_offsets + + int i; + for (i = 0; i < m_offsets.size(); i++) { + writeUInt32(m_offsets.get(i)); + } + + pad(); + } + + protected String getTag() { + return "loca"; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/MaxpWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/MaxpWriter.java index 16880ab29..b82b035b1 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/MaxpWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/MaxpWriter.java @@ -1,137 +1,137 @@ -/* - * $Id: MaxpWriter.java,v 1.11 2004/06/27 07:26:46 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; - -/** - * @author e.e - */ -public class MaxpWriter extends FontFormatWriter { - private int m_numGlyphs = 98; // set by GlyfWriter - private int m_maxPoints = 0; - private int m_maxContours = 0; - private int m_maxCompositePoints = 0; - private int m_maxCompositeContours = 0; - private int m_maxZones = 2; - private int m_maxTwilightPoints = 128; - private int m_maxStorage = 64; - private int m_maxFunctionDefs = 128; - private int m_maxInstructionDefs = 128; - private int m_maxStackElements = 128; - private int m_maxSizeOfInstructions = 128; - private int m_maxComponentElements = 128; - private int m_maxComponentDepth = 0; - - public MaxpWriter() { - super(); - } - - public void write() throws IOException { - writeFixed32(1.0); - writeUInt16(m_numGlyphs); - writeUInt16(m_maxPoints); - writeUInt16(m_maxContours); - writeUInt16(m_maxCompositePoints); - writeUInt16(m_maxCompositeContours); - writeUInt16(m_maxZones); - writeUInt16(m_maxTwilightPoints); - writeUInt16(m_maxStorage); - writeUInt16(m_maxFunctionDefs); - writeUInt16(m_maxInstructionDefs); - writeUInt16(m_maxStackElements); - writeUInt16(m_maxSizeOfInstructions); - writeUInt16(m_maxComponentElements); - writeUInt16(m_maxComponentDepth); - pad(); - } - - protected String getTag() { - return "maxp"; - } - - /** set the number of glyphs in the font */ - public void setNumGlyphs(int a_value) { - m_numGlyphs = a_value; - } - - /** update points in non-compound glyph */ - public void updateNumOfPoints(int a_value) { - if (a_value > m_maxPoints) { - m_maxPoints = a_value; - } // if - } - - /** update points in non-compound glyph */ - public void updateNumOfContours(int a_value) { - if (a_value > m_maxContours) { - m_maxContours = a_value; - } // if - } - - public void updateNumOfCompositePoints(int a_value) { - if (a_value > m_maxCompositePoints) { - m_maxCompositePoints = a_value; - } // if - } - - public void updateNumOfCompositeContours(int a_value) { - if (a_value > m_maxCompositeContours) { - m_maxCompositeContours = a_value; - } // if - } - - /** update byte count for glyph instructions */ - public void updateSizeOfInstructions(int a_value) { - if (a_value > m_maxSizeOfInstructions) { - m_maxSizeOfInstructions = a_value; - } // if - } - - public void updateNumOfComponentElements(int a_value) { - if (a_value > m_maxComponentElements) { - m_maxComponentElements = a_value; - } // if - } - - public void updateComponentDepth(int a_value) { - if (a_value > m_maxComponentDepth) { - m_maxComponentDepth = a_value; - } // if - } - -} +/* + * $Id: MaxpWriter.java,v 1.11 2004/06/27 07:26:46 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; + +/** + * @author e.e + */ +public class MaxpWriter extends FontFormatWriter { + private int m_numGlyphs = 98; // set by GlyfWriter + private int m_maxPoints = 0; + private int m_maxContours = 0; + private int m_maxCompositePoints = 0; + private int m_maxCompositeContours = 0; + private int m_maxZones = 2; + private int m_maxTwilightPoints = 128; + private int m_maxStorage = 64; + private int m_maxFunctionDefs = 128; + private int m_maxInstructionDefs = 128; + private int m_maxStackElements = 128; + private int m_maxSizeOfInstructions = 128; + private int m_maxComponentElements = 128; + private int m_maxComponentDepth = 0; + + public MaxpWriter() { + super(); + } + + public void write() throws IOException { + writeFixed32(1.0); + writeUInt16(m_numGlyphs); + writeUInt16(m_maxPoints); + writeUInt16(m_maxContours); + writeUInt16(m_maxCompositePoints); + writeUInt16(m_maxCompositeContours); + writeUInt16(m_maxZones); + writeUInt16(m_maxTwilightPoints); + writeUInt16(m_maxStorage); + writeUInt16(m_maxFunctionDefs); + writeUInt16(m_maxInstructionDefs); + writeUInt16(m_maxStackElements); + writeUInt16(m_maxSizeOfInstructions); + writeUInt16(m_maxComponentElements); + writeUInt16(m_maxComponentDepth); + pad(); + } + + protected String getTag() { + return "maxp"; + } + + /** set the number of glyphs in the font */ + public void setNumGlyphs(int a_value) { + m_numGlyphs = a_value; + } + + /** update points in non-compound glyph */ + public void updateNumOfPoints(int a_value) { + if (a_value > m_maxPoints) { + m_maxPoints = a_value; + } + } + + /** update points in non-compound glyph */ + public void updateNumOfContours(int a_value) { + if (a_value > m_maxContours) { + m_maxContours = a_value; + } + } + + public void updateNumOfCompositePoints(int a_value) { + if (a_value > m_maxCompositePoints) { + m_maxCompositePoints = a_value; + } + } + + public void updateNumOfCompositeContours(int a_value) { + if (a_value > m_maxCompositeContours) { + m_maxCompositeContours = a_value; + } + } + + /** update byte count for glyph instructions */ + public void updateSizeOfInstructions(int a_value) { + if (a_value > m_maxSizeOfInstructions) { + m_maxSizeOfInstructions = a_value; + } + } + + public void updateNumOfComponentElements(int a_value) { + if (a_value > m_maxComponentElements) { + m_maxComponentElements = a_value; + } + } + + public void updateComponentDepth(int a_value) { + if (a_value > m_maxComponentDepth) { + m_maxComponentDepth = a_value; + } + } + +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/NameWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/NameWriter.java index 37641a200..cfe93a533 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/NameWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/NameWriter.java @@ -1,183 +1,183 @@ -/* - * $Id: NameWriter.java,v 1.9 2004/06/16 07:02:52 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; -import java.util.*; - -/** - * @author e.e - */ -public class NameWriter extends FontFormatWriter { - public static final String k_regular = "Regular"; - private static final String k_utf16be = "UTF-16BE"; - private static final String k_iso8859_1 = "ISO-8859-1"; - - String m_copyright = "\u00A9 Copyright"; - String m_familyName = "Temp"; - String m_subFamilyName = k_regular; - String m_unique = "eed3si9n: Temp Regular: 2003"; - String m_fullFontName = "Temp"; - String m_version = "0.00"; - String m_psName = "Temp"; - String m_tradeMark = ""; - String m_manufacturer = "eed3si9n"; - String m_year = "2004"; - String m_sample = "The quick brown fox jumps over the lazy dog."; - - private ArrayList m_names = new ArrayList<>(); - - public NameWriter() { - super(); - } - - private void prepare() { - m_copyright = "\u00A9 Copyright " - + m_year - + ", " - + m_manufacturer - + "."; - m_unique = "dtype: " - + m_manufacturer + ": " - + m_familyName + " " - + m_subFamilyName + ": " - + "Version " + m_version + ": " - + m_year; - m_fullFontName = m_familyName; - m_psName = m_fullFontName; - - if (m_tradeMark.length() == 0) { - m_tradeMark = "n/a"; - } // if - - m_names.clear(); - addNames(); - } - - private void addNames() { - addMacintoshRomanEnglish(0, m_copyright); - addMacintoshRomanEnglish(1, m_familyName); - addMacintoshRomanEnglish(2, m_subFamilyName); - addMacintoshRomanEnglish(3, m_unique); - addMacintoshRomanEnglish(4, m_fullFontName); - addMacintoshRomanEnglish(5, "Version " + m_version); - addMacintoshRomanEnglish(6, m_psName); - addMacintoshRomanEnglish(7, m_tradeMark); - addMacintoshRomanEnglish(8, m_manufacturer); - - addMicrosoftUnicodeEnglish(0, m_copyright); - addMicrosoftUnicodeEnglish(1, m_familyName); - addMicrosoftUnicodeEnglish(2, m_subFamilyName); - addMicrosoftUnicodeEnglish(3, m_unique); - addMicrosoftUnicodeEnglish(4, m_fullFontName); - addMicrosoftUnicodeEnglish(5, "Version " + m_version); - addMicrosoftUnicodeEnglish(6, m_psName); - addMicrosoftUnicodeEnglish(7, m_tradeMark); - addMicrosoftUnicodeEnglish(8, m_manufacturer); - // addMicrosoftUnicodeEnglish(19, m_sample); - } - - private void addMacintoshRomanEnglish(int a_nameId, String a_value) { - try { - add(TTName.k_macintosh, - TTName.k_macRomanEncode, - TTName.k_macEnglishLang, - a_nameId, - a_value.getBytes(k_iso8859_1)); - } - catch (IOException e) { - e.printStackTrace(); - } // try-catch - } - - private void addMicrosoftUnicodeEnglish(int a_nameId, String a_value) { - try { - add(TTName.k_microsoft, - TTName.k_winUnicodeEncode, - TTName.k_winEnglishLang, - a_nameId, - a_value.getBytes(k_utf16be)); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - private void add(int a_platformId, int a_encodingId, int a_languageId, - int a_nameId, byte a_bytes[]) { - TTName name = new TTName(a_platformId, - a_encodingId, - a_languageId, - a_nameId, - a_bytes); - m_names.add(name); - } - - public void write() throws IOException { - prepare(); - - // table version number - writeUInt16(0); - - // number of name records - writeUInt16(m_names.size()); - - // Offset to start of string storage (from start of table). - writeUInt16(12 * m_names.size() + 6); - - int offset = 0; - for (TTName name: m_names) { - writeUInt16(name.getPlatformId()); - writeUInt16(name.getEncodingId()); - writeUInt16(name.getLanguageId()); - writeUInt16(name.getNameId()); - writeUInt16(name.getStringLength()); - writeUInt16(offset); - offset += name.getStringLength(); - } // for i - - for (TTName name: m_names) { - m_buffer.write(name.getBytes()); - } // for i - - pad(); - } - - protected String getTag() { - return "name"; - } -} +/* + * $Id: NameWriter.java,v 1.9 2004/06/16 07:02:52 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; +import java.util.*; + +/** + * @author e.e + */ +public class NameWriter extends FontFormatWriter { + public static final String k_regular = "Regular"; + private static final String k_utf16be = "UTF-16BE"; + private static final String k_iso8859_1 = "ISO-8859-1"; + + String m_copyright = "\u00A9 Copyright"; + String m_familyName = "Temp"; + String m_subFamilyName = k_regular; + String m_unique = "eed3si9n: Temp Regular: 2003"; + String m_fullFontName = "Temp"; + String m_version = "0.00"; + String m_psName = "Temp"; + String m_tradeMark = ""; + String m_manufacturer = "eed3si9n"; + String m_year = "2004"; + String m_sample = "The quick brown fox jumps over the lazy dog."; + + private ArrayList m_names = new ArrayList<>(); + + public NameWriter() { + super(); + } + + private void prepare() { + m_copyright = "\u00A9 Copyright " + + m_year + + ", " + + m_manufacturer + + "."; + m_unique = "dtype: " + + m_manufacturer + ": " + + m_familyName + " " + + m_subFamilyName + ": " + + "Version " + m_version + ": " + + m_year; + m_fullFontName = m_familyName; + m_psName = m_fullFontName; + + if (m_tradeMark.length() == 0) { + m_tradeMark = "n/a"; + } + + m_names.clear(); + addNames(); + } + + private void addNames() { + addMacintoshRomanEnglish(0, m_copyright); + addMacintoshRomanEnglish(1, m_familyName); + addMacintoshRomanEnglish(2, m_subFamilyName); + addMacintoshRomanEnglish(3, m_unique); + addMacintoshRomanEnglish(4, m_fullFontName); + addMacintoshRomanEnglish(5, "Version " + m_version); + addMacintoshRomanEnglish(6, m_psName); + addMacintoshRomanEnglish(7, m_tradeMark); + addMacintoshRomanEnglish(8, m_manufacturer); + + addMicrosoftUnicodeEnglish(0, m_copyright); + addMicrosoftUnicodeEnglish(1, m_familyName); + addMicrosoftUnicodeEnglish(2, m_subFamilyName); + addMicrosoftUnicodeEnglish(3, m_unique); + addMicrosoftUnicodeEnglish(4, m_fullFontName); + addMicrosoftUnicodeEnglish(5, "Version " + m_version); + addMicrosoftUnicodeEnglish(6, m_psName); + addMicrosoftUnicodeEnglish(7, m_tradeMark); + addMicrosoftUnicodeEnglish(8, m_manufacturer); + // addMicrosoftUnicodeEnglish(19, m_sample); + } + + private void addMacintoshRomanEnglish(int a_nameId, String a_value) { + try { + add(TTName.k_macintosh, + TTName.k_macRomanEncode, + TTName.k_macEnglishLang, + a_nameId, + a_value.getBytes(k_iso8859_1)); + } + catch (IOException e) { + e.printStackTrace(); + } // try-catch + } + + private void addMicrosoftUnicodeEnglish(int a_nameId, String a_value) { + try { + add(TTName.k_microsoft, + TTName.k_winUnicodeEncode, + TTName.k_winEnglishLang, + a_nameId, + a_value.getBytes(k_utf16be)); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + private void add(int a_platformId, int a_encodingId, int a_languageId, + int a_nameId, byte a_bytes[]) { + TTName name = new TTName(a_platformId, + a_encodingId, + a_languageId, + a_nameId, + a_bytes); + m_names.add(name); + } + + public void write() throws IOException { + prepare(); + + // table version number + writeUInt16(0); + + // number of name records + writeUInt16(m_names.size()); + + // Offset to start of string storage (from start of table). + writeUInt16(12 * m_names.size() + 6); + + int offset = 0; + for (TTName name: m_names) { + writeUInt16(name.getPlatformId()); + writeUInt16(name.getEncodingId()); + writeUInt16(name.getLanguageId()); + writeUInt16(name.getNameId()); + writeUInt16(name.getStringLength()); + writeUInt16(offset); + offset += name.getStringLength(); + } + + for (TTName name: m_names) { + m_buffer.write(name.getBytes()); + } + + pad(); + } + + protected String getTag() { + return "name"; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/OS2Writer.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/OS2Writer.java index 54cf6a398..c846bff26 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/OS2Writer.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/OS2Writer.java @@ -1,242 +1,242 @@ -/* - * $Id: OS2Writer.java,v 1.11 2004/10/04 02:25:39 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; - -/** - * @author e.e - */ -public class OS2Writer extends FontFormatWriter { - final int FW_THIN = 100; - final int FW_EXTRALIGHT = 200; - final int FW_LIGHT = 300; - final int FW_NORMAL = 400; - final int FW_MEDIUM = 500; - final int FW_SEMIBOLD = 600; - final int FW_BOLD = 700; - final int FW_EXTRABOLD = 800; - final int FW_BLACK = 900; - - final int FWIDTH_NORMAL = 5; - - final int k_editableEmbedding = 0x0008; - - final int k_sansSerif = 0x0800; - - // unicode - final int k_basicLatin = 0x0001; - final int k_latin1Supplement = 0x0002; - - final int k_regular = 0x40; - final int k_basicLatinStart = 0x0020; - final int k_basciLatinEnd = 0x007e; - - private HeadWriter m_head; - - int m_xAvgCharWidth = 512; - int m_usWeightClass = FW_NORMAL; - int m_usWidthClass = FWIDTH_NORMAL; - int m_fsType = 0; - int m_ySubscriptXSize = 128; - int m_ySubscriptYSize = 128; - int m_ySubscriptXOffset = 0; - int m_ySubscriptYOffset = -64; - int m_ySuperscriptXSize = 128; - int m_ySuperscriptYSize = 128; - int m_ySuperscriptXOffset = 0; - int m_ySuperscriptYOffset = 64; - int m_yStrikeoutSize = 51; - int m_yStrikeoutPosition = 512; - int m_sFamilyClass = k_sansSerif; - - long m_ulUnicodeRange1 = k_basicLatin | k_latin1Supplement; - long m_ulUnicodeRange2 = 0; - long m_ulUnicodeRange3 = 0; - long m_ulUnicodeRange4 = 0; - String m_vendId = "dtyp"; - int m_fsSelection = k_regular; - int m_usFirstCharIndex = k_basicLatinStart; - int m_usLastCharIndex = k_basciLatinEnd; - private int m_sTypoAscender = 1024; - private int m_sTypoDescender = 0; - private int m_sTypoLineGap = 0; - private int m_usWinAscent = 1024; - private int m_usWinDescent = 0; - long m_ulCodePageRange1 = 0; - long m_ulCodePageRange2 = 0; - private int m_sxHeight = 512; - private int m_sCapHeight = 1024; - int m_usDefaultChar = 0x0; - int m_usBreakChar = 0x20; - int m_usMaxContext = 1; - - public OS2Writer(HeadWriter a_head) { - super(); - - m_head = a_head; - } - - public void setCapHeight(int a_value) { - m_sCapHeight = a_value; - } - - public void setXHeight(int a_value) { - m_sxHeight = a_value; - } - - public void setTypoAscender(int a_value) { - m_sTypoAscender = a_value; - } - - public void setTypoDescender(int a_value) { - m_sTypoDescender = a_value; - } - - public void setTypoLineGap(int a_value) { - m_sTypoLineGap = a_value; - } - - public void setUnicodeRangeFlag(int a_pos) { - int which = a_pos / 32; - int where = a_pos % 32; - long what = 0x1 << where; - - switch (which) { - case 0: { - m_ulUnicodeRange1 |= what; - } break; - - case 1: { - m_ulUnicodeRange2 |= what; - } break; - - case 2: { - m_ulUnicodeRange3 |= what; - } break; - - case 3: { - m_ulUnicodeRange4 |= what; - } break; - } // switch - } - - public void setCodePageRangeFlag(int a_pos) { - int which = a_pos / 32; - int where = a_pos % 32; - long what = 0x1 << where; - - switch (which) { - case 0: { - m_ulCodePageRange1 |= what; - } break; - - case 1: { - m_ulCodePageRange2 |= what; - } break; - } // switch - } - - public void write() throws IOException { - m_usWinAscent = m_head.getMax().y; - m_usWinDescent = 0; - if (m_head.getMin().y < 0) { - m_usWinDescent = -m_head.getMin().y; - } // if - - // table version number - writeUInt16(0x02); - - writeInt16(m_xAvgCharWidth); - writeUInt16(m_usWeightClass); - writeUInt16(m_usWidthClass); - writeInt16(m_fsType); - writeInt16(m_ySubscriptXSize); - writeInt16(m_ySubscriptYSize); - writeInt16(m_ySubscriptXOffset); - writeInt16(m_ySubscriptYOffset); - writeInt16(m_ySuperscriptXSize); - writeInt16(m_ySuperscriptYSize); - writeInt16(m_ySuperscriptXOffset); - writeInt16(m_ySuperscriptYOffset); - writeInt16(m_yStrikeoutSize); - writeInt16(m_yStrikeoutPosition); - writeInt16(m_sFamilyClass); - - writePanose(); - - writeUInt32(m_ulUnicodeRange1); - writeUInt32(m_ulUnicodeRange2); - writeUInt32(m_ulUnicodeRange3); - writeUInt32(m_ulUnicodeRange4); - writeTag(m_vendId); - writeUInt16(m_fsSelection); - writeUInt16(m_usFirstCharIndex); - writeUInt16(m_usLastCharIndex); - writeUInt16(m_sTypoAscender); - writeUInt16(m_sTypoDescender); - writeUInt16(m_sTypoLineGap); - writeUInt16(m_usWinAscent); - writeUInt16(m_usWinDescent); - writeUInt32(m_ulCodePageRange1); - writeUInt32(m_ulCodePageRange2); - writeInt16(m_sxHeight); - writeInt16(m_sCapHeight); - writeUInt16(m_usDefaultChar); - writeUInt16(m_usBreakChar); - writeUInt16(m_usMaxContext); - - pad(); - } - - private void writePanose() throws IOException { - writeUInt8(0); // family - writeUInt8(0); // serif - writeUInt8(0); // weight - writeUInt8(0); // proportion - writeUInt8(0); // contrast - writeUInt8(0); // stroke - writeUInt8(0); // arm style - writeUInt8(0); // letterform - writeUInt8(0); // midline - writeUInt8(0); // x-height - } - - protected String getTag() { - return "OS/2 "; - } -} +/* + * $Id: OS2Writer.java,v 1.11 2004/10/04 02:25:39 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; + +/** + * @author e.e + */ +public class OS2Writer extends FontFormatWriter { + final int FW_THIN = 100; + final int FW_EXTRALIGHT = 200; + final int FW_LIGHT = 300; + final int FW_NORMAL = 400; + final int FW_MEDIUM = 500; + final int FW_SEMIBOLD = 600; + final int FW_BOLD = 700; + final int FW_EXTRABOLD = 800; + final int FW_BLACK = 900; + + final int FWIDTH_NORMAL = 5; + + final int k_editableEmbedding = 0x0008; + + final int k_sansSerif = 0x0800; + + // unicode + final int k_basicLatin = 0x0001; + final int k_latin1Supplement = 0x0002; + + final int k_regular = 0x40; + final int k_basicLatinStart = 0x0020; + final int k_basciLatinEnd = 0x007e; + + private HeadWriter m_head; + + int m_xAvgCharWidth = 512; + int m_usWeightClass = FW_NORMAL; + int m_usWidthClass = FWIDTH_NORMAL; + int m_fsType = 0; + int m_ySubscriptXSize = 128; + int m_ySubscriptYSize = 128; + int m_ySubscriptXOffset = 0; + int m_ySubscriptYOffset = -64; + int m_ySuperscriptXSize = 128; + int m_ySuperscriptYSize = 128; + int m_ySuperscriptXOffset = 0; + int m_ySuperscriptYOffset = 64; + int m_yStrikeoutSize = 51; + int m_yStrikeoutPosition = 512; + int m_sFamilyClass = k_sansSerif; + + long m_ulUnicodeRange1 = k_basicLatin | k_latin1Supplement; + long m_ulUnicodeRange2 = 0; + long m_ulUnicodeRange3 = 0; + long m_ulUnicodeRange4 = 0; + String m_vendId = "dtyp"; + int m_fsSelection = k_regular; + int m_usFirstCharIndex = k_basicLatinStart; + int m_usLastCharIndex = k_basciLatinEnd; + private int m_sTypoAscender = 1024; + private int m_sTypoDescender = 0; + private int m_sTypoLineGap = 0; + private int m_usWinAscent = 1024; + private int m_usWinDescent = 0; + long m_ulCodePageRange1 = 0; + long m_ulCodePageRange2 = 0; + private int m_sxHeight = 512; + private int m_sCapHeight = 1024; + int m_usDefaultChar = 0x0; + int m_usBreakChar = 0x20; + int m_usMaxContext = 1; + + public OS2Writer(HeadWriter a_head) { + super(); + + m_head = a_head; + } + + public void setCapHeight(int a_value) { + m_sCapHeight = a_value; + } + + public void setXHeight(int a_value) { + m_sxHeight = a_value; + } + + public void setTypoAscender(int a_value) { + m_sTypoAscender = a_value; + } + + public void setTypoDescender(int a_value) { + m_sTypoDescender = a_value; + } + + public void setTypoLineGap(int a_value) { + m_sTypoLineGap = a_value; + } + + public void setUnicodeRangeFlag(int a_pos) { + int which = a_pos / 32; + int where = a_pos % 32; + long what = 0x1 << where; + + switch (which) { + case 0: { + m_ulUnicodeRange1 |= what; + } break; + + case 1: { + m_ulUnicodeRange2 |= what; + } break; + + case 2: { + m_ulUnicodeRange3 |= what; + } break; + + case 3: { + m_ulUnicodeRange4 |= what; + } break; + } // switch + } + + public void setCodePageRangeFlag(int a_pos) { + int which = a_pos / 32; + int where = a_pos % 32; + long what = 0x1 << where; + + switch (which) { + case 0: { + m_ulCodePageRange1 |= what; + } break; + + case 1: { + m_ulCodePageRange2 |= what; + } break; + } // switch + } + + public void write() throws IOException { + m_usWinAscent = m_head.getMax().y; + m_usWinDescent = 0; + if (m_head.getMin().y < 0) { + m_usWinDescent = -m_head.getMin().y; + } + + // table version number + writeUInt16(0x02); + + writeInt16(m_xAvgCharWidth); + writeUInt16(m_usWeightClass); + writeUInt16(m_usWidthClass); + writeInt16(m_fsType); + writeInt16(m_ySubscriptXSize); + writeInt16(m_ySubscriptYSize); + writeInt16(m_ySubscriptXOffset); + writeInt16(m_ySubscriptYOffset); + writeInt16(m_ySuperscriptXSize); + writeInt16(m_ySuperscriptYSize); + writeInt16(m_ySuperscriptXOffset); + writeInt16(m_ySuperscriptYOffset); + writeInt16(m_yStrikeoutSize); + writeInt16(m_yStrikeoutPosition); + writeInt16(m_sFamilyClass); + + writePanose(); + + writeUInt32(m_ulUnicodeRange1); + writeUInt32(m_ulUnicodeRange2); + writeUInt32(m_ulUnicodeRange3); + writeUInt32(m_ulUnicodeRange4); + writeTag(m_vendId); + writeUInt16(m_fsSelection); + writeUInt16(m_usFirstCharIndex); + writeUInt16(m_usLastCharIndex); + writeUInt16(m_sTypoAscender); + writeUInt16(m_sTypoDescender); + writeUInt16(m_sTypoLineGap); + writeUInt16(m_usWinAscent); + writeUInt16(m_usWinDescent); + writeUInt32(m_ulCodePageRange1); + writeUInt32(m_ulCodePageRange2); + writeInt16(m_sxHeight); + writeInt16(m_sCapHeight); + writeUInt16(m_usDefaultChar); + writeUInt16(m_usBreakChar); + writeUInt16(m_usMaxContext); + + pad(); + } + + private void writePanose() throws IOException { + writeUInt8(0); // family + writeUInt8(0); // serif + writeUInt8(0); // weight + writeUInt8(0); // proportion + writeUInt8(0); // contrast + writeUInt8(0); // stroke + writeUInt8(0); // arm style + writeUInt8(0); // letterform + writeUInt8(0); // midline + writeUInt8(0); // x-height + } + + protected String getTag() { + return "OS/2 "; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/PostWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/PostWriter.java index ecd99a16b..b7ac25959 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/PostWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/PostWriter.java @@ -1,76 +1,76 @@ -/* - * $Id: PostWriter.java,v 1.3 2004/01/11 13:14:45 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - - -package org.doubletype.ossa.truetype; - -import java.io.*; - -/** - * @author e.e - */ -public class PostWriter extends FontFormatWriter { - boolean m_isMonospaced = false; - - public PostWriter() { - super(); - } - - public void write() throws IOException { - // table version number - writeFixed32(1.0); - writeFixed32(10.0); // italic angle - writeFWord(0); // underline pos - writeFWord(60); // underline thickness - - if (m_isMonospaced) { - writeUInt32(1); // fixed pitch - } else { - writeUInt32(0); - } // if - - // vm memory stuff - writeUInt32(0); - writeUInt32(0); - writeUInt32(0); - writeUInt32(0); - - pad(); - } - - protected String getTag() { - return "post"; - } -} +/* + * $Id: PostWriter.java,v 1.3 2004/01/11 13:14:45 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + + +package org.doubletype.ossa.truetype; + +import java.io.*; + +/** + * @author e.e + */ +public class PostWriter extends FontFormatWriter { + boolean m_isMonospaced = false; + + public PostWriter() { + super(); + } + + public void write() throws IOException { + // table version number + writeFixed32(1.0); + writeFixed32(10.0); // italic angle + writeFWord(0); // underline pos + writeFWord(60); // underline thickness + + if (m_isMonospaced) { + writeUInt32(1); // fixed pitch + } else { + writeUInt32(0); + } + + // vm memory stuff + writeUInt32(0); + writeUInt32(0); + writeUInt32(0); + writeUInt32(0); + + pad(); + } + + protected String getTag() { + return "post"; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/TTCodePage.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/TTCodePage.java index ccf0398a0..b619a1e1c 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/TTCodePage.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/TTCodePage.java @@ -1,189 +1,189 @@ -/* - * $Id: TTCodePage.java,v 1.3 2004/05/16 12:59:07 eed3si9n Exp $ - * - * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.truetype; - -import java.util.*; -import java.nio.charset.*; - -/** - * @author e.e - */ -public class TTCodePage { - static public TTCodePage US_ASCII = new TTCodePage("US-ASCII", - "US-ASCII", - 64); - static public TTCodePage Latin_1 = new TTCodePage("windows-1252", - "Latin 1 windows-1252", - 0); - static private boolean s_isInitialized = false; - static private ArrayList s_list = new ArrayList<>(); - - static public String [] getNames() { - initList(); - String [] retval = new String[s_list.size()]; - int i; - for (i = 0; i < s_list.size(); i++) { - TTCodePage codePage = (TTCodePage) s_list.get(i); - retval[i] = codePage.getName(); - } // for i - - return retval; - } - - static public TTCodePage forName(String a_name) { - initList(); - - TTCodePage retval = null; - for (TTCodePage codePage: s_list) { - if (codePage.getName().equals(a_name)) { - return codePage; - } - } // for - - for (TTCodePage codePage: s_list) { - if (codePage.getCharset() == null) { - continue; - } // if - - if (codePage.getCharset().name().equals(a_name)) { - return codePage; - } - } // for - - return retval; - } - - static private void initList() { - if (s_isInitialized) - return; - - s_isInitialized = true; - - s_list.add(US_ASCII); - s_list.add(Latin_1); - s_list.add(new TTCodePage("ISO-2022-JP", - "Japan-JIS", - 17)); - s_list.add(new TTCodePage("windows-1250", - "Latin 2: Eastern Europe windows-1250", - 1)); - s_list.add(new TTCodePage("windows-1251", - "Cyrillic windows-1251", - 2)); - s_list.add(new TTCodePage("windows-1253", - "Greek windows-1253", - 3)); - s_list.add(new TTCodePage("windows-1254", - "Turkish windows-1254", - 4)); - s_list.add(new TTCodePage("windows-1258", - "Vietnamese windows-1258", - 8)); - - - // extended - s_list.add(new TTCodePage("windows-1255", - "Hebrew windows-1255", - 5)); - s_list.add(new TTCodePage("windows-1256", - "Arabic windows-1256", - 6)); - s_list.add(new TTCodePage("windows-1257", - "Windows Baltic", - 7)); - - // TODO: 16 Thai 874 - s_list.add(new TTCodePage( - "Thai windows-874", - 16)); - - s_list.add(new TTCodePage("x-mswin-936", - "Chinese: Simplified", - 18)); - - // TODO: 19 Korean Wansung - s_list.add(new TTCodePage( - "Korean Wansung", - 19)); - - s_list.add(new TTCodePage("x-windows-950", - "Chinese: Traditional", - 20)); - } - - - private String m_name; - - /** http://www.microsoft.com/typography/otspec/os2.htm - */ - private int m_osTwoFlag = 0; - private Charset m_charset = null; - - public TTCodePage(String a_charsetName, String a_name, - int a_osTwoFlag) - { - if (Charset.isSupported(a_charsetName)) { - m_charset = Charset.forName(a_charsetName); - } // if - - m_name = a_name; - m_osTwoFlag = a_osTwoFlag; - } - - public TTCodePage(String a_name, - int a_osTwoFlag) - { - m_name = a_name; - m_osTwoFlag = a_osTwoFlag; - } - - public String toString() { - return m_name; - } - - public String getName() { - return m_name; - } - - - public Charset getCharset() { - return m_charset; - } - - public int getOsTwoFlag() { - return m_osTwoFlag; - } -} +/* + * $Id: TTCodePage.java,v 1.3 2004/05/16 12:59:07 eed3si9n Exp $ + * + * $Copyright: copyright (c) 2003-2004, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + +package org.doubletype.ossa.truetype; + +import java.util.*; +import java.nio.charset.*; + +/** + * @author e.e + */ +public class TTCodePage { + static public TTCodePage US_ASCII = new TTCodePage("US-ASCII", + "US-ASCII", + 64); + static public TTCodePage Latin_1 = new TTCodePage("windows-1252", + "Latin 1 windows-1252", + 0); + static private boolean s_isInitialized = false; + static private ArrayList s_list = new ArrayList<>(); + + static public String [] getNames() { + initList(); + String [] retval = new String[s_list.size()]; + int i; + for (i = 0; i < s_list.size(); i++) { + TTCodePage codePage = (TTCodePage) s_list.get(i); + retval[i] = codePage.getName(); + } + + return retval; + } + + static public TTCodePage forName(String a_name) { + initList(); + + TTCodePage retval = null; + for (TTCodePage codePage: s_list) { + if (codePage.getName().equals(a_name)) { + return codePage; + } + } // for + + for (TTCodePage codePage: s_list) { + if (codePage.getCharset() == null) { + continue; + } + + if (codePage.getCharset().name().equals(a_name)) { + return codePage; + } + } // for + + return retval; + } + + static private void initList() { + if (s_isInitialized) + return; + + s_isInitialized = true; + + s_list.add(US_ASCII); + s_list.add(Latin_1); + s_list.add(new TTCodePage("ISO-2022-JP", + "Japan-JIS", + 17)); + s_list.add(new TTCodePage("windows-1250", + "Latin 2: Eastern Europe windows-1250", + 1)); + s_list.add(new TTCodePage("windows-1251", + "Cyrillic windows-1251", + 2)); + s_list.add(new TTCodePage("windows-1253", + "Greek windows-1253", + 3)); + s_list.add(new TTCodePage("windows-1254", + "Turkish windows-1254", + 4)); + s_list.add(new TTCodePage("windows-1258", + "Vietnamese windows-1258", + 8)); + + + // extended + s_list.add(new TTCodePage("windows-1255", + "Hebrew windows-1255", + 5)); + s_list.add(new TTCodePage("windows-1256", + "Arabic windows-1256", + 6)); + s_list.add(new TTCodePage("windows-1257", + "Windows Baltic", + 7)); + + // TODO: 16 Thai 874 + s_list.add(new TTCodePage( + "Thai windows-874", + 16)); + + s_list.add(new TTCodePage("x-mswin-936", + "Chinese: Simplified", + 18)); + + // TODO: 19 Korean Wansung + s_list.add(new TTCodePage( + "Korean Wansung", + 19)); + + s_list.add(new TTCodePage("x-windows-950", + "Chinese: Traditional", + 20)); + } + + + private String m_name; + + /** http://www.microsoft.com/typography/otspec/os2.htm + */ + private int m_osTwoFlag = 0; + private Charset m_charset = null; + + public TTCodePage(String a_charsetName, String a_name, + int a_osTwoFlag) + { + if (Charset.isSupported(a_charsetName)) { + m_charset = Charset.forName(a_charsetName); + } + + m_name = a_name; + m_osTwoFlag = a_osTwoFlag; + } + + public TTCodePage(String a_name, + int a_osTwoFlag) + { + m_name = a_name; + m_osTwoFlag = a_osTwoFlag; + } + + public String toString() { + return m_name; + } + + public String getName() { + return m_name; + } + + + public Charset getCharset() { + return m_charset; + } + + public int getOsTwoFlag() { + return m_osTwoFlag; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/TTGlyph.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/TTGlyph.java index de32707b3..775f0a977 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/TTGlyph.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/TTGlyph.java @@ -1,391 +1,391 @@ -/* - * $Copyright: copyright (c) 2003-2008, e.e d3si9n $ - * $License: - * This source code is part of DoubleType. - * DoubleType is a graphical typeface designer. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, e.e d3si9n gives permission to - * link the code of this program with any Java Platform that is available - * to public with free of charge, including but not limited to - * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), - * and distribute linked combinations including the two. - * You must obey the GNU General Public License in all respects for all - * of the code used other than Java Platform. If you modify this file, - * you may extend this exception to your version of the file, but you are not - * obligated to do so. If you do not wish to do so, delete this exception - * statement from your version. - * $ - */ - -package org.doubletype.ossa.truetype; - -import java.awt.*; -import java.util.*; - -/** - * @author e.e - */ -public class TTGlyph { - // -------------------------------------------------------------- - public static final int k_onCurve = 0x1; - - public static final int ARG_1_AND_2_ARE_WORDS = 0x1; - public static final int ARGS_ARE_XY_VALUES = 0x2; - public static final int ROUND_XY_TO_GRID = 0x4; - public static final int WE_HAVE_A_SCALE = 0x8; - // 0x10 is obsolete - public static final int MORE_COMPONENTS = 0x20; - public static final int WE_HAVE_AN_X_AND_Y_SCALE = 0x40; - public static final int WE_HAVE_A_TWO_BY_TWO = 0x80; - public static final int WE_HAVE_INSTRUCTIONS = 0x100; - public static final int USE_MY_METRICS = 0x200; - public static final int OVERLAP_COMPOUND = 0x400; - - /** Move Direct Absolute Point - do not round */ - public static final int MDAP0 = 0x2E; - - /** Move Direct Absolute Point - round the value */ - public static final int MDAP1 = 0x2F; - - /** Interpolate Untouched Points through the outline - y-direction */ - public static final int IUP0 = 0x30; - - /** Interpolate Untouched Points through the outline - x-direction */ - public static final int IUP1 = 0x31; - - /** push one byte */ - public static final int PUSHB000 = 0xB0; - - /** push two bytes */ - public static final int PUSHB001 = 0xB1; - - /** push three bytes */ - public static final int PUSHB010 = 0xB2; - public static final int PUSHB011 = 0xB3; - public static final int PUSHB100 = 0xB4; - public static final int PUSHB101 = 0xB5; - public static final int PUSHB110 = 0xB6; - public static final int PUSHB111 = 0xB7; - - /** set vector to y-axis. */ - public static final int SVTCA0 = 0x00; - - /** set vector to x-axis. */ - public static final int SVTCA1 = 0x01; - public static final int SPVFS = 0x0A; // set projection vector - public static final int SFVFS = 0x0B; // set freedom vector - public static final int SFVTPV = 0x0E; - public static final int DELTAP1 = 0x5D; - public static final int DELTAP2 = 0x71; - public static final int DELTAP3 = 0x72; - - /** set delta base */ - public static final int SDB = 0x5E; - - // -------------------------------------------------------------- - - /** - * converts double into F2Dot14, 16 bit fixed point format. - * @param a_value - * @return - */ - public static int toF2Dot14(double a_value) { - int retval = 0; - - if (a_value >= 2.0 || a_value < -2.0) { - throw new RuntimeException(Double.toString(a_value) + " out of range"); - } // if - - int mantissa = (int) Math.floor(a_value); - int fraction = (int) Math.floor((a_value - mantissa) * 16384); - - int twoBitPart = mantissa; - if (mantissa < 0) { - twoBitPart = 4 + mantissa; - } // if - - retval = (twoBitPart << 14) | fraction; - - return retval; - } - - public static int toDeltaArg(int a_relativePpem, int a_step) { - int retval = 0; - - if (a_step < -8 || a_step > 8 || a_step == 0) { - throw new RuntimeException("Out of range"); - } // if - - int selector = 0; - if (a_step > 0) { - selector = a_step + 7; - } else { - selector = a_step + 8; - } // if - - retval = (a_relativePpem << 4) | (selector); - - return retval; - } - - // -------------------------------------------------------------- - - private ArrayList m_points = new ArrayList<>(); - private ArrayList m_endPtsOfContours = new ArrayList<>(); - private ArrayList m_instructions = new ArrayList<>(); - private ArrayList m_flags = new ArrayList<>(); - private ArrayList m_glyfIndeces = new ArrayList<>(); - private ArrayList m_arg1s = new ArrayList<>(); - private ArrayList m_arg2s = new ArrayList<>(); - - private boolean m_isSimple = true; - private int m_advanceWidth = 512; - - private int m_numOfCompositePoints = 0; - private int m_numOfCompositeContours = 0; - private int m_componentDepth = 0; - - private Point m_min = null; - private Point m_max = null; - - // -------------------------------------------------------------- - - public TTGlyph() { - init(); - } - - public void init() { - m_isSimple = true; - m_points.clear(); - m_endPtsOfContours.clear(); - m_instructions.clear(); - m_flags.clear(); - m_glyfIndeces.clear(); - m_arg1s.clear(); - m_arg2s.clear(); - m_advanceWidth = 512; - } - - public void buildCompound() { - init(); - - m_isSimple = false; - - addFlag(ARG_1_AND_2_ARE_WORDS - | ARGS_ARE_XY_VALUES - | ROUND_XY_TO_GRID - | MORE_COMPONENTS); - addFlag(ARG_1_AND_2_ARE_WORDS - | ARGS_ARE_XY_VALUES - | ROUND_XY_TO_GRID); - - addGlyfIndex(3); - addGlyfIndex(3); - - addArg1(0); - addArg2(0); - addArg1(0); - addArg2(500); - } - - /** - * add the index of the last point in the contour - * @param a_index - */ - public void addEndPoint(int a_value) { - m_endPtsOfContours.add(a_value); - } - - public int getNumOfContours() { - if (isSimple()) { - return m_endPtsOfContours.size(); - } else { - return -1; - } // if-else - } - - public int getEndPoint(int a_index) { - return m_endPtsOfContours.get(a_index); - } - - public int getAdvanceWidth() { - return m_advanceWidth; - } - - public void setAdvanceWidth(int a_value) { - m_advanceWidth = a_value; - } - - public Point getMax() { - if (m_max == null) { - m_max = new Point(0, 0); - } // if - - return m_max; - } - - public Point getMin() { - if (m_min == null) { - m_min = new Point(0, 0); - } // if - - return m_min; - } - - public boolean isSimple() { - return m_isSimple; - } - - public void setSimple(boolean a_isSimple) { - m_isSimple = a_isSimple; - } - - public void addInstruction(int a_value) { - m_instructions.add(a_value); - } - - public int getInstruction(int a_index) { - return m_instructions.get(a_index); - } - - public int getNumOfInstructions() { - return m_instructions.size(); - } - - public void addFlag(int a_value) { - m_flags.add(a_value); - } - - public int getFlag(int a_index) { - return m_flags.get(a_index); - } - - public int getNumOfFlags() { - return m_flags.size(); - } - - public void addPoint(Point a_value) { - m_points.add(a_value); - updateMinMax(a_value); - } - - private void updateMinMax(Point a_value) { - if (m_max == null) { - m_max = new Point(a_value); - } // if - - if (m_min == null) { - m_min = new Point(a_value); - } // if - - if (a_value.x > m_max.x) { - m_max.x = a_value.x; - } // if - - if (a_value.x < m_min.x) { - m_min.x = a_value.x; - } // if - - if (a_value.y > m_max.y) { - m_max.y = a_value.y; - } // if - - if (a_value.y < m_min.y) { - m_min.y = a_value.y; - } // if - } - - public Point getPoint(int a_index) { - return m_points.get(a_index); - } - - public int getNumOfPoints() { - return m_points.size(); - } - - public int getLastIndex() { - return m_points.size() - 1; - } - - public void addGlyfIndex(int a_value) { - m_glyfIndeces.add(a_value); - } - - public int getGlyfIndex(int a_index) { - return m_glyfIndeces.get(a_index); - } - - public void addArg1(int a_value) { - m_arg1s.add(a_value); - } - - public int getArg1(int a_index) { - return m_arg1s.get(a_index); - } - - public void addArg2(int a_value) { - m_arg2s.add(a_value); - } - - public int getArg2(int a_index) { - return m_arg2s.get(a_index); - } - - public int getNumOfCompositePoints() { - if (isSimple()) { - return getNumOfPoints(); - } else { - return m_numOfCompositePoints; - } - } - - public void setNumOfCompositePoints(int a_value) { - m_numOfCompositePoints = a_value; - } - - public int getNumOfCompositeContours() { - if (isSimple()) { - return getNumOfContours(); - } else { - return m_numOfCompositeContours; - } // if-else - } - - public void setNumOfCompositeContours(int a_value) { - m_numOfCompositeContours = a_value; - } - - public int getComponentDepth() { - if (isSimple()) { - return 0; - } else { - return m_componentDepth; - } // if-else - } - - public void setComponentDepth(int a_value) { - m_componentDepth = a_value; - } - - public int getLeftSideBearing() { - return getMin().x; - } - - public int getRightSideBearing() { - return getAdvanceWidth() - getMax().x; - } -} +/* + * $Copyright: copyright (c) 2003-2008, e.e d3si9n $ + * $License: + * This source code is part of DoubleType. + * DoubleType is a graphical typeface designer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, e.e d3si9n gives permission to + * link the code of this program with any Java Platform that is available + * to public with free of charge, including but not limited to + * Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE), + * and distribute linked combinations including the two. + * You must obey the GNU General Public License in all respects for all + * of the code used other than Java Platform. If you modify this file, + * you may extend this exception to your version of the file, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your version. + * $ + */ + +package org.doubletype.ossa.truetype; + +import java.awt.*; +import java.util.*; + +/** + * @author e.e + */ +public class TTGlyph { + // -------------------------------------------------------------- + public static final int k_onCurve = 0x1; + + public static final int ARG_1_AND_2_ARE_WORDS = 0x1; + public static final int ARGS_ARE_XY_VALUES = 0x2; + public static final int ROUND_XY_TO_GRID = 0x4; + public static final int WE_HAVE_A_SCALE = 0x8; + // 0x10 is obsolete + public static final int MORE_COMPONENTS = 0x20; + public static final int WE_HAVE_AN_X_AND_Y_SCALE = 0x40; + public static final int WE_HAVE_A_TWO_BY_TWO = 0x80; + public static final int WE_HAVE_INSTRUCTIONS = 0x100; + public static final int USE_MY_METRICS = 0x200; + public static final int OVERLAP_COMPOUND = 0x400; + + /** Move Direct Absolute Point - do not round */ + public static final int MDAP0 = 0x2E; + + /** Move Direct Absolute Point - round the value */ + public static final int MDAP1 = 0x2F; + + /** Interpolate Untouched Points through the outline - y-direction */ + public static final int IUP0 = 0x30; + + /** Interpolate Untouched Points through the outline - x-direction */ + public static final int IUP1 = 0x31; + + /** push one byte */ + public static final int PUSHB000 = 0xB0; + + /** push two bytes */ + public static final int PUSHB001 = 0xB1; + + /** push three bytes */ + public static final int PUSHB010 = 0xB2; + public static final int PUSHB011 = 0xB3; + public static final int PUSHB100 = 0xB4; + public static final int PUSHB101 = 0xB5; + public static final int PUSHB110 = 0xB6; + public static final int PUSHB111 = 0xB7; + + /** set vector to y-axis. */ + public static final int SVTCA0 = 0x00; + + /** set vector to x-axis. */ + public static final int SVTCA1 = 0x01; + public static final int SPVFS = 0x0A; // set projection vector + public static final int SFVFS = 0x0B; // set freedom vector + public static final int SFVTPV = 0x0E; + public static final int DELTAP1 = 0x5D; + public static final int DELTAP2 = 0x71; + public static final int DELTAP3 = 0x72; + + /** set delta base */ + public static final int SDB = 0x5E; + + // -------------------------------------------------------------- + + /** + * converts double into F2Dot14, 16 bit fixed point format. + * @param a_value + * @return + */ + public static int toF2Dot14(double a_value) { + int retval = 0; + + if (a_value >= 2.0 || a_value < -2.0) { + throw new RuntimeException(Double.toString(a_value) + " out of range"); + } + + int mantissa = (int) Math.floor(a_value); + int fraction = (int) Math.floor((a_value - mantissa) * 16384); + + int twoBitPart = mantissa; + if (mantissa < 0) { + twoBitPart = 4 + mantissa; + } + + retval = (twoBitPart << 14) | fraction; + + return retval; + } + + public static int toDeltaArg(int a_relativePpem, int a_step) { + int retval = 0; + + if (a_step < -8 || a_step > 8 || a_step == 0) { + throw new RuntimeException("Out of range"); + } + + int selector = 0; + if (a_step > 0) { + selector = a_step + 7; + } else { + selector = a_step + 8; + } + + retval = (a_relativePpem << 4) | (selector); + + return retval; + } + + // -------------------------------------------------------------- + + private ArrayList m_points = new ArrayList<>(); + private ArrayList m_endPtsOfContours = new ArrayList<>(); + private ArrayList m_instructions = new ArrayList<>(); + private ArrayList m_flags = new ArrayList<>(); + private ArrayList m_glyfIndeces = new ArrayList<>(); + private ArrayList m_arg1s = new ArrayList<>(); + private ArrayList m_arg2s = new ArrayList<>(); + + private boolean m_isSimple = true; + private int m_advanceWidth = 512; + + private int m_numOfCompositePoints = 0; + private int m_numOfCompositeContours = 0; + private int m_componentDepth = 0; + + private Point m_min = null; + private Point m_max = null; + + // -------------------------------------------------------------- + + public TTGlyph() { + init(); + } + + public void init() { + m_isSimple = true; + m_points.clear(); + m_endPtsOfContours.clear(); + m_instructions.clear(); + m_flags.clear(); + m_glyfIndeces.clear(); + m_arg1s.clear(); + m_arg2s.clear(); + m_advanceWidth = 512; + } + + public void buildCompound() { + init(); + + m_isSimple = false; + + addFlag(ARG_1_AND_2_ARE_WORDS + | ARGS_ARE_XY_VALUES + | ROUND_XY_TO_GRID + | MORE_COMPONENTS); + addFlag(ARG_1_AND_2_ARE_WORDS + | ARGS_ARE_XY_VALUES + | ROUND_XY_TO_GRID); + + addGlyfIndex(3); + addGlyfIndex(3); + + addArg1(0); + addArg2(0); + addArg1(0); + addArg2(500); + } + + /** + * add the index of the last point in the contour + * @param a_index + */ + public void addEndPoint(int a_value) { + m_endPtsOfContours.add(a_value); + } + + public int getNumOfContours() { + if (isSimple()) { + return m_endPtsOfContours.size(); + } else { + return -1; + } + } + + public int getEndPoint(int a_index) { + return m_endPtsOfContours.get(a_index); + } + + public int getAdvanceWidth() { + return m_advanceWidth; + } + + public void setAdvanceWidth(int a_value) { + m_advanceWidth = a_value; + } + + public Point getMax() { + if (m_max == null) { + m_max = new Point(0, 0); + } + + return m_max; + } + + public Point getMin() { + if (m_min == null) { + m_min = new Point(0, 0); + } + + return m_min; + } + + public boolean isSimple() { + return m_isSimple; + } + + public void setSimple(boolean a_isSimple) { + m_isSimple = a_isSimple; + } + + public void addInstruction(int a_value) { + m_instructions.add(a_value); + } + + public int getInstruction(int a_index) { + return m_instructions.get(a_index); + } + + public int getNumOfInstructions() { + return m_instructions.size(); + } + + public void addFlag(int a_value) { + m_flags.add(a_value); + } + + public int getFlag(int a_index) { + return m_flags.get(a_index); + } + + public int getNumOfFlags() { + return m_flags.size(); + } + + public void addPoint(Point a_value) { + m_points.add(a_value); + updateMinMax(a_value); + } + + private void updateMinMax(Point a_value) { + if (m_max == null) { + m_max = new Point(a_value); + } + + if (m_min == null) { + m_min = new Point(a_value); + } + + if (a_value.x > m_max.x) { + m_max.x = a_value.x; + } + + if (a_value.x < m_min.x) { + m_min.x = a_value.x; + } + + if (a_value.y > m_max.y) { + m_max.y = a_value.y; + } + + if (a_value.y < m_min.y) { + m_min.y = a_value.y; + } + } + + public Point getPoint(int a_index) { + return m_points.get(a_index); + } + + public int getNumOfPoints() { + return m_points.size(); + } + + public int getLastIndex() { + return m_points.size() - 1; + } + + public void addGlyfIndex(int a_value) { + m_glyfIndeces.add(a_value); + } + + public int getGlyfIndex(int a_index) { + return m_glyfIndeces.get(a_index); + } + + public void addArg1(int a_value) { + m_arg1s.add(a_value); + } + + public int getArg1(int a_index) { + return m_arg1s.get(a_index); + } + + public void addArg2(int a_value) { + m_arg2s.add(a_value); + } + + public int getArg2(int a_index) { + return m_arg2s.get(a_index); + } + + public int getNumOfCompositePoints() { + if (isSimple()) { + return getNumOfPoints(); + } else { + return m_numOfCompositePoints; + } + } + + public void setNumOfCompositePoints(int a_value) { + m_numOfCompositePoints = a_value; + } + + public int getNumOfCompositeContours() { + if (isSimple()) { + return getNumOfContours(); + } else { + return m_numOfCompositeContours; + } + } + + public void setNumOfCompositeContours(int a_value) { + m_numOfCompositeContours = a_value; + } + + public int getComponentDepth() { + if (isSimple()) { + return 0; + } else { + return m_componentDepth; + } + } + + public void setComponentDepth(int a_value) { + m_componentDepth = a_value; + } + + public int getLeftSideBearing() { + return getMin().x; + } + + public int getRightSideBearing() { + return getAdvanceWidth() - getMax().x; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/TTPixelSize.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/TTPixelSize.java index d81b15dc7..a417d40f3 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/TTPixelSize.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/TTPixelSize.java @@ -1,107 +1,107 @@ -package org.doubletype.ossa.truetype; - -import java.util.ArrayList; - -public class TTPixelSize { - static private int s_em = 1024; - static private boolean s_isInitialized = false; - static private ArrayList s_list = new ArrayList<>(); - - static public int getEm() { - return s_em; - } - - static public ArrayList getList() { - initList(); - return s_list; - } - - static private void initList() { - if (s_isInitialized) - return; - - s_isInitialized = true; - - // s_list.add(new TTPixelSize(9, "9px: 7pt(96dpi)/9pt(72dpi)")); - // s_list.add(new TTPixelSize(10, "10px: 7.5pt(96dpi)/10pt(72dpi)")); - s_list.add(new TTPixelSize(11, "11px: 8pt(96dpi)/11pt(72dpi)")); - s_list.add(new TTPixelSize(12, "12px: 9pt(96dpi)/12pt(72dpi)")); - s_list.add(new TTPixelSize(13, "13px: 10pt(96dpi)/13pt(72dpi)")); - s_list.add(new TTPixelSize(14, "14px: 10.5pt(96dpi)/14pt(72dpi)")); - s_list.add(new TTPixelSize(15, "15px: 11pt(96dpi)/15pt(72dpi)")); - s_list.add(new TTPixelSize(16, "16px: 12pt(96dpi)/16pt(72dpi)")); - s_list.add(new TTPixelSize(17, "17px: 13pt(96dpi)/17pt(72dpi)")); - s_list.add(new TTPixelSize(18, "18px: 13.5pt(96dpi)/18pt(72dpi)")); - s_list.add(new TTPixelSize(19, "19px: 14pt(96dpi)/14pt(72dpi)")); - s_list.add(new TTPixelSize(20, "20px: 15pt(96dpi)/20pt(72dpi)")); - s_list.add(new TTPixelSize(21, "21px: 16pt(96dpi)/21pt(72dpi)")); - s_list.add(new TTPixelSize(22, "22px: 16.5pt(96dpi)/22pt(72dpi)")); - s_list.add(new TTPixelSize(23, "23px: 17pt(96dpi)/23pt(72dpi)")); - s_list.add(new TTPixelSize(24, "24px: 18pt(96dpi)/24pt(72dpi)")); - s_list.add(new TTPixelSize(27, "27px: 20pt(96dpi)")); - s_list.add(new TTPixelSize(29, "29px: 22pt(96dpi)")); - s_list.add(new TTPixelSize(32, "32px: 24pt(96dpi)")); - s_list.add(new TTPixelSize(33, "33px: 8pt(300dpi) ")); - // s_list.add(new TTPixelSize(35, "35px: 26pt(96dpi) ")); - s_list.add(new TTPixelSize(37, "37px: 28pt(96dpi)")); - // s_list.add(new TTPixelSize(38, "38px: 9pt(300dpi)"); - s_list.add(new TTPixelSize(42, "42px: 10pt(300dpi)")); - // s_list.add(new TTPixelSize(44, "44px: 10.5pt(300dpi)")); - s_list.add(new TTPixelSize(46, "46px: 11pt(300dpi)")); - s_list.add(new TTPixelSize(50, "50px: 12pt(300dpi)")); - s_list.add(new TTPixelSize(54, "54px: 13pt(300dpi)")); - s_list.add(new TTPixelSize(58, "58px: 14pt(300dpi)")); - s_list.add(new TTPixelSize(67, "67px: 16pt(300dpi)")); - s_list.add(new TTPixelSize(75, "75px: 18pt(300dpi)")); - s_list.add(new TTPixelSize(83, "83px: 20pt(300dpi)")); - s_list.add(new TTPixelSize(92, "92px: 22pt(300dpi)")); - s_list.add(new TTPixelSize(100, "100px: 24pt(300dpi)")); - } - - private int m_pixel; - private String m_description; - private int m_pixelWidths[]; - private int m_maxPixelWidth = 0; - - public TTPixelSize(int a_pixel, String a_description) - { - m_pixel = a_pixel; - m_description = a_description; - } - - public int getPixel() { - return m_pixel; - } - - public String getDescription() { - return m_description; - } - - /** - * sets the size of the pixel widths. Use num of glyphs. - * @param a_size - */ - public void setPixelWidthsSize(int a_size) { - m_pixelWidths = new int[a_size]; - m_maxPixelWidth = 0; - } - - public void setPixelWidth(int a_glyphIndex, int a_value) { - m_pixelWidths[a_glyphIndex] = a_value; - if (a_value > m_maxPixelWidth) { - m_maxPixelWidth = a_value; - } // if - } - - public int [] getPixelWidths() { - return m_pixelWidths; - } - - public int getPixelWidth(int a_glyphIndex) { - return m_pixelWidths[a_glyphIndex]; - } - - public int getMaxPixelWidth() { - return m_maxPixelWidth; - } -} +package org.doubletype.ossa.truetype; + +import java.util.ArrayList; + +public class TTPixelSize { + static private int s_em = 1024; + static private boolean s_isInitialized = false; + static private ArrayList s_list = new ArrayList<>(); + + static public int getEm() { + return s_em; + } + + static public ArrayList getList() { + initList(); + return s_list; + } + + static private void initList() { + if (s_isInitialized) + return; + + s_isInitialized = true; + + // s_list.add(new TTPixelSize(9, "9px: 7pt(96dpi)/9pt(72dpi)")); + // s_list.add(new TTPixelSize(10, "10px: 7.5pt(96dpi)/10pt(72dpi)")); + s_list.add(new TTPixelSize(11, "11px: 8pt(96dpi)/11pt(72dpi)")); + s_list.add(new TTPixelSize(12, "12px: 9pt(96dpi)/12pt(72dpi)")); + s_list.add(new TTPixelSize(13, "13px: 10pt(96dpi)/13pt(72dpi)")); + s_list.add(new TTPixelSize(14, "14px: 10.5pt(96dpi)/14pt(72dpi)")); + s_list.add(new TTPixelSize(15, "15px: 11pt(96dpi)/15pt(72dpi)")); + s_list.add(new TTPixelSize(16, "16px: 12pt(96dpi)/16pt(72dpi)")); + s_list.add(new TTPixelSize(17, "17px: 13pt(96dpi)/17pt(72dpi)")); + s_list.add(new TTPixelSize(18, "18px: 13.5pt(96dpi)/18pt(72dpi)")); + s_list.add(new TTPixelSize(19, "19px: 14pt(96dpi)/14pt(72dpi)")); + s_list.add(new TTPixelSize(20, "20px: 15pt(96dpi)/20pt(72dpi)")); + s_list.add(new TTPixelSize(21, "21px: 16pt(96dpi)/21pt(72dpi)")); + s_list.add(new TTPixelSize(22, "22px: 16.5pt(96dpi)/22pt(72dpi)")); + s_list.add(new TTPixelSize(23, "23px: 17pt(96dpi)/23pt(72dpi)")); + s_list.add(new TTPixelSize(24, "24px: 18pt(96dpi)/24pt(72dpi)")); + s_list.add(new TTPixelSize(27, "27px: 20pt(96dpi)")); + s_list.add(new TTPixelSize(29, "29px: 22pt(96dpi)")); + s_list.add(new TTPixelSize(32, "32px: 24pt(96dpi)")); + s_list.add(new TTPixelSize(33, "33px: 8pt(300dpi) ")); + // s_list.add(new TTPixelSize(35, "35px: 26pt(96dpi) ")); + s_list.add(new TTPixelSize(37, "37px: 28pt(96dpi)")); + // s_list.add(new TTPixelSize(38, "38px: 9pt(300dpi)"); + s_list.add(new TTPixelSize(42, "42px: 10pt(300dpi)")); + // s_list.add(new TTPixelSize(44, "44px: 10.5pt(300dpi)")); + s_list.add(new TTPixelSize(46, "46px: 11pt(300dpi)")); + s_list.add(new TTPixelSize(50, "50px: 12pt(300dpi)")); + s_list.add(new TTPixelSize(54, "54px: 13pt(300dpi)")); + s_list.add(new TTPixelSize(58, "58px: 14pt(300dpi)")); + s_list.add(new TTPixelSize(67, "67px: 16pt(300dpi)")); + s_list.add(new TTPixelSize(75, "75px: 18pt(300dpi)")); + s_list.add(new TTPixelSize(83, "83px: 20pt(300dpi)")); + s_list.add(new TTPixelSize(92, "92px: 22pt(300dpi)")); + s_list.add(new TTPixelSize(100, "100px: 24pt(300dpi)")); + } + + private int m_pixel; + private String m_description; + private int m_pixelWidths[]; + private int m_maxPixelWidth = 0; + + public TTPixelSize(int a_pixel, String a_description) + { + m_pixel = a_pixel; + m_description = a_description; + } + + public int getPixel() { + return m_pixel; + } + + public String getDescription() { + return m_description; + } + + /** + * sets the size of the pixel widths. Use num of glyphs. + * @param a_size + */ + public void setPixelWidthsSize(int a_size) { + m_pixelWidths = new int[a_size]; + m_maxPixelWidth = 0; + } + + public void setPixelWidth(int a_glyphIndex, int a_value) { + m_pixelWidths[a_glyphIndex] = a_value; + if (a_value > m_maxPixelWidth) { + m_maxPixelWidth = a_value; + } + } + + public int [] getPixelWidths() { + return m_pixelWidths; + } + + public int getPixelWidth(int a_glyphIndex) { + return m_pixelWidths[a_glyphIndex]; + } + + public int getMaxPixelWidth() { + return m_maxPixelWidth; + } +} diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/TTUnicodeRange.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/TTUnicodeRange.java index 0437f0f36..95e5c8df1 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/TTUnicodeRange.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/TTUnicodeRange.java @@ -65,8 +65,8 @@ public class TTUnicodeRange implements Comparable { TTUnicodeRange range = s_list.get(i); if (range.m_block.equals(block)) { return range; - } // if - } // for i + } + } return retval; } @@ -300,8 +300,8 @@ public class TTUnicodeRange implements Comparable { s_selected = range; return true; - } // if - } // for i + } + } return false; } diff --git a/libsrc/ttf/src/org/doubletype/ossa/xml/AbstractGlyphFactory.java b/libsrc/ttf/src/org/doubletype/ossa/xml/AbstractGlyphFactory.java deleted file mode 100644 index d2d75cb43..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/xml/AbstractGlyphFactory.java +++ /dev/null @@ -1,3291 +0,0 @@ -/* - * The Relaxer artifact - * Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package org.doubletype.ossa.xml; - -import java.io.*; -import java.net.URL; -import javax.xml.parsers.*; -import org.w3c.dom.*; -import org.xml.sax.*; - -/** - * AbstractGlyphFactory is generated by Relaxer based on glyph.rng. - * - * @version glyph.rng 1.0 (Tue Nov 09 20:22:48 EST 2004) - * @author Relaxer 1.1b (http://www.relaxer.org) - */ -public abstract class AbstractGlyphFactory implements IGlyphFactory { - protected org.xml.sax.ErrorHandler errorHandler; - protected org.xml.sax.EntityResolver entityResolver; - protected String baseUri; - - /** - * Gets a Class of XParamListParam. - * - * @return Class - */ - public Class getXParamListParamClass() { - return (createXParamListParam().getClass()); - } - - /** - * Gets a Class of XHeadGlobal. - * - * @return Class - */ - public Class getXHeadGlobalClass() { - return (createXHeadGlobal().getClass()); - } - - /** - * Gets a Class of XHeadLocal. - * - * @return Class - */ - public Class getXHeadLocalClass() { - return (createXHeadLocal().getClass()); - } - - /** - * Gets a Class of XHead. - * - * @return Class - */ - public Class getXHeadClass() { - return (createXHead().getClass()); - } - - /** - * Gets a Class of XGlyphFile. - * - * @return Class - */ - public Class getXGlyphFileClass() { - return (createXGlyphFile().getClass()); - } - - /** - * Gets a Class of XContour. - * - * @return Class - */ - public Class getXContourClass() { - return (createXContour().getClass()); - } - - /** - * Gets a Class of XPoint2d. - * - * @return Class - */ - public Class getXPoint2dClass() { - return (createXPoint2d().getClass()); - } - - /** - * Gets a Class of XInvokePos. - * - * @return Class - */ - public Class getXInvokePosClass() { - return (createXInvokePos().getClass()); - } - - /** - * Gets a Class of XInvokeArg. - * - * @return Class - */ - public Class getXInvokeArgClass() { - return (createXInvokeArg().getClass()); - } - - /** - * Gets a Class of XInvokeVarg. - * - * @return Class - */ - public Class getXInvokeVargClass() { - return (createXInvokeVarg().getClass()); - } - - /** - * Gets a Class of XInvoke. - * - * @return Class - */ - public Class getXInvokeClass() { - return (createXInvoke().getClass()); - } - - /** - * Gets a Class of XInclude. - * - * @return Class - */ - public Class getXIncludeClass() { - return (createXInclude().getClass()); - } - - /** - * Gets a Class of XModule. - * - * @return Class - */ - public Class getXModuleClass() { - return (createXModule().getClass()); - } - - /** - * Gets a Class of XBody. - * - * @return Class - */ - public Class getXBodyClass() { - return (createXBody().getClass()); - } - - /** - * Gets a Class of XStartGlyphElement. - * - * @return Class - */ - public Class getXStartGlyphElementClass() { - return (createXStartGlyphElement().getClass()); - } - - /** - * Gets a Class of XControlPoint. - * - * @return Class - */ - public Class getXControlPointClass() { - return (createXControlPoint().getClass()); - } - - /** - * Gets a Class of XHint. - * - * @return Class - */ - public Class getXHintClass() { - return (createXHint().getClass()); - } - - /** - * Gets a Class of XContourPoint. - * - * @return Class - */ - public Class getXContourPointClass() { - return (createXContourPoint().getClass()); - } - - /** - * Gets a Class of XParamList. - * - * @return Class - */ - public Class getXParamListClass() { - return (createXParamList().getClass()); - } - - /** - * Sets a errorHandler. - * - * @param errorHandler - */ - public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler) { - this.errorHandler = errorHandler; - } - - /** - * Gets a errorHandler. - * - * @return org.xml.sax.ErrorHandler - */ - public org.xml.sax.ErrorHandler getErrorHandler() { - return (errorHandler); - } - - /** - * Sets a entityResolver. - * - * @param entityResolver - */ - public void setEntityResolver(org.xml.sax.EntityResolver entityResolver) { - this.entityResolver = entityResolver; - } - - /** - * Gets a entityResolver. - * - * @return org.xml.sax.EntityResolver - */ - public org.xml.sax.EntityResolver getEntityResolver() { - return (entityResolver); - } - - /** - * Sets a baseUri. - * - * @param baseUri - */ - public void setBaseUri(String baseUri) { - this.baseUri = baseUri; - } - - /** - * Gets a baseUri. - * - * @return String - */ - public String getBaseUri() { - return (baseUri); - } - - /** - * Creates a Object by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - public Object create(File file) throws IOException, SAXException, ParserConfigurationException { - Object node = create(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (node); - } - - /** - * Creates a Object by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - public Object create(String uri) throws IOException, SAXException, ParserConfigurationException { - Object node = create(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (node); - } - - /** - * Creates a Object by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - public Object create(URL url) throws IOException, SAXException, ParserConfigurationException { - Object node = create(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (node); - } - - /** - * Creates a Object by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - public Object create(InputStream in) throws IOException, SAXException, ParserConfigurationException { - Object node = create(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (node); - } - - /** - * Creates a Object by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - public Object create(InputSource is) throws IOException, SAXException, ParserConfigurationException { - Object node = create(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (node); - } - - /** - * Creates a Object by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - public Object create(Reader reader) throws IOException, SAXException, ParserConfigurationException { - Object node = create(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (node); - } - - /** - * Creates a Object by the copy Object. - * This method is a template method for concrete classes. - * - * @param source - * @return Object - */ - public Object create(Object source) { - if (source instanceof XParamListParam) { - XParamListParam node = createXParamListParam(); - node.setup((XParamListParam)source); - return(node); - } else if (source instanceof XHeadGlobal) { - XHeadGlobal node = createXHeadGlobal(); - node.setup((XHeadGlobal)source); - return(node); - } else if (source instanceof XHeadLocal) { - XHeadLocal node = createXHeadLocal(); - node.setup((XHeadLocal)source); - return(node); - } else if (source instanceof XHead) { - XHead node = createXHead(); - node.setup((XHead)source); - return(node); - } else if (source instanceof XGlyphFile) { - XGlyphFile node = createXGlyphFile(); - node.setup((XGlyphFile)source); - return(node); - } else if (source instanceof XContour) { - XContour node = createXContour(); - node.setup((XContour)source); - return(node); - } else if (source instanceof XPoint2d) { - XPoint2d node = createXPoint2d(); - node.setup((XPoint2d)source); - return(node); - } else if (source instanceof XInvokePos) { - XInvokePos node = createXInvokePos(); - node.setup((XInvokePos)source); - return(node); - } else if (source instanceof XInvokeArg) { - XInvokeArg node = createXInvokeArg(); - node.setup((XInvokeArg)source); - return(node); - } else if (source instanceof XInvokeVarg) { - XInvokeVarg node = createXInvokeVarg(); - node.setup((XInvokeVarg)source); - return(node); - } else if (source instanceof XInvoke) { - XInvoke node = createXInvoke(); - node.setup((XInvoke)source); - return(node); - } else if (source instanceof XInclude) { - XInclude node = createXInclude(); - node.setup((XInclude)source); - return(node); - } else if (source instanceof XModule) { - XModule node = createXModule(); - node.setup((XModule)source); - return(node); - } else if (source instanceof XBody) { - XBody node = createXBody(); - node.setup((XBody)source); - return(node); - } else if (source instanceof XStartGlyphElement) { - XStartGlyphElement node = createXStartGlyphElement(); - node.setup((XStartGlyphElement)source); - return(node); - } else if (source instanceof XControlPoint) { - XControlPoint node = createXControlPoint(); - node.setup((XControlPoint)source); - return(node); - } else if (source instanceof XHint) { - XHint node = createXHint(); - node.setup((XHint)source); - return(node); - } else if (source instanceof XContourPoint) { - XContourPoint node = createXContourPoint(); - node.setup((XContourPoint)source); - return(node); - } else { - return (null); - } - } - - /** - * Creates a Object by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - public Object create(Document doc) throws IOException, SAXException, ParserConfigurationException { - Object node = create(doc.getDocumentElement()); - return (node); - } - - /** - * Creates a Object by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - public Object create(Element element) throws IOException, SAXException, ParserConfigurationException { - if (XParamListParam.isMatch(element)) { - XParamListParam node = createXParamListParam(); - node.setup(element); - return(node); - } else if (XHeadGlobal.isMatch(element)) { - XHeadGlobal node = createXHeadGlobal(); - node.setup(element); - return(node); - } else if (XHeadLocal.isMatch(element)) { - XHeadLocal node = createXHeadLocal(); - node.setup(element); - return(node); - } else if (XHead.isMatch(element)) { - XHead node = createXHead(); - node.setup(element); - return(node); - } else if (XGlyphFile.isMatch(element)) { - XGlyphFile node = createXGlyphFile(); - node.setup(element); - return(node); - } else if (XContour.isMatch(element)) { - XContour node = createXContour(); - node.setup(element); - return(node); - } else if (XPoint2d.isMatch(element)) { - XPoint2d node = createXPoint2d(); - node.setup(element); - return(node); - } else if (XInvokePos.isMatch(element)) { - XInvokePos node = createXInvokePos(); - node.setup(element); - return(node); - } else if (XInvokeArg.isMatch(element)) { - XInvokeArg node = createXInvokeArg(); - node.setup(element); - return(node); - } else if (XInvokeVarg.isMatch(element)) { - XInvokeVarg node = createXInvokeVarg(); - node.setup(element); - return(node); - } else if (XInvoke.isMatch(element)) { - XInvoke node = createXInvoke(); - node.setup(element); - return(node); - } else if (XInclude.isMatch(element)) { - XInclude node = createXInclude(); - node.setup(element); - return(node); - } else if (XModule.isMatch(element)) { - XModule node = createXModule(); - node.setup(element); - return(node); - } else if (XBody.isMatch(element)) { - XBody node = createXBody(); - node.setup(element); - return(node); - } else if (XStartGlyphElement.isMatch(element)) { - XStartGlyphElement node = createXStartGlyphElement(); - node.setup(element); - return(node); - } else if (XControlPoint.isMatch(element)) { - XControlPoint node = createXControlPoint(); - node.setup(element); - return(node); - } else if (XHint.isMatch(element)) { - XHint node = createXHint(); - node.setup(element); - return(node); - } else if (XContourPoint.isMatch(element)) { - XContourPoint node = createXContourPoint(); - node.setup(element); - return(node); - } else { - return (null); - } - } - - /** - * Creates a XParamListParam by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - public XParamListParam createXParamListParam(File file) throws IOException, SAXException, ParserConfigurationException { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(File file) throws IOException, SAXException, ParserConfigurationException { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(File file) throws IOException, SAXException, ParserConfigurationException { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - public XHead createXHead(File file) throws IOException, SAXException, ParserConfigurationException { - XHead xHead_ = createXHead(); - xHead_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(File file) throws IOException, SAXException, ParserConfigurationException { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - public XContour createXContour(File file) throws IOException, SAXException, ParserConfigurationException { - XContour xContour_ = createXContour(); - xContour_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContour_); - } - - /** - * Creates a XPoint2d by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - public XPoint2d createXPoint2d(File file) throws IOException, SAXException, ParserConfigurationException { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - public XInvokePos createXInvokePos(File file) throws IOException, SAXException, ParserConfigurationException { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(File file) throws IOException, SAXException, ParserConfigurationException { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(File file) throws IOException, SAXException, ParserConfigurationException { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - public XInvoke createXInvoke(File file) throws IOException, SAXException, ParserConfigurationException { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvoke_); - } - - /** - * Creates a XInclude by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - public XInclude createXInclude(File file) throws IOException, SAXException, ParserConfigurationException { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInclude_); - } - - /** - * Creates a XModule by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - public XModule createXModule(File file) throws IOException, SAXException, ParserConfigurationException { - XModule xModule_ = createXModule(); - xModule_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xModule_); - } - - /** - * Creates a XBody by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - public XBody createXBody(File file) throws IOException, SAXException, ParserConfigurationException { - XBody xBody_ = createXBody(); - xBody_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(File file) throws IOException, SAXException, ParserConfigurationException { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - public XControlPoint createXControlPoint(File file) throws IOException, SAXException, ParserConfigurationException { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xControlPoint_); - } - - /** - * Creates a XHint by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - public XHint createXHint(File file) throws IOException, SAXException, ParserConfigurationException { - XHint xHint_ = createXHint(); - xHint_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHint_); - } - - /** - * Creates a XContourPoint by the File file. - * This method is a template method for concrete classes. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - public XContourPoint createXContourPoint(File file) throws IOException, SAXException, ParserConfigurationException { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - public XParamListParam createXParamListParam(String uri) throws IOException, SAXException, ParserConfigurationException { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(String uri) throws IOException, SAXException, ParserConfigurationException { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(String uri) throws IOException, SAXException, ParserConfigurationException { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadLocal_); - } - - /** - * Creates a XHead - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - public XHead createXHead(String uri) throws IOException, SAXException, ParserConfigurationException { - XHead xHead_ = createXHead(); - xHead_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHead_); - } - - /** - * Creates a XGlyphFile - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(String uri) throws IOException, SAXException, ParserConfigurationException { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xGlyphFile_); - } - - /** - * Creates a XContour - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - public XContour createXContour(String uri) throws IOException, SAXException, ParserConfigurationException { - XContour xContour_ = createXContour(); - xContour_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContour_); - } - - /** - * Creates a XPoint2d - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - public XPoint2d createXPoint2d(String uri) throws IOException, SAXException, ParserConfigurationException { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - public XInvokePos createXInvokePos(String uri) throws IOException, SAXException, ParserConfigurationException { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(String uri) throws IOException, SAXException, ParserConfigurationException { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(String uri) throws IOException, SAXException, ParserConfigurationException { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - public XInvoke createXInvoke(String uri) throws IOException, SAXException, ParserConfigurationException { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvoke_); - } - - /** - * Creates a XInclude - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - public XInclude createXInclude(String uri) throws IOException, SAXException, ParserConfigurationException { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInclude_); - } - - /** - * Creates a XModule - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - public XModule createXModule(String uri) throws IOException, SAXException, ParserConfigurationException { - XModule xModule_ = createXModule(); - xModule_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xModule_); - } - - /** - * Creates a XBody - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - public XBody createXBody(String uri) throws IOException, SAXException, ParserConfigurationException { - XBody xBody_ = createXBody(); - xBody_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(String uri) throws IOException, SAXException, ParserConfigurationException { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - public XControlPoint createXControlPoint(String uri) throws IOException, SAXException, ParserConfigurationException { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xControlPoint_); - } - - /** - * Creates a XHint - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - public XHint createXHint(String uri) throws IOException, SAXException, ParserConfigurationException { - XHint xHint_ = createXHint(); - xHint_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHint_); - } - - /** - * Creates a XContourPoint - * by the String representation of URI uri. - * This method is a template method for concrete classes. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - public XContourPoint createXContourPoint(String uri) throws IOException, SAXException, ParserConfigurationException { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - public XParamListParam createXParamListParam(URL url) throws IOException, SAXException, ParserConfigurationException { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(URL url) throws IOException, SAXException, ParserConfigurationException { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(URL url) throws IOException, SAXException, ParserConfigurationException { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - public XHead createXHead(URL url) throws IOException, SAXException, ParserConfigurationException { - XHead xHead_ = createXHead(); - xHead_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(URL url) throws IOException, SAXException, ParserConfigurationException { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - public XContour createXContour(URL url) throws IOException, SAXException, ParserConfigurationException { - XContour xContour_ = createXContour(); - xContour_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContour_); - } - - /** - * Creates a XPoint2d by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - public XPoint2d createXPoint2d(URL url) throws IOException, SAXException, ParserConfigurationException { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - public XInvokePos createXInvokePos(URL url) throws IOException, SAXException, ParserConfigurationException { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(URL url) throws IOException, SAXException, ParserConfigurationException { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(URL url) throws IOException, SAXException, ParserConfigurationException { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - public XInvoke createXInvoke(URL url) throws IOException, SAXException, ParserConfigurationException { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvoke_); - } - - /** - * Creates a XInclude by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - public XInclude createXInclude(URL url) throws IOException, SAXException, ParserConfigurationException { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInclude_); - } - - /** - * Creates a XModule by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - public XModule createXModule(URL url) throws IOException, SAXException, ParserConfigurationException { - XModule xModule_ = createXModule(); - xModule_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xModule_); - } - - /** - * Creates a XBody by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - public XBody createXBody(URL url) throws IOException, SAXException, ParserConfigurationException { - XBody xBody_ = createXBody(); - xBody_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(URL url) throws IOException, SAXException, ParserConfigurationException { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - public XControlPoint createXControlPoint(URL url) throws IOException, SAXException, ParserConfigurationException { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xControlPoint_); - } - - /** - * Creates a XHint by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - public XHint createXHint(URL url) throws IOException, SAXException, ParserConfigurationException { - XHint xHint_ = createXHint(); - xHint_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHint_); - } - - /** - * Creates a XContourPoint by the URL url. - * This method is a template method for concrete classes. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - public XContourPoint createXContourPoint(URL url) throws IOException, SAXException, ParserConfigurationException { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - public XParamListParam createXParamListParam(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - public XHead createXHead(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XHead xHead_ = createXHead(); - xHead_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - public XContour createXContour(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XContour xContour_ = createXContour(); - xContour_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContour_); - } - - /** - * Creates a XPoint2d by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - public XPoint2d createXPoint2d(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - public XInvokePos createXInvokePos(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - public XInvoke createXInvoke(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvoke_); - } - - /** - * Creates a XInclude by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - public XInclude createXInclude(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInclude_); - } - - /** - * Creates a XModule by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - public XModule createXModule(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XModule xModule_ = createXModule(); - xModule_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xModule_); - } - - /** - * Creates a XBody by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - public XBody createXBody(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XBody xBody_ = createXBody(); - xBody_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - public XControlPoint createXControlPoint(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xControlPoint_); - } - - /** - * Creates a XHint by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - public XHint createXHint(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XHint xHint_ = createXHint(); - xHint_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHint_); - } - - /** - * Creates a XContourPoint by the InputStream in. - * This method is a template method for concrete classes. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - public XContourPoint createXContourPoint(InputStream in) throws IOException, SAXException, ParserConfigurationException { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - public XParamListParam createXParamListParam(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - public XHead createXHead(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XHead xHead_ = createXHead(); - xHead_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - public XContour createXContour(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XContour xContour_ = createXContour(); - xContour_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContour_); - } - - /** - * Creates a XPoint2d by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - public XPoint2d createXPoint2d(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - public XInvokePos createXInvokePos(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - public XInvoke createXInvoke(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvoke_); - } - - /** - * Creates a XInclude by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - public XInclude createXInclude(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInclude_); - } - - /** - * Creates a XModule by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - public XModule createXModule(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XModule xModule_ = createXModule(); - xModule_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xModule_); - } - - /** - * Creates a XBody by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - public XBody createXBody(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XBody xBody_ = createXBody(); - xBody_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - public XControlPoint createXControlPoint(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xControlPoint_); - } - - /** - * Creates a XHint by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - public XHint createXHint(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XHint xHint_ = createXHint(); - xHint_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHint_); - } - - /** - * Creates a XContourPoint by the InputSource is. - * This method is a template method for concrete classes. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - public XContourPoint createXContourPoint(InputSource is) throws IOException, SAXException, ParserConfigurationException { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - public XParamListParam createXParamListParam(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - public XHead createXHead(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XHead xHead_ = createXHead(); - xHead_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - public XContour createXContour(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XContour xContour_ = createXContour(); - xContour_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContour_); - } - - /** - * Creates a XPoint2d by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - public XPoint2d createXPoint2d(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - public XInvokePos createXInvokePos(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - public XInvoke createXInvoke(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInvoke_); - } - - /** - * Creates a XInclude by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - public XInclude createXInclude(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xInclude_); - } - - /** - * Creates a XModule by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - public XModule createXModule(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XModule xModule_ = createXModule(); - xModule_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xModule_); - } - - /** - * Creates a XBody by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - public XBody createXBody(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XBody xBody_ = createXBody(); - xBody_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - public XControlPoint createXControlPoint(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xControlPoint_); - } - - /** - * Creates a XHint by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - public XHint createXHint(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XHint xHint_ = createXHint(); - xHint_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xHint_); - } - - /** - * Creates a XContourPoint by the Reader reader. - * This method is a template method for concrete classes. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - public XContourPoint createXContourPoint(Reader reader) throws IOException, SAXException, ParserConfigurationException { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NONE, errorHandler, entityResolver)); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XParamListParam - */ - public XParamListParam createXParamListParam(XParamListParam source) { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(source); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(XHeadGlobal source) { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(source); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(XHeadLocal source) { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(source); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XHead - */ - public XHead createXHead(XHead source) { - XHead xHead_ = createXHead(); - xHead_.setup(source); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(XGlyphFile source) { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(source); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XContour - */ - public XContour createXContour(XContour source) { - XContour xContour_ = createXContour(); - xContour_.setup(source); - return (xContour_); - } - - /** - * Creates a XPoint2d by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XPoint2d - */ - public XPoint2d createXPoint2d(XPoint2d source) { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(source); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XInvokePos - */ - public XInvokePos createXInvokePos(XInvokePos source) { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(source); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(XInvokeArg source) { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(source); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(XInvokeVarg source) { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(source); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XInvoke - */ - public XInvoke createXInvoke(XInvoke source) { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(source); - return (xInvoke_); - } - - /** - * Creates a XInclude by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XInclude - */ - public XInclude createXInclude(XInclude source) { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(source); - return (xInclude_); - } - - /** - * Creates a XModule by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XModule - */ - public XModule createXModule(XModule source) { - XModule xModule_ = createXModule(); - xModule_.setup(source); - return (xModule_); - } - - /** - * Creates a XBody by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XBody - */ - public XBody createXBody(XBody source) { - XBody xBody_ = createXBody(); - xBody_.setup(source); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(XStartGlyphElement source) { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(source); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XControlPoint - */ - public XControlPoint createXControlPoint(XControlPoint source) { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(source); - return (xControlPoint_); - } - - /** - * Creates a XHint by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XHint - */ - public XHint createXHint(XHint source) { - XHint xHint_ = createXHint(); - xHint_.setup(source); - return (xHint_); - } - - /** - * Creates a XContourPoint by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XContourPoint - */ - public XContourPoint createXContourPoint(XContourPoint source) { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(source); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XParamListParam - */ - public XParamListParam createXParamListParam(Document doc) { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(doc); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(Document doc) { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(doc); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(Document doc) { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(doc); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XHead - */ - public XHead createXHead(Document doc) { - XHead xHead_ = createXHead(); - xHead_.setup(doc); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(Document doc) { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(doc); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XContour - */ - public XContour createXContour(Document doc) { - XContour xContour_ = createXContour(); - xContour_.setup(doc); - return (xContour_); - } - - /** - * Creates a XPoint2d by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XPoint2d - */ - public XPoint2d createXPoint2d(Document doc) { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(doc); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XInvokePos - */ - public XInvokePos createXInvokePos(Document doc) { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(doc); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(Document doc) { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(doc); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(Document doc) { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(doc); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XInvoke - */ - public XInvoke createXInvoke(Document doc) { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(doc); - return (xInvoke_); - } - - /** - * Creates a XInclude by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XInclude - */ - public XInclude createXInclude(Document doc) { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(doc); - return (xInclude_); - } - - /** - * Creates a XModule by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XModule - */ - public XModule createXModule(Document doc) { - XModule xModule_ = createXModule(); - xModule_.setup(doc); - return (xModule_); - } - - /** - * Creates a XBody by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XBody - */ - public XBody createXBody(Document doc) { - XBody xBody_ = createXBody(); - xBody_.setup(doc); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(Document doc) { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(doc); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XControlPoint - */ - public XControlPoint createXControlPoint(Document doc) { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(doc); - return (xControlPoint_); - } - - /** - * Creates a XHint by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XHint - */ - public XHint createXHint(Document doc) { - XHint xHint_ = createXHint(); - xHint_.setup(doc); - return (xHint_); - } - - /** - * Creates a XContourPoint by the Document doc. - * This method is a template method for concrete classes. - * - * @param doc - * @return XContourPoint - */ - public XContourPoint createXContourPoint(Document doc) { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(doc); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XParamListParam - */ - public XParamListParam createXParamListParam(Element element) { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(element); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(Element element) { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(element); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(Element element) { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(element); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XHead - */ - public XHead createXHead(Element element) { - XHead xHead_ = createXHead(); - xHead_.setup(element); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(Element element) { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(element); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XContour - */ - public XContour createXContour(Element element) { - XContour xContour_ = createXContour(); - xContour_.setup(element); - return (xContour_); - } - - /** - * Creates a XPoint2d by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XPoint2d - */ - public XPoint2d createXPoint2d(Element element) { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(element); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XInvokePos - */ - public XInvokePos createXInvokePos(Element element) { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(element); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(Element element) { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(element); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(Element element) { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(element); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XInvoke - */ - public XInvoke createXInvoke(Element element) { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(element); - return (xInvoke_); - } - - /** - * Creates a XInclude by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XInclude - */ - public XInclude createXInclude(Element element) { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(element); - return (xInclude_); - } - - /** - * Creates a XModule by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XModule - */ - public XModule createXModule(Element element) { - XModule xModule_ = createXModule(); - xModule_.setup(element); - return (xModule_); - } - - /** - * Creates a XBody by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XBody - */ - public XBody createXBody(Element element) { - XBody xBody_ = createXBody(); - xBody_.setup(element); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(Element element) { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(element); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XControlPoint - */ - public XControlPoint createXControlPoint(Element element) { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(element); - return (xControlPoint_); - } - - /** - * Creates a XHint by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XHint - */ - public XHint createXHint(Element element) { - XHint xHint_ = createXHint(); - xHint_.setup(element); - return (xHint_); - } - - /** - * Creates a XContourPoint by the Element element. - * This method is a template method for concrete classes. - * - * @param element - * @return XContourPoint - */ - public XContourPoint createXContourPoint(Element element) { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(element); - return (xContourPoint_); - } - - /** - * Creates a XParamListParam by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XParamListParam - */ - public XParamListParam createXParamListParam(RStack stack) { - XParamListParam xParamListParam_ = createXParamListParam(); - xParamListParam_.setup(stack); - return (xParamListParam_); - } - - /** - * Creates a XHeadGlobal by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal(RStack stack) { - XHeadGlobal xHeadGlobal_ = createXHeadGlobal(); - xHeadGlobal_.setup(stack); - return (xHeadGlobal_); - } - - /** - * Creates a XHeadLocal by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal(RStack stack) { - XHeadLocal xHeadLocal_ = createXHeadLocal(); - xHeadLocal_.setup(stack); - return (xHeadLocal_); - } - - /** - * Creates a XHead by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XHead - */ - public XHead createXHead(RStack stack) { - XHead xHead_ = createXHead(); - xHead_.setup(stack); - return (xHead_); - } - - /** - * Creates a XGlyphFile by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile(RStack stack) { - XGlyphFile xGlyphFile_ = createXGlyphFile(); - xGlyphFile_.setup(stack); - return (xGlyphFile_); - } - - /** - * Creates a XContour by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XContour - */ - public XContour createXContour(RStack stack) { - XContour xContour_ = createXContour(); - xContour_.setup(stack); - return (xContour_); - } - - /** - * Creates a XPoint2d by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XPoint2d - */ - public XPoint2d createXPoint2d(RStack stack) { - XPoint2d xPoint2d_ = createXPoint2d(); - xPoint2d_.setup(stack); - return (xPoint2d_); - } - - /** - * Creates a XInvokePos by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XInvokePos - */ - public XInvokePos createXInvokePos(RStack stack) { - XInvokePos xInvokePos_ = createXInvokePos(); - xInvokePos_.setup(stack); - return (xInvokePos_); - } - - /** - * Creates a XInvokeArg by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg(RStack stack) { - XInvokeArg xInvokeArg_ = createXInvokeArg(); - xInvokeArg_.setup(stack); - return (xInvokeArg_); - } - - /** - * Creates a XInvokeVarg by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg(RStack stack) { - XInvokeVarg xInvokeVarg_ = createXInvokeVarg(); - xInvokeVarg_.setup(stack); - return (xInvokeVarg_); - } - - /** - * Creates a XInvoke by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XInvoke - */ - public XInvoke createXInvoke(RStack stack) { - XInvoke xInvoke_ = createXInvoke(); - xInvoke_.setup(stack); - return (xInvoke_); - } - - /** - * Creates a XInclude by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XInclude - */ - public XInclude createXInclude(RStack stack) { - XInclude xInclude_ = createXInclude(); - xInclude_.setup(stack); - return (xInclude_); - } - - /** - * Creates a XModule by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XModule - */ - public XModule createXModule(RStack stack) { - XModule xModule_ = createXModule(); - xModule_.setup(stack); - return (xModule_); - } - - /** - * Creates a XBody by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XBody - */ - public XBody createXBody(RStack stack) { - XBody xBody_ = createXBody(); - xBody_.setup(stack); - return (xBody_); - } - - /** - * Creates a XStartGlyphElement by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement(RStack stack) { - XStartGlyphElement xStartGlyphElement_ = createXStartGlyphElement(); - xStartGlyphElement_.setup(stack); - return (xStartGlyphElement_); - } - - /** - * Creates a XControlPoint by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XControlPoint - */ - public XControlPoint createXControlPoint(RStack stack) { - XControlPoint xControlPoint_ = createXControlPoint(); - xControlPoint_.setup(stack); - return (xControlPoint_); - } - - /** - * Creates a XHint by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XHint - */ - public XHint createXHint(RStack stack) { - XHint xHint_ = createXHint(); - xHint_.setup(stack); - return (xHint_); - } - - /** - * Creates a XContourPoint by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XContourPoint - */ - public XContourPoint createXContourPoint(RStack stack) { - XContourPoint xContourPoint_ = createXContourPoint(); - xContourPoint_.setup(stack); - return (xContourPoint_); - } - - /** - * Creates a XParamList by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * This method is a template method for concrete classes. - * - * @param stack - * @return XParamList - */ - public XParamList createXParamList(RStack stack) { - XParamList xParamList_ = createXParamList(); - xParamList_.setup(stack); - return (xParamList_); - } - - /** - * Creates a XParamList by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XParamList - */ - public XParamList createXParamList(XParamList source) { - XParamList xParamList_ = createXParamList(); - xParamList_.setup(source); - return (xParamList_); - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/xml/DefaultGlyphFactory.java b/libsrc/ttf/src/org/doubletype/ossa/xml/DefaultGlyphFactory.java deleted file mode 100644 index bf2d11249..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/xml/DefaultGlyphFactory.java +++ /dev/null @@ -1,394 +0,0 @@ -/* - * The Relaxer artifact - * Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package org.doubletype.ossa.xml; - -/** - * DefaultGlyphFactory is generated by Relaxer based on glyph.rng. - * - * @version glyph.rng 1.0 (Tue Nov 09 20:22:48 EST 2004) - * @author Relaxer 1.1b (http://www.relaxer.org) - */ -public class DefaultGlyphFactory extends AbstractGlyphFactory { - - /** - * Gets a Class of XParamListParam. - * - * @return Class - */ - public Class getXParamListParamClass() { - return (XParamListParam.class); - } - - /** - * Gets a Class of XHeadGlobal. - * - * @return Class - */ - public Class getXHeadGlobalClass() { - return (XHeadGlobal.class); - } - - /** - * Gets a Class of XHeadLocal. - * - * @return Class - */ - public Class getXHeadLocalClass() { - return (XHeadLocal.class); - } - - /** - * Gets a Class of XHead. - * - * @return Class - */ - public Class getXHeadClass() { - return (XHead.class); - } - - /** - * Gets a Class of XGlyphFile. - * - * @return Class - */ - public Class getXGlyphFileClass() { - return (XGlyphFile.class); - } - - /** - * Gets a Class of XContour. - * - * @return Class - */ - public Class getXContourClass() { - return (XContour.class); - } - - /** - * Gets a Class of XPoint2d. - * - * @return Class - */ - public Class getXPoint2dClass() { - return (XPoint2d.class); - } - - /** - * Gets a Class of XInvokePos. - * - * @return Class - */ - public Class getXInvokePosClass() { - return (XInvokePos.class); - } - - /** - * Gets a Class of XInvokeArg. - * - * @return Class - */ - public Class getXInvokeArgClass() { - return (XInvokeArg.class); - } - - /** - * Gets a Class of XInvokeVarg. - * - * @return Class - */ - public Class getXInvokeVargClass() { - return (XInvokeVarg.class); - } - - /** - * Gets a Class of XInvoke. - * - * @return Class - */ - public Class getXInvokeClass() { - return (XInvoke.class); - } - - /** - * Gets a Class of XInclude. - * - * @return Class - */ - public Class getXIncludeClass() { - return (XInclude.class); - } - - /** - * Gets a Class of XModule. - * - * @return Class - */ - public Class getXModuleClass() { - return (XModule.class); - } - - /** - * Gets a Class of XBody. - * - * @return Class - */ - public Class getXBodyClass() { - return (XBody.class); - } - - /** - * Gets a Class of XStartGlyphElement. - * - * @return Class - */ - public Class getXStartGlyphElementClass() { - return (XStartGlyphElement.class); - } - - /** - * Gets a Class of XControlPoint. - * - * @return Class - */ - public Class getXControlPointClass() { - return (XControlPoint.class); - } - - /** - * Gets a Class of XHint. - * - * @return Class - */ - public Class getXHintClass() { - return (XHint.class); - } - - /** - * Gets a Class of XContourPoint. - * - * @return Class - */ - public Class getXContourPointClass() { - return (XContourPoint.class); - } - - /** - * Gets a Class of XParamList. - * - * @return Class - */ - public Class getXParamListClass() { - return (XParamList.class); - } - - /** - * Creates a default XParamListParam. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XParamListParam - */ - public XParamListParam createXParamListParam() { - return (new XParamListParam()); - } - - /** - * Creates a default XHeadGlobal. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XHeadGlobal - */ - public XHeadGlobal createXHeadGlobal() { - return (new XHeadGlobal()); - } - - /** - * Creates a default XHeadLocal. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XHeadLocal - */ - public XHeadLocal createXHeadLocal() { - return (new XHeadLocal()); - } - - /** - * Creates a default XHead. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XHead - */ - public XHead createXHead() { - return (new XHead()); - } - - /** - * Creates a default XGlyphFile. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XGlyphFile - */ - public XGlyphFile createXGlyphFile() { - return (new XGlyphFile()); - } - - /** - * Creates a default XContour. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XContour - */ - public XContour createXContour() { - return (new XContour()); - } - - /** - * Creates a default XPoint2d. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XPoint2d - */ - public XPoint2d createXPoint2d() { - return (new XPoint2d()); - } - - /** - * Creates a default XInvokePos. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XInvokePos - */ - public XInvokePos createXInvokePos() { - return (new XInvokePos()); - } - - /** - * Creates a default XInvokeArg. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XInvokeArg - */ - public XInvokeArg createXInvokeArg() { - return (new XInvokeArg()); - } - - /** - * Creates a default XInvokeVarg. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XInvokeVarg - */ - public XInvokeVarg createXInvokeVarg() { - return (new XInvokeVarg()); - } - - /** - * Creates a default XInvoke. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XInvoke - */ - public XInvoke createXInvoke() { - return (new XInvoke()); - } - - /** - * Creates a default XInclude. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XInclude - */ - public XInclude createXInclude() { - return (new XInclude()); - } - - /** - * Creates a default XModule. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XModule - */ - public XModule createXModule() { - return (new XModule()); - } - - /** - * Creates a default XBody. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XBody - */ - public XBody createXBody() { - return (new XBody()); - } - - /** - * Creates a default XStartGlyphElement. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XStartGlyphElement - */ - public XStartGlyphElement createXStartGlyphElement() { - return (new XStartGlyphElement()); - } - - /** - * Creates a default XControlPoint. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XControlPoint - */ - public XControlPoint createXControlPoint() { - return (new XControlPoint()); - } - - /** - * Creates a default XHint. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XHint - */ - public XHint createXHint() { - return (new XHint()); - } - - /** - * Creates a default XContourPoint. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XContourPoint - */ - public XContourPoint createXContourPoint() { - return (new XContourPoint()); - } - - /** - * Creates a default XParamList. - * This method is a hook method of the AbstractGlyphFactory. - * - * @return XParamList - */ - public XParamList createXParamList() { - return (new XParamList()); - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/xml/GlyphFactory.java b/libsrc/ttf/src/org/doubletype/ossa/xml/GlyphFactory.java deleted file mode 100644 index b9c5ae8bf..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/xml/GlyphFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The Relaxer artifact - * Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package org.doubletype.ossa.xml; - -/** - * GlyphFactory is generated by Relaxer based on glyph.rng. - * - * @version glyph.rng 1.0 (Tue Nov 09 20:22:48 EST 2004) - * @author Relaxer 1.1b (http://www.relaxer.org) - */ -public class GlyphFactory { - private static IGlyphFactory factory; - - /** - * Sets a factory. - * - * @param newFactory - */ - public static void setFactory(IGlyphFactory newFactory) { - factory = newFactory; - } - - /** - * Gets the factory. - * - * @return IGlyphFactory - */ - public static IGlyphFactory getFactory() { - if (factory == null) { - factory = new DefaultGlyphFactory(); - } - return (factory); - } -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/xml/IGlyphFactory.java b/libsrc/ttf/src/org/doubletype/ossa/xml/IGlyphFactory.java deleted file mode 100644 index 36547070c..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/xml/IGlyphFactory.java +++ /dev/null @@ -1,2279 +0,0 @@ -/* - * The Relaxer artifact - * Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package org.doubletype.ossa.xml; - -import java.io.*; -import java.net.URL; -import javax.xml.parsers.*; -import org.w3c.dom.*; -import org.xml.sax.*; - -/** - * IGlyphFactory is generated by Relaxer based on glyph.rng. - * - * @version glyph.rng 1.0 (Tue Nov 09 20:22:48 EST 2004) - * @author Relaxer 1.1b (http://www.relaxer.org) - */ -public interface IGlyphFactory { - /** - * Gets a Class of XParamListParam. - * - * @return Class - */ - Class getXParamListParamClass(); - - /** - * Gets a Class of XHeadGlobal. - * - * @return Class - */ - Class getXHeadGlobalClass(); - - /** - * Gets a Class of XHeadLocal. - * - * @return Class - */ - Class getXHeadLocalClass(); - - /** - * Gets a Class of XHead. - * - * @return Class - */ - Class getXHeadClass(); - - /** - * Gets a Class of XGlyphFile. - * - * @return Class - */ - Class getXGlyphFileClass(); - - /** - * Gets a Class of XContour. - * - * @return Class - */ - Class getXContourClass(); - - /** - * Gets a Class of XPoint2d. - * - * @return Class - */ - Class getXPoint2dClass(); - - /** - * Gets a Class of XInvokePos. - * - * @return Class - */ - Class getXInvokePosClass(); - - /** - * Gets a Class of XInvokeArg. - * - * @return Class - */ - Class getXInvokeArgClass(); - - /** - * Gets a Class of XInvokeVarg. - * - * @return Class - */ - Class getXInvokeVargClass(); - - /** - * Gets a Class of XInvoke. - * - * @return Class - */ - Class getXInvokeClass(); - - /** - * Gets a Class of XInclude. - * - * @return Class - */ - Class getXIncludeClass(); - - /** - * Gets a Class of XModule. - * - * @return Class - */ - Class getXModuleClass(); - - /** - * Gets a Class of XBody. - * - * @return Class - */ - Class getXBodyClass(); - - /** - * Gets a Class of XStartGlyphElement. - * - * @return Class - */ - Class getXStartGlyphElementClass(); - - /** - * Gets a Class of XControlPoint. - * - * @return Class - */ - Class getXControlPointClass(); - - /** - * Gets a Class of XHint. - * - * @return Class - */ - Class getXHintClass(); - - /** - * Gets a Class of XContourPoint. - * - * @return Class - */ - Class getXContourPointClass(); - - /** - * Gets a Class of XParamList. - * - * @return Class - */ - Class getXParamListClass(); - - /** - * Sets a errorHandler. - * - * @param errorHandler - */ - void setErrorHandler(org.xml.sax.ErrorHandler errorHandler); - - /** - * Gets a errorHandler. - * - * @return org.xml.sax.ErrorHandler - */ - org.xml.sax.ErrorHandler getErrorHandler(); - - /** - * Sets a entityResolver. - * - * @param entityResolver - */ - void setEntityResolver(org.xml.sax.EntityResolver entityResolver); - - /** - * Gets a entityResolver. - * - * @return org.xml.sax.EntityResolver - */ - org.xml.sax.EntityResolver getEntityResolver(); - - /** - * Sets a baseUri. - * - * @param baseUri - */ - void setBaseUri(String baseUri); - - /** - * Gets a baseUri. - * - * @return String - */ - String getBaseUri(); - - /** - * Creates a Object by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - Object create(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a Object by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - Object create(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a Object by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - Object create(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a Object by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - Object create(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a Object by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - Object create(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a Object by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - Object create(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a Object by the Object source. - * - * @param source - * @return Object - */ - Object create(Object source); - - /** - * Creates a Object by the Document dom. - * - * @param doc - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - Object create(Document doc) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a Object by the Element element. - * - * @param element - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return Object - */ - Object create(Element element) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XParamListParam by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - XParamListParam createXParamListParam(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadGlobal by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadLocal by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHead by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - XHead createXHead(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XGlyphFile by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContour by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - XContour createXContour(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XPoint2d by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - XPoint2d createXPoint2d(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokePos by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - XInvokePos createXInvokePos(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeArg by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeVarg by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvoke by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - XInvoke createXInvoke(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInclude by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - XInclude createXInclude(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XModule by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - XModule createXModule(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XBody by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - XBody createXBody(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XStartGlyphElement by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XControlPoint by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - XControlPoint createXControlPoint(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHint by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - XHint createXHint(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContourPoint by the File file. - * - * @param file - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - XContourPoint createXContourPoint(File file) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XParamListParam - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - XParamListParam createXParamListParam(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadGlobal - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadLocal - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHead - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - XHead createXHead(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XGlyphFile - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContour - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - XContour createXContour(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XPoint2d - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - XPoint2d createXPoint2d(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokePos - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - XInvokePos createXInvokePos(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeArg - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeVarg - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvoke - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - XInvoke createXInvoke(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInclude - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - XInclude createXInclude(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XModule - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - XModule createXModule(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XBody - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - XBody createXBody(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XStartGlyphElement - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XControlPoint - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - XControlPoint createXControlPoint(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHint - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - XHint createXHint(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContourPoint - * by the String representation of URI uri. - * - * @param uri - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - XContourPoint createXContourPoint(String uri) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XParamListParam by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - XParamListParam createXParamListParam(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadGlobal by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadLocal by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHead by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - XHead createXHead(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XGlyphFile by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContour by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - XContour createXContour(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XPoint2d by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - XPoint2d createXPoint2d(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokePos by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - XInvokePos createXInvokePos(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeArg by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeVarg by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvoke by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - XInvoke createXInvoke(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInclude by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - XInclude createXInclude(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XModule by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - XModule createXModule(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XBody by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - XBody createXBody(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XStartGlyphElement by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XControlPoint by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - XControlPoint createXControlPoint(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHint by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - XHint createXHint(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContourPoint by the URL url. - * - * @param url - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - XContourPoint createXContourPoint(URL url) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XParamListParam by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - XParamListParam createXParamListParam(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadGlobal by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadLocal by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHead by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - XHead createXHead(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XGlyphFile by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContour by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - XContour createXContour(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XPoint2d by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - XPoint2d createXPoint2d(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokePos by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - XInvokePos createXInvokePos(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeArg by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeVarg by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvoke by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - XInvoke createXInvoke(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInclude by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - XInclude createXInclude(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XModule by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - XModule createXModule(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XBody by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - XBody createXBody(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XStartGlyphElement by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XControlPoint by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - XControlPoint createXControlPoint(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHint by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - XHint createXHint(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContourPoint by the InputStream in. - * - * @param in - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - XContourPoint createXContourPoint(InputStream in) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XParamListParam by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - XParamListParam createXParamListParam(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadGlobal by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadLocal by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHead by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - XHead createXHead(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XGlyphFile by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContour by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - XContour createXContour(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XPoint2d by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - XPoint2d createXPoint2d(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokePos by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - XInvokePos createXInvokePos(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeArg by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeVarg by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvoke by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - XInvoke createXInvoke(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInclude by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - XInclude createXInclude(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XModule by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - XModule createXModule(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XBody by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - XBody createXBody(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XStartGlyphElement by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XControlPoint by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - XControlPoint createXControlPoint(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHint by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - XHint createXHint(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContourPoint by the InputSource is. - * - * @param is - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - XContourPoint createXContourPoint(InputSource is) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XParamListParam by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XParamListParam - */ - XParamListParam createXParamListParam(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadGlobal by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHeadLocal by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHead by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHead - */ - XHead createXHead(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XGlyphFile by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContour by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContour - */ - XContour createXContour(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XPoint2d by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XPoint2d - */ - XPoint2d createXPoint2d(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokePos by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokePos - */ - XInvokePos createXInvokePos(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeArg by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvokeVarg by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInvoke by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInvoke - */ - XInvoke createXInvoke(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XInclude by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XInclude - */ - XInclude createXInclude(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XModule by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XModule - */ - XModule createXModule(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XBody by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XBody - */ - XBody createXBody(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XStartGlyphElement by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XControlPoint by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XControlPoint - */ - XControlPoint createXControlPoint(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XHint by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XHint - */ - XHint createXHint(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XContourPoint by the Reader reader. - * - * @param reader - * @exception IOException - * @exception SAXException - * @exception ParserConfigurationException - * @return XContourPoint - */ - XContourPoint createXContourPoint(Reader reader) throws IOException, SAXException, ParserConfigurationException; - - /** - * Creates a XParamListParam. - * - * @return XParamListParam - */ - XParamListParam createXParamListParam(); - - /** - * Creates a XHeadGlobal. - * - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(); - - /** - * Creates a XHeadLocal. - * - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(); - - /** - * Creates a XHead. - * - * @return XHead - */ - XHead createXHead(); - - /** - * Creates a XGlyphFile. - * - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(); - - /** - * Creates a XContour. - * - * @return XContour - */ - XContour createXContour(); - - /** - * Creates a XPoint2d. - * - * @return XPoint2d - */ - XPoint2d createXPoint2d(); - - /** - * Creates a XInvokePos. - * - * @return XInvokePos - */ - XInvokePos createXInvokePos(); - - /** - * Creates a XInvokeArg. - * - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(); - - /** - * Creates a XInvokeVarg. - * - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(); - - /** - * Creates a XInvoke. - * - * @return XInvoke - */ - XInvoke createXInvoke(); - - /** - * Creates a XInclude. - * - * @return XInclude - */ - XInclude createXInclude(); - - /** - * Creates a XModule. - * - * @return XModule - */ - XModule createXModule(); - - /** - * Creates a XBody. - * - * @return XBody - */ - XBody createXBody(); - - /** - * Creates a XStartGlyphElement. - * - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(); - - /** - * Creates a XControlPoint. - * - * @return XControlPoint - */ - XControlPoint createXControlPoint(); - - /** - * Creates a XHint. - * - * @return XHint - */ - XHint createXHint(); - - /** - * Creates a XContourPoint. - * - * @return XContourPoint - */ - XContourPoint createXContourPoint(); - - /** - * Creates a XParamListParam by the XParamListParam source. - * - * @param source - * @return XParamListParam - */ - XParamListParam createXParamListParam(XParamListParam source); - - /** - * Creates a XHeadGlobal by the XHeadGlobal source. - * - * @param source - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(XHeadGlobal source); - - /** - * Creates a XHeadLocal by the XHeadLocal source. - * - * @param source - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(XHeadLocal source); - - /** - * Creates a XHead by the XHead source. - * - * @param source - * @return XHead - */ - XHead createXHead(XHead source); - - /** - * Creates a XGlyphFile by the XGlyphFile source. - * - * @param source - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(XGlyphFile source); - - /** - * Creates a XContour by the XContour source. - * - * @param source - * @return XContour - */ - XContour createXContour(XContour source); - - /** - * Creates a XPoint2d by the XPoint2d source. - * - * @param source - * @return XPoint2d - */ - XPoint2d createXPoint2d(XPoint2d source); - - /** - * Creates a XInvokePos by the XInvokePos source. - * - * @param source - * @return XInvokePos - */ - XInvokePos createXInvokePos(XInvokePos source); - - /** - * Creates a XInvokeArg by the XInvokeArg source. - * - * @param source - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(XInvokeArg source); - - /** - * Creates a XInvokeVarg by the XInvokeVarg source. - * - * @param source - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(XInvokeVarg source); - - /** - * Creates a XInvoke by the XInvoke source. - * - * @param source - * @return XInvoke - */ - XInvoke createXInvoke(XInvoke source); - - /** - * Creates a XInclude by the XInclude source. - * - * @param source - * @return XInclude - */ - XInclude createXInclude(XInclude source); - - /** - * Creates a XModule by the XModule source. - * - * @param source - * @return XModule - */ - XModule createXModule(XModule source); - - /** - * Creates a XBody by the XBody source. - * - * @param source - * @return XBody - */ - XBody createXBody(XBody source); - - /** - * Creates a XStartGlyphElement by the XStartGlyphElement source. - * - * @param source - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(XStartGlyphElement source); - - /** - * Creates a XControlPoint by the XControlPoint source. - * - * @param source - * @return XControlPoint - */ - XControlPoint createXControlPoint(XControlPoint source); - - /** - * Creates a XHint by the XHint source. - * - * @param source - * @return XHint - */ - XHint createXHint(XHint source); - - /** - * Creates a XContourPoint by the XContourPoint source. - * - * @param source - * @return XContourPoint - */ - XContourPoint createXContourPoint(XContourPoint source); - - /** - * Creates a XParamListParam by the Document doc. - * - * @param doc - * @return XParamListParam - */ - XParamListParam createXParamListParam(Document doc); - - /** - * Creates a XHeadGlobal by the Document doc. - * - * @param doc - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(Document doc); - - /** - * Creates a XHeadLocal by the Document doc. - * - * @param doc - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(Document doc); - - /** - * Creates a XHead by the Document doc. - * - * @param doc - * @return XHead - */ - XHead createXHead(Document doc); - - /** - * Creates a XGlyphFile by the Document doc. - * - * @param doc - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(Document doc); - - /** - * Creates a XContour by the Document doc. - * - * @param doc - * @return XContour - */ - XContour createXContour(Document doc); - - /** - * Creates a XPoint2d by the Document doc. - * - * @param doc - * @return XPoint2d - */ - XPoint2d createXPoint2d(Document doc); - - /** - * Creates a XInvokePos by the Document doc. - * - * @param doc - * @return XInvokePos - */ - XInvokePos createXInvokePos(Document doc); - - /** - * Creates a XInvokeArg by the Document doc. - * - * @param doc - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(Document doc); - - /** - * Creates a XInvokeVarg by the Document doc. - * - * @param doc - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(Document doc); - - /** - * Creates a XInvoke by the Document doc. - * - * @param doc - * @return XInvoke - */ - XInvoke createXInvoke(Document doc); - - /** - * Creates a XInclude by the Document doc. - * - * @param doc - * @return XInclude - */ - XInclude createXInclude(Document doc); - - /** - * Creates a XModule by the Document doc. - * - * @param doc - * @return XModule - */ - XModule createXModule(Document doc); - - /** - * Creates a XBody by the Document doc. - * - * @param doc - * @return XBody - */ - XBody createXBody(Document doc); - - /** - * Creates a XStartGlyphElement by the Document doc. - * - * @param doc - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(Document doc); - - /** - * Creates a XControlPoint by the Document doc. - * - * @param doc - * @return XControlPoint - */ - XControlPoint createXControlPoint(Document doc); - - /** - * Creates a XHint by the Document doc. - * - * @param doc - * @return XHint - */ - XHint createXHint(Document doc); - - /** - * Creates a XContourPoint by the Document doc. - * - * @param doc - * @return XContourPoint - */ - XContourPoint createXContourPoint(Document doc); - - /** - * Creates a XParamListParam by the Element element. - * - * @param element - * @return XParamListParam - */ - XParamListParam createXParamListParam(Element element); - - /** - * Creates a XHeadGlobal by the Element element. - * - * @param element - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(Element element); - - /** - * Creates a XHeadLocal by the Element element. - * - * @param element - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(Element element); - - /** - * Creates a XHead by the Element element. - * - * @param element - * @return XHead - */ - XHead createXHead(Element element); - - /** - * Creates a XGlyphFile by the Element element. - * - * @param element - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(Element element); - - /** - * Creates a XContour by the Element element. - * - * @param element - * @return XContour - */ - XContour createXContour(Element element); - - /** - * Creates a XPoint2d by the Element element. - * - * @param element - * @return XPoint2d - */ - XPoint2d createXPoint2d(Element element); - - /** - * Creates a XInvokePos by the Element element. - * - * @param element - * @return XInvokePos - */ - XInvokePos createXInvokePos(Element element); - - /** - * Creates a XInvokeArg by the Element element. - * - * @param element - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(Element element); - - /** - * Creates a XInvokeVarg by the Element element. - * - * @param element - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(Element element); - - /** - * Creates a XInvoke by the Element element. - * - * @param element - * @return XInvoke - */ - XInvoke createXInvoke(Element element); - - /** - * Creates a XInclude by the Element element. - * - * @param element - * @return XInclude - */ - XInclude createXInclude(Element element); - - /** - * Creates a XModule by the Element element. - * - * @param element - * @return XModule - */ - XModule createXModule(Element element); - - /** - * Creates a XBody by the Element element. - * - * @param element - * @return XBody - */ - XBody createXBody(Element element); - - /** - * Creates a XStartGlyphElement by the Element element. - * - * @param element - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(Element element); - - /** - * Creates a XControlPoint by the Element element. - * - * @param element - * @return XControlPoint - */ - XControlPoint createXControlPoint(Element element); - - /** - * Creates a XHint by the Element element. - * - * @param element - * @return XHint - */ - XHint createXHint(Element element); - - /** - * Creates a XContourPoint by the Element element. - * - * @param element - * @return XContourPoint - */ - XContourPoint createXContourPoint(Element element); - - /** - * Creates a XParamListParam by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XParamListParam - */ - XParamListParam createXParamListParam(RStack stack); - - /** - * Creates a XHeadGlobal by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XHeadGlobal - */ - XHeadGlobal createXHeadGlobal(RStack stack); - - /** - * Creates a XHeadLocal by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XHeadLocal - */ - XHeadLocal createXHeadLocal(RStack stack); - - /** - * Creates a XHead by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XHead - */ - XHead createXHead(RStack stack); - - /** - * Creates a XGlyphFile by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XGlyphFile - */ - XGlyphFile createXGlyphFile(RStack stack); - - /** - * Creates a XContour by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XContour - */ - XContour createXContour(RStack stack); - - /** - * Creates a XPoint2d by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XPoint2d - */ - XPoint2d createXPoint2d(RStack stack); - - /** - * Creates a XInvokePos by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XInvokePos - */ - XInvokePos createXInvokePos(RStack stack); - - /** - * Creates a XInvokeArg by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XInvokeArg - */ - XInvokeArg createXInvokeArg(RStack stack); - - /** - * Creates a XInvokeVarg by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XInvokeVarg - */ - XInvokeVarg createXInvokeVarg(RStack stack); - - /** - * Creates a XInvoke by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XInvoke - */ - XInvoke createXInvoke(RStack stack); - - /** - * Creates a XInclude by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XInclude - */ - XInclude createXInclude(RStack stack); - - /** - * Creates a XModule by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XModule - */ - XModule createXModule(RStack stack); - - /** - * Creates a XBody by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XBody - */ - XBody createXBody(RStack stack); - - /** - * Creates a XStartGlyphElement by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XStartGlyphElement - */ - XStartGlyphElement createXStartGlyphElement(RStack stack); - - /** - * Creates a XControlPoint by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XControlPoint - */ - XControlPoint createXControlPoint(RStack stack); - - /** - * Creates a XHint by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XHint - */ - XHint createXHint(RStack stack); - - /** - * Creates a XContourPoint by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XContourPoint - */ - XContourPoint createXContourPoint(RStack stack); - - /** - * Creates a XParamList by the Element element. - * - * @return XParamList - */ - XParamList createXParamList(); - - /** - * Creates a XParamList by the Stack stack. - * This mehtod is supposed to be used internally - * by the Relaxer system. - * - * @param stack - * @return XParamList - */ - XParamList createXParamList(RStack stack); - - /** - * Creates a XParamList by the object source. - * This method is a template method for concrete classes. - * - * @param source - * @return XParamList - */ - XParamList createXParamList(XParamList source); -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/xml/IRNode.java b/libsrc/ttf/src/org/doubletype/ossa/xml/IRNode.java deleted file mode 100644 index 2e513627e..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/xml/IRNode.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The Relaxer artifact - * Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package org.doubletype.ossa.xml; - -/** - * @version glyph.rng 1.0 (Tue Nov 09 20:22:48 EST 2004) - * @author Relaxer 1.1b (http://www.relaxer.org) - */ -public interface IRNode { - /** - * Sets parent RNode. - * - * @param parent - */ - void rSetParentRNode(IRNode parent); - - /** - * Gets parent RNode. - * - * @return IRNode - */ - IRNode rGetParentRNode(); - - /** - * Gets child RNodes. - * - * @return IRNode[] - */ - IRNode[] rGetRNodes(); -} diff --git a/libsrc/ttf/src/org/doubletype/ossa/xml/RInterleave.java b/libsrc/ttf/src/org/doubletype/ossa/xml/RInterleave.java deleted file mode 100644 index 2c158592a..000000000 --- a/libsrc/ttf/src/org/doubletype/ossa/xml/RInterleave.java +++ /dev/null @@ -1,753 +0,0 @@ -/* - * The Relaxer artifact - * Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package org.doubletype.ossa.xml; - -import java.util.*; -import java.net.URL; -import java.math.*; -import java.lang.reflect.*; -import java.sql.Time; -import java.sql.Timestamp; -import org.w3c.dom.*; - -/** - * RInterleave - * - * @since May. 13, 2002 - * @version Oct. 22, 2003 - * @author ASAMI, Tomoharu (asami@relaxer.org) - */ -public final class RInterleave { - private RStack rstack_; - private List entries_ = new ArrayList<>(); - private Map entryByStateClass_ = new HashMap<>(); - private Map entryByElementName_ = new HashMap<>(); - private Boolean isMatch_ = null; - - public RInterleave(RStack rstack) { - rstack_ = rstack; - } - - public Object getProperty(Class stateClass) { - StateClassEntry entry = _getEntryByStateClass(stateClass); - return (entry.getObject()); - } - - public Object[] getPropertyList(Class stateClass) { - StateClassEntry entry = _getEntryByStateClass(stateClass); - return (entry.getObjects()); - } - - public String getElementPropertyAsString(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsString(element)); - } - - public boolean getElementPropertyAsBoolean(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (false); - } - return (URelaxer.getElementPropertyAsBoolean(element)); - } - - public Boolean getElementPropertyAsBooleanObject(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsBooleanObject(element)); - } - - public byte getElementPropertyAsByte(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (-1); - } - return (URelaxer.getElementPropertyAsByte(element)); - } - - public Byte getElementPropertyAsByteObject(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsByteObject(element)); - } - - public short getElementPropertyAsShort(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (-1); - } - return (URelaxer.getElementPropertyAsShort(element)); - } - - public Short getElementPropertyAsShortObject(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsShortObject(element)); - } - - public int getElementPropertyAsInt(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (-1); - } - return (URelaxer.getElementPropertyAsInt(element)); - } - - public Integer getElementPropertyAsIntObject(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsIntObject(element)); - } - - public long getElementPropertyAsLong(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (-1); - } - return (URelaxer.getElementPropertyAsLong(element)); - } - - public Long getElementPropertyAsLongObject(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsLongObject(element)); - } - - public float getElementPropertyAsFloat(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (Float.NaN); - } - return (URelaxer.getElementPropertyAsFloat(element)); - } - - public Float getElementPropertyAsFloatObject(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsFloatObject(element)); - } - - public double getElementPropertyAsDouble(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (Double.NaN); - } - return (URelaxer.getElementPropertyAsDouble(element)); - } - - public Double getElementPropertyAsDoubleObject(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsDoubleObject(element)); - } - - public BigDecimal getElementPropertyAsBigDecimal(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsBigDecimal(element)); - } - - public BigInteger getElementPropertyAsBigInteger(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsBigInteger(element)); - } - - public Date getElementPropertyAsDate(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsDate(element)); - } - - public Locale getElementPropertyAsLocale(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsLocale(element)); - } - - public URL getElementPropertyAsURL(String elementName) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsURL(element)); - } - - public java.sql.Timestamp getElementPropertyAsSQLTimestamp( - String elementName - ) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsSQLTimestamp(element)); - } - - public java.sql.Time getElementPropertyAsSQLTime( - String elementName - ) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsSQLTime(element)); - } - - public java.sql.Date getElementPropertyAsSQLDate( - String elementName - ) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsSQLDate(element)); - } - - public byte[] getElementPropertyAsBinaryBASE64( - String elementName - ) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsBinaryBASE64(element)); - } - - public byte[] getElementPropertyAsBinaryHEX( - String elementName - ) { - Element element = _getElementByElementName(elementName); - if (element == null) { - return (null); - } - return (URelaxer.getElementPropertyAsBinaryHEX(element)); - } - - public List getElementPropertyAsStringList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsString(element)); - } - return (result); - } - - public List getElementPropertyAsBooleanList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsBooleanObject(element)); - } - return (result); - } - - public List getElementPropertyAsByteList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsByteObject(element)); - } - return (result); - } - - public List getElementPropertyAsShortList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsShortObject(element)); - } - return (result); - } - - public List getElementPropertyAsIntList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsIntObject(element)); - } - return (result); - } - - public List getElementPropertyAsLongList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsLongObject(element)); - } - return (result); - } - - public List getElementPropertyAsFloatList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsFloatObject(element)); - } - return (result); - } - - public List getElementPropertyAsDoubleList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsDoubleObject(element)); - } - return (result); - } - - public List getElementPropertyAsBigDecimalList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsBigDecimal(element)); - } - return (result); - } - - public List getElementPropertyAsBigIntegerList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsBigInteger(element)); - } - return (result); - } - - public List getElementPropertyAsDateList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsDate(element)); - } - return (result); - } - - public List getElementPropertyAsLocaleList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsLocale(element)); - } - return (result); - } - - public List getElementPropertyAsURLList(String elementName) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsURL(element)); - } - return (result); - } - - public List getElementPropertyAsSQLTimestampList( - String elementName - ) { - List list = _getElementListByElementName(elementName); - int size = list.size(); - List result = new ArrayList<>(); - for (int i = 0;i < size;i++) { - Element element = (Element)list.get(i); - result.add(URelaxer.getElementPropertyAsSQLTimestamp(element)); - } - return (result); - } - - public List