foray-commit Mailing List for FOray (Page 9)
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...> - 2025-05-17 16:49:40
|
Revision: 13678
http://sourceforge.net/p/foray/code/13678
Author: victormote
Date: 2025-05-17 16:49:37 +0000 (Sat, 17 May 2025)
Log Message:
-----------
Conform to aXSL change: Remove currently unneeded specialized interface for the bitmap portion of an EPS.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java 2025-05-17 16:14:59 UTC (rev 13677)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java 2025-05-17 16:49:37 UTC (rev 13678)
@@ -28,7 +28,7 @@
package org.foray.graphic;
-import org.axsl.graphic.EpsBitmapGraphic;
+import org.axsl.graphic.BitmapGraphic;
import org.axsl.graphic.GraphicException;
import org.axsl.graphic.GraphicLink;
import org.axsl.primitive.sequence.ByteSequence;
@@ -41,7 +41,7 @@
/**
* The bitmap portion of an EPS (encapsulated Postscript) graphic.
*/
-public class EpsBitmapGraphic4a implements EpsBitmapGraphic {
+public class EpsBitmapGraphic4a implements BitmapGraphic {
@Override
public boolean isInverted() {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java 2025-05-17 16:14:59 UTC (rev 13677)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java 2025-05-17 16:49:37 UTC (rev 13678)
@@ -28,7 +28,6 @@
package org.foray.graphic;
-import org.axsl.graphic.EpsBitmapGraphic;
import org.axsl.graphic.EpsGraphic;
import org.axsl.graphic.EpsVectorGraphic;
import org.axsl.graphic.GraphicException;
@@ -70,7 +69,7 @@
}
@Override
- public EpsBitmapGraphic getBitmapGraphic() {
+ public EpsBitmapGraphic4a getBitmapGraphic() {
return this.bitmapGraphic;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-17 16:15:04
|
Revision: 13677
http://sourceforge.net/p/foray/code/13677
Author: victormote
Date: 2025-05-17 16:14:59 +0000 (Sat, 17 May 2025)
Log Message:
-----------
Fix compile errors from Graphic Metafile change. All tests pass, but EPS processing still broken.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsVectorGraphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/EpsFactory.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/GraphicFactory.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/graphics/PdfXformEps.java
trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
Added Paths:
-----------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java 2025-05-17 16:14:59 UTC (rev 13677)
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic;
+
+import org.axsl.graphic.EpsBitmapGraphic;
+import org.axsl.graphic.GraphicException;
+import org.axsl.graphic.GraphicLink;
+import org.axsl.primitive.sequence.ByteSequence;
+
+import java.awt.Color;
+import java.awt.color.ColorSpace;
+import java.net.URL;
+import java.util.List;
+
+/**
+ * The bitmap portion of an EPS (encapsulated Postscript) graphic.
+ */
+public class EpsBitmapGraphic4a implements EpsBitmapGraphic {
+
+ @Override
+ public boolean isInverted() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public URL getUrl() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getPixelWidth() throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getPixelHeight() throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getAbsoluteWidth(final int pixelsPerInch) throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getAbsoluteHeight(final int pixelsPerInch) throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public ColorSpace getColorSpace() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getBitsPerComponent() throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean isTransparent() throws GraphicException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Color getTransparentColor() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ByteSequence getRawSamples() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ByteSequence getContent() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getContentSize() throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void close() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Type getGraphicType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Compression getCompressionType() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getMimeType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<? extends GraphicLink> getLinks() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsBitmapGraphic4a.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java 2025-05-17 16:14:59 UTC (rev 13677)
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic;
+
+import org.axsl.graphic.EpsBitmapGraphic;
+import org.axsl.graphic.EpsGraphic;
+import org.axsl.graphic.EpsVectorGraphic;
+import org.axsl.graphic.GraphicException;
+import org.axsl.primitive.sequence.ByteSequence;
+
+import java.awt.Color;
+import java.awt.color.ColorSpace;
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * An EPS (encapsulated Postscript) graphic.
+ */
+public class EpsGraphic4a extends Graphic4a implements EpsGraphic {
+
+ /** The vector portion of this graphic. */
+ private EpsVectorGraphic4a vectorGraphic;
+
+ /** The vector portion of this graphic. */
+ private EpsBitmapGraphic4a bitmapGraphic;
+
+ /**
+ * Constructor.
+ * @param server The parent graphic server.
+ * @param url The URL which contains the graphic content.
+ * @param bis The reusable input stream containing the bytes from {@code url}.
+ * @param isAscii Indicates whether this file format is ASCII (true) or binary (false).
+ */
+ public EpsGraphic4a(final GraphicServer4a server, final URL url, final BufferedInputStream bis,
+ final boolean isAscii) {
+ super(server, url, bis);
+ this.vectorGraphic = new EpsVectorGraphic4a(server, url, bis, isAscii);
+ }
+
+ @Override
+ public EpsVectorGraphic getVectorGraphic() {
+ return this.vectorGraphic;
+ }
+
+ @Override
+ public EpsBitmapGraphic getBitmapGraphic() {
+ return this.bitmapGraphic;
+ }
+
+ @Override
+ public boolean isInverted() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int getPixelWidth() throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getPixelHeight() throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public ColorSpace getColorSpace() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isTransparent() throws GraphicException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Color getTransparentColor() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ByteSequence getRawSamples() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Type getGraphicType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Compression getCompressionType() throws GraphicException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getMimeType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected void loadImage() throws GraphicException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ protected void parseBasics() throws IOException, GraphicException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int absoluteWidthReal() throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int absoluteHeightReal() throws GraphicException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsVectorGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsVectorGraphic4a.java 2025-05-17 15:33:14 UTC (rev 13676)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsVectorGraphic4a.java 2025-05-17 16:14:59 UTC (rev 13677)
@@ -46,7 +46,7 @@
import java.net.URL;
/**
- * An EPS (encapsulated Postscript) graphic.
+ * The vector portion of an EPS (encapsulated Postscript) graphic.
*/
public class EpsVectorGraphic4a extends VectorGraphic4a implements EpsVectorGraphic {
@@ -125,14 +125,13 @@
* @param server The parent graphic server.
* @param url The URL which contains the graphic content.
* @param bis The reusable input stream containing the bytes from {@code url}.
- * @param isASCII Indicates whether this file format is ASCII (true) or
- * binary (false).
+ * @param isAscii Indicates whether this file format is ASCII (true) or binary (false).
*/
public EpsVectorGraphic4a(final GraphicServer4a server, final URL url,
- final BufferedInputStream bis, final boolean isASCII) {
+ final BufferedInputStream bis, final boolean isAscii) {
super(server, url, bis);
this.docName = url.toString();
- this.isAscii = isASCII;
+ this.isAscii = isAscii;
}
@Override
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/EpsFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/EpsFactory.java 2025-05-17 15:33:14 UTC (rev 13676)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/EpsFactory.java 2025-05-17 16:14:59 UTC (rev 13677)
@@ -28,7 +28,7 @@
package org.foray.graphic.factory;
-import org.foray.graphic.EpsVectorGraphic4a;
+import org.foray.graphic.EpsGraphic4a;
import org.foray.graphic.GraphicServer4a;
import java.io.BufferedInputStream;
@@ -70,8 +70,7 @@
}
@Override
- public EpsVectorGraphic4a attemptCreate(final URL url,
- final BufferedInputStream bis) throws IOException {
+ public EpsGraphic4a attemptCreate(final URL url, final BufferedInputStream bis) throws IOException {
final byte[] header = new byte[EpsFactory.EPS_HEADER_BINARY.length];
bis.read(header);
boolean isEPS = false;
@@ -96,7 +95,7 @@
if (! isEPS) {
return null;
}
- return new EpsVectorGraphic4a(this.getServer(), url, bis, isAscii);
+ return new EpsGraphic4a(this.getServer(), url, bis, isAscii);
}
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/GraphicFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/GraphicFactory.java 2025-05-17 15:33:14 UTC (rev 13676)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/GraphicFactory.java 2025-05-17 16:14:59 UTC (rev 13677)
@@ -99,8 +99,7 @@
* unable to create such an instance.
* @throws IOException For IO errors.
*/
- protected abstract Graphic4a attemptCreate(URL url,
- BufferedInputStream bis) throws IOException;
+ protected abstract Graphic4a attemptCreate(URL url, BufferedInputStream bis) throws IOException;
/**
* Tells GraphicFactory how large to set the {@code readlimit} value
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/graphics/PdfXformEps.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/graphics/PdfXformEps.java 2025-05-17 15:33:14 UTC (rev 13676)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/graphics/PdfXformEps.java 2025-05-17 16:14:59 UTC (rev 13677)
@@ -32,6 +32,7 @@
import org.foray.primitive.sequence.ByteArray;
import org.axsl.graphic.EpsGraphic;
+import org.axsl.graphic.EpsVectorGraphic;
import org.axsl.graphic.GraphicException;
import org.axsl.ps.BoundingBox;
import org.axsl.ps.PsException;
@@ -52,7 +53,7 @@
public class PdfXformEps extends PdfFormXobject {
/** The Graphic instance associated with this XObject. */
- private EpsGraphic graphic;
+ private EpsVectorGraphic graphic;
/**
* Constructor.
@@ -60,8 +61,8 @@
* @param graphic The form to be encapsulated.
*/
public PdfXformEps(final PdfDocument4a doc, final EpsGraphic graphic) {
- super(doc, graphic);
- this.graphic = graphic;
+ super(doc, graphic.getVectorGraphic());
+ this.graphic = graphic.getVectorGraphic();
}
@Override
@@ -91,7 +92,7 @@
@Override
public float getHorizontalScaling(
final Rectangle2D.Float contentRectangle) {
- final EpsGraphic eps = this.getGraphic();
+ final EpsVectorGraphic eps = this.getGraphic();
final float graphicWidth = eps.getBoundingBox().computeWidthAsFloat();
return contentRectangle.width / graphicWidth;
}
@@ -98,13 +99,13 @@
@Override
public float getVerticalScaling(final Rectangle2D.Float contentRectangle) {
- final EpsGraphic eps = this.getGraphic();
+ final EpsVectorGraphic eps = this.getGraphic();
final float graphicHeight = eps.getBoundingBox().computeHeightAsFloat();
return contentRectangle.height / graphicHeight;
}
@Override
- public EpsGraphic getGraphic() {
+ public EpsVectorGraphic getGraphic() {
return this.graphic;
}
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2025-05-17 15:33:14 UTC (rev 13676)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2025-05-17 16:14:59 UTC (rev 13677)
@@ -671,12 +671,12 @@
*/
public byte[] epsToPostScript(final EpsGraphic image, final int x,
final int y, final int w, final int h) throws GraphicException {
- final BoundingBox bbox = image.getBoundingBox();
+ final BoundingBox bbox = image.getVectorGraphic().getBoundingBox();
final float bboxw = bbox.computeWidthAsFloat();
final float bboxh = bbox.computeHeightAsFloat();
StringBuilder buffer = new StringBuilder();
- buffer.append("%%BeginDocument: " + image.getName());
+ buffer.append("%%BeginDocument: " + image.getVectorGraphic().getName());
buffer.append("BeginEPSF");
buffer.append(x + " " + (y - h) + " translate");
@@ -703,15 +703,15 @@
buffer.append("");
final String string2 = buffer.toString();
final byte[] output = new byte[string1.length()
- + image.getContent().length()
+ + image.getVectorGraphic().getContent().length()
+ string2.length()];
int offset = 0;
System.arraycopy(string1.getBytes(), 0, output, offset,
string1.getBytes().length);
offset += string1.getBytes().length;
- System.arraycopy(image.getContent(), 0, output, offset,
- image.getContent().length());
- offset += image.getContent().length();
+ System.arraycopy(image.getVectorGraphic().getContent(), 0, output, offset,
+ image.getVectorGraphic().getContent().length());
+ offset += image.getVectorGraphic().getContent().length();
System.arraycopy(string2.getBytes(), 0, output, offset,
string2.getBytes().length);
return output;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-17 15:33:19
|
Revision: 13676
http://sourceforge.net/p/foray/code/13676
Author: victormote
Date: 2025-05-17 15:33:14 +0000 (Sat, 17 May 2025)
Log Message:
-----------
Partial conformity to aXSL change: Rough-in naive supposition of Metafile support. Temporary compile breakage.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/EpsFactory.java
Added Paths:
-----------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsVectorGraphic4a.java
Removed Paths:
-------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java
Deleted: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java 2025-05-17 14:35:09 UTC (rev 13675)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java 2025-05-17 15:33:14 UTC (rev 13676)
@@ -1,364 +0,0 @@
-/*
- * Copyright 2004 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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.graphic;
-
-import org.foray.common.data.BoundingBoxUtils;
-import org.foray.primitive.ByteUtils;
-import org.foray.primitive.sequence.ByteArray;
-
-import org.axsl.graphic.EpsGraphic;
-import org.axsl.graphic.Graphic;
-import org.axsl.graphic.GraphicException;
-import org.axsl.primitive.sequence.ByteSequence;
-import org.axsl.ps.BoundingBox;
-
-import java.awt.Color;
-import java.awt.color.ColorSpace;
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-
-/**
- * An EPS (encapsulated Postscript) graphic.
- */
-public class EpsGraphic4a extends VectorGraphic4a implements EpsGraphic {
-
- /** The size, in bytes, of the read buffer to use when reading the file. */
- private static final int READ_BUFFER_SIZE = 20480;
-
- /** The offset to the location at which the start of the PostScript portion
- * of the graphic is recorded. */
- private static final int PS_START_OFFSET = 4;
-
- /** The offset to the location at which the length of the PostScript portion
- * of the graphic is recorded. */
- private static final int PS_LENGTH_OFFSET = 8;
-
- /** The offset to the location at which the start of the WMF portion of
- * the graphic, if any, is recorded. */
- private static final int WMF_START_OFFSET = 12;
-
- /** The offset to the location at which the length of the TIFF portion of
- * the graphic, if any, is recorded. */
- private static final int WMF_LENGTH_OFFSET = 16;
-
- /** The offset to the location at which the start of the TIFF portion of
- * the graphic, if any, is recorded. */
- private static final int TIFF_START_OFFSET = 20;
-
- /** The offset to the location at which the length of the TIFF portion of
- * the graphic, if any, is recorded. */
- private static final int TIFF_LENGTH_OFFSET = 24;
-
- /** The name of this EPS graphic. */
- private String docName;
-
- /** The bounding box. */
- private BoundingBox bbox;
-
- /** Indicates whether this EPS is in ASCII format (true) or in binary format
- * (false). */
- private boolean isAscii;
-
- /** For preview EPS, bytes 5-8 (index 4-7) of the file, indicating the
- * offset to the PostScript portion of the file. */
- private int psStart = 0;
-
- /** For preview EPS, bytes 9-12 (index 8-11) of the file, indicating the
- * size, in bytes, of the PostScript portion of the file. */
- private int psLength = 0;
-
- /** For preview EPS, bytes 13-16 (index 12-15) of the file, indicating the
- * offset to the Windows Metafile portion of the file, if any. */
- private int wmfStart = 0;
-
- /** For preview EPS, bytes 17-20 (index 16-19) of the file, indicating the
- * size, in bytes, of the Windows Metafile portion of the file, if any. */
- private int wmfLength = 0;
-
- /** For preview EPS, bytes 21-24 (index 20-23) of the file, indicating the
- * offset to the TIFF portion of the file, if any. */
- private int tiffStart = 0;
-
- /** For preview EPS, bytes 25-28 (index 24-27) of the file, indicating the
- * size, in bytes, of the TIFF portion of the file, if any. */
- private int tiffLength = 0;
-
- /** The entire contents of the file. */
- private ByteArray fileContents;
-
- /** Image width (in pixel). */
- private int pixelWidth = 0;
-
- /** Image height (in pixel). */
- private int pixelHeight = 0;
-
- /**
- * Constructor.
- * @param server The parent graphic server.
- * @param url The URL which contains the graphic content.
- * @param bis The reusable input stream containing the bytes from {@code url}.
- * @param isASCII Indicates whether this file format is ASCII (true) or
- * binary (false).
- */
- public EpsGraphic4a(final GraphicServer4a server, final URL url,
- final BufferedInputStream bis, final boolean isASCII) {
- super(server, url, bis);
- this.docName = url.toString();
- this.isAscii = isASCII;
- }
-
- @Override
- public String getName() {
- return this.docName;
- }
-
- @Override
- protected void loadImage() throws GraphicException {
- if (isImageLoaded()) {
- return;
- }
- setImageLoaded(true);
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- final byte[] readBuf = new byte[EpsGraphic4a.READ_BUFFER_SIZE];
- int bytesRead;
-
- try {
- while (true) {
- bytesRead = getInputStream().read(readBuf);
- if (bytesRead != -1) {
- baos.write(readBuf, 0, bytesRead);
- } else {
- break;
- }
- }
- } catch (final IOException ex) {
- throw new GraphicException("Error while loading image " +
- getUrl().toString() + " : " + ex.getClass() +
- " - " + ex.getMessage());
- }
- this.fileContents = new ByteArray(baos.toByteArray());
- }
-
- @Override
- public Graphic.Type getGraphicType() {
- return Graphic.Type.EPS;
- }
-
- @Override
- public Graphic.Compression getCompressionType() {
- return null;
- }
-
- @Override
- public String getMimeType() {
- return "image/eps";
- }
-
- @Override
- protected void parseBasics() throws IOException {
- final byte[] fileStart = new byte[this.maxBytesToParseBasics()];
- getInputStream().read(fileStart);
- if (! this.isAscii) {
- this.psStart = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsGraphic4a.PS_START_OFFSET);
- this.psLength = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsGraphic4a.PS_LENGTH_OFFSET);
- this.wmfStart = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsGraphic4a.WMF_START_OFFSET);
- this.wmfLength = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsGraphic4a.WMF_LENGTH_OFFSET);
- this.tiffStart = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsGraphic4a.TIFF_START_OFFSET);
- this.tiffLength = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsGraphic4a.TIFF_LENGTH_OFFSET);
- }
- readBBox(fileStart);
- if (this.bbox != null) {
- final float xUR = this.bbox.getCoordinateAsFloat(BoundingBox.UPPER_RIGHT_X_INDEX);
- final float xLL = this.bbox.getCoordinateAsFloat(BoundingBox.LOWER_LEFT_X_INDEX);
- final float pixelWidth = xUR - xLL;
- this.pixelWidth = Math.round(pixelWidth);
- final float yUR = this.bbox.getCoordinateAsFloat(BoundingBox.UPPER_RIGHT_Y_INDEX);
- final float yLL = this.bbox.getCoordinateAsFloat(BoundingBox.LOWER_LEFT_Y_INDEX);
- final float pixelHeight = yUR - yLL;
- this.pixelHeight = Math.round(pixelHeight);
- } else {
- // Invalid EPS if no bounding box.
- throw new IOException("EPS missing bbox: " + getUrl().toString());
- }
- }
-
- @Override
- public ByteSequence getContent() throws GraphicException {
- this.loadImageWrapper();
- if (this.isAscii) {
- return this.fileContents;
- }
- final byte[] epsFile = new byte[this.psLength];
- System.arraycopy(this.fileContents, this.psStart, epsFile, 0,
- this.psLength);
- return new ByteArray(epsFile);
- }
-
- /**
- * Returns the embedded preview.
- * @return The embedded preview, or null if there is no preview.
- */
- public byte[] getPreview() {
- byte[] preview = null;
- if (this.tiffLength > 0) {
- preview = new byte[this.tiffLength];
- System.arraycopy(this.fileContents, this.tiffStart, preview, 0,
- this.tiffLength);
- } else if (this.wmfLength > 0) {
- preview = new byte[this.tiffLength];
- System.arraycopy(this.fileContents, this.wmfStart, preview, 0,
- this.wmfLength);
- }
- return preview;
- }
-
- /**
- * Extract and cache the bounding box information.
- * @param fileStart The first bytes of the file, which should contain the
- * bounding box information.
- */
- private void readBBox(final byte[] fileStart) {
- final ByteArray fileStart2 = new ByteArray(fileStart);
- final String bbxName = "%%BoundingBox:";
- int index = fileStart2.indexOf(bbxName);
- if (index < 0) {
- return;
- }
- /* index now holds the index of the start of bbxName. Skip past it. */
- index += bbxName.length();
- final float[] bboxArray = new float[BoundingBox.QTY_ENTRIES];
- for (int i = 0; i < BoundingBox.QTY_ENTRIES; i++) {
- index += readBBoxString(fileStart, i, index, bboxArray);
- }
- this.bbox = BoundingBoxUtils.makeBoundingBox(bboxArray);
- }
-
- /**
- * Read the string describing a bounding box component.
- * @param fileStart The first bytes of the file, which should contain the bounding box information.
- * @param bboxIndex 0-based index inicating which bounding box component is being parsed.
- * @param inputIdx The starting index into {@code fileStart} at which this method should start reading.
- * @param bboxArray The array that is being built, which contains the bounding box elements.
- * @return The value of the bounding box component parsed.
- */
- private int readBBoxString(final byte[] fileStart, final int bboxIndex,
- final int inputIdx, final float[] bboxArray) {
- int idx = inputIdx;
- while (idx < fileStart.length && (fileStart[idx] == ' ')) {
- idx++;
- }
- int nidx = idx;
- while (nidx < fileStart.length &&
- isNumeric(fileStart[nidx])) {
- nidx++;
- }
- final byte[] num = new byte[nidx - idx];
- System.arraycopy(fileStart, idx, num, 0, nidx - idx);
- final String ns = new String(num);
- bboxArray[bboxIndex] = Float.parseFloat(ns);
- return 1 + nidx - idx;
- }
-
- /**
- * Indicates whether a given byte is numeric for purposes of parsing the
- * bounding box components.
- * @param testByte The byte to be tested.
- * @return True if and only if the byte is numeric for purposes of parsing a bounding
- * box component.
- */
- private boolean isNumeric(final byte testByte) {
- if (testByte >= '0'
- && testByte <= '9') {
- return true;
- }
- if (testByte == '-') {
- return true;
- }
- if (testByte == '.') {
- return true;
- }
- return false;
- }
-
- @Override
- public BoundingBox getBoundingBox() {
- return this.bbox;
- }
-
- @Override
- public ByteSequence getRawSamples() throws GraphicException {
- /* EPS is not typically a raster format. */
- return null;
- }
-
- @Override
- public int absoluteWidthReal() throws GraphicException {
- return -1;
- }
-
- @Override
- public int absoluteHeightReal() throws GraphicException {
- return -1;
- }
-
- @Override
- public boolean isInverted() {
- return false;
- }
-
- @Override
- public ColorSpace getColorSpace() throws GraphicException {
- return null;
- }
-
- @Override
- public boolean isTransparent() throws GraphicException {
- return false;
- }
-
- @Override
- public Color getTransparentColor() throws GraphicException {
- return null;
- }
-
- @Override
- public int getPixelWidth() throws GraphicException {
- this.parseBasicsWrapper();
- return this.pixelWidth;
- }
-
- @Override
- public int getPixelHeight() throws GraphicException {
- this.parseBasicsWrapper();
- return this.pixelHeight;
- }
-
-}
Copied: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsVectorGraphic4a.java (from rev 13673, trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsGraphic4a.java)
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsVectorGraphic4a.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/EpsVectorGraphic4a.java 2025-05-17 15:33:14 UTC (rev 13676)
@@ -0,0 +1,364 @@
+/*
+ * Copyright 2004 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic;
+
+import org.foray.common.data.BoundingBoxUtils;
+import org.foray.primitive.ByteUtils;
+import org.foray.primitive.sequence.ByteArray;
+
+import org.axsl.graphic.EpsVectorGraphic;
+import org.axsl.graphic.Graphic;
+import org.axsl.graphic.GraphicException;
+import org.axsl.primitive.sequence.ByteSequence;
+import org.axsl.ps.BoundingBox;
+
+import java.awt.Color;
+import java.awt.color.ColorSpace;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * An EPS (encapsulated Postscript) graphic.
+ */
+public class EpsVectorGraphic4a extends VectorGraphic4a implements EpsVectorGraphic {
+
+ /** The size, in bytes, of the read buffer to use when reading the file. */
+ private static final int READ_BUFFER_SIZE = 20480;
+
+ /** The offset to the location at which the start of the PostScript portion
+ * of the graphic is recorded. */
+ private static final int PS_START_OFFSET = 4;
+
+ /** The offset to the location at which the length of the PostScript portion
+ * of the graphic is recorded. */
+ private static final int PS_LENGTH_OFFSET = 8;
+
+ /** The offset to the location at which the start of the WMF portion of
+ * the graphic, if any, is recorded. */
+ private static final int WMF_START_OFFSET = 12;
+
+ /** The offset to the location at which the length of the TIFF portion of
+ * the graphic, if any, is recorded. */
+ private static final int WMF_LENGTH_OFFSET = 16;
+
+ /** The offset to the location at which the start of the TIFF portion of
+ * the graphic, if any, is recorded. */
+ private static final int TIFF_START_OFFSET = 20;
+
+ /** The offset to the location at which the length of the TIFF portion of
+ * the graphic, if any, is recorded. */
+ private static final int TIFF_LENGTH_OFFSET = 24;
+
+ /** The name of this EPS graphic. */
+ private String docName;
+
+ /** The bounding box. */
+ private BoundingBox bbox;
+
+ /** Indicates whether this EPS is in ASCII format (true) or in binary format
+ * (false). */
+ private boolean isAscii;
+
+ /** For preview EPS, bytes 5-8 (index 4-7) of the file, indicating the
+ * offset to the PostScript portion of the file. */
+ private int psStart = 0;
+
+ /** For preview EPS, bytes 9-12 (index 8-11) of the file, indicating the
+ * size, in bytes, of the PostScript portion of the file. */
+ private int psLength = 0;
+
+ /** For preview EPS, bytes 13-16 (index 12-15) of the file, indicating the
+ * offset to the Windows Metafile portion of the file, if any. */
+ private int wmfStart = 0;
+
+ /** For preview EPS, bytes 17-20 (index 16-19) of the file, indicating the
+ * size, in bytes, of the Windows Metafile portion of the file, if any. */
+ private int wmfLength = 0;
+
+ /** For preview EPS, bytes 21-24 (index 20-23) of the file, indicating the
+ * offset to the TIFF portion of the file, if any. */
+ private int tiffStart = 0;
+
+ /** For preview EPS, bytes 25-28 (index 24-27) of the file, indicating the
+ * size, in bytes, of the TIFF portion of the file, if any. */
+ private int tiffLength = 0;
+
+ /** The entire contents of the file. */
+ private ByteArray fileContents;
+
+ /** Image width (in pixel). */
+ private int pixelWidth = 0;
+
+ /** Image height (in pixel). */
+ private int pixelHeight = 0;
+
+ /**
+ * Constructor.
+ * @param server The parent graphic server.
+ * @param url The URL which contains the graphic content.
+ * @param bis The reusable input stream containing the bytes from {@code url}.
+ * @param isASCII Indicates whether this file format is ASCII (true) or
+ * binary (false).
+ */
+ public EpsVectorGraphic4a(final GraphicServer4a server, final URL url,
+ final BufferedInputStream bis, final boolean isASCII) {
+ super(server, url, bis);
+ this.docName = url.toString();
+ this.isAscii = isASCII;
+ }
+
+ @Override
+ public String getName() {
+ return this.docName;
+ }
+
+ @Override
+ protected void loadImage() throws GraphicException {
+ if (isImageLoaded()) {
+ return;
+ }
+ setImageLoaded(true);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final byte[] readBuf = new byte[EpsVectorGraphic4a.READ_BUFFER_SIZE];
+ int bytesRead;
+
+ try {
+ while (true) {
+ bytesRead = getInputStream().read(readBuf);
+ if (bytesRead != -1) {
+ baos.write(readBuf, 0, bytesRead);
+ } else {
+ break;
+ }
+ }
+ } catch (final IOException ex) {
+ throw new GraphicException("Error while loading image " +
+ getUrl().toString() + " : " + ex.getClass() +
+ " - " + ex.getMessage());
+ }
+ this.fileContents = new ByteArray(baos.toByteArray());
+ }
+
+ @Override
+ public Graphic.Type getGraphicType() {
+ return Graphic.Type.EPS;
+ }
+
+ @Override
+ public Graphic.Compression getCompressionType() {
+ return null;
+ }
+
+ @Override
+ public String getMimeType() {
+ return "image/eps";
+ }
+
+ @Override
+ protected void parseBasics() throws IOException {
+ final byte[] fileStart = new byte[this.maxBytesToParseBasics()];
+ getInputStream().read(fileStart);
+ if (! this.isAscii) {
+ this.psStart = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsVectorGraphic4a.PS_START_OFFSET);
+ this.psLength = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsVectorGraphic4a.PS_LENGTH_OFFSET);
+ this.wmfStart = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsVectorGraphic4a.WMF_START_OFFSET);
+ this.wmfLength = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsVectorGraphic4a.WMF_LENGTH_OFFSET);
+ this.tiffStart = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsVectorGraphic4a.TIFF_START_OFFSET);
+ this.tiffLength = (int) ByteUtils.unsignedBytesToLongBE(fileStart, EpsVectorGraphic4a.TIFF_LENGTH_OFFSET);
+ }
+ readBBox(fileStart);
+ if (this.bbox != null) {
+ final float xUR = this.bbox.getCoordinateAsFloat(BoundingBox.UPPER_RIGHT_X_INDEX);
+ final float xLL = this.bbox.getCoordinateAsFloat(BoundingBox.LOWER_LEFT_X_INDEX);
+ final float pixelWidth = xUR - xLL;
+ this.pixelWidth = Math.round(pixelWidth);
+ final float yUR = this.bbox.getCoordinateAsFloat(BoundingBox.UPPER_RIGHT_Y_INDEX);
+ final float yLL = this.bbox.getCoordinateAsFloat(BoundingBox.LOWER_LEFT_Y_INDEX);
+ final float pixelHeight = yUR - yLL;
+ this.pixelHeight = Math.round(pixelHeight);
+ } else {
+ // Invalid EPS if no bounding box.
+ throw new IOException("EPS missing bbox: " + getUrl().toString());
+ }
+ }
+
+ @Override
+ public ByteSequence getContent() throws GraphicException {
+ this.loadImageWrapper();
+ if (this.isAscii) {
+ return this.fileContents;
+ }
+ final byte[] epsFile = new byte[this.psLength];
+ System.arraycopy(this.fileContents, this.psStart, epsFile, 0,
+ this.psLength);
+ return new ByteArray(epsFile);
+ }
+
+ /**
+ * Returns the embedded preview.
+ * @return The embedded preview, or null if there is no preview.
+ */
+ public byte[] getPreview() {
+ byte[] preview = null;
+ if (this.tiffLength > 0) {
+ preview = new byte[this.tiffLength];
+ System.arraycopy(this.fileContents, this.tiffStart, preview, 0,
+ this.tiffLength);
+ } else if (this.wmfLength > 0) {
+ preview = new byte[this.tiffLength];
+ System.arraycopy(this.fileContents, this.wmfStart, preview, 0,
+ this.wmfLength);
+ }
+ return preview;
+ }
+
+ /**
+ * Extract and cache the bounding box information.
+ * @param fileStart The first bytes of the file, which should contain the
+ * bounding box information.
+ */
+ private void readBBox(final byte[] fileStart) {
+ final ByteArray fileStart2 = new ByteArray(fileStart);
+ final String bbxName = "%%BoundingBox:";
+ int index = fileStart2.indexOf(bbxName);
+ if (index < 0) {
+ return;
+ }
+ /* index now holds the index of the start of bbxName. Skip past it. */
+ index += bbxName.length();
+ final float[] bboxArray = new float[BoundingBox.QTY_ENTRIES];
+ for (int i = 0; i < BoundingBox.QTY_ENTRIES; i++) {
+ index += readBBoxString(fileStart, i, index, bboxArray);
+ }
+ this.bbox = BoundingBoxUtils.makeBoundingBox(bboxArray);
+ }
+
+ /**
+ * Read the string describing a bounding box component.
+ * @param fileStart The first bytes of the file, which should contain the bounding box information.
+ * @param bboxIndex 0-based index inicating which bounding box component is being parsed.
+ * @param inputIdx The starting index into {@code fileStart} at which this method should start reading.
+ * @param bboxArray The array that is being built, which contains the bounding box elements.
+ * @return The value of the bounding box component parsed.
+ */
+ private int readBBoxString(final byte[] fileStart, final int bboxIndex,
+ final int inputIdx, final float[] bboxArray) {
+ int idx = inputIdx;
+ while (idx < fileStart.length && (fileStart[idx] == ' ')) {
+ idx++;
+ }
+ int nidx = idx;
+ while (nidx < fileStart.length &&
+ isNumeric(fileStart[nidx])) {
+ nidx++;
+ }
+ final byte[] num = new byte[nidx - idx];
+ System.arraycopy(fileStart, idx, num, 0, nidx - idx);
+ final String ns = new String(num);
+ bboxArray[bboxIndex] = Float.parseFloat(ns);
+ return 1 + nidx - idx;
+ }
+
+ /**
+ * Indicates whether a given byte is numeric for purposes of parsing the
+ * bounding box components.
+ * @param testByte The byte to be tested.
+ * @return True if and only if the byte is numeric for purposes of parsing a bounding
+ * box component.
+ */
+ private boolean isNumeric(final byte testByte) {
+ if (testByte >= '0'
+ && testByte <= '9') {
+ return true;
+ }
+ if (testByte == '-') {
+ return true;
+ }
+ if (testByte == '.') {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public BoundingBox getBoundingBox() {
+ return this.bbox;
+ }
+
+ @Override
+ public ByteSequence getRawSamples() throws GraphicException {
+ /* EPS is not typically a raster format. */
+ return null;
+ }
+
+ @Override
+ public int absoluteWidthReal() throws GraphicException {
+ return -1;
+ }
+
+ @Override
+ public int absoluteHeightReal() throws GraphicException {
+ return -1;
+ }
+
+ @Override
+ public boolean isInverted() {
+ return false;
+ }
+
+ @Override
+ public ColorSpace getColorSpace() throws GraphicException {
+ return null;
+ }
+
+ @Override
+ public boolean isTransparent() throws GraphicException {
+ return false;
+ }
+
+ @Override
+ public Color getTransparentColor() throws GraphicException {
+ return null;
+ }
+
+ @Override
+ public int getPixelWidth() throws GraphicException {
+ this.parseBasicsWrapper();
+ return this.pixelWidth;
+ }
+
+ @Override
+ public int getPixelHeight() throws GraphicException {
+ this.parseBasicsWrapper();
+ return this.pixelHeight;
+ }
+
+}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/EpsFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/EpsFactory.java 2025-05-17 14:35:09 UTC (rev 13675)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/EpsFactory.java 2025-05-17 15:33:14 UTC (rev 13676)
@@ -28,7 +28,7 @@
package org.foray.graphic.factory;
-import org.foray.graphic.EpsGraphic4a;
+import org.foray.graphic.EpsVectorGraphic4a;
import org.foray.graphic.GraphicServer4a;
import java.io.BufferedInputStream;
@@ -70,7 +70,7 @@
}
@Override
- public EpsGraphic4a attemptCreate(final URL url,
+ public EpsVectorGraphic4a attemptCreate(final URL url,
final BufferedInputStream bis) throws IOException {
final byte[] header = new byte[EpsFactory.EPS_HEADER_BINARY.length];
bis.read(header);
@@ -96,7 +96,7 @@
if (! isEPS) {
return null;
}
- return new EpsGraphic4a(this.getServer(), url, bis, isAscii);
+ return new EpsVectorGraphic4a(this.getServer(), url, bis, isAscii);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-17 14:35:16
|
Revision: 13675
http://sourceforge.net/p/foray/code/13675
Author: victormote
Date: 2025-05-17 14:35:09 +0000 (Sat, 17 May 2025)
Log Message:
-----------
Store and return the input stream for a graphic as a BufferedInputStream.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2025-05-17 13:54:26 UTC (rev 13674)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2025-05-17 14:35:09 UTC (rev 13675)
@@ -43,7 +43,6 @@
import java.awt.color.ColorSpace;
import java.io.BufferedInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
import java.util.Collections;
import java.util.List;
@@ -78,7 +77,7 @@
private URL url = null;
/** The physical file. */
- private InputStream bis = null;
+ private BufferedInputStream bis = null;
/** Bits per pixel. */
private int bitDepth = 0;
@@ -391,19 +390,11 @@
* Returns the input stream for this file.
* @return Returns the input stream.
*/
- public InputStream getInputStream() {
+ public BufferedInputStream getInputStream() {
return this.bis;
}
/**
- * Sets the input stream for this file.
- * @param inputStream The new input stream.
- */
- public void setInputStream(final InputStream inputStream) {
- this.bis = inputStream;
- }
-
- /**
* Allows subclasses to set the "basics parsed" flag if they have already
* parsed the basics.
* @param basicsParsed Set to true to indicate that the basics have already
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-17 13:54:30
|
Revision: 13674
http://sourceforge.net/p/foray/code/13674
Author: victormote
Date: 2025-05-17 13:54:26 +0000 (Sat, 17 May 2025)
Log Message:
-----------
Add checkstyle check probiting @author entries. Move remaining entries to "Known contributors" comment.
Modified Paths:
--------------
trunk/foray/foray-00-dev/config/checkstyle/checkstyle-config.xml
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/GifFactory.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/JpegFactory.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/PngFactory.java
trunk/foray/foray-mif/src/main/java/org/foray/mif/MifBook.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4aStandard.java
trunk/foray/foray-output/src/main/java/org/foray/output/MifConverter.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/filter/DctEncodeFilter.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/demo/Main.java
trunk/foray/foray-render/src/main/java/org/foray/render/awt/AwtRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/LoadableProperties.java
trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/MessagesDialog.java
trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/SecureResourceBundle.java
trunk/foray/foray-render/src/main/java/org/foray/render/txt/TxtRenderer.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentInputSource.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentReader.java
trunk/foray/foray-zz-attic/src/main/java/org/foray/orthography/OrthographyServer4aAttic.java
Added Paths:
-----------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/package-info.java
Modified: trunk/foray/foray-00-dev/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-dev/config/checkstyle/checkstyle-config.xml 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-00-dev/config/checkstyle/checkstyle-config.xml 2025-05-17 13:54:26 UTC (rev 13674)
@@ -347,8 +347,7 @@
<property name="id" value="RestrictSystemOutPrint"/>
<property name="ignoreComments" value="true"/>
<property name="format" value=" System.out.print"/>
- <property name="message" value="Use logging instead of System.out, except in void
-main(String[])."/>
+ <property name="message" value="Use logging instead of System.out, except in void main(String[])."/>
</module>
<module name="RegexpSinglelineJava">
@@ -355,8 +354,7 @@
<property name="id" value="RestrictSystemErrPrint"/>
<property name="ignoreComments" value="true"/>
<property name="format" value=" System.err.print"/>
- <property name="message" value="Use logging instead of System.err, except in void
-main(String[])."/>
+ <property name="message" value="Use logging instead of System.err, except in void main(String[])."/>
</module>
<module name="RegexpSinglelineJava">
@@ -390,6 +388,12 @@
<property name="message" value="For consistency, use 'codePoint' or 'code point' instead of 'codepoint'."/>
</module>
+ <module name="RegexpSinglelineJava">
+ <property name="ignoreComments" value="false"/>
+ <property name="format" value="@author"/>
+ <property name="message" value="Move @author entries to 'Known Contributors' comment after file header."/>
+ </module>
+
<module name="MissingOverride"/>
</module>
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,11 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Eric SCHAEFFER
+ * Modified by Eric Dalquist - 9/14/2001 - ebd...@mt...
+ */
+
package org.foray.graphic;
import org.foray.primitive.ByteUtils;
@@ -48,9 +53,6 @@
/**
* Implementation of AbstractGraphic for GIF images, using Java native classes.
- * @author Eric SCHAEFFER
- * @author Modified by Eric Dalquist - 9/14/2001 - ebd...@mt...
- * @see Graphic4a
*/
public class GifGraphic extends BitmapGraphic4a {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,11 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Eric Schaeffer
+ * <a href="mailto:ebd...@mt...">Eric Dalquist</a>
+ */
+
package org.foray.graphic;
import org.foray.graphic.factory.GraphicFactory;
@@ -45,9 +50,6 @@
/**
* Abstract base class for graphics.
- *
- * @author Eric Schaeffer
- * @author <a href="mailto:ebd...@mt...">Eric Dalquist</a>
*/
public abstract class Graphic4a implements org.axsl.graphic.Graphic {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Eric SCHAEFFER
+ */
+
package org.foray.graphic;
import org.foray.graphic.factory.BmpFactory;
@@ -79,7 +83,6 @@
/**
* create Graphic objects (with a configuration file - not yet implemented).
- * @author Eric SCHAEFFER
*/
public class GraphicServer4a implements GraphicServer {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Pankaj Narula
+ */
+
package org.foray.graphic.factory;
import org.foray.graphic.BmpGraphic;
@@ -39,7 +43,6 @@
/**
* ImageReader object for BMP image type.
- * @author Pankaj Narula
*/
public class BmpFactory extends GraphicFactory {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/GifFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/GifFactory.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/GifFactory.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Pankaj Narula
+ */
+
package org.foray.graphic.factory;
import org.foray.graphic.GifGraphic;
@@ -38,7 +42,6 @@
/**
* ImageReader object for GIF image type.
- * @author Pankaj Narula
*/
public class GifFactory extends GraphicFactory {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/JpegFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/JpegFactory.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/JpegFactory.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Pankaj Narula
+ */
+
package org.foray.graphic.factory;
import org.foray.graphic.GraphicServer4a;
@@ -38,8 +42,6 @@
/**
* ImageReader object for JPEG image type.
- * @author Pankaj Narula
- * @version 1.0
*/
public class JpegFactory extends GraphicFactory {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/PngFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/PngFactory.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/PngFactory.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Pankaj Narula
+ */
+
package org.foray.graphic.factory;
import org.foray.graphic.GraphicServer4a;
@@ -38,7 +42,6 @@
/**
* ImageReader object for PNG image type.
- * @author Pankaj Narula
*/
public class PngFactory extends GraphicFactory {
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/package-info.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/package-info.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/package-info.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+/**
+ * <p>Utility classes that store constants, enums, and other format-specific information.</p>
+ */
+
+package org.foray.graphic.format;
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/package-info.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-mif/src/main/java/org/foray/mif/MifBook.java
===================================================================
--- trunk/foray/foray-mif/src/main/java/org/foray/mif/MifBook.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-mif/src/main/java/org/foray/mif/MifBook.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Seshadri G
+ */
+
package org.foray.mif;
import org.axsl.output.OutputException;
@@ -41,8 +45,6 @@
*
* The document is built up by calling various methods and then finally
* output to given filehandle using output method.
- *
- * @author Seshadri G
*/
public class MifBook implements org.axsl.mif.MifBook {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4aStandard.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4aStandard.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4aStandard.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -28,7 +28,7 @@
/*
* Known contributors:
- * @author Carlos Villegas <ca...@un...> (original author)
+ * Carlos Villegas <ca...@un...> (original author)
*/
package org.foray.orthography;
Modified: trunk/foray/foray-output/src/main/java/org/foray/output/MifConverter.java
===================================================================
--- trunk/foray/foray-output/src/main/java/org/foray/output/MifConverter.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-output/src/main/java/org/foray/output/MifConverter.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,11 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Seshadri G
+ * <a href="mailto:mar...@in...">Mark Lillywhite</a>
+ */
+
package org.foray.output;
import org.axsl.font.FontSelectionConstraints;
@@ -47,9 +52,6 @@
/**
* Renders areas to MIF. Collects all the Pages and print them out at the end.
* This means that the MIF renderer does not stream.
- *
- * @author Seshadri G
- * @author <a href="mailto:mar...@in...">Mark Lillywhite</a>
*/
public class MifConverter extends Converter {
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Jeremias Maerki
+ */
+
package org.foray.ps;
import org.foray.primitive.sequence.ByteArray;
@@ -40,7 +44,6 @@
/**
* An implementation of PsInput that wraps a java.io.File instance.
- * @author Jeremias Maerki
* @see PsInput
*/
public class PsInputFile implements PsInput {
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/filter/CcittFaxEncodeFilter.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/filter/CcittFaxEncodeFilter.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Manuel Mall
+ */
+
package org.foray.ps.filter;
import java.io.ByteArrayOutputStream;
@@ -37,8 +41,6 @@
* we can write TIFF images to the PDF. The encode method just returns the
* data passed to it. In the future an actual CCITT Group 4 compression should
* be added to the encode method so other images can be compressed.
- *
- * @author Manuel Mall
*/
public class CcittFaxEncodeFilter extends PsEncodeFilter4a {
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/filter/DctEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/filter/DctEncodeFilter.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/filter/DctEncodeFilter.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Eric Dalquist
+ */
+
package org.foray.ps.filter;
import java.io.ByteArrayOutputStream;
@@ -37,8 +41,6 @@
* we can write JPG images to the PDF. The encode method just returns the
* data passed to it. In the future an actual JPEG compression should be
* added to the encode method so other images can be compressed.
- *
- * @author Eric Dalquist
*/
public class DctEncodeFilter extends PsEncodeFilter4a {
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/demo/Main.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/demo/Main.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/java2d/demo/Main.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Jeremias Maerki
+ */
+
package org.foray.ps.java2d.demo;
import org.slf4j.Logger;
@@ -36,7 +40,6 @@
* This demo is a simple Swing application that demonstrates the basic
* capabilities of the PostScript interpreter by operating on the output from
* the Krysallis barcode generator.
- * @author Jeremias Maerki
*/
public final class Main {
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/awt/AwtRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/awt/AwtRenderer.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/awt/AwtRenderer.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -28,13 +28,10 @@
/*
* Known contributors:
- * @author <a href="mailto:Jue...@jC...">Juergen
- * Verwohlt</a>
- * @author <a href="mailto:Rai...@jC...">Rainer
- * Steinkuhle</a>
- * @author <a href="mailto:Sta...@jC...">Stanislav
- * Gorkhover</a>
- * @author <a href="mailto:mar...@in...">Mark Lillywhite</a>
+ * <a href="mailto:Jue...@jC...">Juergen Verwohlt</a>
+ * <a href="mailto:Rai...@jC...">Rainer Steinkuhle</a>
+ * <a href="mailto:Sta...@jC...">Stanislav Gorkhover</a>
+ * <a href="mailto:mar...@in...">Mark Lillywhite</a>
*/
package org.foray.render.awt;
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/LoadableProperties.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/LoadableProperties.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/LoadableProperties.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Sta...@jC...
+ */
+
package org.foray.render.awt.viewer;
import java.io.BufferedReader;
@@ -42,9 +46,6 @@
* Die Klasse LoadableProperties lässt im Gegensatz zu der Klasse Properties
* die Schlüsselwerte mit Leerzeichen zu.
*
- * @author Sta...@jC...
- * @version 02.12.99
- *
*/
public class LoadableProperties extends Hashtable<String, String> {
/* TODO: This class looks a lot like a parser for a standard java.util.Properties file. Can it be replaced with
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/MessagesDialog.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/MessagesDialog.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/MessagesDialog.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Jue...@jC...
+ */
+
package org.foray.render.awt.viewer;
import java.awt.BorderLayout;
@@ -45,9 +49,6 @@
* eine Detailanzeige einzublenden, in der z.B. bei Fehlern der StackTrace
* ausgegeben
* werden kann.
- *
- * @author Jue...@jC...
- * @version 1.0 09.06.99
*/
public class MessagesDialog extends JOptionPane {
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/SecureResourceBundle.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Sta...@jC...
+ */
+
package org.foray.render.awt.viewer;
import java.io.IOException;
@@ -39,9 +43,6 @@
* Falle eines fehlenden
* Eintrages keinen Absturz verursacht, sondern die Meldung
* <strong>Key <i>key</i> not found</strong> zurückgibt.
- *
- * @author Sta...@jC...
- * @version 1.0 18.03.1999
*/
public class SecureResourceBundle extends ResourceBundle implements Translator {
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/txt/TxtRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/txt/TxtRenderer.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/txt/TxtRenderer.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,11 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Art Welch
+ * <a href="mailto:mar...@in...">Mark Lillywhite</a> (to use the new Renderer interface)
+ */
+
package org.foray.render.txt;
import org.foray.render.PrintRenderer;
@@ -53,10 +58,6 @@
/**
* Renderer that renders areas to plain text.
- *
- * @author Art Welch
- * @author <a href="mailto:mar...@in...">Mark Lillywhite</a> (to use
- * the new Renderer interface)
*/
public class TxtRenderer extends PrintRenderer {
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentInputSource.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentInputSource.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentInputSource.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Kelly A Campbell
+ */
+
package org.foray.xml;
import org.w3c.dom.Document;
@@ -33,9 +37,6 @@
/**
* This is an InputSource to be used with DocumentReader.
- *
- * @author Kelly A Campbell
- *
*/
public class DocumentInputSource extends InputSource {
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentReader.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentReader.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentReader.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -26,6 +26,10 @@
* $LastChangedBy$
*/
+/* Known contributors:
+ * Kelly A Campbell
+ */
+
package org.foray.xml;
import org.w3c.dom.Attr;
@@ -46,11 +50,7 @@
import java.io.IOException;
/**
- * This presents a DOM as an XMLReader to make it easy to use a Document
- * with a SAX-based implementation.
- *
- * @author Kelly A Campbell
- *
+ * This presents a DOM as an XMLReader to make it easy to use a Document with a SAX-based implementation.
*/
public class DocumentReader implements XMLReader {
Modified: trunk/foray/foray-zz-attic/src/main/java/org/foray/orthography/OrthographyServer4aAttic.java
===================================================================
--- trunk/foray/foray-zz-attic/src/main/java/org/foray/orthography/OrthographyServer4aAttic.java 2025-05-17 12:13:35 UTC (rev 13673)
+++ trunk/foray/foray-zz-attic/src/main/java/org/foray/orthography/OrthographyServer4aAttic.java 2025-05-17 13:54:26 UTC (rev 13674)
@@ -28,7 +28,7 @@
/*
* Known contributors:
- * @author Carlos Villegas <ca...@un...> (original author)
+ * Carlos Villegas <ca...@un...> (original author)
*/
package org.foray.orthography;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-17 12:13:39
|
Revision: 13673
http://sourceforge.net/p/foray/code/13673
Author: victormote
Date: 2025-05-17 12:13:35 +0000 (Sat, 17 May 2025)
Log Message:
-----------
Rename some poorly-named constants.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2025-05-17 11:33:09 UTC (rev 13672)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2025-05-17 12:13:35 UTC (rev 13673)
@@ -177,7 +177,7 @@
* hardcodes m_bitsPerPixel to 8. If I do not do this Acrobat is unable
* to read the resultant PDF, so we will hardcode this...
*/
- setBitDepth(BIT_DEPTH_GRAYSCALE);
+ setBitDepth(BIT_DEPTH_8);
setContent(new ByteArray(normalizedBytes));
}
@@ -198,18 +198,18 @@
final int index = (int) ((this.pixelHeight - row - 1) * this.bytesPerRow + byteInRow);
final byte p = inputBytes[index];
- if (getBitDepth() == BIT_DEPTH_COLOR
+ if (getBitDepth() == BIT_DEPTH_24
&& column < this.pixelWidth) {
byteInRow = processColorPixel(normalizedBytes, inputBytes,
row, column, byteInRow);
column++;
- } else if (getBitDepth() == BIT_DEPTH_MONOCHROME) {
+ } else if (getBitDepth() == BIT_DEPTH_1) {
column = processMonochromeByte(normalizedBytes, row, column, p);
byteInRow++;
} else if (getBitDepth() == BIT_DEPTH_4) {
column = process4BitsByte(normalizedBytes, row, column, p);
byteInRow++;
- } else if (getBitDepth() == BIT_DEPTH_GRAYSCALE) {
+ } else if (getBitDepth() == BIT_DEPTH_8) {
byteInRow = processGrayscaleByte(normalizedBytes,
row, column, byteInRow, p);
column++;
@@ -409,7 +409,7 @@
*/
private byte[] readPalette() throws GraphicException {
if (getBitDepth() != BIT_DEPTH_4
- && getBitDepth() != BIT_DEPTH_GRAYSCALE) {
+ && getBitDepth() != BIT_DEPTH_8) {
return null;
}
final int numChannels = getRawColorSpace().getNumComponents();
@@ -450,12 +450,12 @@
*/
private int computeBytesPerRow() throws GraphicException {
int bytesPerRow = 0;
- if (getBitDepth() == BIT_DEPTH_MONOCHROME) {
+ if (getBitDepth() == BIT_DEPTH_1) {
bytesPerRow = (int) this.pixelWidth;
- } else if (getBitDepth() == BIT_DEPTH_COLOR) {
+ } else if (getBitDepth() == BIT_DEPTH_24) {
bytesPerRow = (int) (this.pixelWidth * getRawColorSpace().getNumComponents());
} else if (getBitDepth() == BIT_DEPTH_4
- || getBitDepth() == BIT_DEPTH_GRAYSCALE) {
+ || getBitDepth() == BIT_DEPTH_8) {
bytesPerRow = (int) (this.pixelWidth * getBitDepth() / PrimitiveConstants.BITS_PER_BYTE);
} else {
throw new GraphicException("Image (" + getUrl().toString() + ") has " + getBitDepth()
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java 2025-05-17 11:33:09 UTC (rev 13672)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GifGraphic.java 2025-05-17 12:13:35 UTC (rev 13673)
@@ -112,7 +112,7 @@
tmpMap = consumer.getImage();
final ColorModel cm = consumer.getColorModel();
- setBitDepth(BIT_DEPTH_GRAYSCALE);
+ setBitDepth(BIT_DEPTH_8);
// this.m_bitsPerPixel = cm.getPixelSize();
if (cm.hasAlpha()) {
loadTransparency(cm);
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2025-05-17 11:33:09 UTC (rev 13672)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2025-05-17 12:13:35 UTC (rev 13673)
@@ -52,16 +52,16 @@
public abstract class Graphic4a implements org.axsl.graphic.Graphic {
/** The bit depth (bits per pixel) for a monochrome image. */
- public static final byte BIT_DEPTH_MONOCHROME = 1;
+ public static final byte BIT_DEPTH_1 = 1;
/** The bit depth (bits per pixel) for a 4-bit image. */
public static final byte BIT_DEPTH_4 = 4;
- /** The bit depth (bits per pixel) for an 8-bit image. */
- public static final byte BIT_DEPTH_GRAYSCALE = 8;
+ /** The bit depth (bits per pixel) for an 8-bit image, frequently used for grayscale. */
+ public static final byte BIT_DEPTH_8 = 8;
- /** The bit depth (bits per pixel) for a typical 3-channel color image. */
- public static final byte BIT_DEPTH_COLOR = 24;
+ /** The bit depth (bits per pixel) for a 24-bit image, typically a 3-channel color image. */
+ public static final byte BIT_DEPTH_24 = 24;
/**
* The default maximimum number of bytes that need to be read in order to
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-17 11:33:11
|
Revision: 13672
http://sourceforge.net/p/foray/code/13672
Author: victormote
Date: 2025-05-17 11:33:09 +0000 (Sat, 17 May 2025)
Log Message:
-----------
Improvements to BMP bitmap header parsing.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2025-05-16 21:23:51 UTC (rev 13671)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2025-05-17 11:33:09 UTC (rev 13672)
@@ -78,17 +78,17 @@
}
@Override
- public void bitmapWidth(final @Unsigned int value) {
+ public void bmhWidth(final long value) {
graphic.pixelWidth = value;
}
@Override
- public void bitmapHeight(final @Unsigned int value) {
+ public void bmhHeight(final long value) {
graphic.pixelHeight = value;
}
@Override
- public void bitmapBitsPerPixel(final @Unsigned short value) {
+ public void bmhBitsPerPixel(final @Unsigned short value) {
graphic.bitsPerPixel = value;
graphic.setBitDepth(value);
}
@@ -118,10 +118,10 @@
private byte[] colorPalette;
/** Image width (in pixel). */
- private int pixelWidth;
+ private long pixelWidth;
/** Image height (in pixel). */
- private int pixelHeight;
+ private long pixelHeight;
/** The number of bits per pixel. Should be 1, 4, 8, or 24. */
private int bitsPerPixel;
@@ -163,8 +163,7 @@
this.bytesPerRow = computeBytesPerRow();
// Should take care of the ColorSpace and bitsPerPixel
- final int normalizedSize = this.pixelWidth * this.pixelHeight
- * getRawColorSpace().getNumComponents();
+ final int normalizedSize = (int) (this.pixelWidth * this.pixelHeight * getRawColorSpace().getNumComponents());
final byte[] normalizedBytes = new byte[normalizedSize];
final byte[] inputBytes = readImageData();
@@ -196,8 +195,7 @@
int column = 0;
int byteInRow = 0;
while (byteInRow < this.bytesPerRow) {
- final int index = (this.pixelHeight - row - 1) * this.bytesPerRow
- + byteInRow;
+ final int index = (int) ((this.pixelHeight - row - 1) * this.bytesPerRow + byteInRow);
final byte p = inputBytes[index];
if (getBitDepth() == BIT_DEPTH_COLOR
@@ -238,10 +236,9 @@
int byteInRow = inputByteInRow;
int countr = 2;
while (countr >= 0) {
- final int contentIndex = getRawColorSpace().getNumComponents()
- * (row * this.pixelWidth + column) + countr;
- final int tempIndex = (this.pixelHeight - row - 1)
- * this.bytesPerRow + byteInRow;
+ final int contentIndex =
+ (int) (getRawColorSpace().getNumComponents() * (row * this.pixelWidth + column) + countr);
+ final int tempIndex = (int) ((this.pixelHeight - row - 1) * this.bytesPerRow + byteInRow);
normalizedBytes[contentIndex] = inputBytes[tempIndex];
byteInRow++;
countr --;
@@ -272,8 +269,7 @@
if ((p & BmpGraphic.BIT_7_MASK) != 0) {
color = PrimitiveConstants.MAX_8_BIT_UNSIGNED_BYTE;
}
- final int contentIndex = getRawColorSpace().getNumComponents()
- * (row * this.pixelWidth + column);
+ final int contentIndex = (int) (getRawColorSpace().getNumComponents() * (row * this.pixelWidth + column));
for (int i = 0; i < getRawColorSpace().getNumComponents(); i++) {
normalizedBytes[contentIndex + i] = color;
}
@@ -297,20 +293,16 @@
final int row, final int inputColumn, final byte inputByte) {
int column = inputColumn;
byte p = inputByte;
- for (int countr = 0; countr < 2 && column < this.pixelWidth;
- countr++) {
+ for (int countr = 0; countr < 2 && column < this.pixelWidth; countr++) {
p &= BmpGraphic.HIGH_NIBBLE_MASK;
p >>= PrimitiveConstants.BITS_PER_NIBBLE;
final int pal = p * getRawColorSpace().getNumComponents();
- normalizedBytes[getRawColorSpace().getNumComponents()
- * (row * this.pixelWidth + column)] =
- this.colorPalette[pal];
- normalizedBytes[getRawColorSpace().getNumComponents()
- * (row * this.pixelWidth + column) + 1] =
- this.colorPalette[pal + 1];
- normalizedBytes[getRawColorSpace().getNumComponents()
- * (row * this.pixelWidth + column) + 2] =
- this.colorPalette[pal + 2];
+ int index = (int) (getRawColorSpace().getNumComponents() * (row * this.pixelWidth + column));
+ normalizedBytes[index] = this.colorPalette[pal];
+ index = (int) (getRawColorSpace().getNumComponents() * (row * this.pixelWidth + column) + 1);
+ normalizedBytes[index] = this.colorPalette[pal + 1];
+ index = (int) (getRawColorSpace().getNumComponents() * (row * this.pixelWidth + column) + 2);
+ normalizedBytes[index] = this.colorPalette[pal + 2];
p <<= PrimitiveConstants.BITS_PER_NIBBLE;
column++;
}
@@ -335,15 +327,12 @@
byte p = inputByte;
if (column < this.pixelWidth) {
p *= getRawColorSpace().getNumComponents();
- normalizedBytes[getRawColorSpace().getNumComponents()
- * (row * this.pixelWidth + column)] =
- this.colorPalette[p];
- normalizedBytes[getRawColorSpace().getNumComponents()
- * (row * this.pixelWidth + column) + 1] =
- this.colorPalette[p + 1];
- normalizedBytes[getRawColorSpace().getNumComponents()
- * (row * this.pixelWidth + column) + 2] =
- this.colorPalette[p + 2];
+ int index = (int) (getRawColorSpace().getNumComponents() * (row * this.pixelWidth + column));
+ normalizedBytes[index] = this.colorPalette[p];
+ index = (int) (getRawColorSpace().getNumComponents() * (row * this.pixelWidth + column) + 1);
+ normalizedBytes[index] = this.colorPalette[p + 1];
+ index = (int) (getRawColorSpace().getNumComponents() * (row * this.pixelWidth + column) + 2);
+ normalizedBytes[index] = this.colorPalette[p + 2];
byteInRow++;
} else {
byteInRow = this.bytesPerRow;
@@ -357,7 +346,7 @@
* @throws GraphicException For error reading the image file.
*/
private byte[] readImageData() throws GraphicException {
- final byte[] temp = new byte[this.bytesPerRow * this.pixelHeight];
+ final byte[] temp = new byte[(int) (this.bytesPerRow * this.pixelHeight)];
try {
getInputStream().read(temp);
getInputStream().close();
@@ -404,7 +393,7 @@
final GraphicRandomAccessInput input = new GraphicRandomAccessInput.Impl(header);
final BmpGraphicHandler handler = this.new Handler(this);
final BmpGraphicParser1 parser = new BmpGraphicParser1();
- parser.parse(input, handler);
+ parser.parse(input, 0, handler);
}
@Override
@@ -462,17 +451,14 @@
private int computeBytesPerRow() throws GraphicException {
int bytesPerRow = 0;
if (getBitDepth() == BIT_DEPTH_MONOCHROME) {
- bytesPerRow = this.pixelWidth;
+ bytesPerRow = (int) this.pixelWidth;
} else if (getBitDepth() == BIT_DEPTH_COLOR) {
- bytesPerRow = this.pixelWidth
- * getRawColorSpace().getNumComponents();
+ bytesPerRow = (int) (this.pixelWidth * getRawColorSpace().getNumComponents());
} else if (getBitDepth() == BIT_DEPTH_4
|| getBitDepth() == BIT_DEPTH_GRAYSCALE) {
- bytesPerRow = this.pixelWidth * getBitDepth() /
- PrimitiveConstants.BITS_PER_BYTE;
+ bytesPerRow = (int) (this.pixelWidth * getBitDepth() / PrimitiveConstants.BITS_PER_BYTE);
} else {
- throw new GraphicException("Image (" + getUrl().toString()
- + ") has " + getBitDepth()
+ throw new GraphicException("Image (" + getUrl().toString() + ") has " + getBitDepth()
+ " which is not a supported BMP format.");
}
if ((bytesPerRow & BmpGraphic.BITS_1_AND_2_MASK) != 0) {
@@ -524,14 +510,12 @@
@Override
public int getPixelWidth() throws GraphicException {
- this.parseBasicsWrapper();
- return this.pixelWidth;
+ return (int) this.pixelWidth;
}
@Override
public int getPixelHeight() throws GraphicException {
- this.parseBasicsWrapper();
- return this.pixelHeight;
+ return (int) this.pixelHeight;
}
/**
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java 2025-05-16 21:23:51 UTC (rev 13671)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java 2025-05-17 11:33:09 UTC (rev 13672)
@@ -68,6 +68,11 @@
/* BA is an array of images. We do not currently support that type. */
supported = false;
}
+ if (Bmp.WINDOWS_VERSION_1_FILE_TYPE_MARKER.equals(fileType)) {
+ /* Version 1 files are platform dependent and not expected to be used. We will add support for them later
+ * as needed. */
+ supported = false;
+ }
if (! supported) {
return null;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java 2025-05-16 21:23:51 UTC (rev 13671)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java 2025-05-17 11:33:09 UTC (rev 13672)
@@ -46,24 +46,28 @@
/** Windows BMP version 1. Device-Dependent Bitmap for Windows 1.x. */
WIN_1,
- /** Windows BMP version 2. Used by Windows 2.x. Identical to OS/2 version 1, used by OS/2 1.x. */
- WIN_2_AND_OS2_1,
+ /** Windows BMP version 2. Used by Windows 2.x. Almost identical to {@link #OS2_1}. */
+ WIN_2,
/** Windows BMP version 3. Used by Windows 3.x. */
- WIN_3_3_X,
+ WIN_3,
- /** Windows BMP version 3. Used by Windows NT. */
+ /** Windows BMP version 3 variant used by Windows NT. */
WIN_3_NT,
/** Windows BMP version 4. Used by Windows 95. */
WIN_4,
- /** OS/2 BMP version 2. Used by OS/2 2.x.*/
- OS2_2
+ /** OS/2 BMP version 1. Used by OS/2 1.x. Almost identical to {@link #WIN_2}. */
+ OS2_1,
+ /** OS/2 BMP version 2. Used by OS/2 2.x. */
+ OS2_2;
+
/* The "BA" (Bitmap Array) variety of BMP file really constitutes a different format and, when we add support
* for it, should be treated as such. The class it creates should be a collection of {@link BmpGraphic}
* instances parsed from it. */
+
}
/** The size, in bytes, of the file type marker at the beginning of a BMP file. */
@@ -86,6 +90,21 @@
"CP" // OS/2 Color Pointer
));
+ /** The size, in bytes, of a Windows version 2 Bitmap Header. */
+ public static final int WIN_2_BITMAP_HEADER_SIZE = 12;
+
+ /** The size, in bytes, of a Windows version 3 Bitmap Header. */
+ public static final int WIN_3_BITMAP_HEADER_SIZE = 40;
+
+ /** The size, in bytes, of a Windows version 4 Bitmap Header. */
+ public static final int WIN_4_BITMAP_HEADER_SIZE = 108;
+
+ /** The size, in bytes, of a OS/2 version 2 Bitmap Header. */
+ public static final int MIN_OS2_2_BITMAP_HEADER_SIZE = 16;
+
+ /** The size, in bytes, of a Windows version 1 Bitmap Header. */
+ public static final int MAX_OS2_2_BITMAP_HEADER_SIZE = 64;
+
/**
* Private constructor. This class should never be instantiated.
*/
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java 2025-05-16 21:23:51 UTC (rev 13671)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java 2025-05-17 11:33:09 UTC (rev 13672)
@@ -39,13 +39,17 @@
default void fileType(final String value) { return; }
default void fileSize(final @Unsigned int value) { return; }
+ default void xHotSpot(final @Unsigned short value) { return; }
+ default void yHotSpot(final @Unsigned short value) { return; }
default void bitmapOffset(final @Unsigned int value) { return; }
- default void bitmapHeaderSize(final @Unsigned int value) { return; }
- default void bitmapWidth(final @Unsigned int value) { return; }
- default void bitmapHeight(final @Unsigned int value) { return; }
- default void bitmapPlanes(final @Unsigned short value) { return; }
- default void bitmapBitsPerPixel(final @Unsigned short value) { return; }
+ default void bmhSize(final @Unsigned int value) { return; }
+ /* For width, some file types use 4-byte signed and other use 4-byte unsigned. We use a long to handle both. */
+ default void bmhWidth(final long value) { return; }
+ /* For height, some file types use 4-byte signed and other use 4-byte unsigned. We use a long to handle both. */
+ default void bmhHeight(final long value) { return; }
+ default void bmhNumPlanes(final @Unsigned short value) { return; }
+ default void bmhBitsPerPixel(final @Unsigned short value) { return; }
default void numPaletteEntries(final @Unsigned int value) { return; }
default void blueComponent(final @Unsigned byte value) { return; }
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java 2025-05-16 21:23:51 UTC (rev 13671)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java 2025-05-17 11:33:09 UTC (rev 13672)
@@ -28,6 +28,7 @@
package org.foray.graphic.parser;
+import org.foray.graphic.format.Bmp;
import org.foray.graphic.handler.BmpGraphicHandler;
import org.axsl.constants.PrimitiveConstants;
@@ -42,40 +43,28 @@
*/
public class BmpGraphicParser1 extends GraphicParser<BmpGraphicHandler> {
+ /** The first 2 bytes of the header. */
+ private String fileType;
+
+ /** The bits-per-pixel parsed from the bitmap header. */
+ private @Unsigned short bmhBitsPerPixel;
+
+
@Override
- public void parse(final GraphicRandomAccessInput input, final BmpGraphicHandler handler)
+ public void parse(final GraphicRandomAccessInput input, final long offset, final BmpGraphicHandler handler)
throws IOException, GraphicException {
- input.seek(0);
+ input.seek(offset);
/* *** BMP is little-endian, so we reverse the bytes on numeric values. *** */
- /* File Header. */
- final String fileType = input.readStringASCII(2); // 2 bytes, total 2
- handler.fileType(fileType);
- if ("BA".equals(fileType)) {
- throw new GraphicException("OS/2 Bitmap Arrays are not currently supported");
- }
- handler.fileSize(Integer.reverseBytes(input.read_DWORD())); // 4 bytes, total 6
- /* Skip Reserved1 and Reserved2. */
- input.read_WORD(); // 2 bytes, total 8
- input.read_WORD(); // 2 bytes, total 10
- final @Unsigned int bitmapOffset = Integer.reverseBytes(input.read_DWORD()); // 4 bytes, total 14
- handler.bitmapOffset(bitmapOffset);
+ parseFileHeader(input, handler);
- /* Bitmap Header. */ // *** Restart Count ***
- final @Unsigned int bitmapHeaderSize = Integer.reverseBytes(input.read_DWORD()); // 4 bytes, total 4
- handler.bitmapHeaderSize(bitmapHeaderSize);
- /* GFF2 says that Width & Height are SHORT, but they appear to be DWORD. */
- handler.bitmapWidth(Integer.reverseBytes(input.read_DWORD())); // 4 bytes, total 8
- handler.bitmapHeight(Integer.reverseBytes(input.read_DWORD())); // 4 bytes, total 12
- handler.bitmapPlanes(Short.reverseBytes(input.read_WORD())); // 2 bytes, total 14
- final @Unsigned short bitmapBitsPerPixel = Short.reverseBytes(input.read_WORD()); // 2 bytes, total 16
- handler.bitmapBitsPerPixel(bitmapBitsPerPixel);
+ parseBitmapHeader(input, handler);
/* Color Palette. */ // *** Restart Count ***
- int numColorPaletteEntries = 1 << bitmapBitsPerPixel;
+ int numColorPaletteEntries = 1 << bmhBitsPerPixel;
if (numColorPaletteEntries > PrimitiveConstants.MAX_8_BIT_UNSIGNED_VALUES) {
numColorPaletteEntries = 0;
}
@@ -90,4 +79,126 @@
}
+ /**
+ * Parses the file header. Currently handles all formats except Windows version 1.
+ * @param input The bytes being parsed.
+ * @param handler The handler catching events thrown by this parser.
+ * @throws IOException For errors reading the input.
+ */
+ private void parseFileHeader(final GraphicRandomAccessInput input, final BmpGraphicHandler handler)
+ throws IOException {
+ /* *** File Header. The supported types all have compatible file header formats. *** */
+ this.fileType = input.readStringASCII(2); // 2 bytes, total 2
+ handler.fileType(fileType);
+
+ /* See {@link BmpFactory} where headers of 0x0000 and "BA" are not currently supported. */
+
+ handler.fileSize(Integer.reverseBytes(input.read_DWORD())); // 4 bytes, total 6
+
+ switch (fileType) {
+ case "CI":
+ case "CP":
+ case "IC":
+ case "PT": {
+ /* These are all OS/2 only. */
+ handler.xHotSpot(Short.reverseBytes(input.read_WORD()));
+ handler.yHotSpot(Short.reverseBytes(input.read_WORD()));
+ break;
+ }
+ default: {
+ /* Skip Reserved1 and Reserved2. */
+ input.read_WORD(); // 2 bytes, total 8
+ input.read_WORD(); // 2 bytes, total 10
+ break;
+ }
+ }
+
+ final @Unsigned int bitmapOffset = Integer.reverseBytes(input.read_DWORD()); // 4 bytes, total 14
+ handler.bitmapOffset(bitmapOffset);
+ }
+
+
+
+ /**
+ * Parses the bitmap header.
+ * @param input The bytes being parsed.
+ * @param handler The handler catching events thrown by this parser.
+ * @throws IOException For errors reading the input.
+ */
+ private void parseBitmapHeader(final GraphicRandomAccessInput input, final BmpGraphicHandler handler)
+ throws IOException, GraphicException {
+ final @Unsigned int bmhSize = Integer.reverseBytes(input.read_DWORD()); // 4 bytes
+ handler.bmhSize(bmhSize);
+
+ /* We now know enough to compute a tentative file format. */
+ final Bmp.Format fileFormat = computeTentativeFileFormat(fileType, bmhSize);
+
+ switch (fileFormat) {
+ case WIN_1: break;
+ case WIN_2: {
+ handler.bmhWidth(Integer.reverseBytes(input.read_SHORT())); // 2 bytes
+ handler.bmhHeight(Integer.reverseBytes(input.read_SHORT())); // 2 bytes
+ break;
+ }
+ case WIN_3:
+ case WIN_3_NT:
+ case WIN_4: {
+ handler.bmhWidth(Integer.reverseBytes(input.read_LONG())); // 4 bytes
+ handler.bmhHeight(Integer.reverseBytes(input.read_LONG())); // 4 bytes
+ break;
+ }
+ case OS2_1: {
+ handler.bmhWidth(Integer.reverseBytes(input.read_WORD())); // 2 bytes
+ handler.bmhHeight(Integer.reverseBytes(input.read_WORD())); // 2 bytes
+ break;
+ }
+ case OS2_2: {
+ handler.bmhWidth(Integer.reverseBytes(input.read_DWORD())); // 4 bytes
+ handler.bmhHeight(Integer.reverseBytes(input.read_DWORD())); // 4 bytes
+ break;
+ }
+ }
+
+
+ handler.bmhNumPlanes(Short.reverseBytes(input.read_WORD())); // 2 bytes
+ this.bmhBitsPerPixel = Short.reverseBytes(input.read_WORD()); // 2 bytes
+ handler.bmhBitsPerPixel(bmhBitsPerPixel);
+ }
+
+
+
+ /**
+ * Computes the file format from the type of the file and the size of the Bitmap Header.
+ * @param fileType The file type, from the first two bytes of the file.
+ * @param bmhSize The size of the bitmap header.
+ * @return The file format.
+ * @throws GraphicException If no file type is found that matches {@code fileType} and {@code bmhSize}.
+ */
+ private Bmp.Format computeTentativeFileFormat(final String fileType, final @Unsigned int bmhSize)
+ throws GraphicException {
+ switch (fileType) {
+ case Bmp.WINDOWS_VERSION_1_FILE_TYPE_MARKER: return Bmp.Format.WIN_1;
+ case "BM":
+ case "CI":
+ case "CP":
+ case "IC":
+ case "PT": {
+ switch (bmhSize) {
+ case Bmp.WIN_2_BITMAP_HEADER_SIZE: return Bmp.Format.WIN_2;
+ /* Size of 40 could also be OS2_2. However, when that is the case, the fields appear to be identical, so
+ * there is no known risk resulting from a misdiagnosis here. **/
+ case Bmp.WIN_3_BITMAP_HEADER_SIZE: return Bmp.Format.WIN_3;
+ case Bmp.WIN_4_BITMAP_HEADER_SIZE: return Bmp.Format.WIN_4;
+ default: {
+ if (bmhSize >= Bmp.MIN_OS2_2_BITMAP_HEADER_SIZE
+ && bmhSize <= Bmp.MAX_OS2_2_BITMAP_HEADER_SIZE) {
+ return Bmp.Format.OS2_2;
+ }
+ }
+ }
+ }
+ }
+ throw new GraphicException("Unknown BMP format: file type [" + fileType + "], bitmap header size [" +
+ bmhSize + "]");
+ }
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java 2025-05-16 21:23:51 UTC (rev 13671)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java 2025-05-17 11:33:09 UTC (rev 13672)
@@ -46,10 +46,12 @@
/**
* Parses the input.
* @param input The input to be parsed.
+ * @param offset The offset into {@code input} at which parsing should begin.
* @param consumer The consumer of the parsing.
* @throws IOException For errors reading the input.
* @throws GraphicException For formats or features that we don't support.
*/
- public abstract void parse(GraphicRandomAccessInput input, H consumer) throws IOException, GraphicException;
+ public abstract void parse(GraphicRandomAccessInput input, long offset, H consumer)
+ throws IOException, GraphicException;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-16 21:23:53
|
Revision: 13671
http://sourceforge.net/p/foray/code/13671
Author: victormote
Date: 2025-05-16 21:23:51 +0000 (Fri, 16 May 2025)
Log Message:
-----------
Remove some dependencies on GraphicServer4a for a Logger.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/VectorGraphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgOutput2Pdf.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgOutput2Ps.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic4a.java 2025-05-16 21:01:55 UTC (rev 13670)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/SvgGraphic4a.java 2025-05-16 21:23:51 UTC (rev 13671)
@@ -42,6 +42,7 @@
import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.util.XMLResourceDescriptor;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.svg.SVGDocument;
@@ -106,7 +107,7 @@
getServer().getSVGParserClassName());
this.doc = factory.createSVGDocument(getUrl().toExternalForm());
} catch (final IOException e) {
- getServer().logError("Could not load external SVG: " + e.getMessage());
+ LoggerFactory.getLogger(this.getClass()).error("Could not load external SVG: " + e.getMessage());
}
}
@@ -187,7 +188,7 @@
SVGOMDocument.SVG_HEIGHT_ATTRIBUTE, uctx);
this.pixelHeight = (int) pixelHeight;
} catch (final NoClassDefFoundError ncdfe) {
- getServer().logError("Batik not in class path");
+ LoggerFactory.getLogger(this.getClass()).error("Batik not in class path");
return;
}
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java 2025-05-16 21:01:55 UTC (rev 13670)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/TiffGraphic.java 2025-05-16 21:23:51 UTC (rev 13671)
@@ -49,6 +49,7 @@
import org.apache.xmlgraphics.image.codec.util.FileCacheSeekableStream;
import org.apache.xmlgraphics.image.codec.util.MemoryCacheSeekableStream;
import org.apache.xmlgraphics.image.codec.util.SeekableStream;
+import org.slf4j.LoggerFactory;
import java.awt.Color;
import java.awt.color.ColorSpace;
@@ -299,7 +300,7 @@
this.seekableInput.skip(this.stripOffset);
bytesRead = this.seekableInput.read(readBuf);
if (bytesRead != this.stripLength) {
- getServer().logError("Error while loading image: length mismatch on read");
+ LoggerFactory.getLogger(this.getClass()).error("Error while loading image: length mismatch on read");
return;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/VectorGraphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/VectorGraphic4a.java 2025-05-16 21:01:55 UTC (rev 13670)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/VectorGraphic4a.java 2025-05-16 21:23:51 UTC (rev 13671)
@@ -34,6 +34,8 @@
import org.axsl.graphic.VectorGraphic;
import org.axsl.graphic.output.VectorOutput;
+import org.slf4j.LoggerFactory;
+
import java.io.BufferedInputStream;
import java.net.URL;
@@ -62,7 +64,8 @@
try {
output = factory.createGraphicOutput(this);
} catch (final GraphicException e) {
- getServer().logError("Error creating Graphic output for: " + mimeType + "\n" + e.getMessage());
+ LoggerFactory.getLogger(this.getClass()).error(
+ "Error creating Graphic output for: " + mimeType + "\n" + e.getMessage());
}
return output;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgOutput2Pdf.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgOutput2Pdf.java 2025-05-16 21:01:55 UTC (rev 13670)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgOutput2Pdf.java 2025-05-16 21:23:51 UTC (rev 13671)
@@ -43,6 +43,7 @@
import org.apache.batik.bridge.StrokingTextPainter;
import org.apache.batik.bridge.TextPainter;
import org.apache.batik.gvt.GraphicsNode;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.svg.SVGDocument;
import java.awt.Graphics2D;
@@ -75,7 +76,8 @@
/* If not running in a graphical environment, log an error message
* and skip the SVG. */
if (! Environment.isGraphicalEnvironment()) {
- this.svg.getServer().logError("Unable to get Graphical Environment required to process SVG. Skipping.");
+ LoggerFactory.getLogger(this.getClass()).error(
+ "Unable to get Graphical Environment required to process SVG. Skipping.");
return;
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgOutput2Ps.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgOutput2Ps.java 2025-05-16 21:01:55 UTC (rev 13670)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/output/SvgOutput2Ps.java 2025-05-16 21:23:51 UTC (rev 13671)
@@ -41,6 +41,7 @@
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.xmlgraphics.java2d.GraphicContext;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.svg.SVGDocument;
import java.awt.geom.AffineTransform;
@@ -77,7 +78,7 @@
try {
doc = this.svg.getSvgDocument();
} catch (final GraphicException e) {
- this.svg.getServer().logError("Error getting SVGDocument in " + this.getClass().getName());
+ LoggerFactory.getLogger(this.getClass()).error("Error getting SVGDocument in " + this.getClass().getName());
return;
}
BridgeContext ctx = makeBridgeContext();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-16 21:02:02
|
Revision: 13670
http://sourceforge.net/p/foray/code/13670
Author: victormote
Date: 2025-05-16 21:01:55 +0000 (Fri, 16 May 2025)
Log Message:
-----------
Document how we handle the "BA" variant of a BMP file.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java 2025-05-16 16:34:17 UTC (rev 13669)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java 2025-05-16 21:01:55 UTC (rev 13670)
@@ -44,14 +44,6 @@
public class BmpFactory extends GraphicFactory {
/**
- * The header bytes at the beginning of a BMP file.
- */
- protected static final byte[] BMP_HEADER = new byte[] {
- 0x42,
- 0x4D,
- };
-
- /**
* Constructor.
* @param server The parent graphic server.
*/
@@ -72,6 +64,10 @@
break;
}
}
+ if ("BA".equals(fileType)) {
+ /* BA is an array of images. We do not currently support that type. */
+ supported = false;
+ }
if (! supported) {
return null;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java 2025-05-16 16:34:17 UTC (rev 13669)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java 2025-05-16 21:01:55 UTC (rev 13670)
@@ -27,7 +27,6 @@
*/
package org.foray.graphic.format;
-import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -42,7 +41,7 @@
* enough similarities between them to treat them as a single format. However, the version numbers between Windows
* and OS/2 are different.
*/
- public enum Version {
+ public enum Format {
/** Windows BMP version 1. Device-Dependent Bitmap for Windows 1.x. */
WIN_1,
@@ -61,6 +60,10 @@
/** OS/2 BMP version 2. Used by OS/2 2.x.*/
OS2_2
+
+ /* The "BA" (Bitmap Array) variety of BMP file really constitutes a different format and, when we add support
+ * for it, should be treated as such. The class it creates should be a collection of {@link BmpGraphic}
+ * instances parsed from it. */
}
/** The size, in bytes, of the file type marker at the beginning of a BMP file. */
@@ -69,13 +72,13 @@
/** The Windows version 1 file type marker, expressed as a String. All BMP file types consist of 2 bytes, each a
* Latin character, except for Windowns version 1, which consists of 2 bytes, each 0x00. To make all of these
* easily expressible as a String, we here coerce the Windows version 1 marker into a String. */
- public static final String WINDOWS_VERSION_1_FILE_TYPE_MARKER =
- new String(new byte[] {0, 0}, StandardCharsets.US_ASCII);
+ public static final String WINDOWS_VERSION_1_FILE_TYPE_MARKER = "\u0000\u0000";
/** The list of possible file markers (first two bytes) of BMP files. */
public static final List<String> FILE_TYPE_MARKERS = Collections.unmodifiableList(Arrays.asList(
WINDOWS_VERSION_1_FILE_TYPE_MARKER,
"BM", // Windows version 2 and higher, and OS/2 single bitmap, all versions
+/* For now, we include "BA" as a valid file marker, but intend eventually to move it to a different format. */
"BA", // OS/2 Bitmap Array
"IC", // OS/2 Icon
"CI", // OS/2 Color Icon
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-16 16:34:20
|
Revision: 13669
http://sourceforge.net/p/foray/code/13669
Author: victormote
Date: 2025-05-16 16:34:17 +0000 (Fri, 16 May 2025)
Log Message:
-----------
Move remaining graphic resource files, including SVG, to the foray-graphics test resources.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/GifGraphicTests.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/JpegGraphicTests.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/PngGraphicTests.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/SvgGraphicTests.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TiffGraphicTests.java
trunk/foray/src/dist/resource/fo-examples/basic/graphics.fo
trunk/foray/src/dist/resource/fo-examples/svg/external.fo
Added Paths:
-----------
trunk/foray/foray-graphic/src/test/resources/eps/
trunk/foray/foray-graphic/src/test/resources/eps/01_telephone_inv.eps
trunk/foray/foray-graphic/src/test/resources/eps/29_coffeeshop_inv.ps
trunk/foray/foray-graphic/src/test/resources/eps/barcode1.eps
trunk/foray/foray-graphic/src/test/resources/gif/
trunk/foray/foray-graphic/src/test/resources/gif/listgeometry.gif
trunk/foray/foray-graphic/src/test/resources/gif/page.gif
trunk/foray/foray-graphic/src/test/resources/gif/xml_feather.gif
trunk/foray/foray-graphic/src/test/resources/gif/xml_feather_transparent.gif
trunk/foray/foray-graphic/src/test/resources/jpg/
trunk/foray/foray-graphic/src/test/resources/jpg/jpeg-test1.jpg
trunk/foray/foray-graphic/src/test/resources/mathml/
trunk/foray/foray-graphic/src/test/resources/mathml/mathml-example-1.xml
trunk/foray/foray-graphic/src/test/resources/pdf/
trunk/foray/foray-graphic/src/test/resources/pdf/01_telephone_inv.pdf
trunk/foray/foray-graphic/src/test/resources/png/
trunk/foray/foray-graphic/src/test/resources/png/png-test1.png
trunk/foray/foray-graphic/src/test/resources/readme.txt
trunk/foray/foray-graphic/src/test/resources/svg/
trunk/foray/foray-graphic/src/test/resources/svg/boxes.svg
trunk/foray/foray-graphic/src/test/resources/svg/font-embed.svg
trunk/foray/foray-graphic/src/test/resources/svg/multi.svg
trunk/foray/foray-graphic/src/test/resources/svg/ref.svg
trunk/foray/foray-graphic/src/test/resources/svg/text-001.svg
trunk/foray/foray-graphic/src/test/resources/svg/view.svg
trunk/foray/foray-graphic/src/test/resources/tif/
trunk/foray/foray-graphic/src/test/resources/tif/xml_fax.tif
Removed Paths:
-------------
trunk/foray/src/dist/resource/fo-examples/graphics/
trunk/foray/src/dist/resource/fo-examples/svg/boxes.svg
trunk/foray/src/dist/resource/fo-examples/svg/font-embed.svg
trunk/foray/src/dist/resource/fo-examples/svg/multi.svg
trunk/foray/src/dist/resource/fo-examples/svg/ref.svg
trunk/foray/src/dist/resource/fo-examples/svg/text-001.svg
trunk/foray/src/dist/resource/fo-examples/svg/view.svg
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/GifGraphicTests.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/GifGraphicTests.java 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/GifGraphicTests.java 2025-05-16 16:34:17 UTC (rev 13669)
@@ -57,7 +57,7 @@
*/
@Test
public void testGraphic01() throws GraphicException, IOException, URISyntaxException {
- final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("xml_feather.gif"));
+ final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("gif/xml_feather.gif"));
final Graphic4a gif = this.getServer().procureGraphic(graphicUri.toURL(), false);
assertNotNull(gif);
assertTrue(gif instanceof GifGraphic);
@@ -88,7 +88,7 @@
*/
@Test
public void testGraphic02() throws GraphicException, IOException, URISyntaxException {
- final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("xml_feather_transparent.gif"));
+ final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("gif/xml_feather_transparent.gif"));
final Graphic4a gif = this.getServer().procureGraphic(graphicUri.toURL(), false);
assertNotNull(gif);
assertTrue(gif instanceof GifGraphic);
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/JpegGraphicTests.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/JpegGraphicTests.java 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/JpegGraphicTests.java 2025-05-16 16:34:17 UTC (rev 13669)
@@ -58,7 +58,7 @@
*/
@Test
public void testGraphic01() throws GraphicException, IOException, URISyntaxException {
- final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("jpeg-test1.jpg"));
+ final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("jpg/jpeg-test1.jpg"));
final Graphic4a jpeg = this.getServer().procureGraphic(graphicUri.toURL(), false);
assertNotNull(jpeg);
assertTrue(jpeg instanceof JpegGraphic);
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/PngGraphicTests.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/PngGraphicTests.java 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/PngGraphicTests.java 2025-05-16 16:34:17 UTC (rev 13669)
@@ -58,7 +58,7 @@
*/
@Test
public void testGraphic01() throws GraphicException, IOException, URISyntaxException {
- final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("png-test1.png"));
+ final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("png/png-test1.png"));
final Graphic4a png = this.getServer().procureGraphic(graphicUri.toURL(), false);
assertNotNull(png);
assertTrue(png instanceof PngGraphic);
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/SvgGraphicTests.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/SvgGraphicTests.java 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/SvgGraphicTests.java 2025-05-16 16:34:17 UTC (rev 13669)
@@ -72,7 +72,7 @@
* should not need to test. However, this will flag changes that they
* might make, and operates as an example of how to get information
* out of their tree. */
- final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("text-001.svg"));
+ final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("svg/text-001.svg"));
final Graphic4a graphic = this.getServer().procureGraphic(graphicUri.toURL(), false);
assertNotNull(graphic);
assertTrue(graphic instanceof SvgGraphic4a);
@@ -150,7 +150,7 @@
*/
@Test
public void testFontEmbed() throws GraphicException, IOException, URISyntaxException {
- final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("font-embed.svg"));
+ final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("svg/font-embed.svg"));
final Graphic4a graphic = this.getServer().procureGraphic(graphicUri.toURL(), false);
assertNotNull(graphic);
assertTrue(graphic instanceof SvgGraphic4a);
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TiffGraphicTests.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TiffGraphicTests.java 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/TiffGraphicTests.java 2025-05-16 16:34:17 UTC (rev 13669)
@@ -58,7 +58,7 @@
*/
@Test
public void testGraphic01() throws GraphicException, IOException, URISyntaxException {
- final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("xml_fax.tif"));
+ final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("tif/xml_fax.tif"));
final Graphic4a tiff = this.getServer().procureGraphic(graphicUri.toURL(), false);
assertNotNull(tiff);
assertTrue(tiff instanceof TiffGraphic);
Copied: trunk/foray/foray-graphic/src/test/resources/eps/01_telephone_inv.eps (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/01_telephone_inv.eps)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/eps/01_telephone_inv.eps (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/eps/01_telephone_inv.eps 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,163 @@
+%!PS-Adobe-2.0 EPSF-1.2
+%%Creator:Adobe Illustrator(TM) 1.1
+%%For:Joseph Sogge Joseph Sogge Design Group
+%%Title:1, Telephone*
+%%CreationDate:2/20/89 4:49 PM
+%%DocumentProcSets:Adobe_Illustrator_1.1 0 0
+%%DocumentSuppliedProcSets:Adobe_Illustrator_1.1 0 0
+%%DocumentFonts:Courier
+%%BoundingBox:-26 -665 587 -50
+%%TemplateBox:288 -360 288 -360
+%%EndComments
+%%BeginProcSet:Adobe_Illustrator_1.1 0 0
+% Copyright (C) 1987 Adobe Systems Incorporated.
+% All Rights Reserved.
+% Adobe Illustrator is a trademark of Adobe Systems Incorporated.
+/Adobe_Illustrator_1.1 dup 100 dict def load begin
+/Version 0 def
+/Revision 0 def
+% definition operators
+/bdef {bind def} bind def
+/ldef {load def} bdef
+/xdef {exch def} bdef
+% graphic state operators
+/_K {3 index add neg dup 0 lt {pop 0} if 3 1 roll} bdef
+/_k /setcmybcolor where
+{/setcmybcolor get} {{1 sub 4 1 roll _K _K _K setrgbcolor pop} bind} ifelse def
+/g {/_b xdef /p {_b setgray} def} bdef
+/G {/_B xdef /P {_B setgray} def} bdef
+/k {/_b xdef /_y xdef /_m xdef /_c xdef /p {_c _m _y _b _k} def} bdef
+/K {/_B xdef /_Y xdef /_M xdef /_C xdef /P {_C _M _Y _B _k} def} bdef
+/d /setdash ldef
+/_i currentflat def
+/i {dup 0 eq {pop _i} if setflat} bdef
+/j /setlinejoin ldef
+/J /setlinecap ldef
+/M /setmiterlimit ldef
+/w /setlinewidth ldef
+% path construction operators
+/_R {.25 sub round .25 add} bdef
+/_r {transform _R exch _R exch itransform} bdef
+/c {_r curveto} bdef
+/C /c ldef
+/v {currentpoint 6 2 roll _r curveto} bdef
+/V /v ldef
+/y {_r 2 copy curveto} bdef
+/Y /y ldef
+/l {_r lineto} bdef
+/L /l ldef
+/m {_r moveto} bdef
+% error operators
+/_e [] def
+/_E {_e length 0 ne {gsave 0 g 0 G 0 i 0 J 0 j 1 w 10 M [] 0 d
+/Courier 20 0 0 1 z [0.966 0.259 -0.259 0.966
+_e 0 get _e 2 get add 2 div _e 1 get _e 3 get add 2 div] e _f t T grestore} if} bdef
+/_fill {{fill} stopped
+{/_e [pathbbox] def /_f (ERROR: can't fill, increase flatness) def n _E} if} bdef
+/_stroke {{stroke} stopped
+{/_e [pathbbox] def /_f (ERROR: can't stroke, increase flatness) def n _E} if} bdef
+% path painting operators
+/n /newpath ldef
+/N /n ldef
+/F {p _fill} bdef
+/f {closepath F} bdef
+/S {P _stroke} bdef
+/s {closepath S} bdef
+/B {gsave F grestore S} bdef
+/b {closepath B} bdef
+% text block construction and painting operators
+/_s /ashow ldef
+/_S {(?) exch {2 copy 0 exch put pop dup false charpath currentpoint _g setmatrix
+_stroke _G setmatrix moveto 3 copy pop rmoveto} forall pop pop pop n} bdef
+/_A {_a moveto _t exch 0 exch} bdef
+/_L {0 _l neg translate _G currentmatrix pop} bdef
+/_w {dup stringwidth exch 3 -1 roll length 1 sub _t mul add exch} bdef
+/_z [{0 0} bind {dup _w exch neg 2 div exch neg 2 div} bind {dup _w exch neg exch neg} bind] def
+/z {_z exch get /_a xdef /_t xdef /_l xdef exch findfont exch scalefont setfont} bdef
+/_g matrix def
+/_G matrix def
+/_D {_g currentmatrix pop gsave concat _G currentmatrix pop} bdef
+/e {_D p /t {_A _s _L} def} bdef
+/r {_D P /t {_A _S _L} def} bdef
+/a {_D /t {dup p _A _s P _A _S _L} def} bdef
+/o {_D /t {pop _L} def} bdef
+/T {grestore} bdef
+% group construction operators
+/u {} bdef
+/U {} bdef
+% font construction operators
+/Z {findfont begin currentdict dup length dict begin
+{1 index /FID ne {def} {pop pop} ifelse} forall /FontName exch def dup length 0 ne
+{/Encoding Encoding 256 array copy def 0 exch {dup type /nametype eq
+{Encoding 2 index 2 index put pop 1 add} {exch pop} ifelse} forall} if pop
+currentdict dup end end /FontName get exch definefont pop} bdef
+end
+%%EndProcSet
+%%EndProlog
+%%BeginSetup
+Adobe_Illustrator_1.1 begin
+n
+%%EndSetup
+u
+0 g
+1 G
+0 i
+0 J
+0 j
+3.408 w
+10 M
+[]0 d
+%%Note:
+56.85 -68.878 m
+15.515 -68.878 -7.721 -90.249 -7.721 -133.914 C
+-7.721 -584.036 L
+-7.721 -624.879 13.17 -646.264 54.471 -646.264 C
+506.495 -646.264 L
+547.798 -646.264 568.721 -625.944 568.721 -584.036 C
+568.721 -133.914 L
+568.721 -91.314 547.798 -68.878 505.198 -68.878 C
+56.707 -68.736 56.85 -68.878 V
+b
+U
+u
+u
+1 g
+0 G
+0.956 w
+283.7555 -114.998 m
+261.3765 -117.502 180.0005 -154.696 177.6265 -346.477 c
+175.1265 -548.502 261.3765 -591.002 283.9965 -590.544 C
+283.9965 -457.108 L
+265.3765 -457.108 261.6305 -436.833 257.3765 -395.002 c
+254.5625 -367.323 253.7415 -333.06 257.3765 -299.002 c
+259.9285 -275.105 264.3765 -251.779 283.8765 -251.779 C
+283.7555 -114.998 L
+f
+U
+u
+332.0015 -590.779 m
+340.6265 -590.779 346.8125 -583.752 346.8125 -575.877 C
+346.8735 -575.815 L
+346.8125 -471.815 346.8125 -471.752 v
+346.8125 -463.502 340.1265 -456.998 332.0015 -456.998 C
+294.2015 -456.998 L
+294.2015 -590.779 L
+331.9085 -590.837 331.9395 -590.806 V
+332.0015 -590.779 L
+f
+U
+u
+332.0015 -251.779 m
+340.6265 -251.779 346.8125 -244.752 346.8125 -236.877 C
+346.8735 -236.815 L
+346.8125 -129.815 346.8125 -129.752 v
+346.8125 -121.502 340.1265 -114.998 332.0015 -114.998 C
+294.2015 -114.998 L
+294.2015 -251.779 L
+331.9085 -251.837 331.9395 -251.806 V
+332.0015 -251.779 L
+f
+U
+U
+%%Trailer
+_E end
Copied: trunk/foray/foray-graphic/src/test/resources/eps/29_coffeeshop_inv.ps (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/29_coffeeshop_inv.ps)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/eps/29_coffeeshop_inv.ps (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/eps/29_coffeeshop_inv.ps 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,162 @@
+%!PS-Adobe-2.0 EPSF-1.2
+%%Creator:Adobe Illustrator(TM) 1.1
+%%For:Joseph Sogge Joseph Sogge Design Group
+%%Title:29, Coffee Shop*
+%%CreationDate:2/8/89 10:32 PM
+%%DocumentProcSets:Adobe_Illustrator_1.1 0 0
+%%DocumentSuppliedProcSets:Adobe_Illustrator_1.1 0 0
+%%DocumentFonts:Courier
+%%BoundingBox:-436.5 -188.25 177.5 425.75
+%%TemplateBox:-115.5 102.75 -115.5 102.75
+%%EndComments
+%%BeginProcSet:Adobe_Illustrator_1.1 0 0
+% Copyright (C) 1987 Adobe Systems Incorporated.
+% All Rights Reserved.
+% Adobe Illustrator is a trademark of Adobe Systems Incorporated.
+/Adobe_Illustrator_1.1 dup 100 dict def load begin
+/Version 0 def
+/Revision 0 def
+% definition operators
+/bdef {bind def} bind def
+/ldef {load def} bdef
+/xdef {exch def} bdef
+% graphic state operators
+/_K {3 index add neg dup 0 lt {pop 0} if 3 1 roll} bdef
+/_k /setcmybcolor where
+{/setcmybcolor get} {{1 sub 4 1 roll _K _K _K setrgbcolor pop} bind} ifelse def
+/g {/_b xdef /p {_b setgray} def} bdef
+/G {/_B xdef /P {_B setgray} def} bdef
+/k {/_b xdef /_y xdef /_m xdef /_c xdef /p {_c _m _y _b _k} def} bdef
+/K {/_B xdef /_Y xdef /_M xdef /_C xdef /P {_C _M _Y _B _k} def} bdef
+/d /setdash ldef
+/_i currentflat def
+/i {dup 0 eq {pop _i} if setflat} bdef
+/j /setlinejoin ldef
+/J /setlinecap ldef
+/M /setmiterlimit ldef
+/w /setlinewidth ldef
+% path construction operators
+/_R {.25 sub round .25 add} bdef
+/_r {transform _R exch _R exch itransform} bdef
+/c {_r curveto} bdef
+/C /c ldef
+/v {currentpoint 6 2 roll _r curveto} bdef
+/V /v ldef
+/y {_r 2 copy curveto} bdef
+/Y /y ldef
+/l {_r lineto} bdef
+/L /l ldef
+/m {_r moveto} bdef
+% error operators
+/_e [] def
+/_E {_e length 0 ne {gsave 0 g 0 G 0 i 0 J 0 j 1 w 10 M [] 0 d
+/Courier 20 0 0 1 z [0.966 0.259 -0.259 0.966
+_e 0 get _e 2 get add 2 div _e 1 get _e 3 get add 2 div] e _f t T grestore} if} bdef
+/_fill {{fill} stopped
+{/_e [pathbbox] def /_f (ERROR: can't fill, increase flatness) def n _E} if} bdef
+/_stroke {{stroke} stopped
+{/_e [pathbbox] def /_f (ERROR: can't stroke, increase flatness) def n _E} if} bdef
+% path painting operators
+/n /newpath ldef
+/N /n ldef
+/F {p _fill} bdef
+/f {closepath F} bdef
+/S {P _stroke} bdef
+/s {closepath S} bdef
+/B {gsave F grestore S} bdef
+/b {closepath B} bdef
+% text block construction and painting operators
+/_s /ashow ldef
+/_S {(?) exch {2 copy 0 exch put pop dup false charpath currentpoint _g setmatrix
+_stroke _G setmatrix moveto 3 copy pop rmoveto} forall pop pop pop n} bdef
+/_A {_a moveto _t exch 0 exch} bdef
+/_L {0 _l neg translate _G currentmatrix pop} bdef
+/_w {dup stringwidth exch 3 -1 roll length 1 sub _t mul add exch} bdef
+/_z [{0 0} bind {dup _w exch neg 2 div exch neg 2 div} bind {dup _w exch neg exch neg} bind] def
+/z {_z exch get /_a xdef /_t xdef /_l xdef exch findfont exch scalefont setfont} bdef
+/_g matrix def
+/_G matrix def
+/_D {_g currentmatrix pop gsave concat _G currentmatrix pop} bdef
+/e {_D p /t {_A _s _L} def} bdef
+/r {_D P /t {_A _S _L} def} bdef
+/a {_D /t {dup p _A _s P _A _S _L} def} bdef
+/o {_D /t {pop _L} def} bdef
+/T {grestore} bdef
+% group construction operators
+/u {} bdef
+/U {} bdef
+% font construction operators
+/Z {findfont begin currentdict dup length dict begin
+{1 index /FID ne {def} {pop pop} ifelse} forall /FontName exch def dup length 0 ne
+{/Encoding Encoding 256 array copy def 0 exch {dup type /nametype eq
+{Encoding 2 index 2 index put pop 1 add} {exch pop} ifelse} forall} if pop
+currentdict dup end end /FontName get exch definefont pop} bdef
+end
+%%EndProcSet
+%%EndProlog
+%%BeginSetup
+Adobe_Illustrator_1.1 begin
+n
+%%EndSetup
+u
+u
+0 g
+0 G
+0 i
+0 J
+0 j
+3.408 w
+10 M
+[]0 d
+%%Note:
+-353.28 407.332 m
+-394.615 407.332 -417.851 385.961 -417.851 342.296 C
+-417.851 -107.826 L
+-417.851 -148.669 -396.96 -170.054 -355.659 -170.054 C
+96.365 -170.054 L
+137.668 -170.054 158.591 -149.734 158.591 -107.826 C
+158.591 342.296 L
+158.591 384.896 137.668 407.332 95.068 407.332 C
+-353.423 407.474 -353.28 407.332 V
+b
+U
+u
+u
+u
+1 g
+0.958 w
+93.069 -13.496 m
+-350.075 -13.496 L
+-350.075 -45.5827 -325.6267 -60.462 -306 -60.462 C
+49 -60.462 L
+72.4939 -60.462 93.069 -41.9998 93.069 -13.496 C
+f
+U
+u
+-255.513 212.855 m
+-255.513 39.25 L
+-255.513 15.7454 -235.2129 -2.887 -213.25 -2.887 C
+-41.769 -2.887 L
+-16.9722 -2.887 -0.095 17.9126 -0.095 39.25 C
+-0.095 53.747 L
+48.7937 53.747 84.313 90.5052 84.313 133.301 c
+84.313 177.0046 49.5 212.855 9 212.855 C
+-255.513 212.855 l
+f
+U
+U
+u
+0 g
+53.125 133.2218 m
+53.25 148.5 42.5 180.2368 9.0162 180.2368 C
+9 180.25 L
+-0.095 180.265 L
+-0.095 86.75 L
+34.75 84.5 53.1225 108.3064 53.1225 133.25 C
+53.125 133.2218 L
+f
+U
+U
+U
+%%Trailer
+_E end
Copied: trunk/foray/foray-graphic/src/test/resources/eps/barcode1.eps (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/barcode1.eps)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/eps/barcode1.eps (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/eps/barcode1.eps 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,79 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%BoundingBox: 0 0 136 43
+%%HiResBoundingBox: 0 0 135.6548 42.525
+%%Creator: Krysalis Barcode (http://www.krysalis.org/barcode)
+%%CreationDate: 2003-05-24T00:12:23
+%%LanguageLevel: 1
+%%EndComments
+%%BeginProlog
+%%BeginProcSet: krysalis-barcode-procset 1.0
+/rf {
+newpath
+4 -2 roll moveto
+dup neg 0 exch rlineto
+exch 0 rlineto
+0 neg exch rlineto
+closepath fill
+} def
+/ct {
+moveto dup stringwidth
+2 div neg exch 2 div neg exch
+rmoveto show
+} def
+/jt {
+4 -1 roll dup stringwidth pop
+5 -2 roll 1 index sub
+3 -1 roll sub
+2 index length
+1 sub div
+0 4 -1 roll 4 -1 roll 5 -1 roll
+moveto ashow
+} def
+%%EndProcSet: krysalis-barcode-procset 1.0
+%%EndProlog
+9.3555 42.525 0.9356 38.525 rf
+11.2266 42.525 0.9356 38.525 rf
+14.0332 42.525 1.8711 34.525 rf
+17.7755 42.525 0.9356 34.525 rf
+20.5821 42.525 0.9356 34.525 rf
+22.4532 42.525 2.8066 34.525 rf
+26.1954 42.525 0.9356 34.525 rf
+29.9376 42.525 1.8711 34.525 rf
+32.7442 42.525 1.8711 34.525 rf
+37.422 42.525 0.9356 34.525 rf
+41.1642 42.525 0.9356 34.525 rf
+43.9709 42.525 0.9356 34.525 rf
+48.6486 42.525 0.9356 34.525 rf
+50.5197 42.525 0.9356 34.525 rf
+%/Helvetica findfont 8.0 scalefont setfont
+%(4) 3.2744 1.6 ct
+%/Helvetica findfont 8.0 scalefont setfont
+%(194586) 13.0977 50.5197 1.6 jt
+52.3908 42.525 0.9356 38.525 rf
+54.2619 42.525 0.9356 38.525 rf
+56.133 42.525 0.9356 34.525 rf
+59.8752 42.525 0.9356 34.525 rf
+62.6818 42.525 2.8066 34.525 rf
+67.3596 42.525 0.9356 34.525 rf
+69.2307 42.525 0.9356 34.525 rf
+72.0373 42.525 2.8066 34.525 rf
+75.7795 42.525 0.9356 34.525 rf
+78.5862 42.525 2.8066 34.525 rf
+82.3284 42.525 2.8066 34.525 rf
+87.0061 42.525 0.9356 34.525 rf
+88.8772 42.525 0.9356 34.525 rf
+90.7483 42.525 0.9356 34.525 rf
+%/Helvetica findfont 8.0 scalefont setfont
+%(705506) 57.0685 94.4905 1.6 jt
+95.4261 42.525 0.9356 38.525 rf
+97.2972 42.525 0.9356 38.525 rf
+107.5882 34.525 0.9356 30.525 rf
+109.4593 34.525 1.8711 30.525 rf
+112.266 34.525 0.9356 30.525 rf
+115.0726 34.525 2.8066 30.525 rf
+118.8148 34.525 0.9356 30.525 rf
+120.6859 34.525 0.9356 30.525 rf
+122.557 34.525 3.7422 30.525 rf
+%/Helvetica findfont 8.0 scalefont setfont
+%(06) 116.9437 36.125 ct
+%%EOF
Copied: trunk/foray/foray-graphic/src/test/resources/gif/listgeometry.gif (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/listgeometry.gif)
===================================================================
(Binary files differ)
Copied: trunk/foray/foray-graphic/src/test/resources/gif/page.gif (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/page.gif)
===================================================================
(Binary files differ)
Copied: trunk/foray/foray-graphic/src/test/resources/gif/xml_feather.gif (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/xml_feather.gif)
===================================================================
(Binary files differ)
Copied: trunk/foray/foray-graphic/src/test/resources/gif/xml_feather_transparent.gif (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/xml_feather_transparent.gif)
===================================================================
(Binary files differ)
Copied: trunk/foray/foray-graphic/src/test/resources/jpg/jpeg-test1.jpg (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/jpeg-test1.jpg)
===================================================================
(Binary files differ)
Copied: trunk/foray/foray-graphic/src/test/resources/mathml/mathml-example-1.xml (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/mathml-example-1.xml)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/mathml/mathml-example-1.xml (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/mathml/mathml-example-1.xml 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE math
+ PUBLIC "-//W3C//DTD MathML 2.0//EN"
+ "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
+
+<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <munderover>
+ <mo>∫</mo>
+ <mn>1</mn>
+ <mi>x</mi>
+ </munderover>
+ <mfrac>
+ <mi>dt</mi>
+ <mi>t</mi>
+ </mfrac>
+ </mrow>
+</math>
Copied: trunk/foray/foray-graphic/src/test/resources/pdf/01_telephone_inv.pdf (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/01_telephone_inv.pdf)
===================================================================
(Binary files differ)
Copied: trunk/foray/foray-graphic/src/test/resources/png/png-test1.png (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/png-test1.png)
===================================================================
(Binary files differ)
Copied: trunk/foray/foray-graphic/src/test/resources/readme.txt (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/readme.txt)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/readme.txt (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/readme.txt 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,39 @@
+readme.txt for FOray example graphics files
+===========================================
+
+The purpose of this file is to document the source of the graphics files
+in this directory, where known. All items in FOray's repository must be
+unencumbered by legal claims, and it is hoped that documenting the source
+of these files will ensure that images in this directory will remain in
+that state.
+
+1. The file jpeg-test1.jpg was created by Victor Mote on Feb 5, 2005,
+using Adobe Photoshop.
+
+2. The file 29_coffeeshop_inv.ps (An EPS file) was downloaded by Victor
+Mote on Feb 5, 2005, from the following URL:
+http://www.aiga.org/Resources/SymbolSigns/eps/29_coffeeshop_inv.eps
+The following URL contained a link to the above URL:
+http://www.aiga.org/content.cfm?ContentAlias=symbolsigns
+and contained the following text:
+"The complete set of 50 passenger/pedestrian symbols developed by AIGA
+is now available on the web, free of charge. Signs are available in EPS
+and GIF formats."
+and the following:
+"These copyright-free symbols have become the standard for off-the-shelf
+symbols in the catalogues of U.S. sign companies."
+
+3. The file 01_telephone_inv.eps was downloaded by Victor Mote on Aug
+8, 2007 from the following URL:
+http://www.aiga.org/Resources/SymbolSigns/eps/01_telephone_inv.eps
+The following URL contained a ling to the above URL:
+http://www.aiga.org/content.cfm/symbol-signs
+which contained the same text noted above for 29_coffeeshop.
+
+4. The file 01_telephone_inv.pdf was distilled from 01_telephone_inv.eps
+by Victor Mote on Aug 8, 2007, using Acrobat Distiller 6.0.
+
+5. The file barcode1.eps was contributed by Jeremias Maerki on Feb 6, 2005,
+being created by his Krysalis software.
+
+----- Last line of file -----
Copied: trunk/foray/foray-graphic/src/test/resources/svg/boxes.svg (from rev 13665, trunk/foray/src/dist/resource/fo-examples/svg/boxes.svg)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/svg/boxes.svg (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/svg/boxes.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="no"?>
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="20" height="20" xml:space="preserve">
+ <g style="fill:red; stroke:#000000">
+ <rect x="0" y="0" width="15" height="15"/>
+ <rect x="5" y="5" width="15" height="15"/>
+ </g>
+</svg>
+
Copied: trunk/foray/foray-graphic/src/test/resources/svg/font-embed.svg (from rev 13665, trunk/foray/src/dist/resource/fo-examples/svg/font-embed.svg)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/svg/font-embed.svg (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/svg/font-embed.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<!--
+ This document tests the ability to handle a font that is embedded directly
+ in the SVG content. The font chosen is called "Saturn" and was chosen
+ primarily because it is in the public domain and because it is not likely to
+ be confused with another typeface. Specifically, each glyph in the font looks
+ like it is painted onto the planet Saturn. This font was downloaded on June
+ 11, 2007 from this URL:
+ http://www.geocities.com/CapeCanaveral/9178/saturn__.zip
+
+ The link to the font was found here:
+ http://www.geocities.com/CapeCanaveral/9178/fonts.html
+
+ This page includes the following text, near the top of the page: "I made up
+ all these fonts, and all of them are public domain. Enjoy."
+
+ Only the glyphs needed by this document were included in the embedded font.
+-->
+
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="150" height="50">
+
+<style type="text/css">
+ <![CDATA[
+@font-face{font-family:'Saturn';src:url("data:;base64,\
+T1RUTwACACAAAQAAQ0ZGIA1bsEAAAAAsAAALE2NtYXD/pwCYAAALQAAAACwBAAQCAAEBAQdTYXR1\
+cm4AAQEBM/gbDAD4GASL+2IcCXIcCE4FHqAAQHFmEf+Lix6gAEBxZhH/i4sMB+0PjBDxEZMcCwsS\
+AAEBARZ3YTJpc2UgIFB1YmxpYyBEb21haW4AAAEAQgIABAIAAQAcA4AHEwqZIPcuFhwITvotHPey\
+B/2U9y4V+PocBxr8+gYOHATxHAhNFfd/91ky+0X3Mx/3Lfs/2Pth+4Ia+4I++2H7Lfs/HvtF+zP7\
+WTL7fxv7gPtZ5PdF+zMf+y33Pz73YPeDGveB2Pdh9y73Px73Rvc091nk934b/L37eBWBkgWJjIqM\
+jBqNjJCMkhuHioWJhB6Ig4qGiRqMioyMjY2Ojhl+fgWGhImGhB+Gg4WJhhuBioaIih6KjImNiYwI\
+iIqKhoIacX55aB9/fQV+Bn5+BYiMiY2KHoyOjY6OH46Ojo2MG4yKjIqJGoSDjZCBH4+Ag42EG2QG\
+Ump+RwWJioqKiRqEknyYcx6WeJB9gxqFiIiGHphwBaUGhISDbIFUCIJYhml6Gl6fa7oFhoCVn3sf\
+n3qBlYYbk4eUg5Qefpp9mAV6g5SdH2ieeqGlGoB+mKZ9H3uqfp2CkIWkfax1tAiAn4akqhqtkbOY\
+uh6YBqiwtZ3DieyI9wpq9x9KwnG4d65+CBwFOP4ZFYR1hXiIeoqIi4iKiAiLB46NmY6iHn87BX1j\
+fgaGiIKEfR6EfYeAioOThJeBnH0Im32TgYUasj+UX4NwhH2EihmEineNaZJUjxiWeneQdhterQWB\
+B36bf34Fh4qFiYQeiIOKhogaiweNjI2Njo5+fRh+Bn5+BXmCgnoegoqFiYoeiYyJjYmMCImKioaC\
+GmZ5gXcfq3uid6h9BaSYg3wfxW2lfqOAooIZmYadg6KC9wVxGKR9sYK9iL6ItZOroKqfGKLiBfcA\
+bOBNyR6AuGa+TcZ4mICXiJSQiJSCmHx+qHWhbpsIkYSWfZoemn2BkoUbfqAFgpmHlpIaHPrO+xcV\
+ioaKhocafJOAnIUeg6Keh5sblJOYm54emp2TmZQalgbU38/CyqUIosLilvcKG4KRf5Z8HnyWlIOU\
+G1yqVMlNHpYGc56nf7IblJWMjJUfksC6j7MbkIeThJYeg5aHkpAag4aMjYofjI2NjYyNCI2KhoyE\
+G5KHlISWHn+ePd9G9wBQ9xgZadpY9wpH9zIIkn+ecqseqnJ8m4YbhX+IgYMaiIuJjB6NjI6PjpEI\
+iIeHhIYfg4aEh4Ebf2gF+8H79fsr+5n7Phr4e/jGFZZzBVEHk4+KiYwfiIUFiYyQipMbdJYHmnyT\
+aFQa+2R/lqIFmJeVn5UfnpSXlZkbstqevqEaDhwIAPp4FYR1hXiIeoqIi4iKiAiLB46NmY6iHn87\
+BX1jfgaGiIKEfR6EfYeAioOThJeBnH0Im32TgYUasj+UX4NwhH2EihmEineNaZJUjxiWeneQdhte\
+rQWBB36bf34Fh4qFiYQeiIOKhogaiweNjI2Njo5+fRh+Bn5+BXmCgnoegoqFiYoeiYyJjYmMCImK\
+ioaCGmZ5gXcfq3uid6h9BaSYg3wfxW2lfqOAooIZmYadg6KC9wVxGKR9sYK9iL6ItZOroKqfGKLi\
+BfcAbOBNyR6AuGa+TcZ4mICXiJSQiJSCmHx+qHWhbpsIkYSWfZoemn2BkoUbfqAFgpmHlpIaHPrI\
++hkVgZIFiYyKjIwajYyQjJIbh4qFiYQeiIOKhokajIqMjI2Njo4Zfn4FhoSJhoQfhoOFiYYbgYqG\
+iIoeioyJjYmMCIiKioaCGnF+eWgff30FfgZ+fgWIjImNih6Mjo2Ojh+Ojo6NjBuMioyKiRqEg42Q\
+gR+PgIONhBtkBlJqfkcFiYqKiokahJJ8mHMelniQfYMahYiIhh6YcAWlBoSEg2yBVAiCWIZpehpe\
+n2u6BYaAlZ97H596gZWGG5OHlIOUHn6afZgFeoOUnR9onnqhpRqAfpimfR97qn6dgpCFpH2sdbQI\
+gJ+GpKoarZGzmLoemAaosLWdw4nsiPcKavcfSsJxuHeufgj4vfd4Ffd/91ky+0X3Mx/3Lfs/2Pth\
++4Ia+4I++2H7Lfs/HvtF+zP7WTL7fxv7gPtZ5PdF+zMf+y33Pz73YPeDGveB2Pdh9y73Px73Rvc0\
+91nk934b+8P8HhUqffskcPtUHnD7VH37JCoa+MGABZKfpLO0HrO0oaqQnpa5ibp8vGP3EhiBe5We\
+dR91noCZlBp8do+Tbx+Sb3aPfBulcXSYdhuBgYeDgR+Gh4iIiBqJjIyKjhuYrpahwh/grbawshqS\
+ipGKjx58uIS+xBpOQpGWNx+SWliOVhtwcYqJcB/3KiIVxZYFgAeDk6qHwRuHj4OTfh6Sfo9/ghp8\
+g390H3+ABXx0iYdsH4dsc4l8G4D7chWIjImMHo2MjY2NjQiNioyHhBqSlImHmB+HmJSJkhuAuX8H\
+joiXiKCICJqJkoJ8GpCTh4SWH4OWkoeQG3uTg5oeln8Ff4l6iHQeh3SJeX8abHyDfB9vYoN8Vh97\
+VmKDbxuckaWXrB6WrJGlnBqWlpClirMIibuKqJUaDvlcHAdpFYGSBYmMioyMGo2MkIySG4eKhYmE\
+HoiDioaJGoyKjIyNjY6OGX5+BYaEiYaEH4aDhYmGG4GKhoiKHoqMiY2JjAiIioqGghpxfnloH399\
+BX4Gfn4FiIyJjYoejI6Njo4fjo6OjYwbjIqMiokahIONkIEfj4CDjYQbZAZSan5HBYmKioqJGoSS\
+fJhzHpZ4kH2DGoWIiIYemHAFpQaEhINsgVQIgliGaXoaXp9rugWGgJWfex+feoGVhhuTh5SDlB5+\
+mn2YBXqDlJ0faJ56oaUagH6Ypn0fe6p+nYKQhaR9rHW0CICfhqSqGq2Rs5i6HpgGqLC1ncOJ7Ij3\
+Cmr3H0rCcbh3rn4IHAU4/hkVhHWFeIh6ioiLiIqICIsHjo2ZjqIefzsFfWN+BoaIgoR9HoR9h4CK\
+g5OEl4GcfQibfZOBhRqyP5Rfg3CEfYSKGYSKd41pklSPGJZ6d5B2G16tBYEHfpt/fgWHioWJhB6I\
+g4qGiBqLB42MjY2Ojn59GH4Gfn4FeYKCeh6CioWJih6JjImNiYwIiYqKhoIaZnmBdx+re6J3qH0F\
+pJiDfB/FbaV+o4CighmZhp2DooL3BXEYpH2xgr2Ivoi1k6ugqp8YouIF9wBs4E3JHoC4Zr5NxniY\
+gJeIlJCIlIKYfH6odaFumwiRhJZ9mh6afYGShRt+oAWCmYeWkhr87PktFWx8k5ofkIaOh4yICIqK\
+i4uKG4eBj5R7H5KKkImMHomKiYmJigiJjIqQkxpoBqptappmG3Bvg3ttH2VETXhXGy77Kl37X/uT\
+GpCSg3uUH5R7j4CEGpd/BZSbgHSiH6F0lnuCGpinfnG3H7dwoXmCGveqBpKMkI2MHoyKjYmNigiN\
+jIyQkxq6ogWjB6KiBZYGuukFlgaMj4yOjhqYgpR5kh51lICVlxpvY4N8Vh97VmKDbxsuo4B/dN0F\
+fwaGlImdjKSMpImdhpUIgAaGkoiVlxqakJ+VpB61nJygnBuPjZGPkx6Oko2RjxqXlwWWlpeXBpeX\
+BaKXBrGQyZThmLCRqpWjmQiWkpGTlRqVhZeAmB5/BpGHlIKYHpeChJGGG5GNkI+QHvtG+GwV93/3\
+WTL7RfczH/ct+z/Y+2H7ghr7gj77Yfst+z8e+0X7M/tZMvt/G/uA+1nk90X7Mx/7Lfc/Pvdg94Ma\
+94HY92H3Lvc/HvdG9zT3WeT3fhsOHAkTFBwFNxUAAAAAAQAAAAMAAAAMAAQAIAAAAAQABAABAAAA\
+Y///AAAAYf///6AAAQAAAAA=")}
+ ]]>
+ </style>
+
+<text x="20" y="40" font-family="Saturn" font-size="36">abc</text>
+
+</svg>
Copied: trunk/foray/foray-graphic/src/test/resources/svg/multi.svg (from rev 13665, trunk/foray/src/dist/resource/fo-examples/svg/multi.svg)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/svg/multi.svg (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/svg/multi.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,18 @@
+<?xml version="1.0" standalone="no"?>
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="60" height="40" xml:space="preserve">
+ <g style="fill:none;stroke:yellow">
+ <rect x="0" y="0" width="25" height="25"/>
+ <image xlink:href="file:boxes.svg" x="10" y="10" width="20" height="20"/>
+ </g>
+ <g>
+ <use xlink:href="file:ref.svg#App" transform="scale(1.5)" x="12" y="25"/>
+ </g>
+</svg>
+
Copied: trunk/foray/foray-graphic/src/test/resources/svg/ref.svg (from rev 13665, trunk/foray/src/dist/resource/fo-examples/svg/ref.svg)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/svg/ref.svg (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/svg/ref.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,13 @@
+<?xml version="1.0" standalone="no"?>
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="20" height="20" xml:space="preserve">
+ <g id="App">
+ <text x="0" y="0" style="fill:black;font-weight:bold;font-size:14"><tspan style="fill:red">F</tspan><tspan style="fill:purple">O</tspan><tspan style="fill:blue">P</tspan></text>
+ </g>
+</svg>
+
Copied: trunk/foray/foray-graphic/src/test/resources/svg/text-001.svg (from rev 13665, trunk/foray/src/dist/resource/fo-examples/svg/text-001.svg)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/svg/text-001.svg (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/svg/text-001.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<!--
+ This document tests the ability of writing some simple text.
+-->
+
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="200" height="50">
+
+<rect x="0" y="0" width="200" height="50" fill="maroon"/>
+<text x="20" y="40" font-family="serif" font-size="36" fill="white">Some Text</text>
+
+</svg>
Copied: trunk/foray/foray-graphic/src/test/resources/svg/view.svg (from rev 13665, trunk/foray/src/dist/resource/fo-examples/svg/view.svg)
===================================================================
--- trunk/foray/foray-graphic/src/test/resources/svg/view.svg (rev 0)
+++ trunk/foray/foray-graphic/src/test/resources/svg/view.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="no"?>
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 10 10" width="20" height="20" xml:space="preserve">
+ <g style="fill:red; stroke:#000000">
+ <rect x="0" y="0" width="15" height="15"/>
+ <rect x="5" y="5" width="15" height="15"/>
+ </g>
+</svg>
+
Copied: trunk/foray/foray-graphic/src/test/resources/tif/xml_fax.tif (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/xml_fax.tif)
===================================================================
(Binary files differ)
Modified: trunk/foray/src/dist/resource/fo-examples/basic/graphics.fo
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/basic/graphics.fo 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/src/dist/resource/fo-examples/basic/graphics.fo 2025-05-16 16:34:17 UTC (rev 13669)
@@ -33,7 +33,7 @@
space-before="2em"
space-after="2em">A GIF image</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/xml_feather.gif')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/gif/xml_feather.gif')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -49,7 +49,7 @@
space-before="2em"
space-after="2em">A transparent GIF image</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/xml_feather_transparent.gif')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/gif/xml_feather_transparent.gif')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -66,7 +66,7 @@
space-before="2em"
space-after="2em">A JPEG image</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/jpeg-test1.jpg')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/jpg/jpeg-test1.jpg')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -100,7 +100,7 @@
space-before="2em"
space-after="2em">A PNG image</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/png-test1.png')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/png/png-test1.png')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -117,7 +117,7 @@
space-before="2em"
space-after="2em">A TIFF image</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/xml_fax.tif')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/tif/xml_fax.tif')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -134,7 +134,7 @@
space-before="2em"
space-after="2em">An EPS graphic (Bar Code)</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/barcode1.eps')"
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/eps/barcode1.eps')"
content-height="2in"/>
</fo:block>
</fo:flow>
@@ -152,7 +152,7 @@
space-before="2em"
space-after="2em">An EPS graphic (Coffee Shop Symbol)</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/29_coffeeshop_inv.ps')"
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/eps/29_coffeeshop_inv.ps')"
content-height="2in"/>
</fo:block>
</fo:flow>
@@ -170,7 +170,7 @@
space-before="2em"
space-after="2em">An Embedded PDF</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/01_telephone_inv.pdf')"
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/pdf/01_telephone_inv.pdf')"
content-height="2in"/>
</fo:block>
</fo:flow>
@@ -188,7 +188,7 @@
space-before="2em"
space-after="2em">An external-graphic SVG graphic</fo:block>
<fo:block>
- <fo:external-graphic src="url('../svg/boxes.svg')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/svg/boxes.svg')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -205,7 +205,7 @@
space-before="2em"
space-after="2em">An exernal-graphic SVG graphic with Text</fo:block>
<fo:block>
- <fo:external-graphic src="url('../svg/text-001.svg')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/svg/text-001.svg')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -225,7 +225,7 @@
chosen primarily because it is in the public domain and because it is not likely to be confused with another typeface.
Specifically, each glyph in the font looks like it is painted onto the planet Saturn.</fo:block>
<fo:block>
- <fo:external-graphic src="url('../svg/font-embed.svg')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/svg/font-embed.svg')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -319,7 +319,7 @@
space-after="2em">MathML Examples</fo:block>
<fo:block>The following is from an external-graphic:</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/mathml-example-1.xml')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/mathml/mathml-example-1.xml')"/>
</fo:block>
<fo:block>This formula in this paragraph is from an fo:instream-foreign-object. In other words, the formula is
embedded in this document.
Deleted: trunk/foray/src/dist/resource/fo-examples/svg/boxes.svg
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/svg/boxes.svg 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/src/dist/resource/fo-examples/svg/boxes.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -1,14 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<svg
- xmlns="http://www.w3.org/2000/svg"
- width="20" height="20" xml:space="preserve">
- <g style="fill:red; stroke:#000000">
- <rect x="0" y="0" width="15" height="15"/>
- <rect x="5" y="5" width="15" height="15"/>
- </g>
-</svg>
-
Modified: trunk/foray/src/dist/resource/fo-examples/svg/external.fo
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/svg/external.fo 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/src/dist/resource/fo-examples/svg/external.fo 2025-05-16 16:34:17 UTC (rev 13669)
@@ -61,13 +61,13 @@
</fo:block>
<fo:block>
-<fo:external-graphic src="url(boxes.svg)"/>
+<fo:external-graphic src="url(../../../../../foray-graphic/src/test/resources/svg/boxes.svg)"/>
</fo:block>
<fo:block>
-This svg document (<fo:external-graphic src="url(multi.svg)"/>) is also obtained from
-an external file using the fo:external-graphic. It has another svg image inside and references
-part of another svg image.
+This svg document (<fo:external-graphic src="url(../../../../../foray-graphic/src/test/resources/svg/multi.svg)"/>)
+is also obtained from an external file using the fo:external-graphic.
+It has another svg image inside and references part of another svg image.
</fo:block>
<fo:block>
@@ -122,7 +122,7 @@
<fo:block space-before.optimum="10pt">
This example is an svg from an external image:
-<fo:external-graphic src="url(view.svg)"/>
+<fo:external-graphic src="url(../../../../../foray-graphic/src/test/resources/svg/view.svg)"/>
it has a viewbox that resizes the contents.
</fo:block>
Deleted: trunk/foray/src/dist/resource/fo-examples/svg/font-embed.svg
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/svg/font-embed.svg 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/src/dist/resource/fo-examples/svg/font-embed.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<!--
- This document tests the ability to handle a font that is embedded directly
- in the SVG content. The font chosen is called "Saturn" and was chosen
- primarily because it is in the public domain and because it is not likely to
- be confused with another typeface. Specifically, each glyph in the font looks
- like it is painted onto the planet Saturn. This font was downloaded on June
- 11, 2007 from this URL:
- http://www.geocities.com/CapeCanaveral/9178/saturn__.zip
-
- The link to the font was found here:
- http://www.geocities.com/CapeCanaveral/9178/fonts.html
-
- This page includes the following text, near the top of the page: "I made up
- all these fonts, and all of them are public domain. Enjoy."
-
- Only the glyphs needed by this document were included in the embedded font.
--->
-
-<svg
- xmlns="http://www.w3.org/2000/svg"
- width="150" height="50">
-
-<style type="text/css">
- <![CDATA[
-@font-face{font-family:'Saturn';src:url("data:;base64,\
-T1RUTwACACAAAQAAQ0ZGIA1bsEAAAAAsAAALE2NtYXD/pwCYAAALQAAAACwBAAQCAAEBAQdTYXR1\
-cm4AAQEBM/gbDAD4GASL+2IcCXIcCE4FHqAAQHFmEf+Lix6gAEBxZhH/i4sMB+0PjBDxEZMcCwsS\
-AAEBARZ3YTJpc2UgIFB1YmxpYyBEb21haW4AAAEAQgIABAIAAQAcA4AHEwqZIPcuFhwITvotHPey\
-B/2U9y4V+PocBxr8+gYOHATxHAhNFfd/91ky+0X3Mx/3Lfs/2Pth+4Ia+4I++2H7Lfs/HvtF+zP7\
-WTL7fxv7gPtZ5PdF+zMf+y33Pz73YPeDGveB2Pdh9y73Px73Rvc091nk934b/L37eBWBkgWJjIqM\
-jBqNjJCMkhuHioWJhB6Ig4qGiRqMioyMjY2Ojhl+fgWGhImGhB+Gg4WJhhuBioaIih6KjImNiYwI\
-iIqKhoIacX55aB9/fQV+Bn5+BYiMiY2KHoyOjY6OH46Ojo2MG4yKjIqJGoSDjZCBH4+Ag42EG2QG\
-Ump+RwWJioqKiRqEknyYcx6WeJB9gxqFiIiGHphwBaUGhISDbIFUCIJYhml6Gl6fa7oFhoCVn3sf\
-n3qBlYYbk4eUg5Qefpp9mAV6g5SdH2ieeqGlGoB+mKZ9H3uqfp2CkIWkfax1tAiAn4akqhqtkbOY\
-uh6YBqiwtZ3DieyI9wpq9x9KwnG4d65+CBwFOP4ZFYR1hXiIeoqIi4iKiAiLB46NmY6iHn87BX1j\
-fgaGiIKEfR6EfYeAioOThJeBnH0Im32TgYUasj+UX4NwhH2EihmEineNaZJUjxiWeneQdhterQWB\
-B36bf34Fh4qFiYQeiIOKhogaiweNjI2Njo5+fRh+Bn5+BXmCgnoegoqFiYoeiYyJjYmMCImKioaC\
-GmZ5gXcfq3uid6h9BaSYg3wfxW2lfqOAooIZmYadg6KC9wVxGKR9sYK9iL6ItZOroKqfGKLiBfcA\
-bOBNyR6AuGa+TcZ4mICXiJSQiJSCmHx+qHWhbpsIkYSWfZoemn2BkoUbfqAFgpmHlpIaHPrO+xcV\
-ioaKhocafJOAnIUeg6Keh5sblJOYm54emp2TmZQalgbU38/CyqUIosLilvcKG4KRf5Z8HnyWlIOU\
-G1yqVMlNHpYGc56nf7IblJWMjJUfksC6j7MbkIeThJYeg5aHkpAag4aMjYofjI2NjYyNCI2KhoyE\
-G5KHlISWHn+ePd9G9wBQ9xgZadpY9wpH9zIIkn+ecqseqnJ8m4YbhX+IgYMaiIuJjB6NjI6PjpEI\
-iIeHhIYfg4aEh4Ebf2gF+8H79fsr+5n7Phr4e/jGFZZzBVEHk4+KiYwfiIUFiYyQipMbdJYHmnyT\
-aFQa+2R/lqIFmJeVn5UfnpSXlZkbstqevqEaDhwIAPp4FYR1hXiIeoqIi4iKiAiLB46NmY6iHn87\
-BX1jfgaGiIKEfR6EfYeAioOThJeBnH0Im32TgYUasj+UX4NwhH2EihmEineNaZJUjxiWeneQdhte\
-rQWBB36bf34Fh4qFiYQeiIOKhogaiweNjI2Njo5+fRh+Bn5+BXmCgnoegoqFiYoeiYyJjYmMCImK\
-ioaCGmZ5gXcfq3uid6h9BaSYg3wfxW2lfqOAooIZmYadg6KC9wVxGKR9sYK9iL6ItZOroKqfGKLi\
-BfcAbOBNyR6AuGa+TcZ4mICXiJSQiJSCmHx+qHWhbpsIkYSWfZoemn2BkoUbfqAFgpmHlpIaHPrI\
-+hkVgZIFiYyKjIwajYyQjJIbh4qFiYQeiIOKhokajIqMjI2Njo4Zfn4FhoSJhoQfhoOFiYYbgYqG\
-iIoeioyJjYmMCIiKioaCGnF+eWgff30FfgZ+fgWIjImNih6Mjo2Ojh+Ojo6NjBuMioyKiRqEg42Q\
-gR+PgIONhBtkBlJqfkcFiYqKiokahJJ8mHMelniQfYMahYiIhh6YcAWlBoSEg2yBVAiCWIZpehpe\
-n2u6BYaAlZ97H596gZWGG5OHlIOUHn6afZgFeoOUnR9onnqhpRqAfpimfR97qn6dgpCFpH2sdbQI\
-gJ+GpKoarZGzmLoemAaosLWdw4nsiPcKavcfSsJxuHeufgj4vfd4Ffd/91ky+0X3Mx/3Lfs/2Pth\
-+4Ia+4I++2H7Lfs/HvtF+zP7WTL7fxv7gPtZ5PdF+zMf+y33Pz73YPeDGveB2Pdh9y73Px73Rvc0\
-91nk934b+8P8HhUqffskcPtUHnD7VH37JCoa+MGABZKfpLO0HrO0oaqQnpa5ibp8vGP3EhiBe5We\
-dR91noCZlBp8do+Tbx+Sb3aPfBulcXSYdhuBgYeDgR+Gh4iIiBqJjIyKjhuYrpahwh/grbawshqS\
-ipGKjx58uIS+xBpOQpGWNx+SWliOVhtwcYqJcB/3KiIVxZYFgAeDk6qHwRuHj4OTfh6Sfo9/ghp8\
-g390H3+ABXx0iYdsH4dsc4l8G4D7chWIjImMHo2MjY2NjQiNioyHhBqSlImHmB+HmJSJkhuAuX8H\
-joiXiKCICJqJkoJ8GpCTh4SWH4OWkoeQG3uTg5oeln8Ff4l6iHQeh3SJeX8abHyDfB9vYoN8Vh97\
-VmKDbxuckaWXrB6WrJGlnBqWlpClirMIibuKqJUaDvlcHAdpFYGSBYmMioyMGo2MkIySG4eKhYmE\
-HoiDioaJGoyKjIyNjY6OGX5+BYaEiYaEH4aDhYmGG4GKhoiKHoqMiY2JjAiIioqGghpxfnloH399\
-BX4Gfn4FiIyJjYoejI6Njo4fjo6OjYwbjIqMiokahIONkIEfj4CDjYQbZAZSan5HBYmKioqJGoSS\
-fJhzHpZ4kH2DGoWIiIYemHAFpQaEhINsgVQIgliGaXoaXp9rugWGgJWfex+feoGVhhuTh5SDlB5+\
-mn2YBXqDlJ0faJ56oaUagH6Ypn0fe6p+nYKQhaR9rHW0CICfhqSqGq2Rs5i6HpgGqLC1ncOJ7Ij3\
-Cmr3H0rCcbh3rn4IHAU4/hkVhHWFeIh6ioiLiIqICIsHjo2ZjqIefzsFfWN+BoaIgoR9HoR9h4CK\
-g5OEl4GcfQibfZOBhRqyP5Rfg3CEfYSKGYSKd41pklSPGJZ6d5B2G16tBYEHfpt/fgWHioWJhB6I\
-g4qGiBqLB42MjY2Ojn59GH4Gfn4FeYKCeh6CioWJih6JjImNiYwIiYqKhoIaZnmBdx+re6J3qH0F\
-pJiDfB/FbaV+o4CighmZhp2DooL3BXEYpH2xgr2Ivoi1k6ugqp8YouIF9wBs4E3JHoC4Zr5NxniY\
-gJeIlJCIlIKYfH6odaFumwiRhJZ9mh6afYGShRt+oAWCmYeWkhr87PktFWx8k5ofkIaOh4yICIqK\
-i4uKG4eBj5R7H5KKkImMHomKiYmJigiJjIqQkxpoBqptappmG3Bvg3ttH2VETXhXGy77Kl37X/uT\
-GpCSg3uUH5R7j4CEGpd/BZSbgHSiH6F0lnuCGpinfnG3H7dwoXmCGveqBpKMkI2MHoyKjYmNigiN\
-jIyQkxq6ogWjB6KiBZYGuukFlgaMj4yOjhqYgpR5kh51lICVlxpvY4N8Vh97VmKDbxsuo4B/dN0F\
-fwaGlImdjKSMpImdhpUIgAaGkoiVlxqakJ+VpB61nJygnBuPjZGPkx6Oko2RjxqXlwWWlpeXBpeX\
-BaKXBrGQyZThmLCRqpWjmQiWkpGTlRqVhZeAmB5/BpGHlIKYHpeChJGGG5GNkI+QHvtG+GwV93/3\
-WTL7RfczH/ct+z/Y+2H7ghr7gj77Yfst+z8e+0X7M/tZMvt/G/uA+1nk90X7Mx/7Lfc/Pvdg94Ma\
-94HY92H3Lvc/HvdG9zT3WeT3fhsOHAkTFBwFNxUAAAAAAQAAAAMAAAAMAAQAIAAAAAQABAABAAAA\
-Y///AAAAYf///6AAAQAAAAA=")}
- ]]>
- </style>
-
-<text x="20" y="40" font-family="Saturn" font-size="36">abc</text>
-
-</svg>
Deleted: trunk/foray/src/dist/resource/fo-examples/svg/multi.svg
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/svg/multi.svg 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/src/dist/resource/fo-examples/svg/multi.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -1,18 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<svg
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- width="60" height="40" xml:space="preserve">
- <g style="fill:none;stroke:yellow">
- <rect x="0" y="0" width="25" height="25"/>
- <image xlink:href="file:boxes.svg" x="10" y="10" width="20" height="20"/>
- </g>
- <g>
- <use xlink:href="file:ref.svg#App" transform="scale(1.5)" x="12" y="25"/>
- </g>
-</svg>
-
Deleted: trunk/foray/src/dist/resource/fo-examples/svg/ref.svg
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/svg/ref.svg 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/src/dist/resource/fo-examples/svg/ref.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -1,13 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<svg
- xmlns="http://www.w3.org/2000/svg"
- width="20" height="20" xml:space="preserve">
- <g id="App">
- <text x="0" y="0" style="fill:black;font-weight:bold;font-size:14"><tspan style="fill:red">F</tspan><tspan style="fill:purple">O</tspan><tspan style="fill:blue">P</tspan></text>
- </g>
-</svg>
-
Deleted: trunk/foray/src/dist/resource/fo-examples/svg/text-001.svg
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/svg/text-001.svg 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/src/dist/resource/fo-examples/svg/text-001.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<!--
- This document tests the ability of writing some simple text.
--->
-
-<svg
- xmlns="http://www.w3.org/2000/svg"
- width="200" height="50">
-
-<rect x="0" y="0" width="200" height="50" fill="maroon"/>
-<text x="20" y="40" font-family="serif" font-size="36" fill="white">Some Text</text>
-
-</svg>
Deleted: trunk/foray/src/dist/resource/fo-examples/svg/view.svg
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/svg/view.svg 2025-05-16 16:03:02 UTC (rev 13668)
+++ trunk/foray/src/dist/resource/fo-examples/svg/view.svg 2025-05-16 16:34:17 UTC (rev 13669)
@@ -1,14 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<svg
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 10 10" width="20" height="20" xml:space="preserve">
- <g style="fill:red; stroke:#000000">
- <rect x="0" y="0" width="15" height="15"/>
- <rect x="5" y="5" width="15" height="15"/>
- </g>
-</svg>
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-16 16:03:07
|
Revision: 13668
http://sourceforge.net/p/foray/code/13668
Author: victormote
Date: 2025-05-16 16:03:02 +0000 (Fri, 16 May 2025)
Log Message:
-----------
Move one graphic test file from dist resources to foray-graphic/src/test/resources.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/AbstractGraphicTests.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/BmpGraphicTests.java
trunk/foray/src/dist/resource/fo-examples/basic/graphics.fo
Added Paths:
-----------
trunk/foray/foray-graphic/src/test/resources/
trunk/foray/foray-graphic/src/test/resources/bmp/
trunk/foray/foray-graphic/src/test/resources/bmp/linux.bmp
Removed Paths:
-------------
trunk/foray/src/dist/resource/fo-examples/graphics/linux.bmp
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/AbstractGraphicTests.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/AbstractGraphicTests.java 2025-05-16 14:03:51 UTC (rev 13667)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/AbstractGraphicTests.java 2025-05-16 16:03:02 UTC (rev 13668)
@@ -61,7 +61,10 @@
final URL graphicsUrl = graphicsDirectory.toURL();
final URI svgDirectory = examplesDirectory.resolve("svg/");
final URL svgUrl = svgDirectory.toURL();
- this.baseURLs = Arrays.asList(graphicsUrl, svgUrl);
+ final URI sandboxDirectory = Environment.getSandbox().toURI();
+ final URI testResourcesDirectory = sandboxDirectory.resolve("foray-graphic/src/test/resources/");
+ final URL testResources = testResourcesDirectory.toURL();
+ this.baseURLs = Arrays.asList(graphicsUrl, svgUrl, testResources);
}
/**
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/BmpGraphicTests.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/BmpGraphicTests.java 2025-05-16 14:03:51 UTC (rev 13667)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/BmpGraphicTests.java 2025-05-16 16:03:02 UTC (rev 13668)
@@ -58,7 +58,7 @@
*/
@Test
public void testGraphic01() throws GraphicException, IOException, URISyntaxException {
- final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("linux.bmp"));
+ final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("bmp/linux.bmp"));
final Graphic4a graphic = this.getServer().procureGraphic(graphicUri.toURL(), false);
assertNotNull(graphic);
assertTrue(graphic instanceof BmpGraphic);
Copied: trunk/foray/foray-graphic/src/test/resources/bmp/linux.bmp (from rev 13665, trunk/foray/src/dist/resource/fo-examples/graphics/linux.bmp)
===================================================================
(Binary files differ)
Modified: trunk/foray/src/dist/resource/fo-examples/basic/graphics.fo
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/basic/graphics.fo 2025-05-16 14:03:51 UTC (rev 13667)
+++ trunk/foray/src/dist/resource/fo-examples/basic/graphics.fo 2025-05-16 16:03:02 UTC (rev 13668)
@@ -83,7 +83,7 @@
space-before="2em"
space-after="2em">A BMP image</fo:block>
<fo:block>
- <fo:external-graphic src="url('../graphics/linux.bmp')"/>
+ <fo:external-graphic src="url('../../../../../foray-graphic/src/test/resources/bmp/linux.bmp')"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
Deleted: trunk/foray/src/dist/resource/fo-examples/graphics/linux.bmp
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-16 14:03:54
|
Revision: 13667
http://sourceforge.net/p/foray/code/13667
Author: victormote
Date: 2025-05-16 14:03:51 +0000 (Fri, 16 May 2025)
Log Message:
-----------
Move BMP version enum to class Bmp.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java 2025-05-16 13:31:33 UTC (rev 13666)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java 2025-05-16 14:03:51 UTC (rev 13667)
@@ -37,6 +37,32 @@
*/
public final class Bmp {
+ /**
+ * Enumeration of the various versions of BMP files. There are both Windows and OS/2 versions of BMP files, with
+ * enough similarities between them to treat them as a single format. However, the version numbers between Windows
+ * and OS/2 are different.
+ */
+ public enum Version {
+
+ /** Windows BMP version 1. Device-Dependent Bitmap for Windows 1.x. */
+ WIN_1,
+
+ /** Windows BMP version 2. Used by Windows 2.x. Identical to OS/2 version 1, used by OS/2 1.x. */
+ WIN_2_AND_OS2_1,
+
+ /** Windows BMP version 3. Used by Windows 3.x. */
+ WIN_3_3_X,
+
+ /** Windows BMP version 3. Used by Windows NT. */
+ WIN_3_NT,
+
+ /** Windows BMP version 4. Used by Windows 95. */
+ WIN_4,
+
+ /** OS/2 BMP version 2. Used by OS/2 2.x.*/
+ OS2_2
+ }
+
/** The size, in bytes, of the file type marker at the beginning of a BMP file. */
public static final int FILE_TYPE_MARKER_SIZE = 2;
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java 2025-05-16 13:31:33 UTC (rev 13666)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java 2025-05-16 14:03:51 UTC (rev 13667)
@@ -42,28 +42,6 @@
*/
public class BmpGraphicParser1 extends GraphicParser<BmpGraphicHandler> {
- /**
- * Enumeration of the various versions of BMP files. There are both Windows ans OS/2 versions of BMP files, with
- * enough similarities between them to treat them as a single format. However, the version numbers are different.
- */
- public enum Version {
-
- /** Device-Dependent Bitmap for Windows 1.x. */
- v1,
-
- /** For Windows 2.x and OS/2 1.x (identical). */
- v2,
-
- /** For Windows 3.x. */
- v3_WINDOWS_3_1,
-
- /** For Windows NT. */
- v3_WINDOWS_NT,
-
- /** For Windows 95. */
- v4
- }
-
@Override
public void parse(final GraphicRandomAccessInput input, final BmpGraphicHandler handler)
throws IOException, GraphicException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-16 13:31:36
|
Revision: 13666
http://sourceforge.net/p/foray/code/13666
Author: victormote
Date: 2025-05-16 13:31:33 +0000 (Fri, 16 May 2025)
Log Message:
-----------
Switch BMP header parsing to parser/handler scheme.
Modified Paths:
--------------
trunk/foray/foray-00-dev/config/checkstyle/checkstyle-suppressions.xml
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java
trunk/foray/foray-graphic/src/test/java/org/foray/graphic/BmpGraphicTests.java
Added Paths:
-----------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/GraphicContentHandler.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/package-info.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicRandomAccessInput.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/package-info.java
Modified: trunk/foray/foray-00-dev/config/checkstyle/checkstyle-suppressions.xml
===================================================================
--- trunk/foray/foray-00-dev/config/checkstyle/checkstyle-suppressions.xml 2025-05-14 20:35:15 UTC (rev 13665)
+++ trunk/foray/foray-00-dev/config/checkstyle/checkstyle-suppressions.xml 2025-05-16 13:31:33 UTC (rev 13666)
@@ -41,5 +41,6 @@
<!-- Permanently suppress some checks in data transfer interfaces. -->
<suppress checks="LeftCurly" files="src.main.java.org.foray.fontParse.ttf.handler.*"/>
+ <suppress checks="LeftCurly" files="src.main.java.org.foray.graphic.handler.*"/>
</suppressions>
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2025-05-14 20:35:15 UTC (rev 13665)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/BmpGraphic.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -33,7 +33,9 @@
package org.foray.graphic;
-import org.foray.primitive.ByteUtils;
+import org.foray.graphic.handler.BmpGraphicHandler;
+import org.foray.graphic.parser.BmpGraphicParser1;
+import org.foray.graphic.parser.GraphicRandomAccessInput;
import org.foray.primitive.sequence.ByteArray;
import org.axsl.constants.PrimitiveConstants;
@@ -41,6 +43,8 @@
import org.axsl.graphic.GraphicException;
import org.axsl.primitive.sequence.ByteSequence;
+import org.checkerframework.checker.signedness.qual.Unsigned;
+
import java.awt.Color;
import java.awt.color.ColorSpace;
import java.io.BufferedInputStream;
@@ -52,18 +56,49 @@
*/
public class BmpGraphic extends BitmapGraphic4a {
- /** The length, in bytes, of the headermap. */
- private static final int HEADERMAP_LENGTH = 54;
+ /**
+ * Handles events from the parser.
+ */
+ private class Handler implements BmpGraphicHandler {
- /** The offset in the header at which the image width is found. */
- private static final byte WIDTH_OFFSET = 18;
+ /** The graphic being parsed. */
+ private BmpGraphic graphic;
- /** The offset in the header at which the image height is found. */
- private static final byte HEIGHT_OFFSET = 22;
+ /**
+ * Constructor.
+ * @param graphic The graphic being parsed.
+ */
+ Handler(final BmpGraphic graphic) {
+ this.graphic = graphic;
+ }
- /** The offset in the headermap at which the bit depth is found. */
- private static final byte BIT_DEPTH_OFFSET = 28;
+ @Override
+ public void bitmapOffset(final @Unsigned int value) {
+ graphic.bitmapOffset = value;
+ }
+ @Override
+ public void bitmapWidth(final @Unsigned int value) {
+ graphic.pixelWidth = value;
+ }
+
+ @Override
+ public void bitmapHeight(final @Unsigned int value) {
+ graphic.pixelHeight = value;
+ }
+
+ @Override
+ public void bitmapBitsPerPixel(final @Unsigned short value) {
+ graphic.bitsPerPixel = value;
+ graphic.setBitDepth(value);
+ }
+
+ @Override
+ public void colorPalette(final @Unsigned byte[] value) {
+ graphic.colorPalette = value;
+ }
+ }
+
/** Mask for bit 7. */
private static final byte BIT_7_MASK = (byte) 0x80;
@@ -73,19 +108,24 @@
/** Mask for bits 1 and 2. */
private static final byte BITS_1_AND_2_MASK = 0x03;
- /** The number of bytes that must be read for a row of pixels in this
- * image. */
- private int bytesPerRow = -1;
+ /** Offset to the image data. */
+ private int bitmapOffset;
- /** The color palette parsed from the input file. */
+ /** The number of bytes that must be read for a row of pixels in this image. */
+ private int bytesPerRow;
+
+ /** The color palette parsed from the input file. This will be null for 24-bit color images. */
private byte[] colorPalette;
/** Image width (in pixel). */
- private int pixelWidth = 0;
+ private int pixelWidth;
/** Image height (in pixel). */
- private int pixelHeight = 0;
+ private int pixelHeight;
+ /** The number of bits per pixel. Should be 1, 4, 8, or 24. */
+ private int bitsPerPixel;
+
/**
* Constructor.
* @param server The parent graphic server.
@@ -99,19 +139,27 @@
@Override
public void loadImage() throws GraphicException {
- final byte[] headermap = new byte[BmpGraphic.HEADERMAP_LENGTH];
+// final byte[] headermap = new byte[BmpGraphic.HEADERMAP_LENGTH];
+// try {
+// getInputStream().read(headermap);
+// } catch (final IOException e) {
+// loadImageError(e);
+// }
+//// int filepos = BmpGraphic.HEADERMAP_LENGTH;
+// setBitDepth(headermap[BmpGraphic.BIT_DEPTH_OFFSET]);
+ this.colorPalette = readPalette();
+// if (this.colorPalette != null) {
+//// filepos += this.colorPalette.length
+//// * getRawColorSpace().getNumComponents();
+// }
+
try {
- getInputStream().read(headermap);
+ getInputStream().skip(this.bitmapOffset);
} catch (final IOException e) {
- loadImageError(e);
+ throw new GraphicException(e);
}
-// int filepos = BmpGraphic.HEADERMAP_LENGTH;
- setBitDepth(headermap[BmpGraphic.BIT_DEPTH_OFFSET]);
- this.colorPalette = readPalette();
- if (this.colorPalette != null) {
-// filepos += this.colorPalette.length
-// * getRawColorSpace().getNumComponents();
- }
+
+
this.bytesPerRow = computeBytesPerRow();
// Should take care of the ColorSpace and bitsPerPixel
@@ -350,12 +398,13 @@
}
@Override
- public void parseBasics() throws IOException {
- final byte[] header = new byte[BmpGraphic.HEADERMAP_LENGTH];
+ public void parseBasics() throws IOException, GraphicException {
+ final byte[] header = new byte[maxBytesToParseBasics()];
getInputStream().read(header);
- /* Little endian format. */
- this.pixelWidth = (int) ByteUtils.unsignedBytesToLongLE(header, BmpGraphic.WIDTH_OFFSET);
- this.pixelHeight = (int) ByteUtils.unsignedBytesToLongLE(header, BmpGraphic.HEIGHT_OFFSET);
+ final GraphicRandomAccessInput input = new GraphicRandomAccessInput.Impl(header);
+ final BmpGraphicHandler handler = this.new Handler(this);
+ final BmpGraphicParser1 parser = new BmpGraphicParser1();
+ parser.parse(input, handler);
}
@Override
@@ -485,4 +534,20 @@
return this.pixelHeight;
}
+ /**
+ * Returns the color palette.
+ * @return The color palette.
+ */
+ public byte[] getColorPalette() {
+ return this.colorPalette;
+ }
+
+ /**
+ * Returns the bits per pixel.
+ * @return The bits per pixel.
+ */
+ public int getBitsPerPixel() {
+ return this.bitsPerPixel;
+ }
+
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2025-05-14 20:35:15 UTC (rev 13665)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/Graphic4a.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -227,8 +227,9 @@
* should be run are handled elsewhere.
* In short, this method does not need to address the details handled there.</p>
* @throws IOException For IO errors during reading of the file.
+ * @throws GraphicException For unsupported formats or features.
*/
- protected abstract void parseBasics() throws IOException;
+ protected abstract void parseBasics() throws IOException, GraphicException;
/**
* Tells {@link #parseBasicsWrapper()} how large to set the
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java 2025-05-14 20:35:15 UTC (rev 13665)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/factory/BmpFactory.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -30,11 +30,12 @@
import org.foray.graphic.BmpGraphic;
import org.foray.graphic.GraphicServer4a;
+import org.foray.graphic.format.Bmp;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.URL;
-import java.util.Arrays;
+import java.nio.charset.StandardCharsets;
/**
* ImageReader object for BMP image type.
@@ -59,14 +60,19 @@
}
@Override
- public BmpGraphic attemptCreate(final URL url,
- final BufferedInputStream bis) throws IOException {
- final byte[] header = new byte[BmpFactory.BMP_HEADER.length];
+ public BmpGraphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException {
+ final byte[] header = new byte[Bmp.FILE_TYPE_MARKER_SIZE];
bis.read(header);
+ final String fileType = new String(header, StandardCharsets.US_ASCII);
+
boolean supported = false;
- if (Arrays.equals(header, BmpFactory.BMP_HEADER)) {
- supported = true;
+ for (int index = 0; index < Bmp.FILE_TYPE_MARKERS.size(); index ++) {
+ if (Bmp.FILE_TYPE_MARKERS.get(index).equals(fileType)) {
+ supported = true;
+ break;
+ }
}
+
if (! supported) {
return null;
}
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+package org.foray.graphic.format;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * General characteristics of the BMP graphic file format.
+ */
+public final class Bmp {
+
+ /** The size, in bytes, of the file type marker at the beginning of a BMP file. */
+ public static final int FILE_TYPE_MARKER_SIZE = 2;
+
+ /** The Windows version 1 file type marker, expressed as a String. All BMP file types consist of 2 bytes, each a
+ * Latin character, except for Windowns version 1, which consists of 2 bytes, each 0x00. To make all of these
+ * easily expressible as a String, we here coerce the Windows version 1 marker into a String. */
+ public static final String WINDOWS_VERSION_1_FILE_TYPE_MARKER =
+ new String(new byte[] {0, 0}, StandardCharsets.US_ASCII);
+
+ /** The list of possible file markers (first two bytes) of BMP files. */
+ public static final List<String> FILE_TYPE_MARKERS = Collections.unmodifiableList(Arrays.asList(
+ WINDOWS_VERSION_1_FILE_TYPE_MARKER,
+ "BM", // Windows version 2 and higher, and OS/2 single bitmap, all versions
+ "BA", // OS/2 Bitmap Array
+ "IC", // OS/2 Icon
+ "CI", // OS/2 Color Icon
+ "PT", // OS/2 Pointer
+ "CP" // OS/2 Color Pointer
+ ));
+
+ /**
+ * Private constructor. This class should never be instantiated.
+ */
+ private Bmp() { }
+
+}
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/format/Bmp.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic.handler;
+
+import org.foray.graphic.parser.BmpGraphicParser1;
+
+import org.checkerframework.checker.signedness.qual.Unsigned;
+
+/**
+ * Implementations catch and handle the output from {@link BmpGraphicParser1}.
+ */
+public interface BmpGraphicHandler extends GraphicContentHandler {
+
+ default void fileType(final String value) { return; }
+ default void fileSize(final @Unsigned int value) { return; }
+ default void bitmapOffset(final @Unsigned int value) { return; }
+
+ default void bitmapHeaderSize(final @Unsigned int value) { return; }
+ default void bitmapWidth(final @Unsigned int value) { return; }
+ default void bitmapHeight(final @Unsigned int value) { return; }
+ default void bitmapPlanes(final @Unsigned short value) { return; }
+ default void bitmapBitsPerPixel(final @Unsigned short value) { return; }
+
+ default void numPaletteEntries(final @Unsigned int value) { return; }
+ default void blueComponent(final @Unsigned byte value) { return; }
+ default void greenComponent(final @Unsigned byte value) { return; }
+ default void redComponent(final @Unsigned byte value) { return; }
+ default void colorPalette(final @Unsigned byte[] value) { return; }
+}
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/BmpGraphicHandler.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/GraphicContentHandler.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/GraphicContentHandler.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/GraphicContentHandler.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic.handler;
+
+import org.foray.graphic.parser.GraphicParser;
+
+/**
+ * Implementations receive events from a {@link GraphicParser}.
+ * Analogous to the {@link org.xml.sax.ContentHandler SAX ContentHandler}.
+ */
+public interface GraphicContentHandler {
+
+}
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/GraphicContentHandler.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/package-info.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/package-info.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/package-info.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+/**
+ * Handler classes for the Graphic Parsers.
+ */
+package org.foray.graphic.handler;
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/handler/package-info.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic.parser;
+
+import org.foray.graphic.handler.BmpGraphicHandler;
+
+import org.axsl.constants.PrimitiveConstants;
+import org.axsl.graphic.GraphicException;
+
+import org.checkerframework.checker.signedness.qual.Unsigned;
+
+import java.io.IOException;
+
+/**
+ * Parses a BMP image.
+ */
+public class BmpGraphicParser1 extends GraphicParser<BmpGraphicHandler> {
+
+ /**
+ * Enumeration of the various versions of BMP files. There are both Windows ans OS/2 versions of BMP files, with
+ * enough similarities between them to treat them as a single format. However, the version numbers are different.
+ */
+ public enum Version {
+
+ /** Device-Dependent Bitmap for Windows 1.x. */
+ v1,
+
+ /** For Windows 2.x and OS/2 1.x (identical). */
+ v2,
+
+ /** For Windows 3.x. */
+ v3_WINDOWS_3_1,
+
+ /** For Windows NT. */
+ v3_WINDOWS_NT,
+
+ /** For Windows 95. */
+ v4
+ }
+
+ @Override
+ public void parse(final GraphicRandomAccessInput input, final BmpGraphicHandler handler)
+ throws IOException, GraphicException {
+ input.seek(0);
+
+ /* *** BMP is little-endian, so we reverse the bytes on numeric values. *** */
+
+ /* File Header. */
+ final String fileType = input.readStringASCII(2); // 2 bytes, total 2
+ handler.fileType(fileType);
+ if ("BA".equals(fileType)) {
+ throw new GraphicException("OS/2 Bitmap Arrays are not currently supported");
+ }
+ handler.fileSize(Integer.reverseBytes(input.read_DWORD())); // 4 bytes, total 6
+ /* Skip Reserved1 and Reserved2. */
+ input.read_WORD(); // 2 bytes, total 8
+ input.read_WORD(); // 2 bytes, total 10
+ final @Unsigned int bitmapOffset = Integer.reverseBytes(input.read_DWORD()); // 4 bytes, total 14
+ handler.bitmapOffset(bitmapOffset);
+
+
+ /* Bitmap Header. */ // *** Restart Count ***
+ final @Unsigned int bitmapHeaderSize = Integer.reverseBytes(input.read_DWORD()); // 4 bytes, total 4
+ handler.bitmapHeaderSize(bitmapHeaderSize);
+ /* GFF2 says that Width & Height are SHORT, but they appear to be DWORD. */
+ handler.bitmapWidth(Integer.reverseBytes(input.read_DWORD())); // 4 bytes, total 8
+ handler.bitmapHeight(Integer.reverseBytes(input.read_DWORD())); // 4 bytes, total 12
+ handler.bitmapPlanes(Short.reverseBytes(input.read_WORD())); // 2 bytes, total 14
+ final @Unsigned short bitmapBitsPerPixel = Short.reverseBytes(input.read_WORD()); // 2 bytes, total 16
+ handler.bitmapBitsPerPixel(bitmapBitsPerPixel);
+
+
+ /* Color Palette. */ // *** Restart Count ***
+ int numColorPaletteEntries = 1 << bitmapBitsPerPixel;
+ if (numColorPaletteEntries > PrimitiveConstants.MAX_8_BIT_UNSIGNED_VALUES) {
+ numColorPaletteEntries = 0;
+ }
+ handler.numPaletteEntries(numColorPaletteEntries);
+
+ /* Each entry has 3 bytes, one each for Blue, Green, Red. */
+// final ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
+// final byte[] palette = new byte[numColorPaletteEntries * cs.getNumComponents()];
+// for (int index = 0; index < numColorPaletteEntries; index ++) {
+// }
+
+
+ }
+
+}
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/BmpGraphicParser1.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic.parser;
+
+import org.foray.graphic.handler.GraphicContentHandler;
+
+import org.axsl.graphic.GraphicException;
+
+import java.io.IOException;
+
+/**
+ * Parses graphic files and produces events to be consumed by a {@link GraphicContentHandler}.
+ * Making graphic parsing an event-driven process separates the concerns of parsing and using the data.
+ * The parser parses everything consistently, regardless of the consumer.
+ * The consumer does what it wishes with the results.
+ * @param <H> The handler class for this parser.
+ */
+public abstract class GraphicParser<H extends GraphicContentHandler> {
+
+ /**
+ * Parses the input.
+ * @param input The input to be parsed.
+ * @param consumer The consumer of the parsing.
+ * @throws IOException For errors reading the input.
+ * @throws GraphicException For formats or features that we don't support.
+ */
+ public abstract void parse(GraphicRandomAccessInput input, H consumer) throws IOException, GraphicException;
+
+}
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicParser.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicRandomAccessInput.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicRandomAccessInput.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicRandomAccessInput.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic.parser;
+
+import org.foray.common.RandomAccessInput;
+import org.foray.common.sequence.ByteSequenceParser;
+import org.foray.primitive.sequence.ByteArray;
+
+import org.axsl.primitive.sequence.ByteSequencePlus;
+
+import org.checkerframework.checker.signedness.qual.Unsigned;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A parser that includes methods specialized for parsing Graphic files.
+ * The methods correspond to the data types described in O'Reilly's "Graphics File Formats, 2nd Edition" Preface,
+ * page xxiii.
+ */
+public interface GraphicRandomAccessInput extends RandomAccessInput {
+
+ /**
+ * Simple implementation.
+ */
+ class Impl extends ByteSequenceParser implements GraphicRandomAccessInput {
+
+ /**
+ * Constructor.
+ * @param sequence The sequence being wrapped.
+ */
+ public Impl(final ByteSequencePlus sequence) {
+ super(sequence);
+ }
+
+ /**
+ * Constructor.
+ * @param bytes The byte array being wrapped.
+ */
+ public Impl(final byte[] bytes) {
+ this(new ByteArray(bytes));
+ }
+
+ /**
+ * Constructor for an {@link InputStream} instance.
+ * Reads the content of {@code inputStream} into the parser, then closes it.
+ * @param inputStream The {@link InputStream} whose content should be captured as a byte sequence.
+ * @throws IOException For errors reading or closing the input stream.
+ */
+ public Impl(final InputStream inputStream) throws IOException {
+ super(inputStream);
+ }
+
+ }
+
+
+ /* Checkstyle: Suppress method name checking when matching low-level type names. */
+
+
+
+
+ /**
+ * Parses a "BYTE" field (1 byte, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned byte read_BYTE() throws IOException {
+ return (byte) readUnsignedByte();
+ }
+
+ /**
+ * Parses a "CHAR" field (1 byte, signed).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default byte read_CHAR() throws IOException {
+ return readByte();
+ }
+
+ /**
+ * Parses a "WORD" field (2 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned short read_WORD() throws IOException {
+ return (short) readUnsignedShort();
+ }
+
+ /**
+ * Parses a "SHORT" field (2 bytes, signed).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default short read_SHORT() throws IOException {
+ return readShort();
+ }
+
+ /**
+ * Parses a "DWORD" field (4 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned int read_DWORD() throws IOException {
+ return (int) readUnsignedInt();
+ }
+
+ /**
+ * Parses a "LONG" field (4 bytes, signed).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default int read_LONG() throws IOException {
+ return readInt();
+ }
+
+ /**
+ * Parses a "FLOAT" field (4 bytes).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default float read_FLOAT() throws IOException {
+ return readFloat();
+ }
+
+ /**
+ * Parses a "DOUBLE" field (2 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default double read_DOUBLE() throws IOException {
+ return readDouble();
+ }
+
+ /* Checkstyle: Restart method name checking. */
+}
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/GraphicRandomAccessInput.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/package-info.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/package-info.java (rev 0)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/package-info.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+/**
+ * Classes that parse Graphic files.
+ * Uncoupling the parsing task from the consumption of the data parsed allows reuse of the parser.
+ */
+package org.foray.graphic.parser;
Property changes on: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/parser/package-info.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-graphic/src/test/java/org/foray/graphic/BmpGraphicTests.java
===================================================================
--- trunk/foray/foray-graphic/src/test/java/org/foray/graphic/BmpGraphicTests.java 2025-05-14 20:35:15 UTC (rev 13665)
+++ trunk/foray/foray-graphic/src/test/java/org/foray/graphic/BmpGraphicTests.java 2025-05-16 13:31:33 UTC (rev 13666)
@@ -59,14 +59,18 @@
@Test
public void testGraphic01() throws GraphicException, IOException, URISyntaxException {
final URI graphicUri = UrlUtil.resolveURI(getBaseURLs(), new URI("linux.bmp"));
- final Graphic4a bmp = this.getServer().procureGraphic(graphicUri.toURL(), false);
- assertNotNull(bmp);
- assertTrue(bmp instanceof BmpGraphic);
+ final Graphic4a graphic = this.getServer().procureGraphic(graphicUri.toURL(), false);
+ assertNotNull(graphic);
+ assertTrue(graphic instanceof BmpGraphic);
+ final BmpGraphic bmp = (BmpGraphic) graphic;
assertEquals(70, bmp.getPixelWidth());
assertEquals(62, bmp.getPixelHeight());
+ assertEquals(24, bmp.getBitDepth());
+ assertEquals(24, bmp.getBitsPerPixel());
assertEquals(8, bmp.getBitsPerComponent());
assertTrue(bmp.getColorSpace().getType() == ColorSpace.TYPE_RGB);
assertEquals(3, bmp.getColorSpace().getNumComponents());
+ assertNull(bmp.getColorPalette());
assertFalse(bmp.isTransparent());
assertNull(bmp.getTransparentColor());
final ByteSequence content = bmp.getContent();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-14 20:35:19
|
Revision: 13665
http://sourceforge.net/p/foray/code/13665
Author: victormote
Date: 2025-05-14 20:35:15 +0000 (Wed, 14 May 2025)
Log Message:
-----------
Conform to aXSL change: Reorder parameters to reflect order of importance in the selection algorithm.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2025-05-14 16:12:27 UTC (rev 13664)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2025-05-14 20:35:15 UTC (rev 13665)
@@ -1247,7 +1247,7 @@
final FontStretch fontStretch = foNeedingFont.traitFontStretch(this);
final FontConsumer fontConsumer = getAreaTree().getFontConsumer();
- final FontUse resolvedFont = fontConsumer.selectFont(foFontFamily, fontStyle, fontWeight, fontVariant,
+ final FontUse resolvedFont = fontConsumer.selectFont(foFontFamily, fontStyle, fontVariant, fontWeight,
fontStretch, 0, null);
if (resolvedFont == null) {
getAreaTree().logError("Error creating Font.\n" + ((Fo) foNeedingFont).getContextMessage());
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-05-14 16:12:27 UTC (rev 13664)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-05-14 20:35:15 UTC (rev 13665)
@@ -226,10 +226,9 @@
}
@Override
- public org.axsl.font.FontUse selectFont(
- final List<String> familyList, final FontStyle style,
- final FontWeight weight, final FontVariant variant,
- final FontStretch stretch, final int fontSize, final WritingSystem writingSystem) {
+ public org.axsl.font.FontUse selectFont(final List<String> familyList, final FontStyle style,
+ final FontVariant variant, final FontWeight weight, final FontStretch stretch, final int fontSize,
+ final WritingSystem writingSystem) {
final FontSelector selector = getFontSelector(FontSelectionStrategy.CHARACTER_BY_CHARACTER);
final RegisteredFont fontDescSelected = selector.selectFont(familyList, style, weight, variant, stretch);
if (fontDescSelected == null) {
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-05-14 16:12:27 UTC (rev 13664)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-05-14 20:35:15 UTC (rev 13665)
@@ -330,8 +330,7 @@
final GVTFontFamily fam = (GVTFontFamily) i.next();
this.fontFamily = fam.getFamilyName();
final org.axsl.font.FontUse font = this.fontConsumer.selectFont(
- FontUtility.foFontFamily(this.fontFamily),
- style, weight, FontVariant.NORMAL,
+ FontUtility.foFontFamily(this.fontFamily), style, FontVariant.NORMAL, weight,
FontStretch.NORMAL, 0, null);
if (font != null) {
/* TODO: Since PdfGraphics2D has moved to the foray-pdf project, this test can no longer be done.
@@ -345,14 +344,8 @@
}
}
this.fontFamily = "any";
- return this.fontConsumer.selectFont(
- Arrays.asList(new String[] {"any"}),
- style,
- weight,
- FontVariant.NORMAL,
- FontStretch.NORMAL,
- 0,
- null);
+ return this.fontConsumer.selectFont(Arrays.asList(new String[] {"any"}), style, FontVariant.NORMAL, weight,
+ FontStretch.NORMAL, 0, null);
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2025-05-14 16:12:27 UTC (rev 13664)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2025-05-14 20:35:15 UTC (rev 13665)
@@ -712,13 +712,8 @@
if (gFont.isBold()) {
fontWeight = FontWeight.BOLD;
}
- FontUse fontUse = this.fontConsumer.selectFont(
- FontUtility.foFontFamily(fontFamily),
- fontStyle, fontWeight,
- FontVariant.NORMAL,
- FontStretch.NORMAL,
- 0,
- null);
+ FontUse fontUse = this.fontConsumer.selectFont(FontUtility.foFontFamily(fontFamily), fontStyle,
+ FontVariant.NORMAL, fontWeight, FontStretch.NORMAL, 0, null);
if (fontUse == null) {
fontUse = this.fontConsumer.selectFontFallback();
}
@@ -752,14 +747,8 @@
fontFamily.add((String) iterator.getAttribute(TextAttribute.FAMILY));
final Float fontSize = (Float) iterator.getAttribute(
TextAttribute.FAMILY);
- FontUse font = this.fontConsumer.selectFont(
- fontFamily,
- FontStyle.NORMAL,
- FontWeight.NORMAL,
- FontVariant.NORMAL,
- FontStretch.NORMAL,
- 0,
- null);
+ FontUse font = this.fontConsumer.selectFont(fontFamily, FontStyle.NORMAL, FontVariant.NORMAL,
+ FontWeight.NORMAL, FontStretch.NORMAL, 0, null);
if (font == null) {
font = this.fontConsumer.selectFontFallback();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-14 16:12:30
|
Revision: 13664
http://sourceforge.net/p/foray/code/13664
Author: victormote
Date: 2025-05-14 16:12:27 +0000 (Wed, 14 May 2025)
Log Message:
-----------
Conform to aXSL change: Replace font-selection-strategy with writing-system for font selection.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2025-05-14 15:05:34 UTC (rev 13663)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2025-05-14 16:12:27 UTC (rev 13664)
@@ -54,7 +54,6 @@
import org.axsl.value.BackgroundRepeat;
import org.axsl.value.BorderStyle;
import org.axsl.value.CardinalRotation;
-import org.axsl.value.FontSelectionStrategy;
import org.axsl.value.FontStretch;
import org.axsl.value.FontStyle;
import org.axsl.value.FontVariant;
@@ -1241,7 +1240,6 @@
}
/* Resolve the FO Tree values. */
- final FontSelectionStrategy fontSelectionStrategy = foNeedingFont.traitFontSelectionStrategy(this);
final List<String> foFontFamily = foNeedingFont.traitFontFamily(this);
final FontStyle fontStyle = foNeedingFont.traitFontStyle(this);
final FontWeight fontWeight = foNeedingFont.traitFontWeight(this);
@@ -1249,8 +1247,8 @@
final FontStretch fontStretch = foNeedingFont.traitFontStretch(this);
final FontConsumer fontConsumer = getAreaTree().getFontConsumer();
- final FontUse resolvedFont = fontConsumer.selectFont(fontSelectionStrategy, foFontFamily, fontStyle,
- fontWeight, fontVariant, fontStretch, 0);
+ final FontUse resolvedFont = fontConsumer.selectFont(foFontFamily, fontStyle, fontWeight, fontVariant,
+ fontStretch, 0, null);
if (resolvedFont == null) {
getAreaTree().logError("Error creating Font.\n" + ((Fo) foNeedingFont).getContextMessage());
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-05-14 15:05:34 UTC (rev 13663)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-05-14 16:12:27 UTC (rev 13664)
@@ -40,6 +40,7 @@
import org.axsl.font.FontUse;
import org.axsl.font.zzz.FontSelectionConstraintsMdo;
import org.axsl.i18n.Script;
+import org.axsl.i18n.WritingSystem;
import org.axsl.value.FontSelectionStrategy;
import org.axsl.value.FontStretch;
import org.axsl.value.FontStyle;
@@ -168,8 +169,7 @@
* desired.
* @return The appropriate font selector for the strategy.
*/
- private FontSelector getFontSelector(
- final FontSelectionStrategy strategy) {
+ private FontSelector getFontSelector(final FontSelectionStrategy strategy) {
switch (strategy) {
case CHARACTER_BY_CHARACTER: {
return this.getFontSelectorCBC();
@@ -227,11 +227,10 @@
@Override
public org.axsl.font.FontUse selectFont(
- final FontSelectionStrategy selectionStrategy,
final List<String> familyList, final FontStyle style,
final FontWeight weight, final FontVariant variant,
- final FontStretch stretch, final int fontSize) {
- final FontSelector selector = getFontSelector(selectionStrategy);
+ final FontStretch stretch, final int fontSize, final WritingSystem writingSystem) {
+ final FontSelector selector = getFontSelector(FontSelectionStrategy.CHARACTER_BY_CHARACTER);
final RegisteredFont fontDescSelected = selector.selectFont(familyList, style, weight, variant, stretch);
if (fontDescSelected == null) {
final StringBuilder builder = new StringBuilder();
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-05-14 15:05:34 UTC (rev 13663)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-05-14 16:12:27 UTC (rev 13664)
@@ -39,7 +39,6 @@
import org.axsl.font.FontException;
import org.axsl.font.FontUtility;
import org.axsl.orthography.Orthography;
-import org.axsl.value.FontSelectionStrategy;
import org.axsl.value.FontStretch;
import org.axsl.value.FontStyle;
import org.axsl.value.FontVariant;
@@ -331,10 +330,9 @@
final GVTFontFamily fam = (GVTFontFamily) i.next();
this.fontFamily = fam.getFamilyName();
final org.axsl.font.FontUse font = this.fontConsumer.selectFont(
- FontSelectionStrategy.CHARACTER_BY_CHARACTER,
FontUtility.foFontFamily(this.fontFamily),
style, weight, FontVariant.NORMAL,
- FontStretch.NORMAL, 0);
+ FontStretch.NORMAL, 0, null);
if (font != null) {
/* TODO: Since PdfGraphics2D has moved to the foray-pdf project, this test can no longer be done.
* We are not sure whether it is necessary. If so, we may need to write a sub-interface to
@@ -348,13 +346,13 @@
}
this.fontFamily = "any";
return this.fontConsumer.selectFont(
- FontSelectionStrategy.AUTO,
Arrays.asList(new String[] {"any"}),
style,
weight,
FontVariant.NORMAL,
FontStretch.NORMAL,
- 0);
+ 0,
+ null);
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2025-05-14 15:05:34 UTC (rev 13663)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2025-05-14 16:12:27 UTC (rev 13664)
@@ -50,7 +50,6 @@
import org.axsl.pdf.PdfColor;
import org.axsl.pdf.PdfPage;
import org.axsl.unicode.block.U0000_Basic_Latin;
-import org.axsl.value.FontSelectionStrategy;
import org.axsl.value.FontStretch;
import org.axsl.value.FontStyle;
import org.axsl.value.FontVariant;
@@ -714,12 +713,12 @@
fontWeight = FontWeight.BOLD;
}
FontUse fontUse = this.fontConsumer.selectFont(
- FontSelectionStrategy.AUTO,
FontUtility.foFontFamily(fontFamily),
fontStyle, fontWeight,
FontVariant.NORMAL,
FontStretch.NORMAL,
- 0);
+ 0,
+ null);
if (fontUse == null) {
fontUse = this.fontConsumer.selectFontFallback();
}
@@ -754,12 +753,13 @@
final Float fontSize = (Float) iterator.getAttribute(
TextAttribute.FAMILY);
FontUse font = this.fontConsumer.selectFont(
- FontSelectionStrategy.CHARACTER_BY_CHARACTER,
fontFamily,
FontStyle.NORMAL,
FontWeight.NORMAL,
FontVariant.NORMAL,
- FontStretch.NORMAL, 0);
+ FontStretch.NORMAL,
+ 0,
+ null);
if (font == null) {
font = this.fontConsumer.selectFontFallback();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-14 15:05:37
|
Revision: 13663
http://sourceforge.net/p/foray/code/13663
Author: victormote
Date: 2025-05-14 15:05:34 +0000 (Wed, 14 May 2025)
Log Message:
-----------
Conform to aXSL change: Remove code point from initial font selection method.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontSelector.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontSelectorCbc.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2025-05-14 14:38:57 UTC (rev 13662)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2025-05-14 15:05:34 UTC (rev 13663)
@@ -1250,7 +1250,7 @@
final FontConsumer fontConsumer = getAreaTree().getFontConsumer();
final FontUse resolvedFont = fontConsumer.selectFont(fontSelectionStrategy, foFontFamily, fontStyle,
- fontWeight, fontVariant, fontStretch, 0, firstChar);
+ fontWeight, fontVariant, fontStretch, 0);
if (resolvedFont == null) {
getAreaTree().logError("Error creating Font.\n" + ((Fo) foNeedingFont).getContextMessage());
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java 2025-05-14 14:38:57 UTC (rev 13662)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java 2025-05-14 15:05:34 UTC (rev 13663)
@@ -159,11 +159,9 @@
/**
* Select a font use based on the registered font description and a Unicode code point.
* @param rfd The font description that should be used for the selection.
- * @param codePoint The Unicode code point that should be encodable by the
- * returned font use.
* @return The best font use.
*/
- public FontUse4a selectFontUse(final RegisteredFont rfd, final int codePoint) {
+ public FontUse4a selectFontUse(final RegisteredFont rfd) {
if (rfd == null) {
return null;
}
@@ -175,17 +173,16 @@
if (trialFontUse.getRegisteredFontDesc() != rfd) {
continue;
}
- if (sf != null) {
- if (! sf.glyphAvailable(codePoint)) {
- continue;
- }
- } else {
- final org.axsl.ps.Encoding encoding =
- trialFontUse.getEncoding();
- if (! encoding.canEncode(codePoint)) {
- continue;
- }
- }
+// if (sf != null) {
+// if (! sf.glyphAvailable(codePoint)) {
+// continue;
+// }
+// } else {
+// final org.axsl.ps.Encoding encoding = trialFontUse.getEncoding();
+// if (! encoding.canEncode(codePoint)) {
+// continue;
+// }
+// }
fontUse = trialFontUse;
}
if (fontUse != null) {
@@ -197,7 +194,8 @@
/* We don't care about encodings for SystemFonts. */
fontUse = new FontUse4a(this, rfd, null);
} else {
- final Encoding encoding = findEncoding(rfd, codePoint);
+ final Encoding encoding = rfd.getEncoding();
+// final Encoding encoding = findEncoding(rfd, codePoint);
if (encoding == null) {
/* We can't encode this character.
* Return null so that the upstream font selection routines can
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-05-14 14:38:57 UTC (rev 13662)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-05-14 15:05:34 UTC (rev 13663)
@@ -40,7 +40,6 @@
import org.axsl.font.FontUse;
import org.axsl.font.zzz.FontSelectionConstraintsMdo;
import org.axsl.i18n.Script;
-import org.axsl.ps.Encoding;
import org.axsl.value.FontSelectionStrategy;
import org.axsl.value.FontStretch;
import org.axsl.value.FontStyle;
@@ -231,10 +230,9 @@
final FontSelectionStrategy selectionStrategy,
final List<String> familyList, final FontStyle style,
final FontWeight weight, final FontVariant variant,
- final FontStretch stretch, final int fontSize, final int codePoint) {
+ final FontStretch stretch, final int fontSize) {
final FontSelector selector = getFontSelector(selectionStrategy);
- final RegisteredFont fontDescSelected = selector.selectFont(familyList, style, weight, variant, stretch,
- codePoint);
+ final RegisteredFont fontDescSelected = selector.selectFont(familyList, style, weight, variant, stretch);
if (fontDescSelected == null) {
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < familyList.size(); i++) {
@@ -244,12 +242,11 @@
builder.append(weight.toString() + " (weight), ");
builder.append(variant.toString() + " (variant), ");
builder.append(stretch.toString() + " (stretch), ");
- builder.append("U+" + Integer.toHexString(codePoint).toUpperCase());
getLogger().warn("Suitable font not found for: " + builder.toString());
return null;
}
try {
- return getFontUse(fontDescSelected, codePoint);
+ return getFontUse(fontDescSelected);
} catch (final FontException e) {
return null;
}
@@ -259,15 +256,14 @@
* For a given RegisteredFontDesc instance known to be able to encode a given Unicode code point, return a FontUse
* that will do exactly that.
* @param fontDescSelected The font description which is known to be able to encode {@code codePoint}.
- * @param codePoint The code point to be encoded.
* @return The FontUse that should be used.
* @throws FontException For errors in font selection.
*/
- private org.axsl.font.FontUse getFontUse(final RegisteredFont fontDescSelected, final int codePoint)
+ private org.axsl.font.FontUse getFontUse(final RegisteredFont fontDescSelected)
throws FontException {
Font4a fontSelected = null;
if (fontDescSelected != null) {
- fontSelected = whichUse(fontDescSelected, codePoint);
+ fontSelected = whichUse(fontDescSelected);
}
if (fontSelected == null) {
/* None of the requested font-family items can provide a suitable
@@ -281,7 +277,7 @@
}
final ConsumerFont4a consumerFont = registerFontUse(fontSelected);
/* Selection of the actual FontUse is delegated to consumerFont. */
- final FontUse4a fontUse = consumerFont.selectFontUse(fontDescSelected, codePoint);
+ final FontUse4a fontUse = consumerFont.selectFontUse(fontDescSelected);
return fontUse;
}
@@ -322,12 +318,9 @@
* to select which one it prefers.
* @param rfd The RegisteredFontDesc instance which points to the usable
* font.
- * @param codePoint The Unicode code point that should be tested to ensure
- * that it can be encoded.
* @return The FontUse instance dictated by the parameters of consumer.
*/
- protected Font4a whichUse(final RegisteredFont rfd,
- final int codePoint) {
+ protected Font4a whichUse(final RegisteredFont rfd) {
final RegisteredFontContent rf = rfd.getRegisteredFont();
/* Avoid instantiating the non-preferred manifestation if it won't be
@@ -337,20 +330,20 @@
if (preferFreeStandingFonts()) {
/* Consumer prefers FreeStandingFont. */
- fsf = eligibleFreeStandingFont(rfd, codePoint);
+ fsf = eligibleFreeStandingFont(rfd);
if (fsf != null) {
/* It is available. */
return fsf;
}
- return eligibleSystemFont(rf, codePoint);
+ return eligibleSystemFont(rf);
} else {
/* Consumer prefers SystemFont. */
- sf = eligibleSystemFont(rf, codePoint);
+ sf = eligibleSystemFont(rf);
if (sf != null) {
/* It is available. */
return sf;
}
- return eligibleFreeStandingFont(rfd, codePoint);
+ return eligibleFreeStandingFont(rfd);
}
}
@@ -358,43 +351,26 @@
* For a given registered font description, returns the free-standing font
* for that description, if it is eligible for selection.
* @param rfd The registered font description to be tested.
- * @param codePoint The Unicode code point that must be encodable for the
- * tested font to be eligible.
* @return The {@link FreeStandingFont} instance, if it exists and is
* eligible, or null otherwise.
*/
- private FreeStandingFont eligibleFreeStandingFont(
- final RegisteredFont rfd, final int codePoint) {
+ private FreeStandingFont eligibleFreeStandingFont(final RegisteredFont rfd) {
if (! this.selectionConstraints.canSelectFreeStandingFonts()) {
return null;
}
- final FreeStandingFont fsf =
- rfd.getRegisteredFont().getFreeStandingFont();
+ final FreeStandingFont fsf = rfd.getRegisteredFont().getFreeStandingFont();
if (fsf == null) {
return null;
}
- final ConsumerFont4a consumerFont = this.getConsumerFont(fsf);
- final Encoding encoding = consumerFont.findEncoding(rfd, codePoint);
- if (encoding == null) {
- /* Either no known encoding for this font can encode this character
- * or we have been restricted from using an encoding that can.
- * Either way, this font can't be used. */
- return null;
- }
return fsf;
}
/**
- * For a given registered font, returns the system font, if it is eligible
- * for selection.
+ * For a given registered font, returns the system font, if it is eligible for selection.
* @param rf The registered font to be tested.
- * @param codePoint The Unicode code point that must be encodable for the
- * tested font to be eligible.
- * @return The {@link SystemFont instance}, if it exists and is eligible, or
- * null otherwise.
+ * @return The {@link SystemFont instance}, if it exists and is eligible, or null otherwise.
*/
- private SystemFont eligibleSystemFont(final RegisteredFontContent rf,
- final int codePoint) {
+ private SystemFont eligibleSystemFont(final RegisteredFontContent rf) {
if (! this.selectionConstraints.canSelectSystemFonts()) {
return null;
}
@@ -402,10 +378,7 @@
if (sf == null) {
return null;
}
- if (sf.glyphAvailable(codePoint)) {
- return sf;
- }
- return null;
+ return sf;
}
/**
@@ -583,7 +556,7 @@
return null;
}
try {
- return this.getFontUse(bestFit, codePoint);
+ return this.getFontUse(bestFit);
} catch (final FontException e) {
return null;
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontSelector.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontSelector.java 2025-05-14 14:38:57 UTC (rev 13662)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontSelector.java 2025-05-14 15:05:34 UTC (rev 13663)
@@ -62,11 +62,10 @@
* @param variant The font variant (normal, small-caps).
* @param stretch The font stretch (normal, condensed, etc.).
* This is used only for bitmapped fonts.
- * @param codePoint The Unicode code point which must be encodable by the selected font.
* @return The best registered font description matching the selection criteria.
*/
public abstract RegisteredFont selectFont(List<String> familyList, FontStyle style, FontWeight weight,
- FontVariant variant, FontStretch stretch, int codePoint);
+ FontVariant variant, FontStretch stretch);
/**
* Returns the parent font consumer instance.
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontSelectorCbc.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontSelectorCbc.java 2025-05-14 14:38:57 UTC (rev 13662)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontSelectorCbc.java 2025-05-14 15:05:34 UTC (rev 13663)
@@ -61,7 +61,7 @@
@Override
public RegisteredFont selectFont(final List<String> familyList, final FontStyle style, final FontWeight weight,
- final FontVariant variant, final FontStretch stretch, final int codePoint) {
+ final FontVariant variant, final FontStretch stretch) {
Font4a fontSelected = null;
RegisteredFont fontDescSelected = null;
if (familyList == null) {
@@ -75,7 +75,7 @@
continue;
}
/* Use the SystemFont or FreeStandingFont? */
- fontSelected = this.getConsumer().whichUse(fontDescSelected, codePoint);
+ fontSelected = this.getConsumer().whichUse(fontDescSelected);
/* Skip this font-family if we can't use the type of font it supports or if it can't encode the
* character. */
if (fontSelected == null) {
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2025-05-14 14:38:57 UTC (rev 13662)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2025-05-14 15:05:34 UTC (rev 13663)
@@ -223,9 +223,9 @@
return null;
}
final FontConsumer4a consumer = this.getFOrayFontConsumer();
- final Font4a font = consumer.whichUse(desc, ' ');
+ final Font4a font = consumer.whichUse(desc);
final ConsumerFont4a consumerFont = consumer.registerFontUse(font);
- return consumerFont.selectFontUse(desc, ' ');
+ return consumerFont.selectFontUse(desc);
}
@Override
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-05-14 14:38:57 UTC (rev 13662)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-05-14 15:05:34 UTC (rev 13663)
@@ -334,8 +334,7 @@
FontSelectionStrategy.CHARACTER_BY_CHARACTER,
FontUtility.foFontFamily(this.fontFamily),
style, weight, FontVariant.NORMAL,
- FontStretch.NORMAL, 0,
- ' ');
+ FontStretch.NORMAL, 0);
if (font != null) {
/* TODO: Since PdfGraphics2D has moved to the foray-pdf project, this test can no longer be done.
* We are not sure whether it is necessary. If so, we may need to write a sub-interface to
@@ -355,8 +354,7 @@
weight,
FontVariant.NORMAL,
FontStretch.NORMAL,
- 0,
- ' ');
+ 0);
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2025-05-14 14:38:57 UTC (rev 13662)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2025-05-14 15:05:34 UTC (rev 13663)
@@ -719,8 +719,7 @@
fontStyle, fontWeight,
FontVariant.NORMAL,
FontStretch.NORMAL,
- 0,
- ' ');
+ 0);
if (fontUse == null) {
fontUse = this.fontConsumer.selectFontFallback();
}
@@ -760,7 +759,7 @@
FontStyle.NORMAL,
FontWeight.NORMAL,
FontVariant.NORMAL,
- FontStretch.NORMAL, 0, ch);
+ FontStretch.NORMAL, 0);
if (font == null) {
font = this.fontConsumer.selectFontFallback();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-14 14:39:02
|
Revision: 13662
http://sourceforge.net/p/foray/code/13662
Author: victormote
Date: 2025-05-14 14:38:57 +0000 (Wed, 14 May 2025)
Log Message:
-----------
Conform to aXSL change: Add method to handle case where a glyph is not found in the selected font.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
trunk/foray/foray-font-tf/src/main/java/org/foray/font/fixture/MockFontUse.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2025-05-14 12:28:10 UTC (rev 13661)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2025-05-14 14:38:57 UTC (rev 13662)
@@ -129,6 +129,12 @@
}
@Override
+ public FontUse getNextBest(final int codePoint) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
public int encode(final int codePoint) {
/* First get the font's encoding for the character. */
int fontEncodedChar = codePoint;
Modified: trunk/foray/foray-font-tf/src/main/java/org/foray/font/fixture/MockFontUse.java
===================================================================
--- trunk/foray/foray-font-tf/src/main/java/org/foray/font/fixture/MockFontUse.java 2025-05-14 12:28:10 UTC (rev 13661)
+++ trunk/foray/foray-font-tf/src/main/java/org/foray/font/fixture/MockFontUse.java 2025-05-14 14:38:57 UTC (rev 13662)
@@ -69,6 +69,12 @@
}
@Override
+ public FontUse getNextBest(final int codePoint) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
public Encoding getEncoding() {
// TODO Auto-generated method stub
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-14 12:28:14
|
Revision: 13661
http://sourceforge.net/p/foray/code/13661
Author: victormote
Date: 2025-05-14 12:28:10 +0000 (Wed, 14 May 2025)
Log Message:
-----------
Conform to aXSL change: Add font-size back to the selectFont method. It is clearly part of the CSS2 font matching algorithm.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2025-05-14 00:00:27 UTC (rev 13660)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2025-05-14 12:28:10 UTC (rev 13661)
@@ -1250,7 +1250,7 @@
final FontConsumer fontConsumer = getAreaTree().getFontConsumer();
final FontUse resolvedFont = fontConsumer.selectFont(fontSelectionStrategy, foFontFamily, fontStyle,
- fontWeight, fontVariant, fontStretch, firstChar);
+ fontWeight, fontVariant, fontStretch, 0, firstChar);
if (resolvedFont == null) {
getAreaTree().logError("Error creating Font.\n" + ((Fo) foNeedingFont).getContextMessage());
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-05-14 00:00:27 UTC (rev 13660)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-05-14 12:28:10 UTC (rev 13661)
@@ -231,7 +231,7 @@
final FontSelectionStrategy selectionStrategy,
final List<String> familyList, final FontStyle style,
final FontWeight weight, final FontVariant variant,
- final FontStretch stretch, final int codePoint) {
+ final FontStretch stretch, final int fontSize, final int codePoint) {
final FontSelector selector = getFontSelector(selectionStrategy);
final RegisteredFont fontDescSelected = selector.selectFont(familyList, style, weight, variant, stretch,
codePoint);
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-05-14 00:00:27 UTC (rev 13660)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-05-14 12:28:10 UTC (rev 13661)
@@ -334,7 +334,7 @@
FontSelectionStrategy.CHARACTER_BY_CHARACTER,
FontUtility.foFontFamily(this.fontFamily),
style, weight, FontVariant.NORMAL,
- FontStretch.NORMAL,
+ FontStretch.NORMAL, 0,
' ');
if (font != null) {
/* TODO: Since PdfGraphics2D has moved to the foray-pdf project, this test can no longer be done.
@@ -355,6 +355,7 @@
weight,
FontVariant.NORMAL,
FontStretch.NORMAL,
+ 0,
' ');
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2025-05-14 00:00:27 UTC (rev 13660)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2025-05-14 12:28:10 UTC (rev 13661)
@@ -719,6 +719,7 @@
fontStyle, fontWeight,
FontVariant.NORMAL,
FontStretch.NORMAL,
+ 0,
' ');
if (fontUse == null) {
fontUse = this.fontConsumer.selectFontFallback();
@@ -759,7 +760,7 @@
FontStyle.NORMAL,
FontWeight.NORMAL,
FontVariant.NORMAL,
- FontStretch.NORMAL, ch);
+ FontStretch.NORMAL, 0, ch);
if (font == null) {
font = this.fontConsumer.selectFontFallback();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-14 00:00:30
|
Revision: 13660
http://sourceforge.net/p/foray/code/13660
Author: victormote
Date: 2025-05-14 00:00:27 +0000 (Wed, 14 May 2025)
Log Message:
-----------
Backfill aXSL change: Make the methods generated static.
Modified Paths:
--------------
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java 2025-05-13 22:55:45 UTC (rev 13659)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java 2025-05-14 00:00:27 UTC (rev 13660)
@@ -521,7 +521,7 @@
" * @param script The script whose count of ranges should be returned." + EOL +
" * @return The count of ranges for {@code script}." + EOL +
" */" + EOL +
-" public int getQtyRanges(final UnicodeScript script) {" + EOL +
+" public static int getQtyRanges(final UnicodeScript script) {" + EOL +
" return SCRIPT_INDEXES.get(script).length;" + EOL +
" }" + EOL +
EOL +
@@ -540,7 +540,7 @@
EOL +
" * {@link #getRangeEnd(int)} obtain the range boundaries." + EOL +
" */" + EOL +
-" public int getRangeIndex(final UnicodeScript script, final int scriptOrdinal) {" + EOL +
+" public static int getRangeIndex(final UnicodeScript script, final int scriptOrdinal) {" + EOL +
" return SCRIPT_INDEXES.get(script)[scriptOrdinal];" + EOL +
" }" + EOL +
EOL +
@@ -549,7 +549,7 @@
" * @param rangeIndex The index to the range." + EOL +
" * @return The first code point in the range at {@code rangeIndex}." + EOL +
" */" + EOL +
-" public int getRangeStart(final int rangeIndex) {" + EOL +
+" public static int getRangeStart(final int rangeIndex) {" + EOL +
" return SCRIPT_STARTS[rangeIndex];" + EOL +
" }" + EOL +
EOL +
@@ -558,7 +558,7 @@
" * @param rangeIndex The index to the range." + EOL +
" * @return The last code point in the range at {@code rangeIndex}." + EOL +
" */" + EOL +
-" public int getRangeEnd(final int rangeIndex) {" + EOL +
+" public static int getRangeEnd(final int rangeIndex) {" + EOL +
" if (rangeIndex >= SCRIPT_STARTS.length - 1) {" + EOL +
" return Character.MAX_CODE_POINT;" + EOL +
" } else {" + EOL +
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-13 22:55:47
|
Revision: 13659
http://sourceforge.net/p/foray/code/13659
Author: victormote
Date: 2025-05-13 22:55:45 +0000 (Tue, 13 May 2025)
Log Message:
-----------
Improvements to ScriptsParser.
Modified Paths:
--------------
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java 2025-05-13 14:51:55 UTC (rev 13658)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java 2025-05-13 22:55:45 UTC (rev 13659)
@@ -198,6 +198,7 @@
/* The file footer. */
writer.write(getUtilityClassConstructor(className));
+ writer.write(getEndOfClass());
}
}
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java 2025-05-13 14:51:55 UTC (rev 13658)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java 2025-05-13 22:55:45 UTC (rev 13659)
@@ -134,9 +134,9 @@
writeScriptsArray(contigRanges, writer);
writeIndexesMap(contigRanges, writer);
-
- /* The file footer. */
writer.write(getUtilityClassConstructor(className));
+ writeMethods(writer);
+ writer.write(getEndOfClass());
}
}
@@ -151,7 +151,9 @@
builder.append(EOL);
builder.append(EOL);
builder.append("import java.lang.Character.UnicodeScript;");
+ builder.append(EOL);
builder.append("import java.util.HashMap;");
+ builder.append(EOL);
builder.append("import java.util.Map;");
builder.append(EOL);
builder.append(EOL);
@@ -195,7 +197,7 @@
}
/**
- * Writes the "scriptStarts" array.
+ * Writes the "SCRIPT_STARTS" array.
* @param ranges The parsed code point ranges.
* @param writer The writer to which the contents of the new class should be written.
* @throws IOException For errors writing to {@code writer}.
@@ -209,7 +211,7 @@
writer.println(" * The Unicode Script for each of these ranges is found in {@link #scripts}.");
writer.println(" * Imitated from {@link Character.UnicodeScript}.");
writer.println(" */");
- writer.println(" private static final int[] scriptStarts = {");
+ writer.println(" private static final int[] SCRIPT_STARTS = {");
for (int index = 0; index < ranges.size(); index ++) {
final Range contig = ranges.get(index);
@@ -236,16 +238,16 @@
*/
private void writeScriptsArray(final List<Range> ranges, final PrintWriter writer) throws IOException {
writer.println();
- writer.println(" /**");
- writer.println(" * Array of the Unicode scripts for each item in the {@link #scriptStarts} array.");
- writer.println(" * Imitated from {@link Character.UnicodeScript}.");
- writer.println(" */");
- writer.println(" private static final UnicodeScript[] scripts = {");
+ writer.println("// /**");
+ writer.println("// * Array of the Unicode scripts for each item in the {@link #SCRIPT_STARTS} array.");
+ writer.println("// * Imitated from {@link Character.UnicodeScript}.");
+ writer.println("// */");
+ writer.println("// private static final UnicodeScript[] SCRIPTS = {");
for (int index = 0; index < ranges.size(); index ++) {
final Range contig = ranges.get(index);
final StringBuilder builder = new StringBuilder();
- builder.append(" UnicodeScript.");
+ builder.append("// UnicodeScript.");
builder.append(String.format("%1$-25s", contig.script + ","));
builder.append(" // ");
builder.append(String.format("%3d", index));
@@ -252,7 +254,7 @@
writer.println(builder.toString());
}
- writer.println(" };");
+ writer.println("// };");
}
/**
@@ -277,10 +279,10 @@
writer.println();
writer.println(" /**");
writer.println(" * Map whose key is a {@link UnicodeScript} and whose value is an array of indexes " +
- "into the {@link #scriptIndexes}");
+ "into the {@link #SCRIPT_INDEXES}");
writer.println(" * array that describe ranges for that script.");
writer.println(" */");
- writer.println(" private static final Map<UnicodeScript, int[]> scriptIndexes =");
+ writer.println(" private static final Map<UnicodeScript, int[]> SCRIPT_INDEXES =");
writer.println(" new HashMap<UnicodeScript, int[]>(UnicodeScript.values().length);");
writer.println(" /* Checkstyle: Allow Magic Numbers that are hard-coded data. */");
writer.println(" static {");
@@ -287,7 +289,7 @@
for (UnicodeScript script : UnicodeScript.values()) {
final StringBuilder builder = new StringBuilder();
builder.append(" ");
- builder.append("scriptIndexes.put(UnicodeScript.");
+ builder.append("SCRIPT_INDEXES.put(UnicodeScript.");
builder.append(script);
builder.append(", new int[] {");
boolean isFirst = true;
@@ -440,6 +442,28 @@
/* Sort the parsed ranges by the start value of the range. */
Collections.sort(parsedRanges, new ParsedRangeComparator());
+
+
+ /* Add "Unknown" records for any holes in the sorted sequences. */
+ Range lastRange = null;
+ for (int index = 0; index < parsedRanges.size(); index ++) {
+ final Range currentRange = parsedRanges.get(index);
+ if (lastRange != null) {
+ if (lastRange.end + 1 != currentRange.start) {
+ final Range unknownRange = new Range();
+ unknownRange.script = UnicodeScript.UNKNOWN;
+ unknownRange.start = lastRange.end + 1;
+ unknownRange.end = currentRange.start - 1;
+ parsedRanges.add(index, unknownRange);
+ lastRange = unknownRange;
+ } else {
+ lastRange = currentRange;
+ }
+ }
+ }
+
+
+
/* Group contiguous ranges together and write them to a new list. */
final List<Range> contigRanges = new ArrayList<Range>(400);
Range rangeStart = null;
@@ -484,7 +508,68 @@
return contigRanges;
}
+ /**
+ * Writes the methods for the class.
+ * @param writer The writer being written to.
+ */
+ private void writeMethods(final PrintWriter writer) {
+ final String methods =
+EOL +
+" /**" + EOL +
+" * Returns the number of ranges of Unicode code points for a given {@link UnicodeScript}." + EOL +
+" * Used with {@link #getRangeIndex(UnicodeScript, int)} to obtain all of the ranges for a given script." + EOL +
+" * @param script The script whose count of ranges should be returned." + EOL +
+" * @return The count of ranges for {@code script}." + EOL +
+" */" + EOL +
+" public int getQtyRanges(final UnicodeScript script) {" + EOL +
+" return SCRIPT_INDEXES.get(script).length;" + EOL +
+" }" + EOL +
+EOL +
+" /**" + EOL +
+" * Returns the range index for a specific ordinal for a specific script." + EOL +
+" * Used with {@link #getQtyRanges(UnicodeScript)} to obtain all of the ranges for a given script." + EOL +
+" * @param script The script whose index should be returned." + EOL +
+" * @param scriptOrdinal The ordinal index into the range indexes for {@code script}." + EOL +
+" * Supposing script MIGHTY_SCRIPT has 3 ranges of Unicode code points, as reported by" + EOL +
+" * {@link #getQtyRanges(UnicodeScript)}." + EOL +
+" * We can get the range index for each of those ranges by calling this method 3 times, with scriptOrdinal values" +
+EOL +
+" * of 0, 1, and 2." + EOL +
+" * @return The range index for {@code script} and {@code scriptOrdinal}." + EOL +
+" * This tells nothing about the values in the range, but is used as the key to {@link #getRangeStart(int)} and" +
+EOL +
+" * {@link #getRangeEnd(int)} obtain the range boundaries." + EOL +
+" */" + EOL +
+" public int getRangeIndex(final UnicodeScript script, final int scriptOrdinal) {" + EOL +
+" return SCRIPT_INDEXES.get(script)[scriptOrdinal];" + EOL +
+" }" + EOL +
+EOL +
+" /**" + EOL +
+" * Returns the first code point in a given range." + EOL +
+" * @param rangeIndex The index to the range." + EOL +
+" * @return The first code point in the range at {@code rangeIndex}." + EOL +
+" */" + EOL +
+" public int getRangeStart(final int rangeIndex) {" + EOL +
+" return SCRIPT_STARTS[rangeIndex];" + EOL +
+" }" + EOL +
+EOL +
+" /**" + EOL +
+" * Returns the last code point in a given range." + EOL +
+" * @param rangeIndex The index to the range." + EOL +
+" * @return The last code point in the range at {@code rangeIndex}." + EOL +
+" */" + EOL +
+" public int getRangeEnd(final int rangeIndex) {" + EOL +
+" if (rangeIndex >= SCRIPT_STARTS.length - 1) {" + EOL +
+" return Character.MAX_CODE_POINT;" + EOL +
+" } else {" + EOL +
+" return SCRIPT_STARTS[rangeIndex + 1];" + EOL +
+" }" + EOL +
+" }" + EOL;
+ writer.write(methods);
+ }
+
+
/**
* Command-line interface.
* @param args The command-line arguments. There are two:
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-13 14:51:55 UTC (rev 13658)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-13 22:55:45 UTC (rev 13659)
@@ -129,10 +129,18 @@
builder.append(className);
builder.append("() { }");
builder.append(EOL);
+ return builder.toString();
+ }
+
+ /**
+ * Returns the standard end-of-classs text.
+ * @return The end-of-class text.
+ */
+ protected String getEndOfClass() {
+ final StringBuilder builder = new StringBuilder();
builder.append(EOL);
builder.append("}");
builder.append(EOL);
-
return builder.toString();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-13 14:51:57
|
Revision: 13658
http://sourceforge.net/p/foray/code/13658
Author: victormote
Date: 2025-05-13 14:51:55 +0000 (Tue, 13 May 2025)
Log Message:
-----------
Write the index map.
Modified Paths:
--------------
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java 2025-05-13 13:19:59 UTC (rev 13657)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java 2025-05-13 14:51:55 UTC (rev 13658)
@@ -151,6 +151,8 @@
builder.append(EOL);
builder.append(EOL);
builder.append("import java.lang.Character.UnicodeScript;");
+ builder.append("import java.util.HashMap;");
+ builder.append("import java.util.Map;");
builder.append(EOL);
builder.append(EOL);
builder.append("/**");
@@ -264,14 +266,60 @@
for (int index = 0; index < ranges.size(); index ++) {
final Range contig = ranges.get(index);
-
List<Integer> indexes = scriptRanges.get(contig.script);
if (indexes == null) {
indexes = new ArrayList<Integer>();
scriptRanges.put(contig.script, indexes);
}
- indexes.add(index - 1);
+ indexes.add(index);
}
+
+ writer.println();
+ writer.println(" /**");
+ writer.println(" * Map whose key is a {@link UnicodeScript} and whose value is an array of indexes " +
+ "into the {@link #scriptIndexes}");
+ writer.println(" * array that describe ranges for that script.");
+ writer.println(" */");
+ writer.println(" private static final Map<UnicodeScript, int[]> scriptIndexes =");
+ writer.println(" new HashMap<UnicodeScript, int[]>(UnicodeScript.values().length);");
+ writer.println(" /* Checkstyle: Allow Magic Numbers that are hard-coded data. */");
+ writer.println(" static {");
+ for (UnicodeScript script : UnicodeScript.values()) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(" ");
+ builder.append("scriptIndexes.put(UnicodeScript.");
+ builder.append(script);
+ builder.append(", new int[] {");
+ boolean isFirst = true;
+ final List<Integer> integerList = scriptRanges.get(script);
+ for (int listIndex = 0; listIndex < integerList.size(); listIndex ++) {
+ final int index = integerList.get(listIndex);
+ if (! isFirst) {
+ builder.append(",");
+ }
+ final String indexAsString = Integer.toString(index);
+
+ /* Add one for the comma and one for the space. */
+ if ((builder.length() + indexAsString.length() + 2) > MAX_JAVA_CLASS_LINE_LENGTH) {
+ writer.println(builder.toString());
+ builder.setLength(0);
+ /* Add same indention as the first line. */
+ builder.append(" ");
+ /* Add another two levels (8), minus the one that will get added as the normal space between
+ * elements. */
+ builder.append(" ");
+ }
+ if (! isFirst) {
+ builder.append(" ");
+ }
+ builder.append(index);
+ isFirst = false;
+ }
+ builder.append("});");
+ writer.println(builder.toString());
+ }
+ writer.println(" }");
+ writer.println(" /* Checkstyle: Restart Magic Number checking. */");
}
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-13 13:19:59 UTC (rev 13657)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-13 14:51:55 UTC (rev 13658)
@@ -47,6 +47,9 @@
/** The end-of-line characters to be used. */
protected static final String EOL = System.lineSeparator();
+ /** The maximum length of a line when writing Java classes. This is a style decision, not a compiler constraint. */
+ protected static final int MAX_JAVA_CLASS_LINE_LENGTH = 120;
+
/**
* Builds and returns the boilerplate content of the class header.
* @return The content of the class header.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-13 13:20:01
|
Revision: 13657
http://sourceforge.net/p/foray/code/13657
Author: victormote
Date: 2025-05-13 13:19:59 +0000 (Tue, 13 May 2025)
Log Message:
-----------
Add class to parse the Unicode Scripts.txt file.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Script4a.java
trunk/foray/foray-unicode/build.gradle
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
Added Paths:
-----------
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Script4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Script4a.java 2025-05-12 18:25:24 UTC (rev 13656)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Script4a.java 2025-05-13 13:19:59 UTC (rev 13657)
@@ -93,7 +93,7 @@
BaselineType.ALPHABETIC, DEFAULT_HYPHENATION_CHAR));
Script4a.register(new Script4a("Armn", 230, "Armenian", "arménien",
UScript.ARMENIAN, UnicodeScript.ARMENIAN,
- null, DEFAULT_HYPHENATION_CHAR));
+ BaselineType.ALPHABETIC, DEFAULT_HYPHENATION_CHAR));
Script4a.register(new Script4a("Bali", 360, "Balinese", "balinais",
UScript.BALINESE, UnicodeScript.BALINESE,
null, DEFAULT_HYPHENATION_CHAR));
@@ -196,7 +196,7 @@
null, DEFAULT_HYPHENATION_CHAR));
Script4a.register(new Script4a("Hani", 500, "Han (Hanzi, Kanji, Hanja)", "idéogrammes han",
UScript.HAN, UnicodeScript.HAN,
- null, DEFAULT_HYPHENATION_CHAR));
+ BaselineType.IDEOGRAPHIC, DEFAULT_HYPHENATION_CHAR));
Script4a.register(new Script4a("Hano", 371, "Hanunoo (Hanunóo)", "hanounóo",
UScript.HANUNOO, UnicodeScript.HANUNOO,
null, DEFAULT_HYPHENATION_CHAR));
Modified: trunk/foray/foray-unicode/build.gradle
===================================================================
--- trunk/foray/foray-unicode/build.gradle 2025-05-12 18:25:24 UTC (rev 13656)
+++ trunk/foray/foray-unicode/build.gradle 2025-05-13 13:19:59 UTC (rev 13657)
@@ -6,6 +6,9 @@
description = 'foray-unicode'
dependencies {
+
+ api (group: 'org.axsl', name: 'axsl-constants', version: versions.axsl)
+
}
javadoc {
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java 2025-05-12 18:25:24 UTC (rev 13656)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java 2025-05-13 13:19:59 UTC (rev 13657)
@@ -28,9 +28,6 @@
package org.foray.unicode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -50,12 +47,6 @@
*/
public class BlockParser extends UnicodeParser {
- /** The logger. */
- private static final Logger LOGGER = LoggerFactory.getLogger(BlockParser.class);
-
- /** The minimum size of generated hex strings, which is {@value}. Those smaller should be left-padded with zeros. */
- private static final int MIN_LENGTH_HEX_STRING = 4;
-
/** The directory containing the Unicode source files. */
private File unicodeDir;
@@ -125,14 +116,13 @@
className = "X" + block.getStartAsString() + "_" + block.getJavaName();
}
final File outFile = new File(outDir, className + ".java");
- final String eol = System.lineSeparator();
try (Writer writer = new FileWriter(outFile)) {
writer.write(getClassHeader());
writer.write("package org.axsl.unicode.block;");
- writer.write(eol);
- writer.write(eol);
+ writer.write(EOL);
+ writer.write(EOL);
writer.write("/**");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" * Unicode(r) code points for the \"");
writer.write(block.getName());
writer.write("\" block (0x");
@@ -140,45 +130,45 @@
writer.write(" thru 0x");
writer.write(Integer.toHexString(block.getEnd()));
writer.write(").");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" * See package documentation for links to the Unicode(r) license and terms of use.");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" */");
- writer.write(eol);
+ writer.write(EOL);
writer.write("public final class ");
writer.write(className);
writer.write(" {");
- writer.write(eol);
- writer.write(eol);
+ writer.write(EOL);
+ writer.write(EOL);
writer.write(" /*");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" * This class was generated by {@link org.foray.unicode.BlockParser}.");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" * If changes are needed, it will likely be better to regenerate than to change ");
writer.write("manually.");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" */");
- writer.write(eol);
- writer.write(eol);
+ writer.write(EOL);
+ writer.write(EOL);
final String type = block.getSmallestIndexType();
if (block.getEnd() <= Byte.MAX_VALUE) {
writer.write(" /*");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" * Since all code points in this block can be contained in one byte, ");
writer.write("it is tempting to use byte as the type for");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" * them. However, byte is a numeric type, which causes some String-building ");
writer.write("methods to treat it is a number,");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" * resulting in the numeric value being included in the string instead ");
writer.write("of the char value: for example \"32\" instead");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" * of \" \".");
- writer.write(eol);
+ writer.write(EOL);
writer.write(" */");
- writer.write(eol);
- writer.write(eol);
+ writer.write(EOL);
+ writer.write(EOL);
}
@@ -203,7 +193,7 @@
}
writer.write(hexString);
writer.write(";");
- writer.write(eol);
+ writer.write(EOL);
}
/* The file footer. */
Added: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java (rev 0)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java 2025-05-13 13:19:59 UTC (rev 13657)
@@ -0,0 +1,466 @@
+/*
+ * Copyright 2021 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.unicode;
+
+import org.axsl.constants.PrimitiveConstants;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.lang.Character.UnicodeScript;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>Parser that reads the raw Unicode Scripts.txt file and generates Java source code files.
+ * Since the Unicode source files are stored as data in this project, the following command-line example may be
+ * helpful:</p>
+ *
+ * <p>{@code java -cp ... ScriptParser ./src/main/data/Unicode_13_0/UCD_zip/extracted/Scripts.txt
+ * "c:/Users/Victor Mote/desktop"}</p>
+ *
+ * <p>Much of the code generated here is a duplicate of that in {@link Character.UnicodeBlock} and
+ * {@link Character.UnicodeScript}, which we would prefer to use. The data structures there are private and we need
+ * access to them to extend their usefulness.</p>
+ */
+public class ScriptsParser extends UnicodeParser {
+
+ /**
+ * Container for parsed range entries.
+ */
+ private final class Range {
+
+ /** The start of the range. */
+ private long start;
+
+ /** The end of the range. */
+ private long end;
+
+ /** The script for the range. */
+ private UnicodeScript script;
+ }
+
+ /**
+ * Comparator for {@link Range}.
+ */
+ final class ParsedRangeComparator implements Comparator<Range> {
+
+ @Override
+ public int compare(final Range o1, final Range o2) {
+ return (int) (o1.start - o2.start);
+ }
+ }
+
+
+
+
+
+ /** The Scripts file. */
+ private File scriptsFile;
+
+ /** The directory into which the generated source code should be created. */
+ private File outputDir;
+
+ /**
+ * Constructor.
+ * @param scriptsFile The directory containing the Unicode source files.
+ * @param outputDir The directory into which the generated source code should be created.
+ */
+ public ScriptsParser(final File scriptsFile, final File outputDir) {
+ if (! scriptsFile.isFile()) {
+ throw new IllegalArgumentException("scriptsFile must be a file");
+ }
+ if (! outputDir.isDirectory()) {
+ throw new IllegalArgumentException("outputDir must be a directory");
+ }
+ this.scriptsFile = scriptsFile;
+ this.outputDir = outputDir;
+ }
+
+ /**
+ * Parse the requested data.
+ * @throws IOException For errors reading the input or writing the output.
+ */
+ public void process() throws IOException {
+ final List<Range> contigRanges = parseRanges();
+
+ File outDir = new File(this.outputDir, "org/");
+ outDir.mkdir();
+ outDir = new File(outDir, "axsl/");
+ outDir.mkdir();
+ outDir = new File(outDir, "unicode/");
+ outDir.mkdir();
+ final String className = "UnicodeScriptExtended";
+ final File outFile = new File(outDir, className + ".java");
+
+ try (PrintWriter writer = new PrintWriter(outFile)) {
+ writer.write(getClassHeader());
+ writer.write(getClassDeclaration(className));
+
+ writeScriptStartsArray(contigRanges, writer);
+ writeScriptsArray(contigRanges, writer);
+ writeIndexesMap(contigRanges, writer);
+
+
+ /* The file footer. */
+ writer.write(getUtilityClassConstructor(className));
+ }
+ }
+
+ /**
+ * Builds the class declaration.
+ * @param className The name of the class.
+ * @return The class declaration.
+ */
+ private String getClassDeclaration(final String className) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("package org.axsl.unicode;");
+ builder.append(EOL);
+ builder.append(EOL);
+ builder.append("import java.lang.Character.UnicodeScript;");
+ builder.append(EOL);
+ builder.append(EOL);
+ builder.append("/**");
+ builder.append(EOL);
+ builder.append(" * Mapping of Unicode scripts to the Unicode(r) code points assigned to them.");
+ builder.append(EOL);
+ builder.append(" * See package documentation for links to the Unicode(r) license and terms of use.");
+ builder.append(EOL);
+ builder.append(" * Extends the functionality of {@link Character.UnicodeScript}.");
+ builder.append(EOL);
+ builder.append(" * We would prefer to use the standard Java classes, but the data structures are private.");
+ builder.append(EOL);
+ builder.append(" * Instead, we have copied the data structures to this class.");
+ builder.append(EOL);
+ builder.append(" * The standard Java classes do a fine job of mapping a Unicode code point to its Unicode ");
+ builder.append("Script.");
+ builder.append(EOL);
+ builder.append(" * The functionality added here is to go the other way, to list all code points that belong ");
+ builder.append("to a given Unicode Script.");
+ builder.append(EOL);
+ builder.append(" */");
+ builder.append(EOL);
+ builder.append("public final class ");
+ builder.append(className);
+ builder.append(" {");
+ builder.append(EOL);
+ builder.append(EOL);
+ builder.append(" /*");
+ builder.append(EOL);
+ builder.append(" * This class was generated by {@link org.foray.unicode.ScriptParser}.");
+ builder.append(EOL);
+ builder.append(" * If changes are needed, it will likely be better to regenerate than to change ");
+ builder.append("manually.");
+ builder.append(EOL);
+ builder.append(" */");
+ builder.append(EOL);
+ builder.append(EOL);
+
+ return builder.toString();
+ }
+
+ /**
+ * Writes the "scriptStarts" array.
+ * @param ranges The parsed code point ranges.
+ * @param writer The writer to which the contents of the new class should be written.
+ * @throws IOException For errors writing to {@code writer}.
+ */
+ private void writeScriptStartsArray(final List<Range> ranges, final PrintWriter writer) throws IOException {
+ writer.println();
+ writer.println(" /**");
+ writer.println(" * Array of the starting codePoints for each contiguous range of Unicode codePoints " +
+ "that share the same Unicode");
+ writer.println(" * Script.");
+ writer.println(" * The Unicode Script for each of these ranges is found in {@link #scripts}.");
+ writer.println(" * Imitated from {@link Character.UnicodeScript}.");
+ writer.println(" */");
+ writer.println(" private static final int[] scriptStarts = {");
+
+ for (int index = 0; index < ranges.size(); index ++) {
+ final Range contig = ranges.get(index);
+ final StringBuilder builder = new StringBuilder();
+ builder.append(" ");
+ builder.append(String.format("%1$-8s", formatHexInteger(contig.start) + ","));
+ builder.append(" // ");
+ final String range = formatHexInteger(contig.start) + ".." + formatHexInteger(contig.end) + ";";
+ builder.append(String.format("%1$-18s", range));
+ builder.append(" ");
+ builder.append(String.format("%1$-25s", contig.script));
+ builder.append(String.format("%3d", index));
+ writer.println(builder.toString());
+
+ }
+ writer.println(" };");
+ }
+
+ /**
+ * Writes the "scripts" array.
+ * @param ranges The parsed code point ranges.
+ * @param writer The writer to which the contents of the new class should be written.
+ * @throws IOException For errors writing to {@code writer}.
+ */
+ private void writeScriptsArray(final List<Range> ranges, final PrintWriter writer) throws IOException {
+ writer.println();
+ writer.println(" /**");
+ writer.println(" * Array of the Unicode scripts for each item in the {@link #scriptStarts} array.");
+ writer.println(" * Imitated from {@link Character.UnicodeScript}.");
+ writer.println(" */");
+ writer.println(" private static final UnicodeScript[] scripts = {");
+
+ for (int index = 0; index < ranges.size(); index ++) {
+ final Range contig = ranges.get(index);
+ final StringBuilder builder = new StringBuilder();
+ builder.append(" UnicodeScript.");
+ builder.append(String.format("%1$-25s", contig.script + ","));
+ builder.append(" // ");
+ builder.append(String.format("%3d", index));
+ writer.println(builder.toString());
+ }
+
+ writer.println(" };");
+ }
+
+ /**
+ * Write the "indexes" map.
+ * @param ranges The parsed code point ranges.
+ * @param writer The writer to which the contents of the new class should be written.
+ * @throws IOException For errors writing to {@code writer}.
+ */
+ private void writeIndexesMap(final List<Range> ranges, final PrintWriter writer) throws IOException {
+ final Map<UnicodeScript, List<Integer>> scriptRanges = new HashMap<UnicodeScript, List<Integer>>(125);
+ for (int index = 0; index < ranges.size(); index ++) {
+ final Range contig = ranges.get(index);
+
+
+ List<Integer> indexes = scriptRanges.get(contig.script);
+ if (indexes == null) {
+ indexes = new ArrayList<Integer>();
+ scriptRanges.put(contig.script, indexes);
+ }
+ indexes.add(index - 1);
+ }
+ }
+
+
+ /**
+ * Parses the input file, sorting its content by code point, then condensing contiguous ranges.
+ * @return A list of ranges, sequenced by code point range, and tagged with the Unicode script to which the range is
+ * assigned.
+ * @throws IOException For errors reading the input.
+ */
+ private List<Range> parseRanges() throws IOException {
+ final List<Range> parsedRanges = new ArrayList<Range>(3000);
+
+ int rangesRead = 0;
+ try (
+ Reader reader = new FileReader(this.scriptsFile);
+ BufferedReader br = new BufferedReader(reader);
+ ) {
+ String line;
+ while ((line = br.readLine()) != null) {
+ if (line.startsWith("#")) {
+ continue;
+ }
+ if (line.length() < 1) {
+ continue;
+ }
+ rangesRead ++;
+ /*
+ * Example:
+ * 0021..0023 ; Common # Po [3] EXCLAMATION MARK..NUMBER SIGN
+ */
+ String[] fields = line.split(";");
+ final String range = fields[0].trim();
+ final String remainder = fields[1].trim();
+
+ long start = -1;
+ long end = -1;
+ if (range.contains("..")) {
+ fields = range.split("\\.\\.");
+ start = Long.parseUnsignedLong(fields[0], PrimitiveConstants.HEXADECIMAL_RADIX);
+ end = Long.parseUnsignedLong(fields[1], PrimitiveConstants.HEXADECIMAL_RADIX);
+ } else {
+ start = Long.parseUnsignedLong(range, PrimitiveConstants.HEXADECIMAL_RADIX);
+ end = start;
+ }
+
+ fields = remainder.split("#");
+ final String script = fields[0].trim();
+ switch (script) {
+ /* The Scripts.txt is a more recent Unicode version than was used to create the UnicodeScript enum.
+ * TODO: The following exceptions were created against Java 8.0. After we upgrade to a more recent
+ * Java release, we should clear as many as possible and update this message. */
+ case "Caucasian_Albanian": continue;
+ case "Bassa_Vah": continue;
+ case "Duployan": continue;
+ case "Elbasan": continue;
+ case "Grantha": continue;
+ case "Pahawh_Hmong": continue;
+ case "Khojki": continue;
+ case "Linear_A": continue;
+ case "Mahajani": continue;
+ case "Manichaean": continue;
+ case "Mende_Kikakui": continue;
+ case "Modi": continue;
+ case "Mro": continue;
+ case "Old_North_Arabian": continue;
+ case "Nabataean": continue;
+ case "Palmyrene": continue;
+ case "Pau_Cin_Hau": continue;
+ case "Old_Permic": continue;
+ case "Psalter_Pahlavi": continue;
+ case "Siddham": continue;
+ case "Khudawadi": continue;
+ case "Tirhuta": continue;
+ case "Warang_Citi": continue;
+ case "Ahom": continue;
+ case "Anatolian_Hieroglyphs": continue;
+ case "Hatran": continue;
+ case "Multani": continue;
+ case "Old_Hungarian": continue;
+ case "SignWriting": continue;
+ case "Adlam": continue;
+ case "Bhaiksuki": continue;
+ case "Marchen": continue;
+ case "Newa": continue;
+ case "Osage": continue;
+ case "Tangut": continue;
+ case "Masaram_Gondi": continue;
+ case "Nushu": continue;
+ case "Soyombo": continue;
+ case "Zanabazar_Square": continue;
+ case "Dogra": continue;
+ case "Gunjala_Gondi": continue;
+ case "Makasar": continue;
+ case "Medefaidrin": continue;
+ case "Hanifi_Rohingya": continue;
+ case "Sogdian": continue;
+ case "Old_Sogdian": continue;
+ case "Elymaic": continue;
+ case "Nandinagari": continue;
+ case "Nyiakeng_Puachue_Hmong": continue;
+ case "Wancho": continue;
+ case "Chorasmian": continue;
+ case "Dives_Akuru": continue;
+ case "Khitan_Small_Script": continue;
+ case "Yezidi": continue;
+ }
+ final UnicodeScript unicodeScript = UnicodeScript.forName(script);
+
+ final Range parsedRange = new Range();
+ parsedRange.start = start;
+ parsedRange.end = end;
+ parsedRange.script = unicodeScript;
+ parsedRanges.add(parsedRange);
+ }
+ LOGGER.info("Count of Ranges read: " + rangesRead);
+ }
+
+ /* Sort the parsed ranges by the start value of the range. */
+ Collections.sort(parsedRanges, new ParsedRangeComparator());
+
+ /* Group contiguous ranges together and write them to a new list. */
+ final List<Range> contigRanges = new ArrayList<Range>(400);
+ Range rangeStart = null;
+ Range rangeEnd = null;
+ for (int index = 0; index < parsedRanges.size(); index ++) {
+ final Range currentRange = parsedRanges.get(index);
+ if (rangeStart == null) {
+ rangeStart = currentRange;
+ } else if (currentRange.script == rangeStart.script) {
+ rangeEnd = currentRange;
+ } else {
+ final Range contig = new Range();
+ contig.script = rangeStart.script;
+ contig.start = rangeStart.start;
+ if (rangeEnd == null) {
+ contig.end = rangeStart.end;
+ } else {
+ contig.end = rangeEnd.end;
+ }
+ contigRanges.add(contig);
+ rangeStart = currentRange;
+ rangeEnd = null;
+ }
+ }
+ /* Handle the last item in the input list. */
+ final Range newContig = new Range();
+ newContig.script = rangeStart.script;
+ newContig.start = rangeStart.start;
+ if (rangeEnd == null) {
+ newContig.end = rangeStart.end;
+ } else {
+ newContig.end = rangeEnd.end;
+ }
+ contigRanges.add(newContig);
+
+ /* Add item on the end to account for the remaining valid code points. */
+ final Range finalContig = new Range();
+ finalContig.script = UnicodeScript.UNKNOWN;
+ finalContig.start = newContig.end + 1;
+ finalContig.end = Character.MAX_CODE_POINT;
+ contigRanges.add(finalContig);
+ return contigRanges;
+ }
+
+
+ /**
+ * Command-line interface.
+ * @param args The command-line arguments. There are two:
+ * <ol>
+ * <li>The directory containing the raw Unicode files.</li>
+ * <li>The directory into which the generated source code should be written.</li>
+ * </ol>
+ */
+ public static void main(final String[] args) {
+ final String unicodeDirArg = args[0];
+ final String outputDirArg = args[1];
+
+ final File unicodeDir = new File(unicodeDirArg);
+ final File outputDir = new File(outputDirArg);
+
+ final ScriptsParser parser = new ScriptsParser(unicodeDir, outputDir);
+ try {
+ parser.process();
+ } catch (final IOException e) {
+ /* CheckStyle: CheckStyle: Allow System.out.print...() in main method. */
+ System.out.println("Error parsing Unicode data. " + e.getMessage());
+ /* CheckStyle: Allow System.exit() in main method. */
+ System.exit(1);
+ }
+ }
+
+}
Property changes on: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/ScriptsParser.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-12 18:25:24 UTC (rev 13656)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-13 13:19:59 UTC (rev 13657)
@@ -28,6 +28,9 @@
package org.foray.unicode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.time.LocalDate;
/**
@@ -35,6 +38,12 @@
*/
public abstract class UnicodeParser {
+ /** The logger. */
+ protected static final Logger LOGGER = LoggerFactory.getLogger(UnicodeParser.class);
+
+ /** The minimum size of generated hex strings, which is {@value}. Those smaller should be left-padded with zeros. */
+ protected static final int MIN_LENGTH_HEX_STRING = 4;
+
/** The end-of-line characters to be used. */
protected static final String EOL = System.lineSeparator();
@@ -124,4 +133,24 @@
return builder.toString();
}
+ /**
+ * Formats the input as a hex string, padding to a minimum of 4 characters, and prepending it with the "0x" hex
+ * identifier.
+ * @param theInteger The integer to be formatted.
+ * @return The formatted string.
+ */
+ protected String formatHexInteger(final long theInteger) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("0x");
+ final String hexString = Long.toHexString(theInteger).toUpperCase();
+
+ int padding = Math.max(0, (MIN_LENGTH_HEX_STRING - hexString.length()));
+ while (padding > 0) {
+ builder.append("0");
+ padding --;
+ }
+ builder.append(hexString);
+ return builder.toString();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-12 18:25:26
|
Revision: 13656
http://sourceforge.net/p/foray/code/13656
Author: victormote
Date: 2025-05-12 18:25:24 +0000 (Mon, 12 May 2025)
Log Message:
-----------
Extract some reusable code into new superclass.
Modified Paths:
--------------
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java
Added Paths:
-----------
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java 2025-05-12 18:08:50 UTC (rev 13655)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java 2025-05-12 18:25:24 UTC (rev 13656)
@@ -38,7 +38,6 @@
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
-import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
@@ -49,7 +48,7 @@
* java -cp ... UnicodeParser ./src/main/data/Unicode_13_0/UCD_zip "c:/Users/Victor Mote/desktop" "General Punctuation"
*
*/
-public class BlockParser {
+public class BlockParser extends UnicodeParser {
/** The logger. */
private static final Logger LOGGER = LoggerFactory.getLogger(BlockParser.class);
@@ -128,7 +127,7 @@
final File outFile = new File(outDir, className + ".java");
final String eol = System.lineSeparator();
try (Writer writer = new FileWriter(outFile)) {
- writer.write(classHeader());
+ writer.write(getClassHeader());
writer.write("package org.axsl.unicode.block;");
writer.write(eol);
writer.write(eol);
@@ -153,7 +152,7 @@
writer.write(eol);
writer.write(" /*");
writer.write(eol);
- writer.write(" * This class was generated by {@link org.foray.unicode.UnicodeParser}.");
+ writer.write(" * This class was generated by {@link org.foray.unicode.BlockParser}.");
writer.write(eol);
writer.write(" * If changes are needed, it will likely be better to regenerate than to change ");
writer.write("manually.");
@@ -208,20 +207,7 @@
}
/* The file footer. */
- writer.write(eol);
- writer.write(" /**");
- writer.write(eol);
- writer.write(" * Private constructor. This is a utility class and should never be instantiated.");
- writer.write(eol);
- writer.write(" */");
- writer.write(eol);
- writer.write(" private ");
- writer.write(className);
- writer.write("() { }");
- writer.write(eol);
- writer.write(eol);
- writer.write("}");
- writer.write(eol);
+ writer.write(getUtilityClassConstructor(className));
}
}
@@ -294,68 +280,7 @@
return new Block(name, startAsString, start, end);
}
- /**
- * Builds and returns the boilerplate content of the class header.
- * @return The content of the class header.
- */
- private String classHeader() {
- final String eol = System.lineSeparator();
- final StringBuilder builder = new StringBuilder();
- builder.append("/*");
- builder.append(eol);
- builder.append(" * Copyright ");
- builder.append(LocalDate.now().getYear());
- builder.append(" The aXSL Project.");
- builder.append(eol);
- builder.append(" * http://www.axsl.org");
- builder.append(eol);
- builder.append(" *");
- builder.append(eol);
- builder.append(" * Licensed under the Apache License, Version 2.0 (the \"License\");");
- builder.append(eol);
- builder.append(" * you may not use this file except in compliance with the License.");
- builder.append(eol);
- builder.append(" * You may obtain a copy of the License at");
- builder.append(eol);
- builder.append(" *");
- builder.append(eol);
- builder.append(" * http://www.apache.org/licenses/LICENSE-2.0");
- builder.append(eol);
- builder.append(" *");
- builder.append(eol);
- builder.append(" * Unless required by applicable law or agreed to in writing, software");
- builder.append(eol);
- builder.append(" * distributed under the License is distributed on an \"AS IS\" BASIS,");
- builder.append(eol);
- builder.append(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
- builder.append(eol);
- builder.append(" * See the License for the specific language governing permissions and");
- builder.append(eol);
- builder.append(" * limitations under the License.");
- builder.append(eol);
- builder.append(" */");
- builder.append(eol);
- builder.append(eol);
- builder.append("/*");
- builder.append(eol);
- /* These next items are keywords meaningful to Subversion. We break them up so that Subversion does not expand
- * them here. */
- builder.append(" * $Last");
- builder.append("ChangedRevision$");
- builder.append(eol);
- builder.append(" * $Last");
- builder.append("ChangedDate$");
- builder.append(eol);
- builder.append(" * $Last");
- builder.append("ChangedBy$");
- builder.append(eol);
- builder.append(" */");
- builder.append(eol);
- builder.append(eol);
- return builder.toString();
- }
-
/**
* Command-line interface.
* @param args The command-line arguments. There are two:
Added: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java (rev 0)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-12 18:25:24 UTC (rev 13656)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.unicode;
+
+import java.time.LocalDate;
+
+/**
+ * Superclass for parsers of Unicode data.
+ */
+public abstract class UnicodeParser {
+
+ /** The end-of-line characters to be used. */
+ protected static final String EOL = System.lineSeparator();
+
+ /**
+ * Builds and returns the boilerplate content of the class header.
+ * @return The content of the class header.
+ */
+ protected String getClassHeader() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("/*");
+ builder.append(EOL);
+ builder.append(" * Copyright ");
+ builder.append(LocalDate.now().getYear());
+ builder.append(" The aXSL Project.");
+ builder.append(EOL);
+ builder.append(" * http://www.axsl.org");
+ builder.append(EOL);
+ builder.append(" *");
+ builder.append(EOL);
+ builder.append(" * Licensed under the Apache License, Version 2.0 (the \"License\");");
+ builder.append(EOL);
+ builder.append(" * you may not use this file except in compliance with the License.");
+ builder.append(EOL);
+ builder.append(" * You may obtain a copy of the License at");
+ builder.append(EOL);
+ builder.append(" *");
+ builder.append(EOL);
+ builder.append(" * http://www.apache.org/licenses/LICENSE-2.0");
+ builder.append(EOL);
+ builder.append(" *");
+ builder.append(EOL);
+ builder.append(" * Unless required by applicable law or agreed to in writing, software");
+ builder.append(EOL);
+ builder.append(" * distributed under the License is distributed on an \"AS IS\" BASIS,");
+ builder.append(EOL);
+ builder.append(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
+ builder.append(EOL);
+ builder.append(" * See the License for the specific language governing permissions and");
+ builder.append(EOL);
+ builder.append(" * limitations under the License.");
+ builder.append(EOL);
+ builder.append(" */");
+ builder.append(EOL);
+ builder.append(EOL);
+ builder.append("/*");
+ builder.append(EOL);
+ /* These next items are keywords meaningful to Subversion. We break them up so that Subversion does not expand
+ * them here. */
+ builder.append(" * $Last");
+ builder.append("ChangedRevision$");
+ builder.append(EOL);
+ builder.append(" * $Last");
+ builder.append("ChangedDate$");
+ builder.append(EOL);
+ builder.append(" * $Last");
+ builder.append("ChangedBy$");
+ builder.append(EOL);
+ builder.append(" */");
+ builder.append(EOL);
+ builder.append(EOL);
+
+ return builder.toString();
+ }
+
+ /**
+ * Returns the standard utility class constructor.
+ * @param className The name of the class for which constructor is being created.
+ * @return The standard utility class constructor, or {@code className}.
+ */
+ protected String getUtilityClassConstructor(final String className) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(EOL);
+ builder.append(" /**");
+ builder.append(EOL);
+ builder.append(" * Private constructor. This is a utility class and should never be instantiated.");
+ builder.append(EOL);
+ builder.append(" */");
+ builder.append(EOL);
+ builder.append(" private ");
+ builder.append(className);
+ builder.append("() { }");
+ builder.append(EOL);
+ builder.append(EOL);
+ builder.append("}");
+ builder.append(EOL);
+
+ return builder.toString();
+ }
+
+}
Property changes on: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-12 18:08:52
|
Revision: 13655
http://sourceforge.net/p/foray/code/13655
Author: victormote
Date: 2025-05-12 18:08:50 +0000 (Mon, 12 May 2025)
Log Message:
-----------
Rename class in preparation for a superclass of the previous name.
Added Paths:
-----------
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java
Removed Paths:
-------------
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
Copied: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java (from rev 13649, trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java)
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java (rev 0)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/BlockParser.java 2025-05-12 18:08:50 UTC (rev 13655)
@@ -0,0 +1,388 @@
+/*
+ * Copyright 2021 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.unicode;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.time.LocalDate;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Parser that reads the raw Unicode files that we care about and generates Java source code files.
+ * Since the Unicode source files are stored as data in this project, the following command-line example may be
+ * helpful:
+ * java -cp ... UnicodeParser ./src/main/data/Unicode_13_0/UCD_zip "c:/Users/Victor Mote/desktop" "General Punctuation"
+ *
+ */
+public class BlockParser {
+
+ /** The logger. */
+ private static final Logger LOGGER = LoggerFactory.getLogger(BlockParser.class);
+
+ /** The minimum size of generated hex strings, which is {@value}. Those smaller should be left-padded with zeros. */
+ private static final int MIN_LENGTH_HEX_STRING = 4;
+
+ /** The directory containing the Unicode source files. */
+ private File unicodeDir;
+
+ /** The directory into which the generated source code should be created. */
+ private File outputDir;
+
+ /** The list of blocks for which source code should be created. */
+ private List<String> blocksToProcess;
+
+ /** The Unicode code blocks. */
+ private Blocks blocks = new Blocks();
+
+ /**
+ * Constructor.
+ * @param unicodeDir The directory containing the Unicode source files.
+ * @param outputDir The directory into which the generated source code should be created.
+ * @param blocksToProcess The list of blocks for which source code should be created.
+ */
+ public BlockParser(final File unicodeDir, final File outputDir, final List<String> blocksToProcess) {
+ if (! unicodeDir.isDirectory()) {
+ throw new IllegalArgumentException("unicodeDir must be a directory");
+ }
+ if (! outputDir.isDirectory()) {
+ throw new IllegalArgumentException("outputDir must be a directory");
+ }
+ this.unicodeDir = unicodeDir;
+ this.outputDir = outputDir;
+ this.blocksToProcess = blocksToProcess;
+ }
+
+ /**
+ * Parse the requested data.
+ * @throws IOException For errors reading the input or writing the output.
+ */
+ public void process() throws IOException {
+ parseBlocks(unicodeDir);
+ parseCodePoints(unicodeDir);
+ for (String blockToProcess : this.blocksToProcess) {
+ final Block block = this.blocks.forName(blockToProcess);
+ if (block == null) {
+ LOGGER.error("Block not found for name: " + blockToProcess);
+ } else {
+ createClass(block);
+ }
+ }
+ }
+
+ /**
+ * Writes the Java class for a given code block.
+ * @param block The Unicode code block for which a Java class should be written.
+ */
+ private void createClass(final Block block) throws IOException {
+ File outDir = new File(this.outputDir, "org/");
+ outDir.mkdir();
+ outDir = new File(outDir, "axsl/");
+ outDir.mkdir();
+ outDir = new File(outDir, "unicode/");
+ outDir.mkdir();
+ outDir = new File(outDir, "block/");
+ outDir.mkdir();
+ final String className;
+ if (block.getStart() < Character.MAX_VALUE) {
+ /* Only use four hex characters for the basic plane. */
+ className = "U" + block.getStartAsString() + "_" + block.getJavaName();
+ } else {
+ /* Keep the blocks with more than four hex characters sorted by prepending "X" instead of "U". */
+ className = "X" + block.getStartAsString() + "_" + block.getJavaName();
+ }
+ final File outFile = new File(outDir, className + ".java");
+ final String eol = System.lineSeparator();
+ try (Writer writer = new FileWriter(outFile)) {
+ writer.write(classHeader());
+ writer.write("package org.axsl.unicode.block;");
+ writer.write(eol);
+ writer.write(eol);
+ writer.write("/**");
+ writer.write(eol);
+ writer.write(" * Unicode(r) code points for the \"");
+ writer.write(block.getName());
+ writer.write("\" block (0x");
+ writer.write(Integer.toHexString(block.getStart()));
+ writer.write(" thru 0x");
+ writer.write(Integer.toHexString(block.getEnd()));
+ writer.write(").");
+ writer.write(eol);
+ writer.write(" * See package documentation for links to the Unicode(r) license and terms of use.");
+ writer.write(eol);
+ writer.write(" */");
+ writer.write(eol);
+ writer.write("public final class ");
+ writer.write(className);
+ writer.write(" {");
+ writer.write(eol);
+ writer.write(eol);
+ writer.write(" /*");
+ writer.write(eol);
+ writer.write(" * This class was generated by {@link org.foray.unicode.UnicodeParser}.");
+ writer.write(eol);
+ writer.write(" * If changes are needed, it will likely be better to regenerate than to change ");
+ writer.write("manually.");
+ writer.write(eol);
+ writer.write(" */");
+ writer.write(eol);
+ writer.write(eol);
+
+ final String type = block.getSmallestIndexType();
+ if (block.getEnd() <= Byte.MAX_VALUE) {
+ writer.write(" /*");
+ writer.write(eol);
+ writer.write(" * Since all code points in this block can be contained in one byte, ");
+ writer.write("it is tempting to use byte as the type for");
+ writer.write(eol);
+ writer.write(" * them. However, byte is a numeric type, which causes some String-building ");
+ writer.write("methods to treat it is a number,");
+ writer.write(eol);
+ writer.write(" * resulting in the numeric value being included in the string instead ");
+ writer.write("of the char value: for example \"32\" instead");
+ writer.write(eol);
+ writer.write(" * of \" \".");
+ writer.write(eol);
+ writer.write(" */");
+ writer.write(eol);
+ writer.write(eol);
+ }
+
+
+ /* CodePoints are already sorted. */
+ for (CodePoint cp : block.getCodePoints()) {
+ writer.write(" public static final ");
+ writer.write(type);
+ writer.write(" ");
+ final String javaName = cp.getJavaName();
+ writer.write(javaName);
+ int padding = block.getLengthLongestJavaName() - javaName.length();
+ while (padding > 0) {
+ writer.write(" ");
+ padding --;
+ }
+ writer.write(" = 0x");
+ final String hexString = Integer.toHexString(cp.getValue());
+ padding = MIN_LENGTH_HEX_STRING - hexString.length();
+ while (padding > 0) {
+ writer.write("0");
+ padding --;
+ }
+ writer.write(hexString);
+ writer.write(";");
+ writer.write(eol);
+ }
+
+ /* The file footer. */
+ writer.write(eol);
+ writer.write(" /**");
+ writer.write(eol);
+ writer.write(" * Private constructor. This is a utility class and should never be instantiated.");
+ writer.write(eol);
+ writer.write(" */");
+ writer.write(eol);
+ writer.write(" private ");
+ writer.write(className);
+ writer.write("() { }");
+ writer.write(eol);
+ writer.write(eol);
+ writer.write("}");
+ writer.write(eol);
+ }
+ }
+
+ /**
+ * Parses the code points from the UnicodeData.txt file.
+ * @param unicodeDir The directory where the UnicodeData.txt file is located.
+ * @throws IOException For errors finding, opening, or reading the UnicodeData.txt file.
+ */
+ private void parseCodePoints(final File unicodeDir) throws IOException {
+ int codePointLinesRead = 0;
+ final File unicodeDataFile = new File(unicodeDir, "UnicodeData.txt");
+ try (Reader reader = new FileReader(unicodeDataFile);
+ BufferedReader br = new BufferedReader(reader);) {
+ String line;
+ while ((line = br.readLine()) != null) {
+ codePointLinesRead ++;
+ /* Example: 000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;; */
+ final String[] fields = line.split(";");
+ final CodePoint cp = new CodePoint(fields);
+ if (cp != null) {
+ final Block block = this.blocks.forCodePoint(cp.getValue());
+ if (this.blocksToProcess.contains(block.getName())) {
+ block.addCodePoint(cp);
+ }
+ }
+ }
+ }
+ LOGGER.info("Count of CodePoints read: " + codePointLinesRead);
+ }
+
+ /**
+ * Parses the blocks from the Blocks.txt file.
+ * @param unicodeDir The directory where the Blocks.txt file is located.
+ * @throws IOException For errors finding, opening, or reading the Blocks.txt file.
+ */
+ private void parseBlocks(final File unicodeDir) throws IOException {
+ final File blocksFile = new File(unicodeDir, "Blocks.txt");
+ try (Reader reader = new FileReader(blocksFile);
+ BufferedReader br = new BufferedReader(reader);) {
+ String line;
+ while ((line = br.readLine()) != null) {
+ if (line.length() < 1) {
+ continue;
+ }
+ if (line.startsWith("#")) {
+ continue;
+ }
+ final Block newBlock = parseBlock(line);
+ this.blocks.addBlock(newBlock);
+ }
+ }
+ }
+
+ /**
+ * Parses a single Unicode block from a line of the Blocks.txt file.
+ * @param line The line from Block.txt to be parsed as a code block.
+ * @return The parsed block.
+ */
+ private Block parseBlock(final String line) {
+ final String[] split1 = line.split("; ");
+ final String range = split1[0];
+ final String name = split1[1];
+
+ final String[] split2 = range.split("\\.\\.");
+ final String startAsString = split2[0];
+ final String endAsString = split2[1];
+ final int start = Integer.parseInt(startAsString, 16);
+ final int end = Integer.parseInt(endAsString, 16);
+
+ return new Block(name, startAsString, start, end);
+ }
+
+ /**
+ * Builds and returns the boilerplate content of the class header.
+ * @return The content of the class header.
+ */
+ private String classHeader() {
+ final String eol = System.lineSeparator();
+ final StringBuilder builder = new StringBuilder();
+ builder.append("/*");
+ builder.append(eol);
+ builder.append(" * Copyright ");
+ builder.append(LocalDate.now().getYear());
+ builder.append(" The aXSL Project.");
+ builder.append(eol);
+ builder.append(" * http://www.axsl.org");
+ builder.append(eol);
+ builder.append(" *");
+ builder.append(eol);
+ builder.append(" * Licensed under the Apache License, Version 2.0 (the \"License\");");
+ builder.append(eol);
+ builder.append(" * you may not use this file except in compliance with the License.");
+ builder.append(eol);
+ builder.append(" * You may obtain a copy of the License at");
+ builder.append(eol);
+ builder.append(" *");
+ builder.append(eol);
+ builder.append(" * http://www.apache.org/licenses/LICENSE-2.0");
+ builder.append(eol);
+ builder.append(" *");
+ builder.append(eol);
+ builder.append(" * Unless required by applicable law or agreed to in writing, software");
+ builder.append(eol);
+ builder.append(" * distributed under the License is distributed on an \"AS IS\" BASIS,");
+ builder.append(eol);
+ builder.append(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
+ builder.append(eol);
+ builder.append(" * See the License for the specific language governing permissions and");
+ builder.append(eol);
+ builder.append(" * limitations under the License.");
+ builder.append(eol);
+ builder.append(" */");
+ builder.append(eol);
+ builder.append(eol);
+ builder.append("/*");
+ builder.append(eol);
+ /* These next items are keywords meaningful to Subversion. We break them up so that Subversion does not expand
+ * them here. */
+ builder.append(" * $Last");
+ builder.append("ChangedRevision$");
+ builder.append(eol);
+ builder.append(" * $Last");
+ builder.append("ChangedDate$");
+ builder.append(eol);
+ builder.append(" * $Last");
+ builder.append("ChangedBy$");
+ builder.append(eol);
+ builder.append(" */");
+ builder.append(eol);
+ builder.append(eol);
+
+ return builder.toString();
+ }
+
+ /**
+ * Command-line interface.
+ * @param args The command-line arguments. There are two:
+ * <ol>
+ * <li>The directory containing the raw Unicode files.</li>
+ * <li>The directory into which the generated source code should be written.</li>
+ * <li>Comma-delimited list of the code blocks to be generated. These code blocks must match those listed in
+ * Blocks.txt in the Unicode distribution.
+ * </ol>
+ */
+ public static void main(final String[] args) {
+ final String unicodeDirArg = args[0];
+ final String outputDirArg = args[1];
+ final String blocksArg = args[2];
+
+ final File unicodeDir = new File(unicodeDirArg);
+ final File outputDir = new File(outputDirArg);
+ final List<String> blocks = Arrays.asList(blocksArg.split(","));
+
+ final BlockParser parser = new BlockParser(unicodeDir, outputDir, blocks);
+ try {
+ parser.process();
+ } catch (final IOException e) {
+ LOGGER.error("Error parsing Unicode data.", e);
+ /* CheckStyle: Allow System.exit() in main method. */
+ System.exit(1);
+ }
+ }
+
+}
Deleted: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-12 12:51:09 UTC (rev 13654)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2025-05-12 18:08:50 UTC (rev 13655)
@@ -1,388 +0,0 @@
-/*
- * Copyright 2021 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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.unicode;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.time.LocalDate;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Parser that reads the raw Unicode files that we care about and generates Java source code files.
- * Since the Unicode source files are stored as data in this project, the following command-line example may be
- * helpful:
- * java -cp ... UnicodeParser ./src/main/data/Unicode_13_0/UCD_zip "c:/Users/Victor Mote/desktop" "General Punctuation"
- *
- */
-public class UnicodeParser {
-
- /** The logger. */
- private static final Logger LOGGER = LoggerFactory.getLogger(UnicodeParser.class);
-
- /** The minimum size of generated hex strings, which is {@value}. Those smaller should be left-padded with zeros. */
- private static final int MIN_LENGTH_HEX_STRING = 4;
-
- /** The directory containing the Unicode source files. */
- private File unicodeDir;
-
- /** The directory into which the generated source code should be created. */
- private File outputDir;
-
- /** The list of blocks for which source code should be created. */
- private List<String> blocksToProcess;
-
- /** The Unicode code blocks. */
- private Blocks blocks = new Blocks();
-
- /**
- * Constructor.
- * @param unicodeDir The directory containing the Unicode source files.
- * @param outputDir The directory into which the generated source code should be created.
- * @param blocksToProcess The list of blocks for which source code should be created.
- */
- public UnicodeParser(final File unicodeDir, final File outputDir, final List<String> blocksToProcess) {
- if (! unicodeDir.isDirectory()) {
- throw new IllegalArgumentException("unicodeDir must be a directory");
- }
- if (! outputDir.isDirectory()) {
- throw new IllegalArgumentException("outputDir must be a directory");
- }
- this.unicodeDir = unicodeDir;
- this.outputDir = outputDir;
- this.blocksToProcess = blocksToProcess;
- }
-
- /**
- * Parse the requested data.
- * @throws IOException For errors reading the input or writing the output.
- */
- public void process() throws IOException {
- parseBlocks(unicodeDir);
- parseCodePoints(unicodeDir);
- for (String blockToProcess : this.blocksToProcess) {
- final Block block = this.blocks.forName(blockToProcess);
- if (block == null) {
- LOGGER.error("Block not found for name: " + blockToProcess);
- } else {
- createClass(block);
- }
- }
- }
-
- /**
- * Writes the Java class for a given code block.
- * @param block The Unicode code block for which a Java class should be written.
- */
- private void createClass(final Block block) throws IOException {
- File outDir = new File(this.outputDir, "org/");
- outDir.mkdir();
- outDir = new File(outDir, "axsl/");
- outDir.mkdir();
- outDir = new File(outDir, "unicode/");
- outDir.mkdir();
- outDir = new File(outDir, "block/");
- outDir.mkdir();
- final String className;
- if (block.getStart() < Character.MAX_VALUE) {
- /* Only use four hex characters for the basic plane. */
- className = "U" + block.getStartAsString() + "_" + block.getJavaName();
- } else {
- /* Keep the blocks with more than four hex characters sorted by prepending "X" instead of "U". */
- className = "X" + block.getStartAsString() + "_" + block.getJavaName();
- }
- final File outFile = new File(outDir, className + ".java");
- final String eol = System.lineSeparator();
- try (Writer writer = new FileWriter(outFile)) {
- writer.write(classHeader());
- writer.write("package org.axsl.unicode.block;");
- writer.write(eol);
- writer.write(eol);
- writer.write("/**");
- writer.write(eol);
- writer.write(" * Unicode(r) code points for the \"");
- writer.write(block.getName());
- writer.write("\" block (0x");
- writer.write(Integer.toHexString(block.getStart()));
- writer.write(" thru 0x");
- writer.write(Integer.toHexString(block.getEnd()));
- writer.write(").");
- writer.write(eol);
- writer.write(" * See package documentation for links to the Unicode(r) license and terms of use.");
- writer.write(eol);
- writer.write(" */");
- writer.write(eol);
- writer.write("public final class ");
- writer.write(className);
- writer.write(" {");
- writer.write(eol);
- writer.write(eol);
- writer.write(" /*");
- writer.write(eol);
- writer.write(" * This class was generated by {@link org.foray.unicode.UnicodeParser}.");
- writer.write(eol);
- writer.write(" * If changes are needed, it will likely be better to regenerate than to change ");
- writer.write("manually.");
- writer.write(eol);
- writer.write(" */");
- writer.write(eol);
- writer.write(eol);
-
- final String type = block.getSmallestIndexType();
- if (block.getEnd() <= Byte.MAX_VALUE) {
- writer.write(" /*");
- writer.write(eol);
- writer.write(" * Since all code points in this block can be contained in one byte, ");
- writer.write("it is tempting to use byte as the type for");
- writer.write(eol);
- writer.write(" * them. However, byte is a numeric type, which causes some String-building ");
- writer.write("methods to treat it is a number,");
- writer.write(eol);
- writer.write(" * resulting in the numeric value being included in the string instead ");
- writer.write("of the char value: for example \"32\" instead");
- writer.write(eol);
- writer.write(" * of \" \".");
- writer.write(eol);
- writer.write(" */");
- writer.write(eol);
- writer.write(eol);
- }
-
-
- /* CodePoints are already sorted. */
- for (CodePoint cp : block.getCodePoints()) {
- writer.write(" public static final ");
- writer.write(type);
- writer.write(" ");
- final String javaName = cp.getJavaName();
- writer.write(javaName);
- int padding = block.getLengthLongestJavaName() - javaName.length();
- while (padding > 0) {
- writer.write(" ");
- padding --;
- }
- writer.write(" = 0x");
- final String hexString = Integer.toHexString(cp.getValue());
- padding = MIN_LENGTH_HEX_STRING - hexString.length();
- while (padding > 0) {
- writer.write("0");
- padding --;
- }
- writer.write(hexString);
- writer.write(";");
- writer.write(eol);
- }
-
- /* The file footer. */
- writer.write(eol);
- writer.write(" /**");
- writer.write(eol);
- writer.write(" * Private constructor. This is a utility class and should never be instantiated.");
- writer.write(eol);
- writer.write(" */");
- writer.write(eol);
- writer.write(" private ");
- writer.write(className);
- writer.write("() { }");
- writer.write(eol);
- writer.write(eol);
- writer.write("}");
- writer.write(eol);
- }
- }
-
- /**
- * Parses the code points from the UnicodeData.txt file.
- * @param unicodeDir The directory where the UnicodeData.txt file is located.
- * @throws IOException For errors finding, opening, or reading the UnicodeData.txt file.
- */
- private void parseCodePoints(final File unicodeDir) throws IOException {
- int codePointLinesRead = 0;
- final File unicodeDataFile = new File(unicodeDir, "UnicodeData.txt");
- try (Reader reader = new FileReader(unicodeDataFile);
- BufferedReader br = new BufferedReader(reader);) {
- String line;
- while ((line = br.readLine()) != null) {
- codePointLinesRead ++;
- /* Example: 000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;; */
- final String[] fields = line.split(";");
- final CodePoint cp = new CodePoint(fields);
- if (cp != null) {
- final Block block = this.blocks.forCodePoint(cp.getValue());
- if (this.blocksToProcess.contains(block.getName())) {
- block.addCodePoint(cp);
- }
- }
- }
- }
- LOGGER.info("Count of CodePoints read: " + codePointLinesRead);
- }
-
- /**
- * Parses the blocks from the Blocks.txt file.
- * @param unicodeDir The directory where the Blocks.txt file is located.
- * @throws IOException For errors finding, opening, or reading the Blocks.txt file.
- */
- private void parseBlocks(final File unicodeDir) throws IOException {
- final File blocksFile = new File(unicodeDir, "Blocks.txt");
- try (Reader reader = new FileReader(blocksFile);
- BufferedReader br = new BufferedReader(reader);) {
- String line;
- while ((line = br.readLine()) != null) {
- if (line.length() < 1) {
- continue;
- }
- if (line.startsWith("#")) {
- continue;
- }
- final Block newBlock = parseBlock(line);
- this.blocks.addBlock(newBlock);
- }
- }
- }
-
- /**
- * Parses a single Unicode block from a line of the Blocks.txt file.
- * @param line The line from Block.txt to be parsed as a code block.
- * @return The parsed block.
- */
- private Block parseBlock(final String line) {
- final String[] split1 = line.split("; ");
- final String range = split1[0];
- final String name = split1[1];
-
- final String[] split2 = range.split("\\.\\.");
- final String startAsString = split2[0];
- final String endAsString = split2[1];
- final int start = Integer.parseInt(startAsString, 16);
- final int end = Integer.parseInt(endAsString, 16);
-
- return new Block(name, startAsString, start, end);
- }
-
- /**
- * Builds and returns the boilerplate content of the class header.
- * @return The content of the class header.
- */
- private String classHeader() {
- final String eol = System.lineSeparator();
- final StringBuilder builder = new StringBuilder();
- builder.append("/*");
- builder.append(eol);
- builder.append(" * Copyright ");
- builder.append(LocalDate.now().getYear());
- builder.append(" The aXSL Project.");
- builder.append(eol);
- builder.append(" * http://www.axsl.org");
- builder.append(eol);
- builder.append(" *");
- builder.append(eol);
- builder.append(" * Licensed under the Apache License, Version 2.0 (the \"License\");");
- builder.append(eol);
- builder.append(" * you may not use this file except in compliance with the License.");
- builder.append(eol);
- builder.append(" * You may obtain a copy of the License at");
- builder.append(eol);
- builder.append(" *");
- builder.append(eol);
- builder.append(" * http://www.apache.org/licenses/LICENSE-2.0");
- builder.append(eol);
- builder.append(" *");
- builder.append(eol);
- builder.append(" * Unless required by applicable law or agreed to in writing, software");
- builder.append(eol);
- builder.append(" * distributed under the License is distributed on an \"AS IS\" BASIS,");
- builder.append(eol);
- builder.append(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
- builder.append(eol);
- builder.append(" * See the License for the specific language governing permissions and");
- builder.append(eol);
- builder.append(" * limitations under the License.");
- builder.append(eol);
- builder.append(" */");
- builder.append(eol);
- builder.append(eol);
- builder.append("/*");
- builder.append(eol);
- /* These next items are keywords meaningful to Subversion. We break them up so that Subversion does not expand
- * them here. */
- builder.append(" * $Last");
- builder.append("ChangedRevision$");
- builder.append(eol);
- builder.append(" * $Last");
- builder.append("ChangedDate$");
- builder.append(eol);
- builder.append(" * $Last");
- builder.append("ChangedBy$");
- builder.append(eol);
- builder.append(" */");
- builder.append(eol);
- builder.append(eol);
-
- return builder.toString();
- }
-
- /**
- * Command-line interface.
- * @param args The command-line arguments. There are two:
- * <ol>
- * <li>The directory containing the raw Unicode files.</li>
- * <li>The directory into which the generated source code should be written.</li>
- * <li>Comma-delimited list of the code blocks to be generated. These code blocks must match those listed in
- * Blocks.txt in the Unicode distribution.
- * </ol>
- */
- public static void main(final String[] args) {
- final String unicodeDirArg = args[0];
- final String outputDirArg = args[1];
- final String blocksArg = args[2];
-
- final File unicodeDir = new File(unicodeDirArg);
- final File outputDir = new File(outputDirArg);
- final List<String> blocks = Arrays.asList(blocksArg.split(","));
-
- final UnicodeParser parser = new UnicodeParser(unicodeDir, outputDir, blocks);
- try {
- parser.process();
- } catch (final IOException e) {
- LOGGER.error("Error parsing Unicode data.", e);
- /* CheckStyle: Allow System.exit() in main method. */
- System.exit(1);
- }
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-05-12 12:51:14
|
Revision: 13654
http://sourceforge.net/p/foray/code/13654
Author: victormote
Date: 2025-05-12 12:51:09 +0000 (Mon, 12 May 2025)
Log Message:
-----------
Move two helper classes to the general ttf package.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java
trunk/foray/foray-font/src/main/java/org/foray/font/format/FontParser.java
trunk/foray/foray-font/src/main/java/org/foray/font/ttf/TrueTypeCollection.java
trunk/foray/foray-font/src/main/java/org/foray/font/ttf/TtfSubSetFile.java
trunk/foray/foray-font/src/main/java/org/foray/font/ttf/table/CoverageTable.java
trunk/foray/foray-font/src/test/java/org/foray/font/ttf/TrueTypeCollectionParserTests.java
trunk/foray/foray-font/src/test/java/org/foray/font/ttf/TrueTypeFontParserTests.java
trunk/foray/foray-font/src/test/java/org/foray/font/ttf/table/OtfLookupGsubTests.java
trunk/foray/foray-font/src/test/java/org/foray/font/type1/Type1FontParserPfaTests.java
trunk/foray/foray-font/src/test/java/org/foray/font/type1/Type1FontParserPfbTests.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseAxisTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseCoordTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseMinMaxTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseScriptTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseValuesTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cff2TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CffTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap00TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap04TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap06TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap12TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CmapTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Coverage01TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Coverage02TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CoverageTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CvtTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/DeviceTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureListTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureVariationsTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FpgmTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GaspTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GdefTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GlyfTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GposTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup01x01Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup01x02Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup02x01Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup03x01Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup04x01Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x01Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x02Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x03Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x01Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x02Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x03Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup07x01Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup08x01Parser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/HeadTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/HheaTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/HmtxTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/JstfTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Kern00TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Kern02TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/KernTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/LangSysTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/LocaTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/LookupListTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/LookupTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/MathTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/MaxpTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/MetaTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/NameTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Os2TableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/PcltTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/PostTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/PrepTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/ScriptListTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/ScriptTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/TableDirectoryParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/TrueTypeFontParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/TtcHeaderParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/VariationIndexTableParser.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/VorgTableParser.java
Added Paths:
-----------
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/TtfDataType.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/TtfRandomAccessInput.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/package-info.java
Removed Paths:
-------------
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/TtfRandomAccessInput.java
trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/TtfType.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -39,7 +39,7 @@
import org.foray.font.format.FontParserClient;
import org.foray.font.format.Panose4a;
import org.foray.font.type1.Type1MetricsParser;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.primitive.sequence.ByteArray;
import org.axsl.font.Font;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/format/FontParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/FontParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/FontParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -34,7 +34,7 @@
import org.foray.font.type1.Type1FontParser;
import org.foray.font.type1.Type1FontParserPfa;
import org.foray.font.type1.Type1FontParserPfb;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.axsl.font.Font;
import org.axsl.font.FontException;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/ttf/TrueTypeCollection.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/ttf/TrueTypeCollection.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ttf/TrueTypeCollection.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -31,6 +31,7 @@
import org.foray.font.format.FontParser;
import org.foray.font.ttf.table.NameTable;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.NameTableHandler;
import org.foray.fontParse.ttf.handler.TrueTypeFontHandler;
import org.foray.fontParse.ttf.handler.TtcHeaderHandler;
@@ -37,7 +38,6 @@
import org.foray.fontParse.ttf.parser.NameTableParser;
import org.foray.fontParse.ttf.parser.TrueTypeFontParser;
import org.foray.fontParse.ttf.parser.TtcHeaderParser;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
import org.axsl.font.FontException;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/ttf/TtfSubSetFile.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/ttf/TtfSubSetFile.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ttf/TtfSubSetFile.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -34,7 +34,7 @@
import org.foray.font.ttf.table.HeadTable;
import org.foray.font.ttf.table.HmtxTable;
import org.foray.font.ttf.table.LocaTable;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.axsl.constants.PrimitiveConstants;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/ttf/table/CoverageTable.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/ttf/table/CoverageTable.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ttf/table/CoverageTable.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -30,11 +30,11 @@
import org.foray.font.ttf.ParserKit;
import org.foray.font.ttf.RoTable;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Coverage01TableHandler;
import org.foray.fontParse.ttf.handler.Coverage02TableHandler;
import org.foray.fontParse.ttf.parser.Coverage01TableParser;
import org.foray.fontParse.ttf.parser.Coverage02TableParser;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
import java.io.IOException;
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/ttf/TrueTypeCollectionParserTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/ttf/TrueTypeCollectionParserTests.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/ttf/TrueTypeCollectionParserTests.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -31,7 +31,7 @@
import org.foray.font.FontServer4a;
import org.foray.font.format.FontContent;
import org.foray.font.format.FontParser;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.axsl.font.FontException;
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/ttf/TrueTypeFontParserTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/ttf/TrueTypeFontParserTests.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/ttf/TrueTypeFontParserTests.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -42,7 +42,7 @@
import org.foray.font.ttf.table.Cmap06Table;
import org.foray.font.ttf.table.Cmap12Table;
import org.foray.font.ttf.table.CmapTable;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.axsl.font.FontException;
import org.axsl.ps.BoundingBox;
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/ttf/table/OtfLookupGsubTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/ttf/table/OtfLookupGsubTests.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/ttf/table/OtfLookupGsubTests.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -36,8 +36,8 @@
import org.foray.font.ttf.TrueTypeSingle;
import org.foray.font.ttf.table.GsubLookup04x01.Ligature;
import org.foray.font.ttf.table.GsubLookup04x01.LigatureSet;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.parser.LookupTableParser;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
import org.foray.primitive.sequence.IntArrayBuilder;
import org.axsl.font.FontContext;
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/type1/Type1FontParserPfaTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/type1/Type1FontParserPfaTests.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/type1/Type1FontParserPfaTests.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -30,7 +30,7 @@
import org.foray.font.FontServer4a;
import org.foray.font.format.FontParser;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.axsl.font.FontException;
import org.axsl.ps.BoundingBox;
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/type1/Type1FontParserPfbTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/type1/Type1FontParserPfbTests.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/type1/Type1FontParserPfbTests.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -30,7 +30,7 @@
import org.foray.font.FontServer4a;
import org.foray.font.format.FontParser;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.axsl.font.FontException;
import org.axsl.ps.BoundingBox;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/TableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/TableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/TableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -28,7 +28,7 @@
package org.foray.fontParse;
-import org.foray.fontParse.ttf.parser.TtfRandomAccessInput;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import java.io.IOException;
Copied: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/TtfDataType.java (from rev 13650, trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/TtfType.java)
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/TtfDataType.java (rev 0)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/TtfDataType.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fontParse.ttf;
+
+/**
+ * Enumeration of data types used in TrueType fonts.
+ * @see <a href="https://learn.microsoft.com/en-us/typography/opentype/spec/otff#data-types">The OpenType Font File,
+ * Data Types</a>
+ */
+public enum TtfDataType {
+
+ /** 8-bit unsigned integer. */
+ uint8(1),
+
+ /** 8-bit signed integer. */
+ int8(1),
+
+ /** 16-bit unsigned integer. */
+ uint16(2),
+
+ /** 16-bit signed integer. */
+ int16(2),
+
+ /** 24-bit unsigned integer. */
+ uint24(3),
+
+ /** 32-bit unsigned integer. */
+ uint32(4),
+
+ /** 32-bit signed integer. */
+ int32(4),
+
+ /** 32-bit signed fixed-point number (16.16). */
+ Fixed(4),
+
+ /** int16 that describes a quantity in font design units. */
+ FWORD(2),
+
+ /** uint16 that describes a quantity in font design units. */
+ UFWORD(2),
+
+ /** 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
+ F2DOT14(2),
+
+ /** Date and time represented in number of seconds since 12:00 midnight, January 1, 1904, UTC.
+ * The value is represented as a signed 64-bit integer.*/
+ LONGDATETIME(8),
+
+ /** Array of four uint8s (length = 32 bits) used to identify a table, design-variationaxis, script, language
+ * system, feature, or baseline.*/
+ Tag(4),
+
+ /** 8-bit offset to a table, same as uint8, NULL offset = 0x00. */
+ Offset8(1),
+
+ /** Short offset to a table, same as uint16, NULL offset = 0x0000. */
+ Offset16(2),
+
+ /** 24-bit offset to a table, same as uint24, NULL offset = 0x000000. */
+ Offset24(3),
+
+ /** Long offset to a table, same as uint32, NULL offset = 0x00000000. */
+ Offset32(4),
+
+ /** Packed 32-bit value with major and minor version numbers. */
+ Version16Dot16(4);
+
+
+ /** The number of bytes consumed by this type. */
+ private byte qtyBytes;
+
+ /**
+ * Constructor.
+ * @param qtyBytes The number of bytes consumed by this type.
+ */
+ TtfDataType(final int qtyBytes) {
+ this.qtyBytes = (byte) qtyBytes;
+ }
+
+ /**
+ * Returns the number of bytes consumed by this type.
+ * @return The number of bytes consumed by this type.
+ */
+ public byte getQtyBytes() {
+ return this.qtyBytes;
+ }
+
+}
Copied: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/TtfRandomAccessInput.java (from rev 13650, trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/TtfRandomAccessInput.java)
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/TtfRandomAccessInput.java (rev 0)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/TtfRandomAccessInput.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fontParse.ttf;
+
+import org.foray.common.RandomAccessInput;
+import org.foray.common.sequence.ByteSequenceParser;
+
+import org.axsl.primitive.sequence.ByteSequencePlus;
+
+import org.checkerframework.checker.signedness.qual.Unsigned;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
+
+/**
+ * A parser that includes methods specialized for parsing TrueType fonts.
+ */
+public interface TtfRandomAccessInput extends RandomAccessInput {
+
+ /**
+ * Simple implementation.
+ */
+ class Impl extends ByteSequenceParser implements TtfRandomAccessInput {
+
+ /**
+ * Constructor.
+ * @param sequence The sequence being wrapped.
+ */
+ public Impl(final ByteSequencePlus sequence) {
+ super(sequence);
+ }
+
+ /**
+ * Constructor for an {@link InputStream} instance.
+ * Reads the content of {@code inputStream} into the parser, then closes it.
+ * @param inputStream The {@link InputStream} whose content should be captured as a byte sequence.
+ * @throws IOException For errors reading or closing the input stream.
+ */
+ public Impl(final InputStream inputStream) throws IOException {
+ super(inputStream);
+ }
+
+ }
+
+
+ /* Checkstyle: Suppress method name checking when matching low-level type names. */
+
+
+
+
+ /**
+ * Parses a TrueType "uint8" field (1 byte, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned byte read_uint8() throws IOException {
+ return (byte) readUnsignedByte();
+ }
+
+ /**
+ * Parses a TrueType "int8" field (1 byte, signed).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default byte read_int8() throws IOException {
+ return readByte();
+ }
+
+ /**
+ * Parses a TrueType "uint16" field (2 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned short read_uint16() throws IOException {
+ return (short) readUnsignedShort();
+ }
+
+ /**
+ * Parses a TrueType "int16" field (2 bytes, signed).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default short read_int16() throws IOException {
+ return readShort();
+ }
+
+ /**
+ * Parses a TrueType "uint24" field (3 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned int read_uint24() throws IOException {
+ final long parsed = this.readLong(TtfDataType.uint24.getQtyBytes());
+ return (int) parsed;
+ }
+
+ /**
+ * Parses a TrueType "uint32" field (4 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned int read_uint32() throws IOException {
+ return (int) readUnsignedInt();
+ }
+
+ /**
+ * Parses a TrueType "int32" field (4 bytes, signed).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default int read_int32() throws IOException {
+ return readInt();
+ }
+
+ /**
+ * Reads a fixed-length decimal number with a 16-bit signed twos-complement mantissa, followed by a 16-bit unsigned
+ * fraction (total of 4 bytes).
+ * Note that this format corresponds to a TrueType Font "FIXED" data type, as described in the TTF Spec, Chapter 2
+ * (Data Types).
+ * @return The parsed value, as a BigDecimal.
+ * @throws IOException For I/O Error.
+ */
+ default BigDecimal read_Fixed() throws IOException {
+ final int highOrder = readShort();
+ final long lowOrder = readUnsignedShort();
+ final String asString = Integer.toString(highOrder) + "." + Long.toString(lowOrder);
+ return new BigDecimal(asString);
+ }
+
+ /**
+ * Parses a TrueType "FWORD" field (2 bytes, signed).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default short read_FWORD() throws IOException {
+ return read_int16();
+ }
+
+ /**
+ * Parses a TrueType "UFWORD" field (2 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned short read_UFWORD() throws IOException {
+ return read_uint16();
+ }
+
+ /**
+ * Parses a TrueType "F2DOT14" field (2 bytes).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default BigDecimal read_F2DOT14() throws IOException {
+ /* TODO: Implement this. */
+ return BigDecimal.ZERO;
+ }
+
+ /**
+ * Parses a TrueType "LONGDATETIME" field (4 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned long read_LONGDATETIME() throws IOException {
+ return readLong();
+ }
+
+ /**
+ * Parses a TrueType "Tag" field (4 bytes, chars).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default String read_Tag() throws IOException {
+ return readString(TtfDataType.Tag.getQtyBytes(), StandardCharsets.US_ASCII);
+ }
+
+ /**
+ * Parses a TrueType "Offset8" field (1 byte, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned byte read_Offset8() throws IOException {
+ return read_uint8();
+ }
+
+ /**
+ * Parses a TrueType "Offset16" field (2 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned short read_Offset16() throws IOException {
+ return read_uint16();
+ }
+
+ /**
+ * Parses a TrueType "Offset24" field (3 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned int read_Offset24() throws IOException {
+ return read_uint24();
+ }
+
+ /**
+ * Parses a TrueType "Offset32" field (4 bytes, unsigned).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default @Unsigned int read_Offset32() throws IOException {
+ return read_uint32();
+ }
+
+ /**
+ * Parses a TrueType "Version16Dot16" field (4 bytes).
+ * @return The parsed value.
+ * @throws IOException For I/O Error.
+ */
+ default BigDecimal read_Version16Dot16() throws IOException {
+ /* TODO: Implement this. */
+ return BigDecimal.ZERO;
+ }
+
+
+ /* Checkstyle: Restart method name checking. */
+}
Added: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/package-info.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/package-info.java (rev 0)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/package-info.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2025 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+/**
+ * Classes generally useful in parsing TrueType and/or OpenType Font files.
+ */
+package org.foray.fontParse.ttf;
Property changes on: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/package-info.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseAxisTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseAxisTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseAxisTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.BaseAxisTableHandler;
import org.foray.fontParse.ttf.handler.BaseScriptTableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseCoordTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseCoordTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseCoordTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.BaseCoordTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseMinMaxTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseMinMaxTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseMinMaxTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.BaseCoordTableHandler;
import org.foray.fontParse.ttf.handler.BaseMinMaxTableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseScriptTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseScriptTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseScriptTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.BaseMinMaxTableHandler;
import org.foray.fontParse.ttf.handler.BaseScriptTableHandler;
import org.foray.fontParse.ttf.handler.BaseValuesTableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.BaseAxisTableHandler;
import org.foray.fontParse.ttf.handler.BaseTableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseValuesTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseValuesTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/BaseValuesTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.BaseCoordTableHandler;
import org.foray.fontParse.ttf.handler.BaseValuesTableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cff2TableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cff2TableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cff2TableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Cff2TableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CffTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CffTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CffTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.CffTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap00TableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap00TableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap00TableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Cmap00TableHandler;
import org.axsl.constants.PrimitiveConstants;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap04TableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap04TableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap04TableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Cmap04TableHandler;
import org.checkerframework.checker.signedness.qual.Unsigned;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap06TableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap06TableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap06TableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Cmap06TableHandler;
import org.checkerframework.checker.signedness.qual.Unsigned;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap12TableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap12TableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Cmap12TableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Cmap12TableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CmapTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CmapTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CmapTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Cmap00TableHandler;
import org.foray.fontParse.ttf.handler.Cmap04TableHandler;
import org.foray.fontParse.ttf.handler.Cmap06TableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Coverage01TableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Coverage01TableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Coverage01TableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Coverage01TableHandler;
import org.checkerframework.checker.signedness.qual.Unsigned;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Coverage02TableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Coverage02TableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/Coverage02TableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Coverage02TableHandler;
import org.checkerframework.checker.signedness.qual.Unsigned;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CoverageTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CoverageTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CoverageTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Coverage01TableHandler;
import org.foray.fontParse.ttf.handler.Coverage02TableHandler;
import org.foray.fontParse.ttf.handler.CoverageTableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CvtTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CvtTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/CvtTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.CvtTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/DeviceTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/DeviceTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/DeviceTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.DeviceTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureListTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureListTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureListTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.FeatureListTableHandler;
import org.foray.fontParse.ttf.handler.FeatureTableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.FeatureTableHandler;
import org.checkerframework.checker.signedness.qual.Unsigned;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureVariationsTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureVariationsTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FeatureVariationsTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.FeatureVariationsTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FpgmTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FpgmTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/FpgmTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.FpgmTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GaspTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GaspTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GaspTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GaspTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GdefTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GdefTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GdefTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GdefTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GlyfTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GlyfTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GlyfTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GlyfTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GposTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GposTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GposTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GposTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup01x01Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup01x01Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup01x01Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup01x01Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup01x02Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup01x02Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup01x02Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup01x02Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup02x01Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup02x01Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup02x01Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup02x01Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup03x01Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup03x01Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup03x01Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup03x01Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup04x01Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup04x01Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup04x01Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.Coverage01TableHandler;
import org.foray.fontParse.ttf.handler.Coverage02TableHandler;
import org.foray.fontParse.ttf.handler.GsubLookup04x01Handler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x01Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x01Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x01Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup05x01Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x02Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x02Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x02Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup05x02Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x03Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x03Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup05x03Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup05x03Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x01Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x01Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x01Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup06x01Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x02Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x02Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x02Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup06x02Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x03Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x03Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup06x03Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup06x03Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup07x01Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup07x01Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup07x01Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup07x01Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup08x01Parser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup08x01Parser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubLookup08x01Parser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.GsubLookup08x01Handler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/GsubTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.FeatureListTableHandler;
import org.foray.fontParse.ttf.handler.FeatureVariationsTableHandler;
import org.foray.fontParse.ttf.handler.GsubTableHandler;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/HeadTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/HeadTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/HeadTableParser.java 2025-05-12 12:51:09 UTC (rev 13654)
@@ -29,6 +29,7 @@
package org.foray.fontParse.ttf.parser;
import org.foray.fontParse.TableParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
import org.foray.fontParse.ttf.handler.HeadTableHandler;
import java.io.IOException;
Modified: trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/HheaTableParser.java
===================================================================
--- trunk/foray/foray-font-parse/src/main/java/org/foray/fontParse/ttf/parser/HheaTableParser.java 2025-05-12 12:29:51 UTC (rev 13653)
+++ trunk/foray/foray...
[truncated message content] |