foray-commit Mailing List for FOray (Page 275)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <vic...@us...> - 2006-04-14 03:22:21
|
Revision: 7010 Author: victormote Date: 2006-04-13 20:22:16 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7010&view=rev Log Message: ----------- Fix some errors. Modified Paths: -------------- trunk/foray/doc/web/app/using/anttask.html Modified: trunk/foray/doc/web/app/using/anttask.html =================================================================== --- trunk/foray/doc/web/app/using/anttask.html 2006-04-14 03:17:45 UTC (rev 7009) +++ trunk/foray/doc/web/app/using/anttask.html 2006-04-14 03:22:16 UTC (rev 7010) @@ -29,8 +29,8 @@ <h2><a name="task">Define the Custom Ant Task</a></h2> <p>The first step toward using FOray from within your Ant scripts is to define the custom task within the Ant script. -It is generally desirable to set define the task in a common task that is -accessible to the remainder of the script, such as an "init" task. +It is generally desirable to define the task in a common target that is +accessible to the remainder of the script, such as an "init" target. Defining the task simply tells Ant how to find the FOray Ant task class, and the classes that are needed to run FOray. In the example below, note that your location for ${foray.home} and the @@ -121,8 +121,8 @@ <tr> <td>messagelevel</td> <td>Logging level. Possible values: <code>error</code>, <code>warn</code>, - <code>info</code>, <code>verbose</code>>, <code>debug</code>></td> - <td>No. Default is <code>verbose</code>></td> + <code>info</code>, <code>verbose</code>, <code>debug</code></td> + <td>No. Default is <code>verbose</code></td> </tr> <!--<tr> <td>logFiles</td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-04-14 03:17:54
|
Revision: 7009 Author: victormote Date: 2006-04-13 20:17:45 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7009&view=rev Log Message: ----------- Add document for the Ant task. Modified Paths: -------------- trunk/foray/doc/web/00-rsrc/include/leftmenu.html Added Paths: ----------- trunk/foray/doc/web/app/using/anttask.html Modified: trunk/foray/doc/web/00-rsrc/include/leftmenu.html =================================================================== --- trunk/foray/doc/web/00-rsrc/include/leftmenu.html 2006-04-13 21:07:39 UTC (rev 7008) +++ trunk/foray/doc/web/00-rsrc/include/leftmenu.html 2006-04-14 03:17:45 UTC (rev 7009) @@ -81,6 +81,12 @@ <tr> <td class="Bullet1"> </td> <td class="Menu1"> + <a class="Menu" href="/app/using/anttask.html">Ant Task</a> + </td> + </tr> + <tr> + <td class="Bullet1"> </td> + <td class="Menu1"> <a class="Menu" href="/app/resources/other.html">Resources</a> </td> </tr> Added: trunk/foray/doc/web/app/using/anttask.html =================================================================== --- trunk/foray/doc/web/app/using/anttask.html (rev 0) +++ trunk/foray/doc/web/app/using/anttask.html 2006-04-14 03:17:45 UTC (rev 7009) @@ -0,0 +1,161 @@ +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + +<head> + <title>FOray - Using the FOray Ant Task</title> + <meta name="content-revised" + content="$Date$"/> + <!--#include virtual="/00-rsrc/include/standard-head.html" --> +</head> + +<body> +<!--#include virtual="/00-rsrc/include/leftmenu.html" --> + +<h1>Using the FOray Ant Task</h1> +<ul> + <li><a href="#intro">Introduction</a></li> + <li><a href="#task">Define the Custom Ant Task</a></li> + <li><a href="#params">Parameters</a></li> +</ul> + +<h2><a name="intro">Introduction</a></h2> +<p><a href="http://ant.apache.org/">Ant</a> is a powerful tool for automating +builds. FOray can be used from within Ant by using the custom FOray Ant +Task.</p> + +<h2><a name="task">Define the Custom Ant Task</a></h2> +<p>The first step toward using FOray from within your Ant scripts is to define +the custom task within the Ant script. +It is generally desirable to set define the task in a common task that is +accessible to the remainder of the script, such as an "init" task. +Defining the task simply tells Ant how to find the FOray Ant task class, and +the classes that are needed to run FOray. +In the example below, note that your location for ${foray.home} and the +classpath may be different.</p> + +<pre> + <property name="foray.home" location="D:/foray/trunk/foray/"/> + <taskdef name="foray" + classname="org.foray.app.ant.FOray"> + <classpath> + <fileset dir="${foray.home}/build" includes="*.jar"/> + <fileset dir="${foray.home}/lib" includes="*.jar"/> + </classpath> + </taskdef> +</pre> + +<h2><a name="params">Parameters</a></h2> +<p>After defining the task, you can use it within your script. +Simply use it like any other Ant task, giving it the parameters that it +needs to perform the desired processing.</p> + +<h3>Parameters specified as attributes</h3> +<table> +<tr> + <th>Attribute</th> + <th>Description</th> + <th>Required</th> +</tr> +<tr> + <td>fofile</td> + <td>The XSL-FO input file to be rendered</td> + <td>Yes<!--, if no fileset nested element is used--></td> +</tr> +<tr> + <td>outfile</td> + <td>Path to the output file.</td> + <td>Yes<!--, when fofile is used.--> + <!--(This attribute is not valid for filesets.)--></td> +</tr> +<tr> + <td>format</td> + <td>The mime-type of the desired output format. Possible values:<br/> +<code>application/pdf</code><br/> +<code>application/postscript</code><br/> +<code>application/vnd.mif</code><br/> +<code>application/rtf</code><br/> +<code>application/vnd.hp-PCL</code><br/> +<code>text/plain</code><br/> +<code>text/xml</code><br/> + </td> + <td>No, defaults to <code>application/pdf</code></td> +</tr> +<!--<tr> + <td>outdir</td> + <td>Output directory</td> + <td>Required if a fileset is used to specify the files to render; optional for fofile. (Can alternatively specify the full path in the fofile value.)</td> +</tr>--> +<!--<tr> + <td>force</td> + <td>Recreate target files, even if they are newer than their corresponding + source files. Note: This attribute is available in post-0.20.5 + versions (0.20.x nightly build and 1.0dev) only; target files are + always generated (i.e., force=true) in 0.20.5 release. + </td> + <td>No, default is <span class="codefrag">false</span></td> +</tr>--> +<!--<tr> + <td>basedir</td> + <td>Base directory to resolve relative references (e.g., graphics files) within the + FO document.</td> + <td>No, for single FO File entry, default is to use the location + of that FO file.</td> +</tr>--> +<!--<tr> + <td>relativebase</td> + <td>For fileset usage only. A value of <span class="codefrag">true</span> specifies using the location + of each .fo file as the base directory for resolving relative file references located + within that .fo file. A value of <span class="codefrag">false</span> specifies using the value of + basedir for all files within the fileset, or just the current working directory + if basedir is not specified.</td> + <td>No, default is <span class="codefrag">false</span>.</td> +</tr>--> +<tr> + <td>userconfig</td> + <td>User configuration file (same as the FOray "-c" command line option)</td> + <td>No</td> +</tr> +<tr> + <td>messagelevel</td> + <td>Logging level. Possible values: <code>error</code>, <code>warn</code>, + <code>info</code>, <code>verbose</code>>, <code>debug</code>></td> + <td>No. Default is <code>verbose</code>></td> +</tr> +<!--<tr> + <td>logFiles</td> + <td>Controls whether the names of the files that are processed are logged + (<span class="codefrag">true</span>) or not (<span class="codefrag">false</span>)</td> + <td>No, default is <span class="codefrag">true</span></td> +</tr>--> +</table> + +<!--<h3>Nested Elements</h3> +<table> +<tr> + <th>Attribute</th> + <th>Description</th> + <th>Required</th> +</tr> +<tr> + <td>fileset</td> + <td><a href="http://ant.apache.org/manual/CoreTypes/fileset.html">FileSets</a> + are used to specify multiple XSL-FO files to be rendered.</td> + <td>Yes, if no fofile attribute is supplied</td> +</tr> +</table>--> + +<h3>Examples</h3> +<p>The following example converts a single XSL-FO file to a PDF document:</p> +<pre> +<target name="generate-pdf" description="Generate a single PDF file"> + <foray format="application/pdf" + fofile="D:/fo/document.fo" + outfile="D:/pdf/document.pdf"/> +</target> +</pre> + +</body> +</html> Property changes on: trunk/foray/doc/web/app/using/anttask.html ___________________________________________________________________ Name: svn:keywords + "Author Id Rev Date URL" Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-04-13 21:07:44
|
Revision: 7008 Author: victormote Date: 2006-04-13 14:07:39 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7008&view=rev Log Message: ----------- Update sample config file to match new DTD location. Modified Paths: -------------- trunk/foray/config/sample-foray-config.xml Modified: trunk/foray/config/sample-foray-config.xml =================================================================== --- trunk/foray/config/sample-foray-config.xml 2006-04-13 20:57:17 UTC (rev 7007) +++ trunk/foray/config/sample-foray-config.xml 2006-04-13 21:07:39 UTC (rev 7008) @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE configuration SYSTEM "./schema/foray-config.dtd"> +<!DOCTYPE foray-config + PUBLIC "-//FOray//DTD FOray Configuration Book V0.1//EN" + "http://www.foray.org/dtds/0.1/en/foray-config.dtd"> <!-- This file is a sample FOray configuration file. For general information about FOray: @@ -8,7 +10,7 @@ http://www.foray.org/app/using/configuration.html --> -<configuration> +<foray-config> <!-- base-directory: Normally the base directory is the directory where the fo file is located. If you want to specify your own, uncomment this entry. @@ -108,6 +110,6 @@ </entry> --> -</configuration> +</foray-config> -<!-- Last Line of $RCSfile$ --> +<!-- Last Line of File. --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-04-13 20:57:27
|
Revision: 7007 Author: victormote Date: 2006-04-13 13:57:17 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7007&view=rev Log Message: ----------- Rename root element from "configuration" to "foray-config". Modified Paths: -------------- trunk/foray/doc/web/dtds/0.1/en/foray-config.dtd Modified: trunk/foray/doc/web/dtds/0.1/en/foray-config.dtd =================================================================== --- trunk/foray/doc/web/dtds/0.1/en/foray-config.dtd 2006-04-13 20:36:43 UTC (rev 7006) +++ trunk/foray/doc/web/dtds/0.1/en/foray-config.dtd 2006-04-13 20:57:17 UTC (rev 7007) @@ -8,7 +8,7 @@ http://www.foray.org/app/using/configuration.html --> -<!ELEMENT configuration (entry+) > +<!ELEMENT foray-config (entry+) > <!ELEMENT entry (key, value) > <!ELEMENT key (#PCDATA)> <!ELEMENT value (#PCDATA)> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-04-13 20:36:54
|
Revision: 7006 Author: victormote Date: 2006-04-13 13:36:43 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7006&view=rev Log Message: ----------- Move the configuration dtd from the config directory to the web site for availability. Added Paths: ----------- trunk/foray/doc/web/dtds/ trunk/foray/doc/web/dtds/0.1/ trunk/foray/doc/web/dtds/0.1/en/ trunk/foray/doc/web/dtds/0.1/en/foray-config.dtd Removed Paths: ------------- trunk/foray/config/schema/foray-config.dtd Deleted: trunk/foray/config/schema/foray-config.dtd =================================================================== --- trunk/foray/config/schema/foray-config.dtd 2006-03-27 20:36:04 UTC (rev 7005) +++ trunk/foray/config/schema/foray-config.dtd 2006-04-13 20:36:43 UTC (rev 7006) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- $Id$ --> - -<!-- This file is the XML DTD for a FOray configuration file. - For general information about FOray: - http://www.foray.org - For specific information about FOray configuration: - http://www.foray.org/app/using/configuration.html ---> - -<!ELEMENT configuration (entry+) > -<!ELEMENT entry (key, value) > -<!ELEMENT key (#PCDATA)> -<!ELEMENT value (#PCDATA)> - -<!-- Last Line of $RCSfile$ --> Copied: trunk/foray/doc/web/dtds/0.1/en/foray-config.dtd (from rev 6864, trunk/foray/config/schema/foray-config.dtd) =================================================================== --- trunk/foray/doc/web/dtds/0.1/en/foray-config.dtd (rev 0) +++ trunk/foray/doc/web/dtds/0.1/en/foray-config.dtd 2006-04-13 20:36:43 UTC (rev 7006) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- $Id$ --> + +<!-- This file is the XML DTD for a FOray configuration file. + For general information about FOray: + http://www.foray.org + For specific information about FOray configuration: + http://www.foray.org/app/using/configuration.html +--> + +<!ELEMENT configuration (entry+) > +<!ELEMENT entry (key, value) > +<!ELEMENT key (#PCDATA)> +<!ELEMENT value (#PCDATA)> + +<!-- Last Line of $RCSfile$ --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-27 20:36:21
|
Revision: 7005 Author: victormote Date: 2006-03-27 12:36:04 -0800 (Mon, 27 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7005&view=rev Log Message: ----------- Go ahead and get the new name fields. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 18:05:15 UTC (rev 7004) +++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-27 20:36:04 UTC (rev 7005) @@ -92,8 +92,8 @@ } fontComplexity = FOrayFont.FONT_SIMPLE; this.postscriptName = metricsFile.getPostscriptName(); - this.fontName = null; - this.fontName = null; + this.fontName = metricsFile.getFontName(); + this.familyName = metricsFile.getFontFamilyName(); capHeight = metricsFile.getCapHeight(); xHeight = metricsFile.getXHeight(); ascender = metricsFile.getLowerCaseAscent(); Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java 2006-03-26 18:05:15 UTC (rev 7004) +++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java 2006-03-27 20:36:04 UTC (rev 7005) @@ -96,15 +96,22 @@ public abstract void load() throws IOException ; /** - * Returns the Windows name of the font. - * - * @return The Windows name. + * Returns the name of the font. + * @return The name of this font. */ public String getFontName() { - return fontName; + return this.fontName; } /** + * Returns the name of the font's font-family. + * @return The name of the font's font-family. + */ + public String getFontFamilyName() { + return this.fontFamilyName; + } + + /** * Return the kerning table. */ public Kerning getKerning() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 18:05:22
|
Revision: 7004 Author: victormote Date: 2006-03-26 10:05:15 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7004&view=rev Log Message: ----------- Fix javadoc problems. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-03-26 17:54:34 UTC (rev 7003) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-03-26 18:05:15 UTC (rev 7004) @@ -99,79 +99,136 @@ return new RandomReaderArray(description, byteArray); } + /** + * {@inheritDoc} + */ public void seek(long pos) throws IOException { realReader.seek(pos); } + /** + * {@inheritDoc} + */ public long getFilePointer() throws IOException { return realReader.getFilePointer(); } + /** + * {@inheritDoc} + */ public long length() throws IOException { return realReader.length(); } + /** + * {@inheritDoc} + */ public void readFully(byte[] b) throws IOException { realReader.readFully(b); } + /** + * {@inheritDoc} + */ public void readFully(byte[] b, int off, int len) throws IOException { realReader.readFully(b, off, len); } + /** + * {@inheritDoc} + */ public int skipBytes(int n) throws IOException { return realReader.skipBytes(n); } + /** + * {@inheritDoc} + */ public boolean readBoolean() throws IOException { return realReader.readBoolean(); } + /** + * {@inheritDoc} + */ public byte readByte() throws IOException { return realReader.readByte(); } + /** + * {@inheritDoc} + */ public int readUnsignedByte() throws IOException { return realReader.readUnsignedByte(); } + /** + * {@inheritDoc} + */ public short readShort() throws IOException { return realReader.readShort(); } + /** + * {@inheritDoc} + */ public int readUnsignedShort() throws IOException { return realReader.readUnsignedShort(); } + /** + * {@inheritDoc} + */ public char readChar() throws IOException { return realReader.readChar(); } + /** + * {@inheritDoc} + */ public int readInt() throws IOException { return realReader.readInt(); } + /** + * {@inheritDoc} + */ public long readLong() throws IOException { return realReader.readLong(); } + /** + * {@inheritDoc} + */ public float readFloat() throws IOException { return realReader.readFloat(); } + /** + * {@inheritDoc} + */ public double readDouble() throws IOException { return realReader.readDouble(); } + /** + * {@inheritDoc} + */ public String readLine() throws IOException { this.lineNumber ++; return realReader.readLine(); } + /** + * {@inheritDoc} + */ public String readUTF() throws IOException { return realReader.readUTF(); } + /** + * {@inheritDoc} + */ public String getDescription() { return realReader.getDescription(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 17:54:47
|
Revision: 7003 Author: victormote Date: 2006-03-26 09:54:34 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7003&view=rev Log Message: ----------- Conform to aXSL changes suggested by Vincent Hennebert. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-03-26 17:01:08 UTC (rev 7002) +++ trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-03-26 17:54:34 UTC (rev 7003) @@ -74,6 +74,8 @@ */ fontComplexity = FOrayFont.FONT_COMPOSITE; this.postscriptName = stripWhiteSpace(ttf.getPostscriptName()); + this.fontName = ttf.getFontName(); + this.familyName = ttf.getFamilyName(); capHeight = ttf.getCapHeight(); xHeight = ttf.getXHeight(); ascender = ttf.getLowerCaseAscent(); Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 17:01:08 UTC (rev 7002) +++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 17:54:34 UTC (rev 7003) @@ -92,6 +92,8 @@ } fontComplexity = FOrayFont.FONT_SIMPLE; this.postscriptName = metricsFile.getPostscriptName(); + this.fontName = null; + this.fontName = null; capHeight = metricsFile.getCapHeight(); xHeight = metricsFile.getXHeight(); ascender = metricsFile.getLowerCaseAscent(); Modified: trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2006-03-26 17:01:08 UTC (rev 7002) +++ trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2006-03-26 17:54:34 UTC (rev 7003) @@ -49,6 +49,9 @@ * font-metrics file itself. */ protected String postscriptName = null; + protected String fontName = null; + protected String familyName = null; + protected Kerning kerning; /** expressed in 1/1000ths of a text space unit */ @@ -97,6 +100,20 @@ } /** + * {@inheritDoc} + */ + public String getFontName() { + return this.fontName; + } + + /** + * {@inheritDoc} + */ + public String getFamilyName() { + return this.familyName; + } + + /** * Returns the font's internal name, if given. Otherwise, returns * the configured name. * @return The name of the font. Modified: trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2006-03-26 17:01:08 UTC (rev 7002) +++ trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2006-03-26 17:54:34 UTC (rev 7003) @@ -192,7 +192,20 @@ /** * {@inheritDoc} */ + public String getFontName() { + if (this.lastMetrics == null) { + return null; + } + return this.lastMetrics.getFont().getFontName(); + } + + /** + * {@inheritDoc} + */ public String getPostscriptName() { + if (this.lastMetrics == null) { + return null; + } return this.lastMetrics.getFont().getPSName(); } @@ -240,7 +253,7 @@ } /** - * Returns the java name of the font's family. + * {@inheritDoc} */ public String getFamilyName() { if (this.lastMetrics == null) { Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java 2006-03-26 17:01:08 UTC (rev 7002) +++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java 2006-03-26 17:54:34 UTC (rev 7003) @@ -39,8 +39,9 @@ protected MetricsFileReader reader = null; // Header stuff - protected String windowsName; + protected String fontName; protected String postscriptName; + protected String fontFamilyName; /** Contains a 1 if the font is italic, otherwise a 0. */ protected short dfItalic; @@ -99,8 +100,8 @@ * * @return The Windows name. */ - public String getWindowsName() { - return windowsName; + public String getFontName() { + return fontName; } /** Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2006-03-26 17:01:08 UTC (rev 7002) +++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2006-03-26 17:54:34 UTC (rev 7003) @@ -728,11 +728,12 @@ } private void fullName() { - this.windowsName = getString(); + this.fontName = getString(); this.doneWithLine = true; } private void familyName() { + this.fontFamilyName = getString(); this.doneWithLine = true; } Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java 2006-03-26 17:01:08 UTC (rev 7002) +++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java 2006-03-26 17:54:34 UTC (rev 7003) @@ -53,21 +53,83 @@ * Parses the header of the PFM file. */ private void loadHeader() throws IOException { - reader.seek(80); + reader.seek(0); + + /* Skip dfVersion. */ + reader.skipBytes(2); + + /* Skip dfSize. */ + reader.skipBytes(4); + + /* Skip dfCopyright. */ + reader.skipBytes(60); + + /* Skip dfType. */ + reader.skipBytes(2); + + /* Skip dfPoints. */ + reader.skipBytes(2); + + /* Skip dfVertRes. */ + reader.skipBytes(2); + + /* Skip dfHorizRes. */ + reader.skipBytes(2); + + /* Skip dfAscent. */ + reader.skipBytes(2); + + /* Skip dfInternalLeading. */ + reader.skipBytes(2); + + /* Skip dfExternalLeading. */ + reader.skipBytes(2); + dfItalic = (short) reader.readUnsignedByte(); - reader.skipBytes(2); + + /* Skip dfUnderline. */ + reader.skipBytes(1); + + /* Skip dfStrikeOut. */ + reader.skipBytes(1); + dfWeight = reader.readUnsignedShortLoHi(); + dfCharSet = reader.readUnsignedByte(); - reader.skipBytes(4); + + /* Skip dfPixWidth. */ + reader.skipBytes(2); + + /* Skip dfPixHeight. */ + reader.skipBytes(2); + dfPitchAndFamily = reader.readUnsignedByte(); + dfAvgWidth = reader.readUnsignedShortLoHi(); + dfMaxWidth = reader.readUnsignedShortLoHi(); + dfFirstChar = (char) reader.readUnsignedByte(); + dfLastChar = (char) reader.readUnsignedByte(); - reader.skipBytes(8); + + /* Skip dfDefaultChar. */ + reader.skipBytes(1); + + /* Skip dfBreakChar. */ + reader.skipBytes(1); + + /* Skip dfWidthBytes. */ + reader.skipBytes(2); + + /* Skip dfDevice. */ + reader.skipBytes(4); + long faceOffset = reader.readUnsignedIntLoHi(); + reader.seek(faceOffset); - windowsName = reader.readNullTerminatedString(); + + this.fontFamilyName = reader.readNullTerminatedString(); } /** Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-26 17:01:08 UTC (rev 7002) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-26 17:54:34 UTC (rev 7003) @@ -205,6 +205,10 @@ return nameTable.familyName; } + public String getFontName() { + return nameTable.fullName; + } + public int getCapHeight() { int capHeightToUse = 0; if (pcltTable == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 17:01:31
|
Revision: 7002 Author: victormote Date: 2006-03-26 09:01:08 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7002&view=rev Log Message: ----------- Conform to aXSL changes regarding method names, suggested by Vincent Hennebert. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutput.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontFileStream.java trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -185,11 +185,6 @@ /** * {@inheritDoc} */ - public abstract String postscriptName() ; - - /** - * {@inheritDoc} - */ public abstract org.axsl.ps.Encoding getInternalEncoding() ; /** Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -310,8 +310,8 @@ /** * {@inheritDoc} */ - public String postscriptName() { - String postScriptName = this.getFont().postscriptName(); + public String getPostscriptName() { + String postScriptName = this.getFont().getPostscriptName(); if (this.encoding == this.getFont().getInternalEncoding()) { return postScriptName; } Modified: trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -101,7 +101,7 @@ * the configured name. * @return The name of the font. */ - public String postscriptName() { + public String getPostscriptName() { if (postscriptName != null && ! postscriptName.equals("")) { return postscriptName; } @@ -289,7 +289,7 @@ FreeStandingFont anotherFSF = (FreeStandingFont) anotherObject; // Use the font name first - int compare = this.postscriptName().compareTo(anotherFSF.postscriptName()); + int compare = this.getPostscriptName().compareTo(anotherFSF.getPostscriptName()); if (compare != 0) { return compare; } Modified: trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -192,7 +192,7 @@ /** * {@inheritDoc} */ - public String postscriptName() { + public String getPostscriptName() { return this.lastMetrics.getFont().getPSName(); } @@ -317,8 +317,8 @@ } SystemFont anotherSystemFont = (SystemFont) anotherObject; // Use the font name first - int compare = this.postscriptName().compareTo(anotherSystemFont - .postscriptName()); + int compare = this.getPostscriptName().compareTo(anotherSystemFont + .getPostscriptName()); if (compare != 0) { return compare; } Modified: trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutput.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutput.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutput.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -103,7 +103,7 @@ embeddableFont = fsf.getRawFontFile(this.fontUse); } catch (IOException e) { this.getLogger().fatal("Failed to get contents for " - + fsf.postscriptName() + ": " + e.getMessage()); + + fsf.getPostscriptName() + ": " + e.getMessage()); } return embeddableFont; } Modified: trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -57,7 +57,7 @@ return pfb.getByteArray(PSFilter.PSDATA_ASCII_HEX); } catch (IOException e) { this.getLogger().fatal("Failed to get contents for " - + font.postscriptName() + ": " + e.getMessage()); + + font.getPostscriptName() + ": " + e.getMessage()); } return null; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -96,7 +96,7 @@ p.append(pdfID() + EOL); p.append("<< /Type /Font"); p.append(EOL + "/BaseFont /"); - p.append(font.postscriptName()); + p.append(font.getPostscriptName()); if (cidMap != null) { p.append(EOL + "/CIDToGIDMap "); p.append(cidMap.pdfReference()); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -139,9 +139,10 @@ public String getBaseFont() { if (fsFont.getFont().isSubsettable()) { - return document.getNextFontSubsetTag() + "+" + fsFont.getFont().postscriptName(); + return document.getNextFontSubsetTag() + "+" + + fsFont.getFont().getPostscriptName(); } - return fsFont.getFont().postscriptName(); + return fsFont.getFont().getPostscriptName(); } /** Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontFileStream.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontFileStream.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontFileStream.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -50,7 +50,8 @@ setData(fontFileStream); } catch (IOException ioe) { document.getLogger().error("Failed to embed font " - + font.getFont().postscriptName() + ": " + ioe.getMessage()); + + font.getFont().getPostscriptName() + ": " + + ioe.getMessage()); } } Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2006-03-26 16:32:54 UTC (rev 7001) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2006-03-26 17:01:08 UTC (rev 7002) @@ -332,7 +332,7 @@ continue; } PSFont psFont = getPSFont(fontUse); - write("/" + psFont.getName() + " /" + fontUse.postscriptName() + write("/" + psFont.getName() + " /" + fontUse.getPostscriptName() + " def"); } write("end def"); @@ -385,13 +385,13 @@ /* If using font's internal encoding, don't re-encode. */ continue; } - write("/" + font.postscriptName() + " findfont"); + write("/" + font.getPostscriptName() + " findfont"); write("dup length dict begin"); write(" {1 index /FID ne {def} {pop pop} ifelse} forall"); write(" /Encoding " + vector.getName() + " def"); write(" currentdict"); write("end"); - write("/" + fontUse.postscriptName() + " exch definefont pop"); + write("/" + fontUse.getPostscriptName() + " exch definefont pop"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 16:33:04
|
Revision: 7001 Author: victormote Date: 2006-03-26 08:32:54 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7001&view=rev Log Message: ----------- Conform to new aXSL requirements regarding new FontServer constructor allowing a font to be regisetered with byte arrays instead of URLs. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-03-26 16:13:53 UTC (rev 7000) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-03-26 16:32:54 UTC (rev 7001) @@ -695,22 +695,41 @@ metricsFileReader = new MetricsFileReader(this.getLogger(), metricsFileURL); } catch (IOException e) { - throw new FontException(e.getMessage()); + throw new FontException(e); } } new RegisteredFont(this, fontID, fontFileReader, metricsFileReader, collectionID, embed, systemName); } -// public void registerFont(String fontID, byte[] fontFileContents, -// byte[] metricsFileContents, String collectionID, String embed, -// String systemName) throws FontException { -// if (! isUsableFont(systemName, fontFileContents, metricsFileContents)) { -// return; -// } -// new RegisteredFont(this, fontID, fontFileURL, metricsFileURL, -// collectionID, embed, systemName); -// } + public void registerFont(String fontID, String fontFileDescription, + byte[] fontFileContents, String metricsFileDescription, + byte[] metricsFileContents, String collectionID, String embed, + String systemName) throws FontException { + if (! isUsableFont(systemName, fontFileContents, metricsFileContents)) { + return; + } + FontFileReader fontFileReader = null; + if (fontFileContents != null) { + try { + fontFileReader = new FontFileReader(this.logger, + fontFileDescription, fontFileContents); + } catch (IOException e) { + throw new FontException(e); + } + } + MetricsFileReader metricsFileReader = null; + if (metricsFileContents != null) { + try { + metricsFileReader = new MetricsFileReader(this.getLogger(), + metricsFileDescription, metricsFileContents); + } catch (IOException e) { + throw new FontException(e); + } + } + new RegisteredFont(this, fontID, fontFileReader, metricsFileReader, + collectionID, embed, systemName); + } private boolean isUsableFont(String systemName, Object fontFile, Object metricsFile) { Modified: trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java 2006-03-26 16:13:53 UTC (rev 7000) +++ trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java 2006-03-26 16:32:54 UTC (rev 7001) @@ -81,6 +81,13 @@ parseFontFileBasics(); } + public FontFileReader(Log logger, String description, byte[] byteArray) + throws IOException { + super(description, byteArray); + this.logger = logger; + parseFontFileBasics(); + } + /** * Parses the font file enough to find the font format and the file * format. This should only be run once. Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java 2006-03-26 16:13:53 UTC (rev 7000) +++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java 2006-03-26 16:32:54 UTC (rev 7001) @@ -68,6 +68,13 @@ parseMetricsFileBasics(); } + public MetricsFileReader(Log logger, String description, byte[] byteArray) + throws IOException { + super(description, byteArray); + this.logger = logger; + parseMetricsFileBasics(); + } + public MetricsFile metricsFileFactory() { switch (metricsFormat) { case METRICSFORMAT_PFM: { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 16:14:02
|
Revision: 7000 Author: victormote Date: 2006-03-26 08:13:53 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7000&view=rev Log Message: ----------- Store MetricsFileReader instead of URL in RegisteredFont, giving more flexibility on which implementation to use. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-03-26 16:05:32 UTC (rev 6999) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-03-26 16:13:53 UTC (rev 7000) @@ -26,6 +26,7 @@ import org.foray.common.Environment; import org.foray.font.format.FontFileReader; +import org.foray.font.format.MetricsFileReader; import org.foray.font.output.FOrayFontPDFFactory; import org.axsl.font.FontException; @@ -688,7 +689,16 @@ throw new FontException(e); } } - new RegisteredFont(this, fontID, fontFileReader, metricsFileURL, + MetricsFileReader metricsFileReader = null; + if (metricsFileURL != null) { + try { + metricsFileReader = new MetricsFileReader(this.getLogger(), + metricsFileURL); + } catch (IOException e) { + throw new FontException(e.getMessage()); + } + } + new RegisteredFont(this, fontID, fontFileReader, metricsFileReader, collectionID, embed, systemName); } Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 16:05:32 UTC (rev 6999) +++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 16:13:53 UTC (rev 7000) @@ -80,13 +80,7 @@ } public void parseFont() throws FontException { - MetricsFileReader reader = null; - try { - reader = new MetricsFileReader(this.getLogger(), - getRegisteredFont().getMetricsFile()); - } catch (IOException e) { - throw new FontException(e.getMessage()); - } + MetricsFileReader reader = this.getRegisteredFont().getMetricsFileReader(); metricsFile = reader.metricsFileFactory(); if (metricsFile == null) { throw new FontException("Unknown Metric Format: " Modified: trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2006-03-26 16:05:32 UTC (rev 6999) +++ trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2006-03-26 16:13:53 UTC (rev 7000) @@ -25,13 +25,12 @@ package org.foray.font; import org.foray.font.format.FontFileReader; +import org.foray.font.format.MetricsFileReader; import org.axsl.font.FontException; import org.apache.commons.logging.Log; -import java.net.URL; - /** * <p>Class representing a font that has been registered for use with FOray. * RegisteredFont is not really a Font, as it is not part of the Font hierarcy @@ -99,7 +98,7 @@ private int fontFormat = FOrayFont.FORMAT_UNKNOWN; /** URL to the font metrics file, if any. */ - private URL metricsFile = null; + private MetricsFileReader metricsFile = null; /** * Set to true if the configuration file has requested that this font be @@ -136,8 +135,9 @@ * Constructor useful for registering a Font that has not yet been created. */ public RegisteredFont(FOrayFontServer server, String fontName, - FontFileReader fontFileReader, URL metricsFileURL, String ttcName, - String embedding, String systemName) throws FontException { + FontFileReader fontFileReader, MetricsFileReader metricsFileURL, + String ttcName, String embedding, String systemName) + throws FontException { this.fontServer = server; this.configuredFontName = fontName; this.fontFileReader = fontFileReader; @@ -267,7 +267,7 @@ return this.systemName; } - protected URL getMetricsFile() { + protected MetricsFileReader getMetricsFileReader() { return metricsFile; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 16:05:40
|
Revision: 6999 Author: victormote Date: 2006-03-26 08:05:32 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6999&view=rev Log Message: ----------- Change MetricsFileReader constructor to take a logger instead of FontServer. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 16:00:45 UTC (rev 6998) +++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 16:05:32 UTC (rev 6999) @@ -82,7 +82,7 @@ public void parseFont() throws FontException { MetricsFileReader reader = null; try { - reader = new MetricsFileReader(getRegisteredFont().getFontServer(), + reader = new MetricsFileReader(this.getLogger(), getRegisteredFont().getMetricsFile()); } catch (IOException e) { throw new FontException(e.getMessage()); Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java 2006-03-26 16:00:45 UTC (rev 6998) +++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java 2006-03-26 16:05:32 UTC (rev 6999) @@ -25,7 +25,6 @@ package org.foray.font.format; import org.foray.common.RandomReader; -import org.foray.font.FOrayFontServer; import org.apache.commons.logging.Log; @@ -57,15 +56,15 @@ /** Set to one of the METRICSFORMAT... constants. */ private byte metricsFormat = METRICSFORMAT_UNKNOWN; - private FOrayFontServer fontServer; + private Log logger; /** * Constructor. * @param url The URL to the file for which this reader is created. */ - public MetricsFileReader(FOrayFontServer server, URL url) throws IOException { + public MetricsFileReader(Log logger, URL url) throws IOException { super(url); - this.fontServer = server; + this.logger = logger; parseMetricsFileBasics(); } @@ -123,12 +122,8 @@ return true; } - public FOrayFontServer getFontServer() { - return this.fontServer; - } - public Log getLogger() { - return getFontServer().getLogger(); + return this.logger; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 16:00:52
|
Revision: 6998 Author: victormote Date: 2006-03-26 08:00:45 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6998&view=rev Log Message: ----------- Rename instance variable for clarity. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-03-26 15:57:36 UTC (rev 6997) +++ trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-03-26 16:00:45 UTC (rev 6998) @@ -60,7 +60,7 @@ } public void parseFont() { - TTFFile ttfFile = (TTFFile) getRegisteredFont().getReader().createFontFile(); + TTFFile ttfFile = (TTFFile) getRegisteredFont().getFontFileReader().createFontFile(); String fontName = getRegisteredFont().getTTCName(); try { this.ttf = ttfFile.getTTFFont(fontName); Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 15:57:36 UTC (rev 6997) +++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-26 16:00:45 UTC (rev 6998) @@ -65,12 +65,12 @@ if (this.type1File != null) { return this.type1File; } - FontFileReader reader = getRegisteredFont().getReader(); + FontFileReader reader = getRegisteredFont().getFontFileReader(); if (reader.getFileFormat() == FontFileReader.FILEFORMAT_TYPE1_PFB) { - this.type1File = new Type1PFBFile(getRegisteredFont().getReader()); + this.type1File = new Type1PFBFile(getRegisteredFont().getFontFileReader()); } else if (reader.getFileFormat() == FontFileReader.FILEFORMAT_TYPE1_PFA) { - this.type1File = new Type1PFAFile(getRegisteredFont().getReader()); + this.type1File = new Type1PFAFile(getRegisteredFont().getFontFileReader()); } else { String message = "Attempted to parse unknown Type1 font type.\n" + reader.getDescription(); Modified: trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2006-03-26 15:57:36 UTC (rev 6997) +++ trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2006-03-26 16:00:45 UTC (rev 6998) @@ -86,7 +86,7 @@ private String systemName = null; /** The FontFileReader used for parsing the actual font file. */ - private FontFileReader reader = null; + private FontFileReader fontFileReader = null; /** * For TrueType collections, ttcName specifies the name of the font within @@ -140,7 +140,7 @@ String embedding, String systemName) throws FontException { this.fontServer = server; this.configuredFontName = fontName; - this.reader = fontFileReader; + this.fontFileReader = fontFileReader; this.ttcName = ttcName; this.metricsFile = metricsFileURL; if (embedding == null) { @@ -217,12 +217,12 @@ } private FreeStandingFont createFSFont() throws FontException { - if (this.reader == null) { + if (this.fontFileReader == null) { /* The assumption here is that we have a metrics file for this * font, but not a font file, therefore it is Type 1. */ this.fontFormat = FOrayFont.FORMAT_TYPE1; } else { - this.fontFormat = reader.getFontFormat(); + this.fontFormat = fontFileReader.getFontFormat(); } switch (this.fontFormat) { case FOrayFont.FORMAT_TYPE1: { @@ -307,12 +307,12 @@ /** * @return Returns the reader. */ - public FontFileReader getReader() { - return reader; + public FontFileReader getFontFileReader() { + return fontFileReader; } public boolean hasFreeStandingFont() { - if (this.reader != null) { + if (this.fontFileReader != null) { return true; } if (this.metricsFile != null) { @@ -331,8 +331,4 @@ return true; } - public FontFileReader getFontFileReader() { - return this.reader; - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 15:57:48
|
Revision: 6997 Author: victormote Date: 2006-03-26 07:57:36 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6997&view=rev Log Message: ----------- Change RegisteredFont constructor to take a FontFileReader instead of a URL, giving us flexibility to use other implementations. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-03-26 15:37:36 UTC (rev 6996) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-03-26 15:57:36 UTC (rev 6997) @@ -25,6 +25,7 @@ package org.foray.font; import org.foray.common.Environment; +import org.foray.font.format.FontFileReader; import org.foray.font.output.FOrayFontPDFFactory; import org.axsl.font.FontException; @@ -676,24 +677,50 @@ public void registerFont(String fontID, URL fontFileURL, URL metricsFileURL, String collectionID, String embed, String systemName) throws FontException { + if (! isUsableFont(systemName, fontFileURL, metricsFileURL)) { + return; + } + FontFileReader fontFileReader = null; + if (fontFileURL != null) { + try { + fontFileReader = new FontFileReader(this.logger, fontFileURL); + } catch (IOException e) { + throw new FontException(e); + } + } + new RegisteredFont(this, fontID, fontFileReader, metricsFileURL, + collectionID, embed, systemName); + } + +// public void registerFont(String fontID, byte[] fontFileContents, +// byte[] metricsFileContents, String collectionID, String embed, +// String systemName) throws FontException { +// if (! isUsableFont(systemName, fontFileContents, metricsFileContents)) { +// return; +// } +// new RegisteredFont(this, fontID, fontFileURL, metricsFileURL, +// collectionID, embed, systemName); +// } + + private boolean isUsableFont(String systemName, Object fontFile, + Object metricsFile) { if (! usingFreeStandingFonts) { /* If not using FreeStandingFonts, then this font should not be * registered unless it will be able to generate a SystemFont. */ if (systemName == null || systemName.equals("")) { - return; + return false; } } if (! usingSystemFonts) { /* If not using SystemFonts, then this font should not be * registered unless it will be able to generate a FreeStandingFont. */ - if (fontFileURL == null - && metricsFileURL == null) { - return; + if (fontFile == null + && metricsFile == null) { + return false; } } - new RegisteredFont(this, fontID, fontFileURL, metricsFileURL, - collectionID, embed, systemName); + return true; } public RegisteredFont getRegisteredFont(String name) { Modified: trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2006-03-26 15:37:36 UTC (rev 6996) +++ trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2006-03-26 15:57:36 UTC (rev 6997) @@ -25,6 +25,7 @@ package org.foray.font; import org.foray.font.charset.CharSet; +import org.foray.font.format.FontFileReader; import org.foray.font.format.Kerning; import org.foray.ps.encode.Encoding; @@ -32,7 +33,6 @@ import java.io.IOException; import java.io.InputStream; -import java.net.URL; /** * Base class for all fonts that are registered independently of the operating @@ -194,7 +194,7 @@ return false; } /* If the fontFile exists, embed it. */ - if (getRegisteredFont().getFontFile() != null) { + if (getRegisteredFont().getFontFileReader() != null) { return true; } return false; @@ -220,17 +220,16 @@ } protected InputStream getFontInputStream() { - URL url = getRegisteredFont().getFontFile(); - if (url == null) { - this.getLogger().fatal("Unable to open font file or " - + "resource for embedding."); + FontFileReader fontFileReader = this.registeredFont.getFontFileReader(); + if ( fontFileReader == null) { return null; } InputStream instream = null; try { - instream = url.openStream(); + instream = fontFileReader.getInputStream(); } catch (IOException e1) { - this.getLogger().fatal("Unable to embed: " + url.getFile()); + this.getLogger().fatal("Unable to embed: " + + fontFileReader.getDescription()); } return instream; } Modified: trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2006-03-26 15:37:36 UTC (rev 6996) +++ trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2006-03-26 15:57:36 UTC (rev 6997) @@ -85,9 +85,6 @@ * configuration file. */ private String systemName = null; - /** URL to the actual font file, if any. */ - private URL fontFile = null; - /** The FontFileReader used for parsing the actual font file. */ private FontFileReader reader = null; @@ -137,14 +134,13 @@ /** * Constructor useful for registering a Font that has not yet been created. - * @param fontEmbedPath URL to the physical font file. */ public RegisteredFont(FOrayFontServer server, String fontName, - URL fontEmbedPath, URL metricsFileURL, String ttcName, + FontFileReader fontFileReader, URL metricsFileURL, String ttcName, String embedding, String systemName) throws FontException { this.fontServer = server; this.configuredFontName = fontName; - this.fontFile = fontEmbedPath; + this.reader = fontFileReader; this.ttcName = ttcName; this.metricsFile = metricsFileURL; if (embedding == null) { @@ -176,10 +172,6 @@ } try { - if (this.fontFile != null) { - this.reader = new FontFileReader(this.getLogger(), - this.fontFile); - } this.fsFont = createFSFont(); if (this.fsFont == null) { this.fsFont = getFontServer().getDefaultFreeStandingFont() @@ -279,10 +271,6 @@ return metricsFile; } - protected URL getFontFile() { - return fontFile; - } - protected String getTTCName() { return ttcName; } @@ -324,7 +312,7 @@ } public boolean hasFreeStandingFont() { - if (this.fontFile != null) { + if (this.reader != null) { return true; } if (this.metricsFile != null) { @@ -343,4 +331,8 @@ return true; } + public FontFileReader getFontFileReader() { + return this.reader; + } + } Modified: trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2006-03-26 15:37:36 UTC (rev 6996) +++ trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2006-03-26 15:57:36 UTC (rev 6997) @@ -25,6 +25,7 @@ package org.foray.font; import org.foray.font.charset.CharSet; +import org.foray.font.format.FontFileReader; import org.foray.font.format.Kerning; import org.axsl.font.FontException; @@ -39,7 +40,6 @@ import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.InputStream; -import java.net.URL; /** * Handles interface of system (AWT) fonts to the client application. @@ -365,8 +365,8 @@ * create Font to draw. */ public java.awt.Font createFont() throws FontException { - if (this.registeredFont.getFontFile() != null) { - return createFontFromInput(this.registeredFont.getFontFile()); + if (this.registeredFont.getFontFileReader() != null) { + return createFontFromInput(); } /* Since we are using the font name instead of the font-family name, * the font-style should be PLAIN. */ @@ -376,11 +376,10 @@ /** * Creates a java.awt.Font instance from a URL. - * @param fontURL The URL containing the file from which the Font should be - * created. * @return The Font created from fontURL. */ - private Font createFontFromInput(URL fontURL) throws FontException { + private Font createFontFromInput() + throws FontException { FreeStandingFont fsf = this.getRegisteredFont().getFreeStandingFont(); if (fsf == null) { return null; @@ -390,23 +389,19 @@ /* An AWT font cannot be created from this font file. */ return null; } + FontFileReader fontFileReader = this.registeredFont.getFontFileReader(); Font newFont = null; if (getLogger().isDebugEnabled()) { - getLogger().debug("Create AWT font from URL: \n " - + fontURL.toExternalForm()); + getLogger().debug("Create AWT font from: \n " + + fontFileReader.getDescription()); } InputStream fontStream = null; try { - fontStream = fontURL.openStream(); - } catch (IOException e) { - throw new FontException("Error opening input stream for: \n " - + fontURL.toExternalForm(), e); - } - try { + fontStream = fontFileReader.getInputStream(); newFont = Font.createFont(fontFormat, fontStream); } catch (IOException e) { throw new FontException("Error reading input stream for: \n " - + fontURL.toExternalForm(), e); + + fontFileReader.getDescription(), e); } catch(FontFormatException ffe) { /* Ignore this. This just means that the fontFormat is not one that * java recognizes, probably because the runtime is lower than This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 15:37:42
|
Revision: 6996 Author: victormote Date: 2006-03-26 07:37:36 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6996&view=rev Log Message: ----------- Add method allowing RandomReader to return an InputStream. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java 2006-03-26 14:55:59 UTC (rev 6995) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java 2006-03-26 15:37:36 UTC (rev 6996) @@ -26,6 +26,7 @@ import java.io.DataInput; import java.io.IOException; +import java.io.InputStream; import java.io.RandomAccessFile; /** @@ -61,4 +62,10 @@ */ String getDescription(); + /** + * Return the input as an InputStream. + * @return An InputStream containing the input contents. + */ + InputStream getInputStream() throws IOException ; + } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-03-26 14:55:59 UTC (rev 6995) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-03-26 15:37:36 UTC (rev 6996) @@ -27,6 +27,7 @@ import java.io.EOFException; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.net.URL; /** @@ -660,4 +661,11 @@ } + /** + * {@inheritDoc} + */ + public InputStream getInputStream() throws IOException { + return this.realReader.getInputStream(); + } + } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-03-26 14:55:59 UTC (rev 6995) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-03-26 15:37:36 UTC (rev 6996) @@ -24,9 +24,11 @@ package org.foray.common; +import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.EOFException; import java.io.IOException; +import java.io.InputStream; /** * Implementation of RandomInput that uses a byte array. @@ -48,22 +50,37 @@ this.byteArray = byteArray; } + /** + * {@inheritDoc} + */ public void seek(long offset) throws IOException { arrayIndex = (int) offset; } + /** + * {@inheritDoc} + */ public int skipBytes(int add) throws IOException { return arrayIndex += add; } + /** + * {@inheritDoc} + */ public long length() throws IOException { return this.byteArray.length; } + /** + * {@inheritDoc} + */ public byte readByte() throws IOException { return this.byteArray[arrayIndex]; } + /** + * {@inheritDoc} + */ public final int readUnsignedByte() throws IOException { if (this.arrayIndex >= this.byteArray.length) { throw new EOFException(); @@ -73,31 +90,49 @@ return c; } + /** + * {@inheritDoc} + */ public final short readShort() throws IOException { int byte1 = readUnsignedByte(); int byte2 = readUnsignedByte(); return (short)((byte1 << 8) + (byte2 << 0)); } + /** + * {@inheritDoc} + */ public final int readUnsignedShort() throws IOException { int byte1 = readUnsignedByte(); int byte2 = readUnsignedByte(); return (byte1 << 8) + (byte2 << 0); } + /** + * {@inheritDoc} + */ public final double readDouble() throws IOException { return Double.longBitsToDouble(readLong()); } + /** + * {@inheritDoc} + */ public final boolean readBoolean() throws IOException { int ch = readUnsignedByte(); return (ch != 0); } + /** + * {@inheritDoc} + */ public final void readFully(byte[] b) throws IOException { readFully(b, 0, b.length); } + /** + * {@inheritDoc} + */ public final void readFully(byte[] b, int off, int len) throws IOException { boolean eofDetected = false; if (this.arrayIndex + len >= this.byteArray.length) { @@ -111,24 +146,39 @@ } } + /** + * {@inheritDoc} + */ public final long readLong() throws IOException { return ((long) (readInt()) << 32) + (readInt() & 0xFFFFFFFFL); } + /** + * {@inheritDoc} + */ public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); } + /** + * {@inheritDoc} + */ public final char readChar() throws IOException { int byte1 = this.readUnsignedByte(); int byte2 = this.readUnsignedByte(); return (char)((byte1 << 8) + (byte2 << 0)); } + /** + * {@inheritDoc} + */ public final String readUTF() throws IOException { return DataInputStream.readUTF(this); } + /** + * {@inheritDoc} + */ public final int readInt() throws IOException { int byte1 = this.readUnsignedByte(); int byte2 = this.readUnsignedByte(); @@ -137,6 +187,9 @@ return ((byte1 << 24) + (byte2 << 16) + (byte3 << 8) + (byte4 << 0)); } + /** + * {@inheritDoc} + */ public final String readLine() throws IOException { StringBuffer input = new StringBuffer(); int byteRead = -1; @@ -169,12 +222,25 @@ return input.toString(); } + /** + * {@inheritDoc} + */ public long getFilePointer() throws IOException { return this.arrayIndex; } + /** + * {@inheritDoc} + */ public String getDescription() { return this.description; } + /** + * {@inheritDoc} + */ + public InputStream getInputStream() { + return new ByteArrayInputStream(this.byteArray); + } + } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java 2006-03-26 14:55:59 UTC (rev 6995) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java 2006-03-26 15:37:36 UTC (rev 6996) @@ -28,6 +28,7 @@ import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.io.RandomAccessFile; import java.net.URL; @@ -37,6 +38,8 @@ * and used by RandomReader. */ class RandomReaderRAFile implements RandomInput { + + private URL url; private File file = null; private RandomAccessFile raFile = null; @@ -44,6 +47,7 @@ * Constructor. */ protected RandomReaderRAFile(URL url) throws IOException { + this.url = url; this.file = new File(url.getFile()); if (file == null) { return; @@ -128,4 +132,11 @@ return this.file.getPath(); } + /** + * {@inheritDoc} + */ + public InputStream getInputStream() throws IOException { + return this.url.openStream(); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 14:56:05
|
Revision: 6995 Author: victormote Date: 2006-03-26 06:55:59 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6995&view=rev Log Message: ----------- Conform to FontFileReader changes. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java Modified: trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2006-03-26 14:54:08 UTC (rev 6994) +++ trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2006-03-26 14:55:59 UTC (rev 6995) @@ -177,7 +177,8 @@ try { if (this.fontFile != null) { - this.reader = new FontFileReader(fontServer, this.fontFile); + this.reader = new FontFileReader(this.getLogger(), + this.fontFile); } this.fsFont = createFSFont(); if (this.fsFont == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-26 14:54:14
|
Revision: 6994 Author: victormote Date: 2006-03-26 06:54:08 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6994&view=rev Log Message: ----------- Remove references to FontServer, just get a Log. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java Modified: trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java 2006-03-25 17:44:45 UTC (rev 6993) +++ trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java 2006-03-26 14:54:08 UTC (rev 6994) @@ -25,7 +25,6 @@ package org.foray.font.format; import org.foray.common.RandomReader; -import org.foray.font.FOrayFontServer; import org.foray.font.FOrayFont; import org.apache.commons.logging.Log; @@ -67,8 +66,6 @@ /** Set to one of the FILEFORMAT constants. */ private byte fileFormat = FILEFORMAT_UNKNOWN; - private FOrayFontServer fontServer; - private Log logger; /** The "child" FontFile instance that knows how to read this file. */ @@ -78,16 +75,6 @@ * instance for this. */ private boolean fontFileCreated = false; - /** - * Constructor - * @param url The URL to the file for which this reader is created. - */ - public FontFileReader(FOrayFontServer server, URL url) throws IOException { - super(url); - this.fontServer = server; - parseFontFileBasics(); - } - public FontFileReader(Log logger, URL url) throws IOException { super(url); this.logger = logger; @@ -173,10 +160,7 @@ } public Log getLogger() { - if (this.logger != null) { - return logger; - } - return this.fontServer.getLogger(); + return this.logger; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-25 17:44:50
|
Revision: 6993 Author: victormote Date: 2006-03-25 09:44:45 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6993&view=rev Log Message: ----------- Add constructor and logic that allows a RandomReader to be be created with a byte array. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-03-25 17:36:04 UTC (rev 6992) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-03-25 17:44:45 UTC (rev 6993) @@ -69,18 +69,35 @@ int lineNumber = 0; /** - * Basic constructor. + * Constructor suitable for a local file. * @param url The URL to the file that will be read. */ public RandomReader(URL url) throws IOException { this.realReader = randomInputFactory(url); } + /** + * Constructor suitable for a file or stream that has already been read + * into memory. + * @param description A description of the contents of + * <code>byteArray</code>. + * @param byteArray The byte array that should be read. + */ + public RandomReader(String description, byte[] byteArray) { + this.realReader = randomInputFactory(description, byteArray); + } + private RandomInput randomInputFactory(URL url) throws IOException{ /* Right now, there is only one available implementation. */ return new RandomReaderRAFile(url); } + private RandomInput randomInputFactory(String description, + byte[] byteArray) { + /* Right now, there is only one available implementation. */ + return new RandomReaderArray(description, byteArray); + } + public void seek(long pos) throws IOException { realReader.seek(pos); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-25 17:36:27
|
Revision: 6992 Author: victormote Date: 2006-03-25 09:36:04 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6992&view=rev Log Message: ----------- 1. Rename getURL to getDescription to make it more generic for the encapsulated item. 2. Remove URL from the wrapper. 3. Add a description instance variable to the RandomReaderArray class. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java 2006-03-25 17:04:25 UTC (rev 6991) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java 2006-03-25 17:36:04 UTC (rev 6992) @@ -55,4 +55,10 @@ */ long length() throws IOException; + /** + * Provides some kind of description of this item, useful in user messages. + * @return A description of the contents of this item. + */ + String getDescription(); + } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-03-25 17:04:25 UTC (rev 6991) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-03-25 17:36:04 UTC (rev 6992) @@ -62,9 +62,6 @@ CHAR_ENCODE_UTF_16 }; - /** The URL of the underlying file */ - private URL url; - /** The RandomInput implementation that does the real work. */ RandomInput realReader; @@ -76,7 +73,6 @@ * @param url The URL to the file that will be read. */ public RandomReader(URL url) throws IOException { - this.url = url; this.realReader = randomInputFactory(url); } @@ -158,8 +154,8 @@ return realReader.readUTF(); } - public URL getURL() { - return url; + public String getDescription() { + return realReader.getDescription(); } /** Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-03-25 17:04:25 UTC (rev 6991) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-03-25 17:36:04 UTC (rev 6992) @@ -29,19 +29,22 @@ import java.io.IOException; /** - * Implementation of RandomInput that uses a RandomAccessFile to do the - * io work. Class has package-visibility only as it should only be instantiated - * and used by RandomReader. + * Implementation of RandomInput that uses a byte array. */ class RandomReaderArray implements RandomInput { - private byte[] byteArray = null; + private String description; + private byte[] byteArray; private int arrayIndex = 0; /** * Constructor. + * @param description A description of the source of this byte array, + * useful in user messages. + * @byteArray The byte array which will be "read" by this reader. */ - protected RandomReaderArray(byte[] byteArray) { + protected RandomReaderArray(String description, byte[] byteArray) { + this.description = description; this.byteArray = byteArray; } @@ -170,4 +173,8 @@ return this.arrayIndex; } + public String getDescription() { + return this.description; + } + } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java 2006-03-25 17:04:25 UTC (rev 6991) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java 2006-03-25 17:36:04 UTC (rev 6992) @@ -124,4 +124,8 @@ return raFile.getFilePointer(); } + public String getDescription() { + return this.file.getPath(); + } + } Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-25 17:04:25 UTC (rev 6991) +++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2006-03-25 17:36:04 UTC (rev 6992) @@ -73,7 +73,7 @@ this.type1File = new Type1PFAFile(getRegisteredFont().getReader()); } else { String message = "Attempted to parse unknown Type1 font type.\n" - + reader.getURL().getFile(); + + reader.getDescription(); this.getLogger().fatal(message); } return this.type1File; @@ -90,11 +90,11 @@ metricsFile = reader.metricsFileFactory(); if (metricsFile == null) { throw new FontException("Unknown Metric Format: " - + reader.getURL()); + + reader.getDescription()); } if (metricsFile.getInternalEncoding() == null) { throw new FontException("Unusable Internal Encoding: " - + reader.getURL()); + + reader.getDescription()); } fontComplexity = FOrayFont.FONT_SIMPLE; this.postscriptName = metricsFile.getPostscriptName(); Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2006-03-25 17:04:25 UTC (rev 6991) +++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2006-03-25 17:36:04 UTC (rev 6992) @@ -1044,7 +1044,7 @@ } protected void logError(String message) { - getLogger().error(this.reader.getURL().getFile() + ": " + message); + getLogger().error(this.reader.getDescription() + ": " + message); } /** @@ -1080,7 +1080,7 @@ || charIndex > this.extentTable.length) { getLogger().error("Cannot encode glyph name: " + this.glyphName + "\n" - + " AFM: " + this.reader.getURL() + "\n" + + " AFM: " + this.reader.getDescription() + "\n" + " line: " + this.currentLineNumber); return; } Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2006-03-25 17:04:25 UTC (rev 6991) +++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2006-03-25 17:36:04 UTC (rev 6992) @@ -102,7 +102,7 @@ computeSegmentBoundaries(); } catch (IOException e) { reader.getLogger().error("Unable to parse basics of Type 1 file:\n" - + " " + reader.getURL().toString()); + + " " + reader.getDescription().toString()); } basicsParsed = true; } @@ -125,17 +125,17 @@ this.interpreter.process(); } catch (PSException e1) { this.reader.getLogger().error("PostScript interpreter failed:\n" - + " " + reader.getURL().toString()); + + " " + reader.getDescription().toString()); } this.fontBBox = parseFontBBox(); if (this.fontBBox == null) { this.reader.getLogger().error("Unable to parse Font BBox:\n" - + " " + reader.getURL().toString()); + + " " + reader.getDescription().toString()); } this.stemV = parseStemV(); if (this.stemV == 0) { this.reader.getLogger().error("Unable to parse StemV:\n" - + " " + reader.getURL().toString()); + + " " + reader.getDescription().toString()); } detailParsed = true; this.interpreter = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-25 17:04:34
|
Revision: 6991 Author: victormote Date: 2006-03-25 09:04:25 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6991&view=rev Log Message: ----------- Add RandomReader implementation that uses a byte array instead of a File. Added Paths: ----------- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java Added: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java (rev 0) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-03-25 17:04:25 UTC (rev 6991) @@ -0,0 +1,173 @@ +/* + * Copyright 2006 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.common; + +import java.io.DataInputStream; +import java.io.EOFException; +import java.io.IOException; + +/** + * Implementation of RandomInput that uses a RandomAccessFile to do the + * io work. Class has package-visibility only as it should only be instantiated + * and used by RandomReader. + */ +class RandomReaderArray implements RandomInput { + + private byte[] byteArray = null; + private int arrayIndex = 0; + + /** + * Constructor. + */ + protected RandomReaderArray(byte[] byteArray) { + this.byteArray = byteArray; + } + + public void seek(long offset) throws IOException { + arrayIndex = (int) offset; + } + + public int skipBytes(int add) throws IOException { + return arrayIndex += add; + } + + public long length() throws IOException { + return this.byteArray.length; + } + + public byte readByte() throws IOException { + return this.byteArray[arrayIndex]; + } + + public final int readUnsignedByte() throws IOException { + if (this.arrayIndex >= this.byteArray.length) { + throw new EOFException(); + } + char c = (char) this.byteArray[this.arrayIndex]; + this.arrayIndex ++; + return c; + } + + public final short readShort() throws IOException { + int byte1 = readUnsignedByte(); + int byte2 = readUnsignedByte(); + return (short)((byte1 << 8) + (byte2 << 0)); + } + + public final int readUnsignedShort() throws IOException { + int byte1 = readUnsignedByte(); + int byte2 = readUnsignedByte(); + return (byte1 << 8) + (byte2 << 0); + } + + public final double readDouble() throws IOException { + return Double.longBitsToDouble(readLong()); + } + + public final boolean readBoolean() throws IOException { + int ch = readUnsignedByte(); + return (ch != 0); + } + + public final void readFully(byte[] b) throws IOException { + readFully(b, 0, b.length); + } + + public final void readFully(byte[] b, int off, int len) throws IOException { + boolean eofDetected = false; + if (this.arrayIndex + len >= this.byteArray.length) { + eofDetected = true; + len = this.byteArray.length - this.arrayIndex; + } + System.arraycopy(this.byteArray, this.arrayIndex, b, off, len); + this.arrayIndex += len; + if (eofDetected) { + throw new EOFException(); + } + } + + public final long readLong() throws IOException { + return ((long) (readInt()) << 32) + (readInt() & 0xFFFFFFFFL); + } + + public final float readFloat() throws IOException { + return Float.intBitsToFloat(readInt()); + } + + public final char readChar() throws IOException { + int byte1 = this.readUnsignedByte(); + int byte2 = this.readUnsignedByte(); + return (char)((byte1 << 8) + (byte2 << 0)); + } + + public final String readUTF() throws IOException { + return DataInputStream.readUTF(this); + } + + public final int readInt() throws IOException { + int byte1 = this.readUnsignedByte(); + int byte2 = this.readUnsignedByte(); + int byte3 = this.readUnsignedByte(); + int byte4 = this.readUnsignedByte(); + return ((byte1 << 24) + (byte2 << 16) + (byte3 << 8) + (byte4 << 0)); + } + + public final String readLine() throws IOException { + StringBuffer input = new StringBuffer(); + int byteRead = -1; + boolean eol = false; + + while (!eol) { + switch (byteRead = this.readUnsignedByte()) { + case -1: + case '\n': { + eol = true; + break; + } + case '\r': { + eol = true; + long cur = getFilePointer(); + if ((this.readUnsignedByte()) != '\n') { + seek(cur); + } + break; + } + default: { + input.append((char)byteRead); + break; + } + } + } + if ((byteRead == -1) && (input.length() == 0)) { + return null; + } + return input.toString(); + } + + public long getFilePointer() throws IOException { + return this.arrayIndex; + } + +} Property changes on: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java ___________________________________________________________________ Name: svn:keywords + "Author Id Rev Date URL" Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-25 17:03:42
|
Revision: 6990 Author: victormote Date: 2006-03-25 09:03:30 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6990&view=rev Log Message: ----------- Javadoc improvements. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java 2006-03-25 14:54:55 UTC (rev 6989) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomInput.java 2006-03-25 17:03:30 UTC (rev 6990) @@ -26,6 +26,7 @@ import java.io.DataInput; import java.io.IOException; +import java.io.RandomAccessFile; /** * This interface extends DataInput by adding methods for random access @@ -39,10 +40,19 @@ */ public interface RandomInput extends DataInput { + /** + * Same function as {@link RandomAccessFile#seek(long)}. + */ void seek(long pos) throws IOException; + /** + * Same function as {@link RandomAccessFile#getFilePointer()}. + */ long getFilePointer() throws IOException; + /** + * Same function as {@link RandomAccessFile#length()}. + */ long length() throws IOException; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-25 14:55:15
|
Revision: 6989 Author: victormote Date: 2006-03-25 06:54:55 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6989&view=rev Log Message: ----------- Conform to aXSL changes, specifically the removal of PDFFactory. Instead just use the PDFDocument constructor directly. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java Removed Paths: ------------- trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-03-24 00:54:29 UTC (rev 6988) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-03-25 14:54:55 UTC (rev 6989) @@ -29,7 +29,6 @@ import org.foray.output.MIFConverter; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; -import org.foray.pdf.FOrayPDFFactory; import org.foray.render.awt.AWTRenderer; import org.foray.render.pcl.PCLRenderer; import org.foray.render.pdf.PDFRenderer; @@ -42,7 +41,7 @@ import org.axsl.font.FontServer; import org.axsl.fotree.FOTreeControl; import org.axsl.graphic.GraphicServer; -import org.axsl.pdf.PDFFactory; +import org.axsl.pdf.PDFDocument; import org.axsl.text.TextServer; import org.apache.commons.logging.Log; @@ -470,8 +469,9 @@ break; } default: { - PDFFactory pdfFactory = new FOrayPDFFactory(getLogger()); - renderer = new PDFRenderer(outputOptions, pdfFactory); + PDFDocument document = new org.foray.pdf.object.PDFDocument( + getLogger()); + renderer = new PDFRenderer(outputOptions, document); break; } } Deleted: trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java 2006-03-24 00:54:29 UTC (rev 6988) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java 2006-03-25 14:54:55 UTC (rev 6989) @@ -1,44 +0,0 @@ -/* - * Copyright 2006 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.pdf; - -import org.axsl.pdf.PDFDocument; -import org.axsl.pdf.PDFFactory; - -import org.apache.commons.logging.Log; - -public class FOrayPDFFactory implements PDFFactory { - - Log logger; - - public FOrayPDFFactory(Log logger) { - this.logger = logger; - } - - public PDFDocument createPDFDocument() { - return new org.foray.pdf.object.PDFDocument(this.logger); - } - -} Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2006-03-24 00:54:29 UTC (rev 6988) +++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2006-03-25 14:54:55 UTC (rev 6989) @@ -54,7 +54,6 @@ import org.axsl.pdf.PDFEncryption; import org.axsl.pdf.PDFException; import org.axsl.pdf.PDFExplicitDestination; -import org.axsl.pdf.PDFFactory; import org.axsl.pdf.PDFFont; import org.axsl.pdf.PDFOutlineItem; import org.axsl.pdf.PDFOutlineParent; @@ -75,9 +74,6 @@ */ public class PDFRenderer extends PrintRenderer { - /** The PDFFactory responsible to generate PDF objects. */ - PDFFactory pdfFactory; - /** The PDF Document being created. */ PDFDocument pdfDoc; @@ -87,9 +83,9 @@ /** * Create a PDF renderer. */ - public PDFRenderer(OutputConfig renderConfig, PDFFactory pdfFactory) { + public PDFRenderer(OutputConfig renderConfig, PDFDocument document) { super(renderConfig); - this.pdfFactory = pdfFactory; + this.pdfDoc = document; } private void addEncryption() { @@ -128,7 +124,6 @@ * {@inheritDoc} */ public void startOutput() throws IOException { - this.pdfDoc = this.pdfFactory.createPDFDocument(); String pdfVersion = this.options.optionPDFVersion(); if (pdfVersion != null) { int pdfVersionConstant = PDFUtility.integralVersion(pdfVersion); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-24 00:54:45
|
Revision: 6988 Author: victormote Date: 2006-03-23 16:54:29 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6988&view=rev Log Message: ----------- Conform to new axsl requirements. Modified Paths: -------------- trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java 2006-03-24 00:30:03 UTC (rev 6987) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java 2006-03-24 00:54:29 UTC (rev 6988) @@ -24,22 +24,11 @@ package org.foray.pdf; -import org.foray.pdf.object.PDFResources; - -import org.axsl.pdf.PDFColor; import org.axsl.pdf.PDFDocument; -import org.axsl.pdf.PDFException; -import org.axsl.pdf.PDFExplicitDestination; import org.axsl.pdf.PDFFactory; -import org.axsl.pdf.PDFLink; -import org.axsl.pdf.PDFNamedDestination; -import org.axsl.pdf.PDFPage; import org.apache.commons.logging.Log; -import java.awt.Color; -import java.awt.geom.Rectangle2D; - public class FOrayPDFFactory implements PDFFactory { Log logger; @@ -52,75 +41,4 @@ return new org.foray.pdf.object.PDFDocument(this.logger); } - private org.foray.pdf.object.PDFDocument getFOrayPDFDocument( - PDFDocument document) throws PDFException { - if (document instanceof org.foray.pdf.object.PDFDocument) { - return (org.foray.pdf.object.PDFDocument) document; - } - throw new PDFException("Unsupported PDFDocument implementation."); - } - - private org.foray.pdf.object.PDFPage getFOrayPDFPage( - PDFPage page) throws PDFException { - if (page instanceof org.foray.pdf.object.PDFPage) { - return (org.foray.pdf.object.PDFPage) page; - } - throw new PDFException("Unsupported PDFPage implementation."); - } - - /** - * {@inheritDoc} - */ - public PDFNamedDestination createPDFNamedDestination( - PDFDocument document, String name, PDFExplicitDestination explicit) - throws PDFException { - org.foray.pdf.object.PDFDocument forayPDFDocument - = getFOrayPDFDocument(document); - if (! (explicit instanceof org.foray.pdf.object.PDFExplicitDestination)) { - throw new PDFException("Unsupported PDFExplicitDestination " - + "implementation."); - } - org.foray.pdf.object.PDFExplicitDestination forayExplicitDestination - = (org.foray.pdf.object.PDFExplicitDestination) explicit; - org.foray.pdf.object.PDFNamedDestination destination - = new org.foray.pdf.object.PDFNamedDestination( - forayPDFDocument, name, forayExplicitDestination); - forayPDFDocument.addNamedDestination(destination); - return destination; - } - - /** - * {@inheritDoc} - */ - public PDFColor createPDFColor(Color color) { - return new org.foray.pdf.object.PDFColor(color); - } - - /** - * {@inheritDoc} - */ - public PDFPage createPDFPage(PDFDocument document, - int pagewidth, int pageheight) throws PDFException { - org.foray.pdf.object.PDFDocument forayPDFDocument - = getFOrayPDFDocument(document); - PDFResources resources = forayPDFDocument.getResources(); - org.foray.pdf.object.PDFPage page = new org.foray.pdf.object.PDFPage( - forayPDFDocument, resources, pagewidth, pageheight); - return page; - } - - /** - * {@inheritDoc} - */ - public PDFLink createPDFLink(PDFDocument document, PDFPage page, - Rectangle2D.Float linkRectangle, String destination) - throws PDFException { - org.foray.pdf.object.PDFDocument forayPDFDocument - = getFOrayPDFDocument(document); - org.foray.pdf.object.PDFPage forayPage = getFOrayPDFPage(page); - PDFLink link = new org.foray.pdf.object.PDFLink(forayPDFDocument, - forayPage, linkRectangle, destination); - return link; - } - } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2006-03-24 00:30:03 UTC (rev 6987) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2006-03-24 00:54:29 UTC (rev 6988) @@ -37,11 +37,14 @@ import org.axsl.font.Font; import org.axsl.font.FontUse; +import org.axsl.pdf.PDFColor; import org.axsl.pdf.PDFException; +import org.axsl.pdf.PDFPage; import org.axsl.ps.Encoding; import org.apache.commons.logging.Log; +import java.awt.Color; import java.awt.color.ColorSpace; import java.io.IOException; import java.io.OutputStream; @@ -603,4 +606,19 @@ return new org.foray.pdf.object.PDFEncryption(this); } + /** + * {@inheritDoc} + */ + public PDFColor createPDFColor(Color color) { + return new org.foray.pdf.object.PDFColor(color); + } + + /** + * {@inheritDoc} + */ + public PDFPage createPDFPage(int pagewidth, int pageheight) { + return new org.foray.pdf.object.PDFPage(this, this.getResources(), + pagewidth, pageheight); + } + } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java 2006-03-24 00:30:03 UTC (rev 6987) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java 2006-03-24 00:54:29 UTC (rev 6988) @@ -65,4 +65,15 @@ return buffer.toString(); } + /** + * {@inheritDoc} + */ + public org.axsl.pdf.PDFNamedDestination createPDFNamedDestination(String name) { + org.foray.pdf.object.PDFNamedDestination destination + = new org.foray.pdf.object.PDFNamedDestination( + this.getPDFDocument(), name, this); + this.getPDFDocument().addNamedDestination(destination); + return destination; + } + } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2006-03-24 00:30:03 UTC (rev 6987) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2006-03-24 00:54:29 UTC (rev 6988) @@ -205,4 +205,13 @@ return destination; } + /** + * {@inheritDoc} + */ + public org.axsl.pdf.PDFLink createPDFLink(Rectangle2D.Float linkRectangle, + String destination) { + return new org.foray.pdf.object.PDFLink(this.getPDFDocument(), this, + linkRectangle, destination); + } + } Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2006-03-24 00:30:03 UTC (rev 6987) +++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2006-03-24 00:54:29 UTC (rev 6988) @@ -175,7 +175,7 @@ */ protected void drawLine(int startX, int startY, int endX, int endY, int thickness, int ruleStyle, Color strokeColor) { - PDFColor pdfColor = this.pdfFactory.createPDFColor(strokeColor); + PDFColor pdfColor = this.getPDFDocument().createPDFColor(strokeColor); float[] dashPattern = null; switch (ruleStyle) { case Constants.FOVAL_DASHED: @@ -200,11 +200,11 @@ Color strokeColor, boolean fill, Color fillColor) { PDFPathPaint strokePaint = null; if (strokeColor != null) { - strokePaint = this.pdfFactory.createPDFColor(strokeColor); + strokePaint = this.getPDFDocument().createPDFColor(strokeColor); } PDFPathPaint fillPaint = null; if (fillColor != null) { - fillPaint = this.pdfFactory.createPDFColor(fillColor); + fillPaint = this.getPDFDocument().createPDFColor(fillColor); } Rectangle2D.Float rectangle = new Rectangle2D.Float(x / 1000f, y / 1000f, w / 1000f, h / 1000f); @@ -276,7 +276,8 @@ } /* Set the color. */ - PDFColor areaColor = this.pdfFactory.createPDFColor(area.traitColor()); + PDFColor areaColor = this.getPDFDocument().createPDFColor( + area.traitColor()); getContentStream().setStrokeColor(areaColor); /* Set word-spacing and letter-spacing. */ @@ -380,13 +381,8 @@ getLogger().debug("Rendering single page to PDF."); float w = page.getWidth(); float h = page.getHeight(); - try { - currentPage = this.pdfFactory.createPDFPage(this.pdfDoc, - Math.round(w / 1000), - Math.round(h / 1000)); - } catch (PDFException e) { - /* Ignore this. It should never happen. */ - } + currentPage = this.pdfDoc.createPDFPage(Math.round(w / 1000), + Math.round(h / 1000)); this.getPDFDocument().resetGraphicsState(); renderRegions(page); getContentStream().close(); @@ -405,15 +401,10 @@ */ private void renderDestinations(Area area) { if (area.destinationName() != null) { - try { - PDFExplicitDestination explicitDest - = this.currentPage.createPDFExplicitDestination( - area.rrOriginX() / 1000f, area.rrOriginY() / 1000f); - this.pdfFactory.createPDFNamedDestination(pdfDoc, - area.traitId(), explicitDest); - } catch (PDFException e) { - /* Ignore this. It should never happen. */ - } + PDFExplicitDestination explicitDest + = this.currentPage.createPDFExplicitDestination( + area.rrOriginX() / 1000f, area.rrOriginY() / 1000f); + explicitDest.createPDFNamedDestination(area.traitId()); } List children = area.getChildren(); for (int i = 0; i < children.size(); i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-24 00:30:21
|
Revision: 6987 Author: victormote Date: 2006-03-23 16:30:03 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6987&view=rev Log Message: ----------- Conform to new axsl requirements. Modified Paths: -------------- trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java 2006-03-20 03:41:34 UTC (rev 6986) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/FOrayPDFFactory.java 2006-03-24 00:30:03 UTC (rev 6987) @@ -28,14 +28,11 @@ import org.axsl.pdf.PDFColor; import org.axsl.pdf.PDFDocument; -import org.axsl.pdf.PDFEncryption; import org.axsl.pdf.PDFException; import org.axsl.pdf.PDFExplicitDestination; import org.axsl.pdf.PDFFactory; import org.axsl.pdf.PDFLink; import org.axsl.pdf.PDFNamedDestination; -import org.axsl.pdf.PDFOutlineItem; -import org.axsl.pdf.PDFOutlineParent; import org.axsl.pdf.PDFPage; import org.apache.commons.logging.Log; @@ -74,52 +71,6 @@ /** * {@inheritDoc} */ - public PDFEncryption createPDFEncryption(PDFDocument document) - throws PDFException { - org.foray.pdf.object.PDFDocument forayPDFDocument - = getFOrayPDFDocument(document); - return new org.foray.pdf.object.PDFEncryption(forayPDFDocument); - } - - /** - * {@inheritDoc} - */ - public PDFOutlineItem createPDFOutlineItem(PDFDocument document, - PDFOutlineParent parent, String titleText, - String internalDestination, Color color, boolean italic, - boolean bold) throws PDFException { - org.foray.pdf.object.PDFDocument forayPDFDocument - = getFOrayPDFDocument(document); - if (! (parent instanceof org.foray.pdf.object.PDFOutlineParent)) { - throw new PDFException("Unsupported PDFOutlineParent " - + "implementation."); - } - org.foray.pdf.object.PDFOutlineParent forayOutlineParent - = (org.foray.pdf.object.PDFOutlineParent) parent; - return new org.foray.pdf.object.PDFOutlineItem(forayPDFDocument, - forayOutlineParent, titleText, internalDestination, color, - italic, bold); - } - - /** - * {@inheritDoc} - */ - public PDFExplicitDestination createPDFExplicitDestination( - PDFDocument document, PDFPage page, float xPosition, - float yPosition) throws PDFException { - org.foray.pdf.object.PDFDocument forayPDFDocument - = getFOrayPDFDocument(document); - org.foray.pdf.object.PDFPage forayPage = getFOrayPDFPage(page); - org.foray.pdf.object.PDFExplicitDestination destination - = new org.foray.pdf.object.PDFExplicitDestination( - forayPDFDocument, forayPage, xPosition, yPosition); - forayPDFDocument.registerIndirectObjectLast(destination); - return destination; - } - - /** - * {@inheritDoc} - */ public PDFNamedDestination createPDFNamedDestination( PDFDocument document, String name, PDFExplicitDestination explicit) throws PDFException { Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2006-03-20 03:41:34 UTC (rev 6986) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2006-03-24 00:30:03 UTC (rev 6987) @@ -32,6 +32,7 @@ package org.foray.pdf.object; +import org.foray.pdf.object.PDFEncryption; import org.foray.pdf.PDFGraphicsState; import org.axsl.font.Font; @@ -595,4 +596,11 @@ this.getCurrentGraphicsState().reset(); } + /** + * {@inheritDoc} + */ + public org.axsl.pdf.PDFEncryption createPDFEncryption() { + return new org.foray.pdf.object.PDFEncryption(this); + } + } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java 2006-03-20 03:41:34 UTC (rev 6986) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java 2006-03-24 00:30:03 UTC (rev 6987) @@ -24,6 +24,7 @@ package org.foray.pdf.object; +import java.awt.Color; import java.util.ArrayList; import java.util.List; @@ -68,4 +69,14 @@ protected abstract int count(); + /** + * {@inheritDoc} + */ + public org.axsl.pdf.PDFOutlineItem createPDFOutlineItem(String titleText, + String internalDestination, Color color, boolean italic, + boolean bold) { + return new org.foray.pdf.object.PDFOutlineItem(this.getPDFDocument(), + this, titleText, internalDestination, color, italic, bold); + } + } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2006-03-20 03:41:34 UTC (rev 6986) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2006-03-24 00:30:03 UTC (rev 6987) @@ -24,6 +24,8 @@ package org.foray.pdf.object; +import org.axsl.pdf.PDFExplicitDestination; + import java.awt.geom.Rectangle2D; /** @@ -191,4 +193,16 @@ return this.contents; } + /** + * {@inheritDoc} + */ + public PDFExplicitDestination createPDFExplicitDestination(float xPosition, + float yPosition) { + org.foray.pdf.object.PDFExplicitDestination destination + = new org.foray.pdf.object.PDFExplicitDestination( + this.getPDFDocument(), this, xPosition, yPosition); + this.getPDFDocument().registerIndirectObjectLast(destination); + return destination; + } + } Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2006-03-20 03:41:34 UTC (rev 6986) +++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2006-03-24 00:30:03 UTC (rev 6987) @@ -113,12 +113,7 @@ } if (encrypt) { PDFEncryption encryption = null; - try { - encryption = this.pdfFactory.createPDFEncryption( - this.getPDFDocument()); - } catch (PDFException e) { - this.getLogger().error("PDF Encryption failed", e); - } + encryption = this.getPDFDocument().createPDFEncryption(); encryption.setOwnerPassword(oPassword); encryption.setUserPassword(uPassword); encryption.setAllowPrint(allowPrint); @@ -412,9 +407,8 @@ if (area.destinationName() != null) { try { PDFExplicitDestination explicitDest - = this.pdfFactory.createPDFExplicitDestination( - pdfDoc, this.currentPage, area.rrOriginX() / 1000f, - area.rrOriginY() / 1000f); + = this.currentPage.createPDFExplicitDestination( + area.rrOriginX() / 1000f, area.rrOriginY() / 1000f); this.pdfFactory.createPDFNamedDestination(pdfDoc, area.traitId(), explicitDest); } catch (PDFException e) { @@ -463,13 +457,8 @@ bold = true; } PDFOutlineItem pdfOutline = null; - try { - pdfOutline = this.pdfFactory.createPDFOutlineItem(pdfDoc, - parent, title.getTitleText(), area.traitInternalDestination(), - color, italic, bold); - } catch (PDFException e) { - /* Ignore this. It should never happen. */ - } + pdfOutline = parent.createPDFOutlineItem(title.getTitleText(), + area.traitInternalDestination(), color, italic, bold); // Recursively handle child bookmarks List children = area.getChildren(); for (int i = 0; i < children.size(); i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-20 03:41:43
|
Revision: 6986 Author: victormote Date: 2006-03-19 19:41:34 -0800 (Sun, 19 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6986&view=rev Log Message: ----------- Javadoc changes. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontDesc.java Modified: trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontDesc.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontDesc.java 2006-03-20 02:31:09 UTC (rev 6985) +++ trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontDesc.java 2006-03-20 03:41:34 UTC (rev 6986) @@ -66,15 +66,15 @@ private float simulateSmallCaps = Float.NaN; /** - * Percentage of 90 degrees by which the font should be slanted to the - * right for the simulated oblique effect. + * Number of degrees by which the font should be slanted clockwise for the + * simulated oblique effect. * Invalid or unset amounts are indicated by the value {@link Float#NaN}. */ private float simulateOblique = Float.NaN; /** - * Percentage of 90 degrees by which the font should be slanted to the - * left for the simulated oblique effect. + * Number of degrees by which the font should be slanted counterclockwise + * for the simulated backslant effect. * Invalid or unset amounts are indicated by the value {@link Float#NaN}. */ private float simulateBackslant = Float.NaN; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |