foray-commit Mailing List for FOray (Page 2)
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
(3) |
Dec
|
|
From: <vic...@us...> - 2025-06-15 21:36:17
|
Revision: 13856
http://sourceforge.net/p/foray/code/13856
Author: victormote
Date: 2025-06-15 21:36:15 +0000 (Sun, 15 Jun 2025)
Log Message:
-----------
Fix problem getting the Font and Ps Servers.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java 2025-06-15 21:08:05 UTC (rev 13855)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java 2025-06-15 21:36:15 UTC (rev 13856)
@@ -157,9 +157,6 @@
/** Indicates whether the creation of the SystemFont has already been attempted. */
private boolean systemFontCreationCompleted = false;
- /** The parent FontServer. */
- private FontServer4a fontServer = null;
-
/** The source of the font file, if any. */
private URL fontFileSource;
@@ -573,7 +570,8 @@
public Type1MetricsParser createMetricsFileReader() throws FontException {
if (this.metricsFileSource != null) {
try {
- return new Type1MetricsParser(this.fontServer, this.metricsFileSource.openStream());
+ return new Type1MetricsParser(this.registeredFontFamily.getServer(),
+ this.metricsFileSource.openStream());
} catch (final IOException e) {
throw new FontException(e);
}
@@ -583,7 +581,7 @@
try {
final ByteArray byteArray = new ByteArray(this.metricsFileContents);
final ByteSequenceParser bsp = new ByteSequenceParser(byteArray);
- return new Type1MetricsParser(this.fontServer, bsp);
+ return new Type1MetricsParser(this.registeredFontFamily.getServer(), bsp);
} catch (final IOException e) {
throw new FontException(e);
}
@@ -669,7 +667,7 @@
* @return The parent font server.
*/
public FontServer4a getFontServer() {
- return this.fontServer;
+ return this.registeredFontFamily.getServer();
}
/**
@@ -794,7 +792,7 @@
@Override
public PsServer getPsServer() {
- return this.fontServer.getPsServer();
+ return this.registeredFontFamily.getServer().getPsServer();
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-15 21:08:06
|
Revision: 13855
http://sourceforge.net/p/foray/code/13855
Author: victormote
Date: 2025-06-15 21:08:05 +0000 (Sun, 15 Jun 2025)
Log Message:
-----------
Get the URL for the Base-14 serialized metrics to the right place.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-15 20:44:47 UTC (rev 13854)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-15 21:08:05 UTC (rev 13855)
@@ -448,8 +448,9 @@
simulation.setSimulateSmallCaps(FontServer4a.DEFAULT_SMALL_CAPS_SIZE);
final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, encoding, style, weight,
- FontVariant.NORMAL, FontStretch.NORMAL, simulation, fontName, null, metricURL, null,
+ FontVariant.NORMAL, FontStretch.NORMAL, simulation, fontName, null, null, null,
org.axsl.font.Font.Embedding.NONE, null);
+ registeredFont.setSerializedMetricsFile(metricURL);
registeredFontFamily.registerFont(registeredFont);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-15 20:44:49
|
Revision: 13854
http://sourceforge.net/p/foray/code/13854
Author: victormote
Date: 2025-06-15 20:44:47 +0000 (Sun, 15 Jun 2025)
Log Message:
-----------
Upgrade JUnit to latest version. Fix missing JUnit dependency.
Modified Paths:
--------------
trunk/foray/buildSrc/src/main/groovy/foray.common-conventions.gradle
trunk/foray/buildSrc/src/main/groovy/foray.test-conventions.gradle
Modified: trunk/foray/buildSrc/src/main/groovy/foray.common-conventions.gradle
===================================================================
--- trunk/foray/buildSrc/src/main/groovy/foray.common-conventions.gradle 2025-06-15 03:15:09 UTC (rev 13853)
+++ trunk/foray/buildSrc/src/main/groovy/foray.common-conventions.gradle 2025-06-15 20:44:47 UTC (rev 13854)
@@ -2,6 +2,7 @@
plugins {
id 'java'
+ id 'eclipse'
id 'checkstyle'
id 'maven-publish'
id "org.checkerframework"
@@ -59,7 +60,7 @@
icu4j: '72.1', // Latest is 72.1 as of 2022-11-26.
checkerFramework: '3.49.2', // Latest is 3.49.2 as of 2025-04-20.
- junit: '5.10.2', // Latest is 5.10.2 as of 2024-05-08.
+ junit: '5.13.1', // Latest is 5.13.1 as of 2025-06-15.
mockito: '4.9.0', // Latest is 4.9.0 as of 2022-11-26. See Note 5.
Modified: trunk/foray/buildSrc/src/main/groovy/foray.test-conventions.gradle
===================================================================
--- trunk/foray/buildSrc/src/main/groovy/foray.test-conventions.gradle 2025-06-15 03:15:09 UTC (rev 13853)
+++ trunk/foray/buildSrc/src/main/groovy/foray.test-conventions.gradle 2025-06-15 20:44:47 UTC (rev 13854)
@@ -8,6 +8,7 @@
testImplementation (platform
(group: 'org.junit', name: 'junit-bom', version: versions.junit))
testImplementation (group: 'org.junit.jupiter', name: 'junit-jupiter')
+ testRuntimeOnly (group: 'org.junit.platform', name: 'junit-platform-launcher')
testImplementation (group: 'org.mockito', name: 'mockito-core', version: versions.mockito)
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-15 03:15:12
|
Revision: 13853
http://sourceforge.net/p/foray/code/13853
Author: victormote
Date: 2025-06-15 03:15:09 +0000 (Sun, 15 Jun 2025)
Log Message:
-----------
Roll class RegisteredFontContent into RegisteredFont. Still some broken tests and test documents.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/FsTrueTypeFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/FsType1Font.java
trunk/foray/foray-font/src/main/java/org/foray/font/SystemFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java
trunk/foray/foray-font/src/main/java/org/foray/font/format/FontParser.java
trunk/foray/foray-font/src/test/java/org/foray/font/Font4aTests.java
trunk/foray/foray-font/src/test/java/org/foray/font/FsType1FontTests.java
trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java
Removed Paths:
-------------
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -35,7 +35,8 @@
import org.foray.font.FontServer4a;
import org.foray.font.FontUse4a;
import org.foray.font.FreeStandingFont;
-import org.foray.font.config.RegisteredFontContent;
+import org.foray.font.config.RegisteredFont;
+import org.foray.font.config.RegisteredFontFamily;
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTree;
@@ -75,7 +76,9 @@
protected FontUse4a getHelveticaFont() throws FontException {
final FontServer4a fontServer = getFontServer();
assertNotNull(fontServer);
- final RegisteredFontContent rf = fontServer.getRegisteredFont("Base14-Helvetica");
+ final RegisteredFontFamily rff = fontServer.getRegisteredFontFamily("Base14-Helvetica");
+ assertNotNull(rff);
+ final RegisteredFont rf = rff.getRegisteredFont("Base14-Helvetica");
assertNotNull(rf);
final FreeStandingFont fsf = rf.getFreeStandingFont();
assertNotNull(fsf);
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-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -30,7 +30,6 @@
import org.foray.common.IoUtil;
import org.foray.font.config.RegisteredFont;
-import org.foray.font.config.RegisteredFontContent;
import org.foray.font.ttf.TrueTypeFont;
import org.foray.font.ttf.TtfSubSetFile;
import org.foray.font.type1.Type1Font;
@@ -213,8 +212,7 @@
// final Encoding encoding = findEncoding(rfd, codePoint);
if (encoding == null) {
/* No encoding was configured, meaning that the native encoding should be used. */
- final RegisteredFontContent content = rfd.getRegisteredFontContent();
- final Font4a font = content.getBestFont();
+ final Font4a font = rfd.getBestFont();
encoding = font.getInternalEncoding();
}
if (encoding == null) {
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -28,7 +28,7 @@
package org.foray.font;
import org.foray.common.FontUtil;
-import org.foray.font.config.RegisteredFontContent;
+import org.foray.font.config.RegisteredFont;
import org.foray.font.format.Kerning;
import org.foray.font.format.Panose4a;
import org.foray.ps.encode.CharSet;
@@ -92,14 +92,14 @@
/**
* The RegisteredFontContent that is attached to this Font instance.
*/
- private RegisteredFontContent registeredFontContent = null;
+ private RegisteredFont registeredFont;
/**
* Constructor.
* @param rf The parent registered font.
*/
- protected Font4a(final RegisteredFontContent rf) {
- this.registeredFontContent = rf;
+ protected Font4a(final RegisteredFont rf) {
+ this.registeredFont = rf;
}
@Override
@@ -257,8 +257,8 @@
* Return the parent registered font.
* @return The registered font.
*/
- public RegisteredFontContent getRegisteredFontContent() {
- return this.registeredFontContent;
+ public RegisteredFont getRegisteredFont() {
+ return this.registeredFont;
}
/**
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-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -29,7 +29,6 @@
package org.foray.font;
import org.foray.font.config.RegisteredFont;
-import org.foray.font.config.RegisteredFontContent;
import org.foray.font.config.RegisteredFontFamily;
import org.foray.font.format.Panose;
import org.foray.font.format.Panose4a;
@@ -47,7 +46,6 @@
import org.axsl.value.FontVariant;
import org.axsl.value.FontWeight;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
@@ -97,31 +95,21 @@
/** The font selection constraints. */
private FontSelectionConstraints selectionConstraints;
- /**
- * Set to true if FreeStandingFonts should be selected where possible,
- * false if SystemFont should be selected where possible.
- * In cases where usesFreeStandingFonts and usesSystemFonts are both set to
- * true, this breaks the tie.
- */
+ /** Set to true if FreeStandingFonts should be selected where possible,false if SystemFont should be selected where
+ * possible. In cases where usesFreeStandingFonts and usesSystemFonts are both set to true, this breaks the tie. */
private boolean prefersFreeStandingFonts = true;
- /**
- * Collection of fonts used by this FontConsumer.
- * The key is the Font instance, and the value is the related ConsumerFont
- * instance.
- */
- private Map<Font4a, ConsumerFont4a> usedFonts
- = new HashMap<Font4a, ConsumerFont4a>();
+ /** Collection of fonts used by this FontConsumer. The key is the Font instance, and the value is the related
+ * {@link ConsumerFont4a} instance. */
+ private Map<Font4a, ConsumerFont4a> usedFonts = new HashMap<Font4a, ConsumerFont4a>();
/** The encoding latitude for this consumer. */
private byte encodingLatitude = FontConsumer4a.ENCODING_ANY;
- /** The FontSelection instance to be used for font-selection-strategy =
- * "character-by-character". */
+ /** The FontSelection instance to be used for font-selection-strategy = "character-by-character". */
private FontSelector fontSelectorCBC;
- /** The FontSelection instance to be used for font-selection-strategy =
- * "auto". */
+ /** The FontSelection instance to be used for font-selection-strategy = "auto". */
private FontSelector fontSelectorAuto;
/** The font selector to be used by this consumer. */
@@ -240,7 +228,7 @@
builder.append(weight.toString() + " (weight), ");
builder.append(variant.toString() + " (variant), ");
builder.append(stretch.toString() + " (stretch), ");
- getLogger().warn("Suitable font not found for: " + builder.toString());
+ LoggerFactory.getLogger(getClass()).warn("Suitable font not found for: " + builder.toString());
return null;
}
try {
@@ -293,9 +281,9 @@
}
Font4a fontSelected = null;
if (this.selectionConstraints.canSelectFreeStandingFonts()) {
- fontSelected = fontDescSelected.getRegisteredFontContent().getFreeStandingFont();
+ fontSelected = fontDescSelected.getFreeStandingFont();
} else {
- fontSelected = fontDescSelected.getRegisteredFontContent().getSystemFont();
+ fontSelected = fontDescSelected.getSystemFont();
}
final ConsumerFont4a consumerFont = registerFontUse(fontSelected);
return consumerFont.getFontUse(fontDescSelected, fontSelected.getInternalEncoding());
@@ -302,27 +290,19 @@
}
/**
- * <p>Since {@link RegisteredFontContent} and {@link RegisteredFont} instances
- * can encapsulate either a FreeStandingFont or a SystemFont, or both,
- * this method selects which one should be used, based on the FontConsumer
- * instances parameters.</p>
+ * <p>Since {@link RegisteredFont} instances can create either a {@link FreeStandingFont} or a {@link SystemFont},
+ * or both, this method selects which one should be used.</p>
*
- * <p>In cases where both a FreeStandingFont and a SystemFont are available,
- * and either can be selected, this method also breaks the tie, again using
- * a FontConsumer parameter.
- * Although each has access to the other's methods for things that it
- * does not natively know, there are still potential differences between
- * the two (especially font metrics), and an application needs to be able
- * to select which one it prefers.
- * @param rfd The RegisteredFontDesc instance which points to the usable
- * font.
+ * <p>In cases where both a FreeStandingFont and a SystemFont are available, and either can be selected, this method
+ * also breaks the tie, again using a FontConsumer parameter.
+ * Although each has access to the other's methods for things that it does not natively know, there are still
+ * potential differences between the two (especially font metrics), and an application needs to be able to select
+ * which one it prefers.
+ * @param rfd The RegisteredFontDesc instance which points to the usable font.
* @return The FontUse instance dictated by the parameters of consumer.
*/
protected Font4a whichUse(final RegisteredFont rfd) {
- final RegisteredFontContent rf = rfd.getRegisteredFontContent();
-
- /* Avoid instantiating the non-preferred manifestation if it won't be
- * used anyway. */
+ /* Avoid instantiating the non-preferred manifestation if it won't be used anyway. */
FreeStandingFont fsf = null;
SystemFont sf = null;
@@ -333,10 +313,10 @@
/* It is available. */
return fsf;
}
- return eligibleSystemFont(rf);
+ return eligibleSystemFont(rfd);
} else {
/* Consumer prefers SystemFont. */
- sf = eligibleSystemFont(rf);
+ sf = eligibleSystemFont(rfd);
if (sf != null) {
/* It is available. */
return sf;
@@ -346,17 +326,16 @@
}
/**
- * For a given registered font description, returns the free-standing font
- * for that description, if it is eligible for selection.
+ * 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.
- * @return The {@link FreeStandingFont} instance, if it exists and is
- * eligible, or null otherwise.
+ * @return The {@link FreeStandingFont} instance, if it exists and is eligible, or null otherwise.
*/
private FreeStandingFont eligibleFreeStandingFont(final RegisteredFont rfd) {
if (! this.selectionConstraints.canSelectFreeStandingFonts()) {
return null;
}
- final FreeStandingFont fsf = rfd.getRegisteredFontContent().getFreeStandingFont();
+ final FreeStandingFont fsf = rfd.getFreeStandingFont();
if (fsf == null) {
return null;
}
@@ -368,7 +347,7 @@
* @param rf The registered font to be tested.
* @return The {@link SystemFont instance}, if it exists and is eligible, or null otherwise.
*/
- private SystemFont eligibleSystemFont(final RegisteredFontContent rf) {
+ private SystemFont eligibleSystemFont(final RegisteredFont rf) {
if (! this.selectionConstraints.canSelectSystemFonts()) {
return null;
}
@@ -410,8 +389,7 @@
/**
* Record the fact that this FontConsumer has used this font.
* @param font The Font instance that was used.
- * @return The consumer font that encapsulates {@code font} for this
- * consumer.
+ * @return The consumer font that encapsulates {@code font} for this consumer.
*/
protected ConsumerFont4a registerFontUse(final Font4a font) {
ConsumerFont4a consumerFont = this.usedFonts.get(font);
@@ -431,8 +409,7 @@
/**
* Returns the FontUse instance for a given font.
- * @param font The Font instance for which we wish to find the
- * related FontUse instance.
+ * @param font The Font instance for which we wish to find the related FontUse instance.
* @return The related FontUse instance.
*/
public ConsumerFont4a getConsumerFont(final Font4a font) {
@@ -461,10 +438,8 @@
* @return True if and only if the encoding latitude is valid.
*/
private boolean validEncodingLatitude(final int encodingLatitude) {
- for (int i = 0; i < FontConsumer4a.VALID_ENCODING_LATITUDES.length;
- i++) {
- if (encodingLatitude
- == FontConsumer4a.VALID_ENCODING_LATITUDES[i]) {
+ for (int i = 0; i < FontConsumer4a.VALID_ENCODING_LATITUDES.length; i++) {
+ if (encodingLatitude == FontConsumer4a.VALID_ENCODING_LATITUDES[i]) {
return true;
}
}
@@ -479,11 +454,9 @@
* {@link #ENCODING_ANY}.
* @throws FontException If the encoding latitude is not valid.
*/
- public void setEncodingLatitude(final int encodingLatitude)
- throws FontException {
+ public void setEncodingLatitude(final int encodingLatitude) throws FontException {
if (! validEncodingLatitude(encodingLatitude)) {
- throw new FontException("FOrayFontConsumer invalid encoding "
- + "latitude: " + encodingLatitude);
+ throw new FontException("FOrayFontConsumer invalid encoding latitude: " + encodingLatitude);
}
this.encodingLatitude = (byte) encodingLatitude;
}
@@ -509,8 +482,7 @@
for (RegisteredFontFamily rff : this.server.registeredFontFamilies()) {
for (int i = 0; i < rff.getRegisteredFonts().size(); i++) {
final RegisteredFont rfd = rff.getRegisteredFonts().get(i);
- final Panose4a panoseInstance = rfd.getRegisteredFontContent()
- .getPanose();
+ final Panose4a panoseInstance = rfd.getPanose();
final long difference = panoseInstance.difference(desiredPanose, null);
if (difference < bestDifference) {
bestDifference = difference;
@@ -528,13 +500,4 @@
}
}
- /**
- * Returns the logger.
- * @return The logger.
- */
- private Logger getLogger() {
- /* Not cached because not expected to get used much. */
- return LoggerFactory.getLogger(getClass());
- }
-
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -33,7 +33,6 @@
import org.foray.font.config.FontConfigParser;
import org.foray.font.config.FontFeatureSimulation4a;
import org.foray.font.config.RegisteredFont;
-import org.foray.font.config.RegisteredFontContent;
import org.foray.font.config.RegisteredFontFamily;
import org.foray.font.format.FontParserClient;
import org.foray.ps.encode.EncodingSymbol;
@@ -148,12 +147,6 @@
/** This is the SystemFont that should be used when a SystemFont is required and all other fallback options fail. */
private RegisteredFont defaultSystemFont = null;
- /**
- * Map whose key is a String containing the id of a {@link RegisteredFontContent} instance, and whose value is that
- * instance.
- */
- private Map<String, RegisteredFontContent> registeredFontContent = new HashMap<String, RegisteredFontContent>();
-
/** Map of registered font selector factories. The key is String containing the name of the factory, and the value
* is the {@link FontSelectorFactory} that the name maps to. */
private Map<String, FontSelectorFactory> registeredFontSelectorFactories =
@@ -234,14 +227,11 @@
}
/* Punt and try to create something that will work. */
try {
- final RegisteredFontContent registeredFontContent =
- new RegisteredFontContent(this, null, null, null, null, null, "serif");
final RegisteredFontFamily registeredFontFamily = this.registerFontFamily("serif");
final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, null, FontStyle.NORMAL,
- FontWeight.NORMAL, FontVariant.NORMAL,
- FontStretch.NORMAL, FontFeatureSimulation.DEFAULT);
+ FontWeight.NORMAL, FontVariant.NORMAL, FontStretch.NORMAL, FontFeatureSimulation.DEFAULT, null,
+ null, null, null, null, "serif");
registeredFontFamily.registerFont(registeredFont);
- registeredFont.registerContent(registeredFontContent);
} catch (final FontException e) {
getLogger().error("Unable to create default system font.");
}
@@ -446,16 +436,7 @@
this.getLogger().warn("Serialized Base-14 font metrics not found: " + resourceName);
return;
}
- RegisteredFontContent registeredFontContent = null;
- try {
- registeredFontContent = new RegisteredFontContent(this, fontName, null, null, null,
- org.axsl.font.Font.Embedding.NONE, null);
- } catch (final FontException e) {
- this.logger.warn(e.getMessage(), e);
- }
- registeredFontContent.setSerializedMetricsFile(metricURL);
-
Encoding encoding = EncodingWinAnsi.getInstance();
if (registeredFontFamily.getName().equals("Base14-Symbol")) {
encoding = EncodingSymbol.getInstance();
@@ -467,8 +448,8 @@
simulation.setSimulateSmallCaps(FontServer4a.DEFAULT_SMALL_CAPS_SIZE);
final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, encoding, style, weight,
- FontVariant.NORMAL, FontStretch.NORMAL, simulation);
- registeredFont.registerContent(registeredFontContent);
+ FontVariant.NORMAL, FontStretch.NORMAL, simulation, fontName, null, metricURL, null,
+ org.axsl.font.Font.Embedding.NONE, null);
registeredFontFamily.registerFont(registeredFont);
}
@@ -510,14 +491,7 @@
continue;
}
}
- final RegisteredFontContent registeredFontContent;
- try {
- registeredFontContent = new RegisteredFontContent(this, awtFont.getFontName(),
- null, null, null, org.axsl.font.Font.Embedding.NONE, awtFont.getFontName());
- } catch (final FontException e) {
- this.logger.error(e.getMessage());
- continue;
- }
+
FontStyle fontStyle = FontStyle.NORMAL;
if (awtFont.isItalic()) {
fontStyle = FontStyle.ITALIC;
@@ -529,8 +503,9 @@
final FontVariant fontVariant = FontVariant.NORMAL;
final FontStretch fontStretch = FontStretch.NORMAL;
final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, null, fontStyle, fontWeight,
- fontVariant, fontStretch, FontFeatureSimulation.DEFAULT);
- registeredFont.registerContent(registeredFontContent);
+ fontVariant, fontStretch, FontFeatureSimulation.DEFAULT,
+ awtFont.getFontName(),
+ null, null, null, org.axsl.font.Font.Embedding.NONE, awtFont.getFontName());
try {
registeredFontFamily.registerFont(registeredFont);
} catch (final FontException e) {
@@ -765,92 +740,6 @@
}
/**
- * Register a font for use by the system.
- * @param fontID A unique ID for this font (e.g. "Courier-Bold").
- * @param fontFileSource Source of the file containing the font, if any.
- * @param metricsFileSource Source of the file containing the font metrics, if any.
- * This is null for TrueType and OpenType fonts.
- * @param collectionID For TrueType collections, indicates which font in the collection corresponds to this font.
- * @param requestedEmbedding The requested font embedding for the font to be registered.
- * @param systemName For system fonts only, this is the name that should be supplied to the operating system font
- * registry to obtain the font from it. For other fonts, set this to null.
- * @throws FontException If a font with this {@code fontID} is already registered.
- */
- public void registerFont(final String fontID, final URL fontFileSource, final URL metricsFileSource,
- final String collectionID, final org.axsl.font.Font.Embedding requestedEmbedding, final String systemName)
- throws FontException {
- if (! isUsableFont(systemName, fontFileSource, metricsFileSource)) {
- return;
- }
- new RegisteredFontContent(this, fontID, fontFileSource, metricsFileSource, collectionID, requestedEmbedding,
- systemName);
- }
-
- /**
- * Indicates whether a given font has the barest capability of being used by
- * this server.
- * @param systemName The "system-name" for the font.
- * @param fontFile The font file for the font.
- * @param metricsFile The metric file for the font.
- * @return True if and only if the font has the barest necessities to be usable by this
- * font server.
- */
- private boolean isUsableFont(final String systemName, final Object fontFile,
- final Object metricsFile) {
- if (! this.usingFreeStandingFonts) {
- /* If not using FreeStandingFonts, then this font should not be
- * registered unless it will be able to generate a SystemFont. */
- if (systemName == null || systemName.equals("")) {
- return false;
- }
- }
- if (! this.usingSystemFonts) {
- /* If not using SystemFonts, then this font should not be
- * registered unless it will be able to generate a FreeStandingFont.
- */
- if (fontFile == null
- && metricsFile == null) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns the font registered to a given name.
- * @param name The name of the font being sought.
- * @return The registered font instance, or null if the font name has not
- * been registered.
- */
- public RegisteredFontContent getRegisteredFont(final String name) {
- return this.registeredFontContent.get(name);
- }
-
- /**
- * Maps a given font name to its related {@link RegisteredFontContent} instance.
- * @param fontID The name of the font to be associated.
- * @param rf The registered font instance to be associated with the name.
- * @throws FontException If the {@code fontID} is already registered.
- */
- public void registerFont(final String fontID, final RegisteredFontContent rf) throws FontException {
- final Object object = this.registeredFontContent.get(fontID);
- if (object != null) {
- throw new FontException("Font ID already registered: " + fontID);
- }
- this.registeredFontContent.put(fontID, rf);
- }
-
- /**
- * Indicates whether a font has already been registered for use by the system.
- * @param fontID The unique font ID for the font (e.g. "Courier-Bold").
- * @return True if and only if a font with ID of {@code fontID} is already registered.
- */
- public boolean isRegisteredFont(final String fontID) {
- final Object object = this.registeredFontContent.get(fontID);
- return object != null;
- }
-
- /**
* Returns the font-selector that should be used by a given font consumer.
* @param consumer The consumer for which a font-selector is needed.
* @return The font-selector instance.
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -28,7 +28,7 @@
package org.foray.font;
-import org.foray.font.config.RegisteredFontContent;
+import org.foray.font.config.RegisteredFont;
import org.foray.font.format.Kerning;
import org.foray.font.format.Panose4a;
import org.foray.ps.encode.CharSet;
@@ -130,7 +130,7 @@
* Constructor.
* @param rf The parent registered font.
*/
- protected FreeStandingFont(final RegisteredFontContent rf) {
+ protected FreeStandingFont(final RegisteredFont rf) {
super(rf);
}
@@ -150,7 +150,7 @@
/* The font and/or metrics may not have been parsed yet. */
return this.fontName;
}
- return this.getRegisteredFontContent().getConfiguredFontName();
+ return this.getRegisteredFont().getConfiguredFontName();
}
@Override
@@ -168,7 +168,7 @@
&& ! this.postscriptName.equals("")) {
return this.postscriptName;
}
- return getRegisteredFontContent().getConfiguredFontName();
+ return getRegisteredFont().getConfiguredFontName();
}
@Override
@@ -250,11 +250,11 @@
return false;
}
/* Don't try to embed unless we have been told to. */
- if (! getRegisteredFontContent().isEmbedding()) {
+ if (! getRegisteredFont().isEmbedding()) {
return false;
}
/* If the fontFile exists, embed it. */
- if (getRegisteredFontContent().hasFontContent()) {
+ if (getRegisteredFont().hasFontContent()) {
return true;
}
return false;
@@ -274,7 +274,7 @@
return false;
}
/* Only subset if we have been told to. */
- return getRegisteredFontContent().isSubsetting();
+ return getRegisteredFont().isSubsetting();
}
/**
@@ -282,7 +282,7 @@
* @return The font content as a stream.
*/
protected InputStream getFontInputStream() {
- final URL contentLocation = getRegisteredFontContent().getFontFileSource();
+ final URL contentLocation = getRegisteredFont().getFontFileSource();
if (contentLocation == null) {
return null;
}
@@ -355,7 +355,7 @@
* is none, return null.
*/
public SystemFont systemFontManifestation() {
- return this.getRegisteredFontContent().getSystemFont();
+ return this.getRegisteredFont().getSystemFont();
}
/**
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FsTrueTypeFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FsTrueTypeFont.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FsTrueTypeFont.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -30,7 +30,7 @@
import org.foray.common.data.BoundingBoxShort;
import org.foray.common.data.BoundingBoxUtils;
-import org.foray.font.config.RegisteredFontContent;
+import org.foray.font.config.RegisteredFont;
import org.foray.font.ttf.TrueTypeCollection;
import org.foray.font.ttf.TrueTypeContainer;
import org.foray.font.ttf.TrueTypeFont;
@@ -72,7 +72,7 @@
* @throws FontException For errors parsing the font.
* @throws IOException For errors reading content.
*/
- public FsTrueTypeFont(final RegisteredFontContent rf) throws FontException, IOException {
+ public FsTrueTypeFont(final RegisteredFont rf) throws FontException, IOException {
super(rf);
parseFont();
}
@@ -84,8 +84,8 @@
*/
public void parseFont() throws FontException, IOException {
final TrueTypeContainer ttfFile = (TrueTypeContainer)
- getRegisteredFontContent().createFontFileReader().parseFontFile();
- final String fontName = getRegisteredFontContent().getTTCName();
+ getRegisteredFont().createFontFileReader().parseFontFile();
+ final String fontName = getRegisteredFont().getTTCName();
try {
if (ttfFile instanceof TrueTypeCollection) {
final TrueTypeCollection ttc = (TrueTypeCollection) ttfFile;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FsType1Font.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FsType1Font.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FsType1Font.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -29,7 +29,7 @@
package org.foray.font;
import org.foray.common.data.BoundingBoxUtils;
-import org.foray.font.config.RegisteredFontContent;
+import org.foray.font.config.RegisteredFont;
import org.foray.font.format.FontFileFormat;
import org.foray.font.format.FontParser;
import org.foray.font.type1.Type1Font;
@@ -72,7 +72,7 @@
* @param rf The RegisteredFont that should be used to create this font.
* @throws FontException For error creating font.
*/
- public FsType1Font(final RegisteredFontContent rf) throws FontException {
+ public FsType1Font(final RegisteredFont rf) throws FontException {
super(rf);
parseFont();
}
@@ -86,12 +86,12 @@
if (this.type1File != null) {
return this.type1File;
}
- final FontParser reader = getRegisteredFontContent().createFontFileReader();
+ final FontParser reader = getRegisteredFont().createFontFileReader();
if (reader.getFileFormat() == FontFileFormat.TYPE1_PFB) {
- final Type1FontParser parser = new Type1FontParserPfb(getRegisteredFontContent().createFontFileReader());
+ final Type1FontParser parser = new Type1FontParserPfb(getRegisteredFont().createFontFileReader());
this.type1File = parser.parse();
} else if (reader.getFileFormat() == FontFileFormat.TYPE1_PFA) {
- final Type1FontParser parser = new Type1FontParserPfa(getRegisteredFontContent().createFontFileReader());
+ final Type1FontParser parser = new Type1FontParserPfa(getRegisteredFont().createFontFileReader());
this.type1File = parser.parse();
} else {
this.getLogger().error("Attempted to parse unknown Type1 font type.");
@@ -159,11 +159,9 @@
*/
private Type1Metrics getMetricsFile() throws IOException, FontException {
Type1Metrics metricsFile = null;
- final URL serializedMetricsFile = this.getRegisteredFontContent()
- .getSerializedMetricsFile();
+ final URL serializedMetricsFile = this.getRegisteredFont().getSerializedMetricsFile();
if (serializedMetricsFile == null) {
- final Type1MetricsParser reader = this.getRegisteredFontContent()
- .createMetricsFileReader();
+ final Type1MetricsParser reader = this.getRegisteredFont().createMetricsFileReader();
metricsFile = reader.parse();
if (metricsFile == null) {
throw new FontException("Unknown Metric Format");
@@ -192,8 +190,7 @@
*/
private Type1Metrics deserializeMetricsFile() throws IOException,
ClassNotFoundException {
- final URL serializedMetricsFile = this.getRegisteredFontContent()
- .getSerializedMetricsFile();
+ final URL serializedMetricsFile = this.getRegisteredFont().getSerializedMetricsFile();
final InputStream is = serializedMetricsFile.openStream();
final ObjectInputStream ois = new ObjectInputStream(is);
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/SystemFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/SystemFont.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/SystemFont.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -30,7 +30,7 @@
import org.foray.common.Environment;
import org.foray.common.data.BoundingBoxUtils;
-import org.foray.font.config.RegisteredFontContent;
+import org.foray.font.config.RegisteredFont;
import org.foray.font.format.Kerning;
import org.foray.font.format.Panose4a;
import org.foray.ps.encode.CharSet;
@@ -90,7 +90,7 @@
* @param rf The parent RegisteredFont instance.
* @throws FontException For error creating font.
*/
- private SystemFont(final RegisteredFontContent rf) throws FontException {
+ private SystemFont(final RegisteredFont rf) throws FontException {
super(rf);
final Font newFont = createFont();
this.lastMetrics = getGraphics().getFontMetrics(newFont);
@@ -101,7 +101,7 @@
* @param rf The parent RegisteredFont instance.
* @return The new SystemFont instance.
*/
- public static SystemFont makeSystemFont(final RegisteredFontContent rf) {
+ public static SystemFont makeSystemFont(final RegisteredFont rf) {
/* Don't allow the SystemFont to be created unless we are running in a
* graphical environment. Trying to create AWT fonts in a non-graphical
* environment will result in a runtime Error and will crash the
@@ -277,7 +277,7 @@
* @return The font server.
*/
public FontServer4a getFontServer() {
- return this.getRegisteredFontContent().getFontServer();
+ return getRegisteredFont().getFontServer();
}
/**
@@ -369,7 +369,7 @@
* font. This usually indicated a font registration error.
*/
public java.awt.Font createFont() throws FontException {
- final String systemName = this.getRegisteredFontContent().getSystemName();
+ final String systemName = getRegisteredFont().getSystemName();
/* If present, system-name has the priority */
if (systemName != null && !systemName.equals("")) {
/* Since we are using the font name instead of the font-family
@@ -378,7 +378,7 @@
SystemFont.INITIAL_FONT_SIZE);
}
Font returnedFont;
- final URL fontLocation = getRegisteredFontContent().getFontFileSource();
+ final URL fontLocation = getRegisteredFont().getFontFileSource();
returnedFont = createFontFromInput(fontLocation);
if (returnedFont != null) {
return returnedFont;
@@ -387,10 +387,10 @@
* Either no font file is available, or creating an awt font from
* the font file has failed
*/
- final org.axsl.font.Font fsf = getRegisteredFontContent().getFreeStandingFont();
+ final org.axsl.font.Font fsf = getRegisteredFont().getFreeStandingFont();
if (fsf == null) {
final String message = "Cannot find a system font for " +
- getRegisteredFontContent().getConfiguredFontName();
+ getRegisteredFont().getConfiguredFontName();
throw new FontException(message);
}
returnedFont = new Font(fsf.getFontName(), Font.PLAIN,
@@ -416,7 +416,7 @@
if (fontLocation == null) {
return null;
}
- final FreeStandingFont fsf = this.getRegisteredFontContent().getFreeStandingFont();
+ final FreeStandingFont fsf = getRegisteredFont().getFreeStandingFont();
if (fsf == null) {
return null;
}
@@ -480,7 +480,7 @@
* is none, return null.
*/
public FreeStandingFont freeStandingFontManifestation() {
- return this.getRegisteredFontContent().getFreeStandingFont();
+ return getRegisteredFont().getFreeStandingFont();
}
@Override
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -409,7 +409,6 @@
// final String simulateObliqueString = optional(attributes, "simulate-oblique", "1");
final String encodingString = optional(attributes, "encoding", this.currentEncoding);
- final RegisteredFontContent content = this.fontServer.getRegisteredFont(idString);
final FontStyle style = FontStyle.parseFo(styleString);
final FontWeight weight = FontWeight.parseFo(weightString);
final FontVariant variant = FontVariant.parseFo(variantString);
@@ -437,18 +436,9 @@
simulateStretch[RegisteredFont.SIMULATE_ULTRA_EXPANDED_INDEX]
= attributes.getValue("simulate-ultra-expanded");
- /* TODO: Reactivate parsing of the simulation parameters and add them to simulation below. */
- final FontFeatureSimulation4a simulation = new FontFeatureSimulation4a();
- final RegisteredFont font = new RegisteredFont(this.currentFontFamily, encoding, style, weight,
- variant, stretch, simulation);
- font.registerContent(content);
- try {
- this.currentFontFamily.registerFont(font);
- } catch (final FontException e) {
- throw new SAXException(e);
- }
+
Font.Embedding embed = null;
if (embedString == null
|| embedString.equals("")) {
@@ -486,18 +476,20 @@
debugMessage("Metrics file: " + metricsFileSource.toExternalForm());
}
+
+
+
+ /* TODO: Reactivate parsing of the simulation parameters and add them to simulation below. */
+ final FontFeatureSimulation4a simulation = new FontFeatureSimulation4a();
+ final RegisteredFont font = new RegisteredFont(this.currentFontFamily, encoding, style, weight,
+ variant, stretch, simulation,
+ idString, fontFileSource, metricsFileSource, collectionID, embed, systemName);
+
try {
- this.fontServer.registerFont(idString, fontFileSource, metricsFileSource, collectionID, embed, systemName);
+ this.currentFontFamily.registerFont(font);
} catch (final FontException e) {
- this.errorMessage(e.getMessage());
- return;
+ throw new SAXException(e);
}
-
- final RegisteredFontContent registeredFont = this.fontServer.getRegisteredFont(idString);
- if (registeredFont == null) {
- warningMessage("font is not registered: " + idString);
- return;
- }
}
/**
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java 2025-06-14 20:07:46 UTC (rev 13852)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java 2025-06-15 03:15:09 UTC (rev 13853)
@@ -28,13 +28,37 @@
package org.foray.font.config;
+import org.foray.common.sequence.ByteSequenceParser;
+import org.foray.font.Font4a;
+import org.foray.font.FontServer4a;
+import org.foray.font.FreeStandingFont;
+import org.foray.font.FsTrueTypeFont;
+import org.foray.font.FsType1Font;
+import org.foray.font.SystemFont;
+import org.foray.font.format.FontParser;
+import org.foray.font.format.FontParserClient;
+import org.foray.font.format.Panose4a;
+import org.foray.font.type1.Type1MetricsParser;
+import org.foray.fontParse.ttf.TtfRandomAccessInput;
+import org.foray.primitive.sequence.ByteArray;
+
+import org.axsl.font.Font;
+import org.axsl.font.FontException;
import org.axsl.font.FontFeatureSimulation;
+import org.axsl.font.FontFormat;
import org.axsl.ps.Encoding;
+import org.axsl.ps.PsServer;
import org.axsl.value.FontStretch;
import org.axsl.value.FontStyle;
import org.axsl.value.FontVariant;
import org.axsl.value.FontWeight;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URL;
+
/**
* <p>Binds a set of user font-selection criteria to a {@link RegisteredFontContent} instance, as configured in the
* "font" element in the font-configuration XML.
@@ -43,41 +67,33 @@
* A {@link RegisteredFont} instance operates within a {@link RegisteredFontFamily}, which provides the context in which
* it can be selected.</p>
*/
-public class RegisteredFont {
+public class RegisteredFont implements FontParserClient {
/** Constant indicating the number of simulated "stretch" components. */
public static final byte QTY_SIMULATED_STRETCH = 8;
- /** Constant indicating the index for the "ultra-condensed" simulated
- * stretch bucket. */
+ /** Constant indicating the index for the "ultra-condensed" simulated stretch bucket. */
public static final byte SIMULATE_ULTRA_CONDENSED_INDEX = 0;
- /** Constant indicating the index for the "extra-condensed" simulated
- * stretch bucket. */
+ /** Constant indicating the index for the "extra-condensed" simulated stretch bucket. */
public static final byte SIMULATE_EXTRA_CONDENSED_INDEX = 1;
- /** Constant indicating the index for the "condensed" simulated
- * stretch bucket. */
+ /** Constant indicating the index for the "condensed" simulated stretch bucket. */
public static final byte SIMULATE_CONDENSED_INDEX = 2;
- /** Constant indicating the index for the "semi-condensed" simulated
- * stretch bucket. */
+ /** Constant indicating the index for the "semi-condensed" simulated stretch bucket. */
public static final byte SIMULATE_SEMI_CONDENSED_INDEX = 3;
- /** Constant indicating the index for the "semi-expanded" simulated
- * stretch bucket. */
+ /** Constant indicating the index for the "semi-expanded" simulated stretch bucket. */
public static final byte SIMULATE_SEMI_EXPANDED_INDEX = 4;
- /** Constant indicating the index for the "expanded" simulated
- * stretch bucket. */
+ /** Constant indicating the index for the "expanded" simulated stretch bucket. */
public static final byte SIMULATE_EXPANDED_INDEX = 5;
- /** Constant indicating the index for the "extra-expanded" simulated
- * stretch bucket. */
+ /** Constant indicating the index for the "extra-expanded" simulated stretch bucket. */
public static final byte SIMULATE_EXTRA_EXPANDED_INDEX = 6;
- /** Constant indicating the index for the "ultra-expanded" simulated
- * stretch bucket. */
+ /** Constant indicating the index for the "ultra-expanded" simulated stretch bucket. */
public static final byte SIMULATE_ULTRA_EXPANDED_INDEX = 7;
/** The parent {@link RegisteredFontFamily} instance. */
@@ -101,9 +117,56 @@
/** The font feature simulation for this registered font. */
private FontFeatureSimulation fontFeatureSimulation;
- /** The content for this registered font. */
- private RegisteredFontContent registeredFontContent;
+ /** The name of the font as specified in the font configuration file. */
+ private String configuredFontName = null;
+ /** The system-name (AWT name) for this font, as specified in the font configuration file. */
+ private String systemName = null;
+
+ /** For TrueType collections, ttcName specifies the name of the font within the TTC that should be used. */
+ private String ttcName = null;
+
+ /** The serialized metrics file. This will be null if the font is not a Type 1 font, or if its metrics file is not
+ * serialized. */
+ private URL serializedMetricsFile;
+
+ /** The font file contents. This should be null for fonts where we know how to read or re-read the contents. */
+ private byte[] fontFileContents;
+
+ /** Description of the font source. This should be null unless {@link #fontFileContents} is not. */
+ private String fontFileDescription;
+
+ /** The metric file contents. This should be null for fonts where we know how to read or re-read the contents. */
+ private byte[] metricsFileContents;
+
+ /** Description of the font metrics source. This should be null unless {@link #metricsFileContents} is not. */
+ private String metricsFileDescription;
+
+ /** The requested embedding for this font. */
+ private Font.Embedding requestedEmbedding = Font.Embedding.NONE;
+
+ /** The FreeStandingFont instance, if any, that has been created for this RegisteredFont. */
+ private FreeStandingFont fsFont = null;
+
+ /** The SystemFont instance, if any, that has been created for this RegisteredFont. */
+ private SystemFont systemFont = null;
+
+ /** Indicates whether the creation of the FreeStandingFont has already been attempted. */
+ private boolean fsFontCreationCompleted = false;
+
+ /** Indicates whether the creation of the SystemFont has already been attempted. */
+ private boolean systemFontCreationCompleted = false;
+
+ /** The parent FontServer. */
+ private FontServer4a fontServer = null;
+
+ /** The source of the font file, if any. */
+ private URL fontFileSource;
+
+ /** The source of the metrics file, if any. */
+ private URL metricsFileSource;
+
+
/**
* Constructor.
* @param registeredFontFamily The parent registered font family.
@@ -113,10 +176,18 @@
* @param fontVariant The font variant (normal, small-caps)
* @param fontStretch The font stretch (normal, condensed, etc.)
* @param simulation The font features to be simulated if not natively present.
+ * @param fontName The name of the font.
+ * @param fontFileSource The source of the font file, if any.
+ * @param metricsFileSource The source of the metrics file, if any.
+ * @param ttcName The font name to be used within a TrueType Collection file to select the proper font.
+ * @param embedding Indicates whether and how much of the font should be embedded.
+ * @param systemName A non-null value indicates that this font can manifest itself as a SystemFont.
*/
public RegisteredFont(final RegisteredFontFamily registeredFontFamily, final Encoding defaultEncoding,
final FontStyle fontStyle, final FontWeight fontWeight, final FontVariant fontVariant,
- final FontStretch fontStretch, final FontFeatureSimulation simulation) {
+ final FontStretch fontStretch, final FontFeatureSimulation simulation, final String fontName,
+ final URL fontFileSource, final URL metricsFileSource, final String ttcName,
+ final Font.Embedding embedding, final String systemName) {
this.registeredFontFamily = registeredFontFamily;
this.encoding = defaultEncoding;
this.fontStyle = fontStyle;
@@ -124,17 +195,19 @@
this.fontVariant = fontVariant;
this.fontStretch = fontStretch;
this.fontFeatureSimulation = simulation == null ? FontFeatureSimulation.DEFAULT : simulation;
+ this.fontFileSource = fontFileSource;
+ this.metricsFileSource = metricsFileSource;
+ this.configuredFontName = fontName;
+ this.ttcName = ttcName;
+ if (embedding == null) {
+ this.requestedEmbedding = Font.Embedding.NONE;
+ } else {
+ this.requestedEmbedding = embedding;
+ }
+ this.systemName = systemName;
}
/**
- * Registers the content for this font.
- * @param registeredFontContent The parent registered font.
- */
- public void registerContent(final RegisteredFontContent registeredFontContent) {
- this.registeredFontContent = registeredFontContent;
- }
-
- /**
* Returns the font style.
* @return The font style.
*/
@@ -167,31 +240,6 @@
}
/**
- * Returns the related registered font instance.
- * @return The related registered font instance.
- */
- public RegisteredFontContent getRegisteredFontContent() {
- return this.registeredFontContent;
- }
-
- /**
- * Sets the related {@link RegisteredFontContent} instance.
- * In cases where "font" and "font-content" elements are parsed from XML, this value may not be known at
- * construction time.
- * This method allows the resolved font-content item to be added later if necessary.
- * Once set, however, it is considered to be immutable.
- * @param content The new content value for this font.
- * @throws IllegalStateException If this method is called on an instance for which the content is already set.
- */
- public void setRegisteredFontContent(final RegisteredFontContent content) {
- if (this.registeredFontContent == null) {
- this.registeredFontContent = content;
- } else {
- throw new IllegalStateException("The content of this font has already been set.");
- }
- }
-
- /**
* Returns the related registered font family instance.
* @return The related registered font family instance.
*/
@@ -426,37 +474,15 @@
*/
public boolean generalTypeMatches(final boolean freeStandingFonts,
final boolean systemFonts) {
- if (freeStandingFonts && this.registeredFontContent.hasFreeStandingFont()) {
+ if (freeStandingFonts && hasFreeStandingFont()) {
return true;
}
- if (systemFonts && this.registeredFontContent.hasSystemFont()) {
+ if (systemFonts && hasSystemFont()) {
return true;
}
return false;
}
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append("[");
- builder.append(this.registeredFontContent.getConfiguredFontName());
- builder.append(", ");
- builder.append(this.registeredFontFamily.getName());
- builder.append(", ");
- final String encodingString = this.encoding == null ? "unspecified" : this.encoding.toString();
- builder.append(encodingString);
- builder.append(", ");
- builder.append(this.fontStyle.toString());
- builder.append(", ");
- builder.append(this.fontWeight.toString());
- builder.append(", ");
- builder.append(this.fontVariant.toString());
- builder.append(", ");
- builder.append(this.fontStretch.toString());
- builder.append("]");
- return builder.toString();
- }
-
/**
* Returns the font feature simulation for this registered font.
* @return The font feature simulation.
@@ -465,4 +491,339 @@
return fontFeatureSimulation;
}
+ /**
+ * Attempts to create a SystemFont manifestation of this registered font.
+ */
+ private void createFreeStandingFont() {
+ if (this.fsFontCreationCompleted) {
+ return;
+ }
+ this.fsFontCreationCompleted = true;
+
+ if (! this.hasFreeStandingFont()) {
+ /* We do not have what is needed to create a FreeStandingFont. */
+ return;
+ }
+
+ try {
+ this.fsFont = createFSFont();
+ if (this.fsFont == null) {
+ this.fsFont = getFontServer().getDefaultFreeStandingFont().fsFont;
+ getLogger().error("Unable to open font "
+ + this.configuredFontName + ".");
+ getLogger().error("Using a default font instead.");
+ return;
+ }
+ if (! (this.requestedEmbedding == Font.Embedding.NONE)
+ && ! this.fsFont.allowsEmbedding()) {
+ getLogger().warn("Font " + this.configuredFontName
+ + " does not allow embedding.");
+ }
+ } catch (final FontException ex) {
+ getLogger().error("Failed to create font object "
+ + "for: "
+ + this.configuredFontName);
+ getLogger().error(ex.getMessage());
+ }
+ }
+
+ /**
+ * Creates a SytemFont manifestation of this registered font if possible.
+ */
+ private void createSystemFont() {
+ if (this.systemFontCreationCompleted) {
+ return;
+ }
+ this.systemFontCreationCompleted = true;
+ this.systemFont = SystemFont.makeSystemFont(this);
+ }
+
+ /**
+ * Creates a font file reader for this registered font.
+ * @return The reader.
+ * @throws FontException For errors opening the font file reader.
+ */
+ public FontParser createFontFileReader() throws FontException {
+ if (this.fontFileSource != null) {
+ try {
+ return new FontParser(this, this.fontFileSource.openStream());
+ } catch (final IOException e) {
+ throw new FontException(e);
+ }
+ }
+
+ if (this.fontFileContents != null) {
+ try {
+ final ByteArray byteArray = new ByteArray(this.fontFileContents);
+ final TtfRandomAccessInput bsp = new TtfRandomAccessInput.Impl(byteArray);
+ return new FontParser(this, bsp);
+ } catch (final IOException e) {
+ throw new FontException(e);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Creates a metrics file reader for this registered font.
+ * @return The reader.
+ * @throws FontException For errors opening the metrics file reader.
+ */
+ public Type1MetricsParser createMetricsFileReader() throws FontException {
+ if (this.metricsFileSource != null) {
+ try {
+ return new Type1MetricsParser(this.fontServer, this.metricsFileSource.openStream());
+ } catch (final IOException e) {
+ throw new FontException(e);
+ }
+ }
+
+ if (this.metricsFileContents != null) {
+ try {
+ final ByteArray byteArray = new ByteArray(this.metricsFileContents);
+ final ByteSequenceParser bsp = new ByteSequenceParser(byteArray);
+ return new Type1MetricsParser(this.fontServer, bsp);
+ } catch (final IOException e) {
+ throw new FontException(e);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Attempts to create a FreeStandingFont manifestation of this registered font.
+ * @return The FreeStandingFont manifestation.
+ * @throws FontException For error during FreeStandingFont creation.
+ */
+ private FreeStandingFont createFSFont() throws FontException {
+ final FontFormat fontFormat;
+ if (this.fontFileSource == null) {
+ /* The assumption here is that we have a metrics file for this
+ * font, but not a font file, therefore it is Type 1. */
+ fontFormat = FontFormat.TYPE1;
+ } else {
+ /* TODO: See if we ca*/
+ fontFormat = createFontFileReader().getFontFormat();
+ }
+
+ if (FontFormat.TYPE1 == fontFormat) {
+ return new FsType1Font(this);
+ }
+ if (FontFormat.TRUETYPE == fontFormat
+ || FontFormat.OTF_CFF == fontFormat
+ || FontFormat.TRUETYPE == fontFormat) {
+ try {
+ return new FsTrueTypeFont(this);
+ } catch (final IOException e) {
+ /* TODO: Remove the throwing of the exception caught here. */
+ throw new IllegalStateException(e);
+ }
+ }
+ throw new FontException("Font " + this.configuredFontName + " is an unknown format.");
+ }
+
+ /**
+ * Returns the {@link FreeStandingFont} manifestation of this font.
+ * @return The {@link FreeStandingFont} manifestation, if any, of this
+ * RegisteredFont.
+ */
+ public FreeStandingFont getFreeStandingFont() {
+ if (this.fsFont == null) {
+ createFreeStandingFont();
+ }
+ return this.fsFont;
+ }
+
+ /**
+ * Returns the {@link SystemFont} manifestation of this font.
+ * @return The SystemFont manifestation, if any, of this RegisteredFont.
+ */
+ public SystemFont getSystemFont() {
+ if (this.systemFont == null) {
+ createSystemFont();
+ }
+ return this.systemFont;
+ }
+
+ /**
+ * Returns the system name for this registerered font.
+ * @return The "system-name" as configured by the user. This is the name of the AWT font (not font-family) that can
+ * be created.
+ */
+ public String getSystemName() {
+ return this.systemName;
+ }
+
+ /**
+ * Return the registered TrueType collection name that should be used to access this font within a TTC file.
+ * @return The TTC name.
+ */
+ public String getTTCName() {
+ return this.ttcName;
+ }
+
+ /**
+ * Returns the parent font server.
+ * @return The parent font server.
+ */
+ public FontServer4a getFontServer() {
+ return this.fontServer;
+ }
+
+ /**
+ * Returns the logger.
+ * @return The logger.
+ */
+ private Logger getLogger() {
+ /* Not cached because not expected to get used much. */
+ return LoggerFactory.getLogger(getClass());
+ }
+
+ /**
+ * Returns the configured font name.
+ * @return Returns the configuredFontName.
+ */
+ public String getConfiguredFontName() {
+ return this.configuredFontName;
+ }
+
+ /**
+ * Indicates whether this font should be embedded.
+ * @return Returns the embedding.
+ */
+ public boolean isEmbedding() {
+ return this.requestedEmbedding != Font.Embedding.NONE;
+ }
+
+ /**
+ * Indicates whether this font should be subsetted.
+ * @return Returns the subsetting.
+ */
+ public boolean isSubsetting() {
+ return this.requestedEmbedding == Font.Embedding.SUBSET;
+ }
+
+ /**
+ * Indicates whether this can return the content of the font.
+ * @return True if and only if, this can return the content of the font.
+ */
+ public boolean hasFontContent() {
+ if (this.fontFileSource != null) {
+ return true;
+ }
+ if (this.fontFileContents ...
[truncated message content] |
|
From: <vic...@us...> - 2025-06-14 20:07:49
|
Revision: 13852
http://sourceforge.net/p/foray/code/13852
Author: victormote
Date: 2025-06-14 20:07:46 +0000 (Sat, 14 Jun 2025)
Log Message:
-----------
Conform to aXSL change: Roll font-content element into font. Breakage in tests and test documents related to font configuration being broken.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/config/ConfigGenerator.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
trunk/foray/foray-font/src/test/resources/font-config.xml
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/ConfigGenerator.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/ConfigGenerator.java 2025-06-14 12:00:07 UTC (rev 13851)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/ConfigGenerator.java 2025-06-14 20:07:46 UTC (rev 13852)
@@ -150,17 +150,14 @@
}
lastFamily = fontFamily;
- final Element fontContentElement = document.createElement("font-content");
- fontContentElement.setAttribute("id", configFile.getPostScriptName());
- fontContentElement.setAttribute("font-file", configFile.getFontUrl());
- lastFamilyElement.appendChild(fontContentElement);
-
final Element fontElement = document.createElement("font");
+ fontElement.setAttribute("id", configFile.getPostScriptName());
+ fontElement.setAttribute("font-file", configFile.getFontUrl());
final FontStyle style = configFile.getStyle();
fontElement.setAttribute("style", style.getName());
final FontWeight weight = configFile.getWeight();
fontElement.setAttribute("weight", weight.getName());
- fontContentElement.appendChild(fontElement);
+ lastFamilyElement.appendChild(fontElement);
}
return document;
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2025-06-14 12:00:07 UTC (rev 13851)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2025-06-14 20:07:46 UTC (rev 13852)
@@ -36,7 +36,6 @@
import org.foray.ps.encode.GlyphList;
import org.foray.ps.encode.GlyphList4a;
import org.foray.ps.encode.GlyphListParser;
-import org.foray.xml.SaxLocation;
import org.foray.xml.SaxParser4a;
import org.axsl.font.Font;
@@ -114,34 +113,9 @@
}
- /* Checkstyle: Suppress some checks for Data Transfer Object (DTO) class. */
- /**
- * Inner Data Transfer Object class storing parsed "font" elements whose related "font-content" element has not yet
- * been parsed.
- */
- private final class UnresolvedFont {
-
- /** The font that is unresolved. */
- private RegisteredFont font;
-
- /** The id of the "font-content" element. */
- private String fontContentId;
-
- /** The location in which the unresolved font was found. */
- private SaxLocation location;
-
- }
- /* Checkstyle: Restart checks after DTO class. */
-
/** Stateful variable tracking which {@link RegisteredFontFamily}, if any, is currently being parsed. */
private RegisteredFontFamily currentFontFamily = null;
- /** The list of registered fonts that have been parsed, but whose related {@link RegisteredFontContent} has not. */
- private List<UnresolvedFont> unresolvedFonts = new ArrayList<UnresolvedFont>();
-
-// /** The current "simulate-small-caps" value. */
-// private transient String currentSimulateSmallCaps = null;
-
/** The current "encoding" value. */
private transient String currentEncoding = null;
@@ -231,10 +205,6 @@
parseElementFontGroup(attributes);
return;
}
- case "font-content": {
- parseElementFontContent(attributes);
- return;
- }
case "font": {
parseElementFont(attributes);
return;
@@ -424,17 +394,22 @@
if (this.currentFontFamily == null) {
return;
}
- final String contentString = required(attributes, "content");
+ final String idString = required(attributes, "id");
final String styleString = required(attributes, "style");
final String weightString = required(attributes, "weight");
final String variantString = optional(attributes, "variant", "normal");
final String stretchString = optional(attributes, "stretch", "normal");
+ final String fontFile = replaceParameters(attributes.getValue("font-file"));
+ final String metricsFile = replaceParameters(attributes.getValue("metrics-file"));
+ final String collectionID = attributes.getValue("collection-id");
+ final String embedString = attributes.getValue("embed");
+
// final String simulateSmallCapsString =
// optional(attributes, "simulate-small-caps", this.currentSimulateSmallCaps);
// final String simulateObliqueString = optional(attributes, "simulate-oblique", "1");
final String encodingString = optional(attributes, "encoding", this.currentEncoding);
- final RegisteredFontContent content = this.fontServer.getRegisteredFont(contentString);
+ final RegisteredFontContent content = this.fontServer.getRegisteredFont(idString);
final FontStyle style = FontStyle.parseFo(styleString);
final FontWeight weight = FontWeight.parseFo(weightString);
final FontVariant variant = FontVariant.parseFo(variantString);
@@ -468,36 +443,12 @@
variant, stretch, simulation);
font.registerContent(content);
- if (font.getRegisteredFontContent() == null) {
- final UnresolvedFont unresolved = new UnresolvedFont();
- unresolved.font = font;
- unresolved.fontContentId = contentString;
- unresolved.location = new SaxLocation(getLocator());
- this.unresolvedFonts.add(unresolved);
- } else {
- try {
- this.currentFontFamily.registerFont(font);
- } catch (final FontException e) {
- throw new SAXException(e);
- }
+ try {
+ this.currentFontFamily.registerFont(font);
+ } catch (final FontException e) {
+ throw new SAXException(e);
}
- }
- /**
- * Parses a "font-content" element.
- * @param attributes The raw parsed attributes.
- */
- private void parseElementFontContent(final Attributes attributes) {
- final String fontID = attributes.getValue("id");
- if (StringUtils.isNullOrEmpty(fontID)) {
- errorMessage("Attribute \"id\" is required. Ignoring element.");
- return;
- }
- final String fontFile = replaceParameters(attributes.getValue("font-file"));
- final String metricsFile = replaceParameters(attributes.getValue("metrics-file"));
- final String collectionID = attributes.getValue("collection-id");
- final String embedString = attributes.getValue("embed");
-
Font.Embedding embed = null;
if (embedString == null
|| embedString.equals("")) {
@@ -536,15 +487,15 @@
}
try {
- this.fontServer.registerFont(fontID, fontFileSource, metricsFileSource, collectionID, embed, systemName);
+ this.fontServer.registerFont(idString, fontFileSource, metricsFileSource, collectionID, embed, systemName);
} catch (final FontException e) {
this.errorMessage(e.getMessage());
return;
}
- final RegisteredFontContent registeredFont = this.fontServer.getRegisteredFont(fontID);
+ final RegisteredFontContent registeredFont = this.fontServer.getRegisteredFont(idString);
if (registeredFont == null) {
- warningMessage("font-content is not registered: " + fontID);
+ warningMessage("font is not registered: " + idString);
return;
}
}
@@ -587,9 +538,6 @@
configureRootAttributes();
return;
}
- case "font-content": {
- return;
- }
case "font-family": {
// this.currentSimulateSmallCaps = null;
this.currentEncoding = null;
@@ -804,23 +752,6 @@
@Override
public void endDocument() throws SAXException {
- /* Handle unresolved "font" elements. */
- while (this.unresolvedFonts.size() > 0) {
- final UnresolvedFont unresolved = this.unresolvedFonts.get(0);
- final RegisteredFontContent content = this.fontServer.getRegisteredFont(unresolved.fontContentId);
- if (content == null) {
- errorMessage(unresolved.location, "Font cannot be registered due to unregistered font-content: " +
- unresolved.fontContentId);
- } else {
- unresolved.font.setRegisteredFontContent(content);
- try {
- unresolved.font.getRegisteredFontFamily().registerFont(unresolved.font);
- } catch (final FontException e) {
- throw new SAXException(e);
- }
- }
- this.unresolvedFonts.remove(0);
- }
}
}
Modified: trunk/foray/foray-font/src/test/resources/font-config.xml
===================================================================
--- trunk/foray/foray-font/src/test/resources/font-config.xml 2025-06-14 12:00:07 UTC (rev 13851)
+++ trunk/foray/foray-font/src/test/resources/font-config.xml 2025-06-14 20:07:46 UTC (rev 13852)
@@ -18,40 +18,27 @@
<!-- Some standard AWT fonts. -->
<font-group label="AWT-standard">
<font-family name="AWT-sans-serif">
- <font-content id="AWT-sans-serif-plain" system-name="sansserif"/>
- <font-content id="AWT-sans-serif-italic" system-name="sansserif.italic"/>
- <font-content id="AWT-sans-serif-bold" system-name="sansserif.bold"/>
- <font-content id="AWT-sans-serif-bold-italic" system-name="sansserif.bolditalic"/>
- <font content="AWT-sans-serif-plain" style="normal" weight="normal"/>
- <font content="AWT-sans-serif-italic" style="italic" weight="normal"/>
- <font content="AWT-sans-serif-bold" style="normal" weight="bold"/>
- <font content="AWT-sans-serif-bold-italic" style="italic" weight="bold"/>
+ <font id="AWT-sans-serif-plain" style="normal" weight="normal" system-name="sansserif"/>
+ <font id="AWT-sans-serif-italic" style="italic" weight="normal" system-name="sansserif.italic"/>
+ <font id="AWT-sans-serif-bold" style="normal" weight="bold" system-name="sansserif.bold"/>
+ <font id="AWT-sans-serif-bold-italic" style="italic" weight="bold" system-name="sansserif.bolditalic"/>
</font-family>
<font-family name="AWT-serif">
- <font-content id="AWT-serif-plain" system-name="serif"/>
- <font-content id="AWT-serif-italic" system-name="serif.italic"/>
- <font-content id="AWT-serif-bold" system-name="serif.bold"/>
- <font-content id="AWT-serif-bold-italic" system-name="serif.bolditalic"/>
- <font content="AWT-serif-plain" style="normal" weight="normal"/>
- <font content="AWT-serif-italic" style="italic" weight="normal"/>
- <font content="AWT-serif-bold" style="normal" weight="bold"/>
- <font content="AWT-serif-bold-italic" style="italic" weight="bold"/>
+ <font id="AWT-serif-plain" style="normal" weight="normal" system-name="serif"/>
+ <font id="AWT-serif-italic" style="italic" weight="normal" system-name="serif.italic"/>
+ <font id="AWT-serif-bold" style="normal" weight="bold" system-name="serif.bold"/>
+ <font id="AWT-serif-bold-italic" style="italic" weight="bold" system-name="serif.bolditalic"/>
</font-family>
<font-family name="AWT-monospaced">
- <font-content id="AWT-monospaced-plain" system-name="monospaced"/>
- <font-content id="AWT-monospaced-italic" system-name="monospaced.italic"/>
- <font-content id="AWT-monospaced-bold" system-name="monospaced.bold"/>
- <font-content id="AWT-monospaced-bold-italic" system-name="monospaced.bolditalic"/>
- <font content="AWT-monospaced-plain" style="normal" weight="normal"/>
- <font content="AWT-monospaced-italic" style="italic" weight="normal"/>
- <font content="AWT-monospaced-bold" style="normal" weight="bold"/>
- <font content="AWT-monospaced-bold-italic" style="italic" weight="bold"/>
+ <font id="AWT-monospaced-plain" style="normal" weight="normal" system-name="monospaced"/>
+ <font id="AWT-monospaced-italic" style="italic" weight="normal" system-name="monospaced.italic"/>
+ <font id="AWT-monospaced-bold" style="normal" weight="bold" system-name="monospaced.bold"/>
+ <font id="AWT-monospaced-bold-italic" style="italic" weight="bold" system-name="monospaced.bolditalic"/>
</font-family>
<font-family name="AWT-unicode">
- <font-content id="AWT-unicode" system-name="Lucida Sans Unicode"/>
- <font content="AWT-unicode" style="normal" weight="normal"/>
+ <font id="AWT-unicode" system-name="Lucida Sans Unicode" style="normal" weight="normal"/>
</font-family>
</font-group>
<!-- End of standard AWT fonts. -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-14 12:00:10
|
Revision: 13851
http://sourceforge.net/p/foray/code/13851
Author: victormote
Date: 2025-06-14 12:00:07 +0000 (Sat, 14 Jun 2025)
Log Message:
-----------
More simplification of Base-14 font registration.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-14 10:44:05 UTC (rev 13850)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-14 12:00:07 UTC (rev 13851)
@@ -398,42 +398,29 @@
final RegisteredFontFamily dingbatsFamily = registerFontFamily("Base14-ZapfDingbats");
/* Register the fonts. */
- registerBase14Font(courierFamily, "Base14-Courier", "Courier");
- registerBase14Font(courierFamily, "Base14-Courier-Oblique", "Courier-Oblique");
- registerBase14Font(courierFamily, "Base14-Courier-Bold", "Courier-Bold");
- registerBase14Font(courierFamily, "Base14-Courier-BoldOblique", "Courier-BoldOblique");
+ registerBase14Font(courierFamily, "Base14-Courier", "Courier", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Font(courierFamily, "Base14-Courier-Oblique", "Courier-Oblique", FontStyle.OBLIQUE,
+ FontWeight.NORMAL);
+ registerBase14Font(courierFamily, "Base14-Courier-Bold", "Courier-Bold", FontStyle.NORMAL, FontWeight.BOLD);
+ registerBase14Font(courierFamily, "Base14-Courier-BoldOblique", "Courier-BoldOblique", FontStyle.OBLIQUE,
+ FontWeight.BOLD);
- registerBase14Font(helveticaFamily, "Base14-Helvetica", "Helvetica");
- registerBase14Font(helveticaFamily, "Base14-Helvetica-Oblique", "Helvetica-Oblique");
- registerBase14Font(helveticaFamily, "Base14-Helvetica-Bold", "Helvetica-Bold");
- registerBase14Font(helveticaFamily, "Base14-Helvetica-BoldOblique", "Helvetica-BoldOblique");
+ registerBase14Font(helveticaFamily, "Base14-Helvetica", "Helvetica", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Font(helveticaFamily, "Base14-Helvetica-Oblique", "Helvetica-Oblique", FontStyle.OBLIQUE,
+ FontWeight.NORMAL);
+ registerBase14Font(helveticaFamily, "Base14-Helvetica-Bold", "Helvetica-Bold", FontStyle.NORMAL,
+ FontWeight.BOLD);
+ registerBase14Font(helveticaFamily, "Base14-Helvetica-BoldOblique", "Helvetica-BoldOblique", FontStyle.OBLIQUE,
+ FontWeight.BOLD);
- registerBase14Font(timesFamily, "Base14-Times", "Times-Roman");
- registerBase14Font(timesFamily, "Base14-Times-Italic", "Times-Italic");
- registerBase14Font(timesFamily, "Base14-Times-Bold", "Times-Bold");
- registerBase14Font(timesFamily, "Base14-Times-BoldItalic", "Times-BoldItalic");
+ registerBase14Font(timesFamily, "Base14-Times", "Times-Roman", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Font(timesFamily, "Base14-Times-Italic", "Times-Italic", FontStyle.ITALIC, FontWeight.NORMAL);
+ registerBase14Font(timesFamily, "Base14-Times-Bold", "Times-Bold", FontStyle.NORMAL, FontWeight.BOLD);
+ registerBase14Font(timesFamily, "Base14-Times-BoldItalic", "Times-BoldItalic", FontStyle.ITALIC,
+ FontWeight.BOLD);
- registerBase14Font(symbolFamily, "Base14-Symbol", "Symbol");
- registerBase14Font(dingbatsFamily, "Base14-ZapfDingbats", "ZapfDingbats");
-
- /* Register the font content. */
- registerBase14Description(courierFamily, "Base14-Courier", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description(courierFamily, "Base14-Courier-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
- registerBase14Description(courierFamily, "Base14-Courier-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description(courierFamily, "Base14-Courier-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
-
- registerBase14Description(helveticaFamily, "Base14-Helvetica", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description(helveticaFamily, "Base14-Helvetica-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
- registerBase14Description(helveticaFamily, "Base14-Helvetica-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description(helveticaFamily, "Base14-Helvetica-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
-
- registerBase14Description(timesFamily, "Base14-Times", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description(timesFamily, "Base14-Times-Italic", FontStyle.ITALIC, FontWeight.NORMAL);
- registerBase14Description(timesFamily, "Base14-Times-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description(timesFamily, "Base14-Times-BoldItalic", FontStyle.ITALIC, FontWeight.BOLD);
-
- registerBase14Description(symbolFamily, "Base14-Symbol", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description(dingbatsFamily, "Base14-ZapfDingbats", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Font(symbolFamily, "Base14-Symbol", "Symbol", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Font(dingbatsFamily, "Base14-ZapfDingbats", "ZapfDingbats", FontStyle.NORMAL, FontWeight.NORMAL);
}
/**
@@ -440,11 +427,13 @@
* Registers one base-14 font.
* @param registeredFontFamily The font family into which the font will be registered.
* @param fontName The name of the font to register.
- * @param fileName The name of the file from which metrics should be
- * obtained.
+ * @param fileName The name of the file from which metrics should be obtained.
+ * @param style The style of the font (normal, italic, etc.).
+ * @param weight The weight of the font (100, 200, normal, bold, etc.).
+ * @throws FontException For errors during registration.
*/
private void registerBase14Font(final RegisteredFontFamily registeredFontFamily, final String fontName,
- final String fileName) {
+ final String fileName, final FontStyle style, final FontWeight weight) throws FontException {
final String resourceName = "classpath:/resources/org/foray/font/base14/" + fileName + ".jbso";
URL metricURL = null;
try {
@@ -457,25 +446,16 @@
this.getLogger().warn("Serialized Base-14 font metrics not found: " + resourceName);
return;
}
- RegisteredFontContent rf = null;
+ RegisteredFontContent registeredFontContent = null;
try {
- rf = new RegisteredFontContent(this, fontName, null, null, null, org.axsl.font.Font.Embedding.NONE, null);
+ registeredFontContent = new RegisteredFontContent(this, fontName, null, null, null,
+ org.axsl.font.Font.Embedding.NONE, null);
} catch (final FontException e) {
this.logger.warn(e.getMessage(), e);
}
- rf.setSerializedMetricsFile(metricURL);
- }
+ registeredFontContent.setSerializedMetricsFile(metricURL);
- /**
- * Registers one base-14 font description item.
- * @param registeredFontFamily The font-family for which the description should be registered.
- * @param fontName The name of the font.
- * @param style The style of the font (normal, italic, etc.).
- * @param weight The weight of the font (100, 200, normal, bold, etc.).
- * @throws FontException For errors during registration.
- */
- private void registerBase14Description(final RegisteredFontFamily registeredFontFamily, final String fontName,
- final FontStyle style, final FontWeight weight) throws FontException {
+
Encoding encoding = EncodingWinAnsi.getInstance();
if (registeredFontFamily.getName().equals("Base14-Symbol")) {
encoding = EncodingSymbol.getInstance();
@@ -486,7 +466,6 @@
final FontFeatureSimulation4a simulation = new FontFeatureSimulation4a();
simulation.setSimulateSmallCaps(FontServer4a.DEFAULT_SMALL_CAPS_SIZE);
- final RegisteredFontContent registeredFontContent = this.getRegisteredFont(fontName);
final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, encoding, style, weight,
FontVariant.NORMAL, FontStretch.NORMAL, simulation);
registeredFont.registerContent(registeredFontContent);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-14 10:44:08
|
Revision: 13850
http://sourceforge.net/p/foray/code/13850
Author: victormote
Date: 2025-06-14 10:44:05 +0000 (Sat, 14 Jun 2025)
Log Message:
-----------
Steps toward simplification of Base-14 font registration.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 22:38:29 UTC (rev 13849)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-14 10:44:05 UTC (rev 13850)
@@ -173,7 +173,6 @@
try {
registerBase14Fonts();
registerDefaultAliases();
- registerBase14Descriptions();
} catch (final FontException e) {
throw new IllegalStateException("Unable to register Base-14 fonts", e);
}
@@ -416,6 +415,25 @@
registerBase14Font(symbolFamily, "Base14-Symbol", "Symbol");
registerBase14Font(dingbatsFamily, "Base14-ZapfDingbats", "ZapfDingbats");
+
+ /* Register the font content. */
+ registerBase14Description(courierFamily, "Base14-Courier", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(courierFamily, "Base14-Courier-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
+ registerBase14Description(courierFamily, "Base14-Courier-Bold", FontStyle.NORMAL, FontWeight.BOLD);
+ registerBase14Description(courierFamily, "Base14-Courier-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
+
+ registerBase14Description(helveticaFamily, "Base14-Helvetica", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(helveticaFamily, "Base14-Helvetica-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
+ registerBase14Description(helveticaFamily, "Base14-Helvetica-Bold", FontStyle.NORMAL, FontWeight.BOLD);
+ registerBase14Description(helveticaFamily, "Base14-Helvetica-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
+
+ registerBase14Description(timesFamily, "Base14-Times", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(timesFamily, "Base14-Times-Italic", FontStyle.ITALIC, FontWeight.NORMAL);
+ registerBase14Description(timesFamily, "Base14-Times-Bold", FontStyle.NORMAL, FontWeight.BOLD);
+ registerBase14Description(timesFamily, "Base14-Times-BoldItalic", FontStyle.ITALIC, FontWeight.BOLD);
+
+ registerBase14Description(symbolFamily, "Base14-Symbol", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(dingbatsFamily, "Base14-ZapfDingbats", FontStyle.NORMAL, FontWeight.NORMAL);
}
/**
@@ -449,88 +467,6 @@
}
/**
- * Registers the font families and descriptions (family members) for the
- * base-14 fonts.
- * @throws FontException For errors during registration.
- */
- private void registerBase14Descriptions() throws FontException {
- registerBase14CourierFamily();
- registerBase14HelveticaFamily();
- registerBase14TimesFamily();
- registerBase14SymbolFamily();
- registerBase14DingbatsFamily();
- }
-
- /**
- * Default registration for the "Base14-Courier" family.
- * @throws FontException For errors during registration.
- */
- private void registerBase14CourierFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-Courier");
- if (rff.getRegisteredFonts().size() > 0) {
- return;
- }
- registerBase14Description(rff, "Base14-Courier", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description(rff, "Base14-Courier-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
- registerBase14Description(rff, "Base14-Courier-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description(rff, "Base14-Courier-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
- }
-
- /**
- * Default registration for the "Base14-Helvetica" family.
- * @throws FontException For errors during registration.
- */
- private void registerBase14HelveticaFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-Helvetica");
- if (rff.getRegisteredFonts().size() > 0) {
- return;
- }
- registerBase14Description(rff, "Base14-Helvetica", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description(rff, "Base14-Helvetica-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
- registerBase14Description(rff, "Base14-Helvetica-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description(rff, "Base14-Helvetica-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
- }
-
- /**
- * Default registration for the "Base14-Times" family.
- * @throws FontException For errors during registration.
- */
- private void registerBase14TimesFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-Times");
- if (rff.getRegisteredFonts().size() > 0) {
- return;
- }
- registerBase14Description(rff, "Base14-Times", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description(rff, "Base14-Times-Italic", FontStyle.ITALIC, FontWeight.NORMAL);
- registerBase14Description(rff, "Base14-Times-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description(rff, "Base14-Times-BoldItalic", FontStyle.ITALIC, FontWeight.BOLD);
- }
-
- /**
- * Default registration for the "Base14-Symbol" family.
- * @throws FontException For errors during registration.
- */
- private void registerBase14SymbolFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-Symbol");
- if (rff.getRegisteredFonts().size() > 0) {
- return;
- }
- registerBase14Description(rff, "Base14-Symbol", FontStyle.NORMAL, FontWeight.NORMAL);
- }
-
- /**
- * Default registration for the "Base14-ZapfDingbats" family.
- * @throws FontException For errors during registration.
- */
- private void registerBase14DingbatsFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-ZapfDingbats");
- if (rff.getRegisteredFonts().size() > 0) {
- return;
- }
- registerBase14Description(rff, "Base14-ZapfDingbats", FontStyle.NORMAL, FontWeight.NORMAL);
- }
-
- /**
* Registers one base-14 font description item.
* @param registeredFontFamily The font-family for which the description should be registered.
* @param fontName The name of the font.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-13 22:38:31
|
Revision: 13849
http://sourceforge.net/p/foray/code/13849
Author: victormote
Date: 2025-06-13 22:38:29 +0000 (Fri, 13 Jun 2025)
Log Message:
-----------
Roll up unneeded public method.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 17:38:39 UTC (rev 13848)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 22:38:29 UTC (rev 13849)
@@ -549,14 +549,12 @@
}
final FontFeatureSimulation4a simulation = new FontFeatureSimulation4a();
simulation.setSimulateSmallCaps(FontServer4a.DEFAULT_SMALL_CAPS_SIZE);
- registerFontDescription(registeredFontFamily,
- fontName,
- encoding,
- style,
- weight,
- FontVariant.NORMAL,
- FontStretch.NORMAL,
- simulation);
+
+ final RegisteredFontContent registeredFontContent = this.getRegisteredFont(fontName);
+ final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, encoding, style, weight,
+ FontVariant.NORMAL, FontStretch.NORMAL, simulation);
+ registeredFont.registerContent(registeredFontContent);
+ registeredFontFamily.registerFont(registeredFont);
}
/**
@@ -938,35 +936,6 @@
}
/**
- * Register a font description for use by the system.
- * @param registeredFontFamily The font-family into which the new font should be registered.
- * @param fontID The font ID for the font that should be registered.
- * @param encoding The encoding, if any, that should be used by this font description.
- * Set this value to null unless you wish to override the encoding for this font.
- * @param style The font style (normal, italic, etc.).
- * @param weight The font weight (normal, bold, etc.).
- * @param variant The font variant (normal, small-caps, etc.).
- * @param stretch The font stretch (normal, condensed, expanded, etc.).
- * @param simulation Information about whether and how font features should be simulated if they are not native to
- * the font.
- * @throws FontException If {@code fontFamily} or {@code fontID} are not already registered.
- */
- public void registerFontDescription(final RegisteredFontFamily registeredFontFamily,
- final String fontID, final Encoding encoding,
- final FontStyle style,
- final FontWeight weight,
- final FontVariant variant,
- final FontStretch stretch,
- final FontFeatureSimulation simulation)
- throws FontException {
- final RegisteredFontContent registeredFontContent = this.getRegisteredFont(fontID);
- final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, encoding, style, weight, variant,
- stretch, simulation);
- registeredFont.registerContent(registeredFontContent);
- registeredFontFamily.registerFont(registeredFont);
- }
-
- /**
* Returns the font-selector that should be used by a given font consumer.
* @param consumer The consumer for which a font-selector is needed.
* @return The font-selector instance.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-13 17:38:41
|
Revision: 13848
http://sourceforge.net/p/foray/code/13848
Author: victormote
Date: 2025-06-13 17:38:39 +0000 (Fri, 13 Jun 2025)
Log Message:
-----------
Roll up unnecessary method.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 16:47:24 UTC (rev 13847)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 17:38:39 UTC (rev 13848)
@@ -237,7 +237,7 @@
try {
final RegisteredFontContent registeredFontContent =
new RegisteredFontContent(this, null, null, null, null, null, "serif");
- final RegisteredFontFamily registeredFontFamily = this.registerFontFamily2("serif");
+ final RegisteredFontFamily registeredFontFamily = this.registerFontFamily("serif");
final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, null, FontStyle.NORMAL,
FontWeight.NORMAL, FontVariant.NORMAL,
FontStretch.NORMAL, FontFeatureSimulation.DEFAULT);
@@ -590,7 +590,7 @@
RegisteredFontFamily registeredFontFamily = this.getRegisteredFontFamily(awtFont.getFamily());
if (registeredFontFamily == null) {
try {
- registeredFontFamily = registerFontFamily2(awtFont.getFamily());
+ registeredFontFamily = registerFontFamily(awtFont.getFamily());
} catch (final FontException e) {
/* This should never happen. We just made sure it doesn't
* already exist. */
@@ -687,23 +687,6 @@
}
/**
- * Add a RegisteredFontFamily to the Collection.
- * @param name the name of the font family (e.g. "Courier")
- * @return The registered font family instance.
- * @throws FontException If the font-family is already registered.
- */
- public RegisteredFontFamily registerFontFamily2(final String name) throws FontException {
- /* Make sure it is not already registered. */
- RegisteredFontFamily rff = this.getRegisteredFontFamily(name);
- if (rff != null) {
- throw new FontException("font-family already registered: " + name);
- }
- rff = new RegisteredFontFamily(this, name);
- this.fontFamilies.put(name, rff);
- return rff;
- }
-
- /**
* Add an alias to a RegisteredFontFamily.
* @param alias The name of the font family alias (e.g. "sans-serif").
* @param realFamily The name of the real font family to which this alias should be associated (e.g. "Helvetica").
@@ -823,7 +806,14 @@
* @throws FontException If the font-family is already registered.
*/
public RegisteredFontFamily registerFontFamily(final String name) throws FontException {
- return registerFontFamily2(name);
+ /* Make sure it is not already registered. */
+ RegisteredFontFamily rff = this.getRegisteredFontFamily(name);
+ if (rff != null) {
+ throw new FontException("font-family already registered: " + name);
+ }
+ rff = new RegisteredFontFamily(this, name);
+ this.fontFamilies.put(name, rff);
+ return rff;
}
/**
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2025-06-13 16:47:24 UTC (rev 13847)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2025-06-13 17:38:39 UTC (rev 13848)
@@ -370,7 +370,7 @@
return;
}
try {
- this.currentFontFamily = this.fontServer.registerFontFamily2(name);
+ this.currentFontFamily = this.fontServer.registerFontFamily(name);
} catch (final FontException e) {
/* Log a warning. */
warningMessage(e.getMessage());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-13 16:47:27
|
Revision: 13847
http://sourceforge.net/p/foray/code/13847
Author: victormote
Date: 2025-06-13 16:47:24 +0000 (Fri, 13 Jun 2025)
Log Message:
-----------
More font registration cleanup.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 14:20:42 UTC (rev 13846)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 16:47:24 UTC (rev 13847)
@@ -466,15 +466,14 @@
* @throws FontException For errors during registration.
*/
private void registerBase14CourierFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily(
- "Base14-Courier");
+ final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-Courier");
if (rff.getRegisteredFonts().size() > 0) {
return;
}
- registerBase14Description("Base14-Courier", "Base14-Courier", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description("Base14-Courier", "Base14-Courier-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
- registerBase14Description("Base14-Courier", "Base14-Courier-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description("Base14-Courier", "Base14-Courier-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
+ registerBase14Description(rff, "Base14-Courier", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(rff, "Base14-Courier-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
+ registerBase14Description(rff, "Base14-Courier-Bold", FontStyle.NORMAL, FontWeight.BOLD);
+ registerBase14Description(rff, "Base14-Courier-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
}
/**
@@ -482,16 +481,14 @@
* @throws FontException For errors during registration.
*/
private void registerBase14HelveticaFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily(
- "Base14-Helvetica");
+ final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-Helvetica");
if (rff.getRegisteredFonts().size() > 0) {
return;
}
- registerBase14Description("Base14-Helvetica", "Base14-Helvetica", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description("Base14-Helvetica", "Base14-Helvetica-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
- registerBase14Description("Base14-Helvetica", "Base14-Helvetica-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description("Base14-Helvetica", "Base14-Helvetica-BoldOblique", FontStyle.OBLIQUE,
- FontWeight.BOLD);
+ registerBase14Description(rff, "Base14-Helvetica", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(rff, "Base14-Helvetica-Oblique", FontStyle.OBLIQUE, FontWeight.NORMAL);
+ registerBase14Description(rff, "Base14-Helvetica-Bold", FontStyle.NORMAL, FontWeight.BOLD);
+ registerBase14Description(rff, "Base14-Helvetica-BoldOblique", FontStyle.OBLIQUE, FontWeight.BOLD);
}
/**
@@ -499,15 +496,14 @@
* @throws FontException For errors during registration.
*/
private void registerBase14TimesFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily(
- "Base14-Times");
+ final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-Times");
if (rff.getRegisteredFonts().size() > 0) {
return;
}
- registerBase14Description("Base14-Times", "Base14-Times", FontStyle.NORMAL, FontWeight.NORMAL);
- registerBase14Description("Base14-Times", "Base14-Times-Italic", FontStyle.ITALIC, FontWeight.NORMAL);
- registerBase14Description("Base14-Times", "Base14-Times-Bold", FontStyle.NORMAL, FontWeight.BOLD);
- registerBase14Description("Base14-Times", "Base14-Times-BoldItalic", FontStyle.ITALIC, FontWeight.BOLD);
+ registerBase14Description(rff, "Base14-Times", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(rff, "Base14-Times-Italic", FontStyle.ITALIC, FontWeight.NORMAL);
+ registerBase14Description(rff, "Base14-Times-Bold", FontStyle.NORMAL, FontWeight.BOLD);
+ registerBase14Description(rff, "Base14-Times-BoldItalic", FontStyle.ITALIC, FontWeight.BOLD);
}
/**
@@ -515,12 +511,11 @@
* @throws FontException For errors during registration.
*/
private void registerBase14SymbolFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily(
- "Base14-Symbol");
+ final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-Symbol");
if (rff.getRegisteredFonts().size() > 0) {
return;
}
- registerBase14Description("Base14-Symbol", "Base14-Symbol", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(rff, "Base14-Symbol", FontStyle.NORMAL, FontWeight.NORMAL);
}
/**
@@ -528,35 +523,33 @@
* @throws FontException For errors during registration.
*/
private void registerBase14DingbatsFamily() throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily(
- "Base14-ZapfDingbats");
+ final RegisteredFontFamily rff = this.getRegisteredFontFamily("Base14-ZapfDingbats");
if (rff.getRegisteredFonts().size() > 0) {
return;
}
- registerBase14Description("Base14-ZapfDingbats", "Base14-ZapfDingbats", FontStyle.NORMAL, FontWeight.NORMAL);
+ registerBase14Description(rff, "Base14-ZapfDingbats", FontStyle.NORMAL, FontWeight.NORMAL);
}
/**
* Registers one base-14 font description item.
- * @param fontFamily The font-family for which the description should be
- * registered.
+ * @param registeredFontFamily The font-family for which the description should be registered.
* @param fontName The name of the font.
* @param style The style of the font (normal, italic, etc.).
* @param weight The weight of the font (100, 200, normal, bold, etc.).
* @throws FontException For errors during registration.
*/
- private void registerBase14Description(final String fontFamily, final String fontName, final FontStyle style,
- final FontWeight weight) throws FontException {
+ private void registerBase14Description(final RegisteredFontFamily registeredFontFamily, final String fontName,
+ final FontStyle style, final FontWeight weight) throws FontException {
Encoding encoding = EncodingWinAnsi.getInstance();
- if (fontFamily.equals("Base14-Symbol")) {
+ if (registeredFontFamily.getName().equals("Base14-Symbol")) {
encoding = EncodingSymbol.getInstance();
}
- if (fontFamily.equals("Base14-ZapfDingbats")) {
+ if (registeredFontFamily.getName().equals("Base14-ZapfDingbats")) {
encoding = EncodingZapfDingbats.getInstance();
}
final FontFeatureSimulation4a simulation = new FontFeatureSimulation4a();
simulation.setSimulateSmallCaps(FontServer4a.DEFAULT_SMALL_CAPS_SIZE);
- registerFontDescription(fontFamily,
+ registerFontDescription(registeredFontFamily,
fontName,
encoding,
style,
@@ -956,7 +949,7 @@
/**
* Register a font description for use by the system.
- * @param fontFamily The name of the font-family in which this font should be registered.
+ * @param registeredFontFamily The font-family into which the new font should be registered.
* @param fontID The font ID for the font that should be registered.
* @param encoding The encoding, if any, that should be used by this font description.
* Set this value to null unless you wish to override the encoding for this font.
@@ -968,7 +961,7 @@
* the font.
* @throws FontException If {@code fontFamily} or {@code fontID} are not already registered.
*/
- public void registerFontDescription(final String fontFamily,
+ public void registerFontDescription(final RegisteredFontFamily registeredFontFamily,
final String fontID, final Encoding encoding,
final FontStyle style,
final FontWeight weight,
@@ -976,7 +969,6 @@
final FontStretch stretch,
final FontFeatureSimulation simulation)
throws FontException {
- final RegisteredFontFamily registeredFontFamily = this.getRegisteredFontFamily(fontFamily);
final RegisteredFontContent registeredFontContent = this.getRegisteredFont(fontID);
final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, encoding, style, weight, variant,
stretch, simulation);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-13 14:20:45
|
Revision: 13846
http://sourceforge.net/p/foray/code/13846
Author: victormote
Date: 2025-06-13 14:20:42 +0000 (Fri, 13 Jun 2025)
Log Message:
-----------
Remove unneeded methods.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2025-06-13 14:06:51 UTC (rev 13845)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2025-06-13 14:20:42 UTC (rev 13846)
@@ -57,7 +57,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.xml.sax.EntityResolver;
import java.io.IOException;
import java.io.InputStream;
@@ -125,12 +124,10 @@
* @throws ForayException For errors creating the server.
*/
public static FontServer makeFontServer(final SessionConfig configuration) throws ForayException {
- final EntityResolver entityResolver = configuration.makeEntityResolver();
final PsServer psServer = ForaySpecific.makePsServer();
final FontServer4a forayFontServer = new FontServer4a(psServer);
forayFontServer.setBaseFontURL(configuration.optionFontBaseDirectory());
forayFontServer.setBaseURL(configuration.optionBaseDirectory());
- forayFontServer.setEntityResolver(entityResolver);
final URL fontConfigURL = configuration.optionFontConfiguration();
if (fontConfigURL != null) {
InputStream inputStream = null;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 14:06:51 UTC (rev 13845)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 14:20:42 UTC (rev 13846)
@@ -55,7 +55,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;
-import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -149,10 +148,6 @@
/** This is the SystemFont that should be used when a SystemFont is required and all other fallback options fail. */
private RegisteredFont defaultSystemFont = null;
- /** An EntityResolver to be used by XML parsers (for handling DTD catalogs,
- * etc.). */
- private EntityResolver entityResolver = null;
-
/**
* Map whose key is a String containing the id of a {@link RegisteredFontContent} instance, and whose value is that
* instance.
@@ -829,68 +824,6 @@
}
/**
- * Returns a list of all Font instances.
- * @param freeStandingFonts Set to true to include free-standing fonts in the returned array.
- * @param systemFonts Set to true to include system fonts in the returned array.
- * @return The array of all Font instances.
- */
- public List<Font4a> getAllFonts(final boolean freeStandingFonts, final boolean systemFonts) {
- final List<Font4a> fontList = new ArrayList<Font4a>();
- for (RegisteredFontFamily family : this.fontFamilies.values()) {
- final List<RegisteredFont> rfdList
- = family.getRegisteredFonts();
- if (rfdList != null) {
- for (int i = 0; i < rfdList.size(); i++) {
- final RegisteredFont rfd = rfdList.get(i);
- final RegisteredFontContent rf = rfd.getRegisteredFontContent();
- if (freeStandingFonts
- && rf.getFreeStandingFont() != null) {
- fontList.add(rf.getFreeStandingFont());
- }
- if (systemFonts
- && rf.getSystemFont() != null) {
- fontList.add(rf.getSystemFont());
- }
- }
- }
- }
- if (fontList.size() < 1) {
- return null;
- }
- final List<Font4a> returnList = new ArrayList<Font4a>();
- for (int i = 0; i < fontList.size(); i++) {
- final Font4a font = fontList.get(i);
- boolean duplicateFound = false;
- for (int j = 0; j < returnList.size() && ! duplicateFound; j++) {
- if (font == returnList.get(j)) {
- duplicateFound = true;
- }
- }
- /* If duplicate found, Skip this one, it is already on the list. */
- if (! duplicateFound) {
- returnList.add(font);
- }
- }
- return returnList;
- }
-
- /**
- * Returns the EntityResolver for this server.
- * @return The EntityResolver.
- */
- public EntityResolver getEntityResolver() {
- return this.entityResolver;
- }
-
- /**
- * Sets the EntityResolver for this server.
- * @param entityResolver The new EntityResolver.
- */
- public void setEntityResolver(final EntityResolver entityResolver) {
- this.entityResolver = entityResolver;
- }
-
- /**
* Register a font-family for use by the system.
* @param name The name of the font-family (e.g. "Courier").
* @return The font family instance.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-13 14:06:54
|
Revision: 13845
http://sourceforge.net/p/foray/code/13845
Author: victormote
Date: 2025-06-13 14:06:51 +0000 (Fri, 13 Jun 2025)
Log Message:
-----------
Tighten relationship of RegisteredFontFamily and RegisteredFont.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 11:33:22 UTC (rev 13844)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 14:06:51 UTC (rev 13845)
@@ -397,39 +397,41 @@
*/
private void registerBase14Fonts() throws FontException {
/* Register the font families. */
- this.registerFontFamily("Base14-Courier");
- this.registerFontFamily("Base14-Helvetica");
- this.registerFontFamily("Base14-Times");
- this.registerFontFamily("Base14-Symbol");
- this.registerFontFamily("Base14-ZapfDingbats");
+ final RegisteredFontFamily courierFamily = registerFontFamily("Base14-Courier");
+ final RegisteredFontFamily helveticaFamily = registerFontFamily("Base14-Helvetica");
+ final RegisteredFontFamily timesFamily = registerFontFamily("Base14-Times");
+ final RegisteredFontFamily symbolFamily = registerFontFamily("Base14-Symbol");
+ final RegisteredFontFamily dingbatsFamily = registerFontFamily("Base14-ZapfDingbats");
/* Register the fonts. */
- registerBase14Font("Base14-Courier", "Courier");
- registerBase14Font("Base14-Courier-Oblique", "Courier-Oblique");
- registerBase14Font("Base14-Courier-Bold", "Courier-Bold");
- registerBase14Font("Base14-Courier-BoldOblique",
- "Courier-BoldOblique");
- registerBase14Font("Base14-Helvetica", "Helvetica");
- registerBase14Font("Base14-Helvetica-Oblique",
- "Helvetica-Oblique");
- registerBase14Font("Base14-Helvetica-Bold", "Helvetica-Bold");
- registerBase14Font("Base14-Helvetica-BoldOblique",
- "Helvetica-BoldOblique");
- registerBase14Font("Base14-Times", "Times-Roman");
- registerBase14Font("Base14-Times-Italic", "Times-Italic");
- registerBase14Font("Base14-Times-Bold", "Times-Bold");
- registerBase14Font("Base14-Times-BoldItalic", "Times-BoldItalic");
- registerBase14Font("Base14-Symbol", "Symbol");
- registerBase14Font("Base14-ZapfDingbats", "ZapfDingbats");
+ registerBase14Font(courierFamily, "Base14-Courier", "Courier");
+ registerBase14Font(courierFamily, "Base14-Courier-Oblique", "Courier-Oblique");
+ registerBase14Font(courierFamily, "Base14-Courier-Bold", "Courier-Bold");
+ registerBase14Font(courierFamily, "Base14-Courier-BoldOblique", "Courier-BoldOblique");
+
+ registerBase14Font(helveticaFamily, "Base14-Helvetica", "Helvetica");
+ registerBase14Font(helveticaFamily, "Base14-Helvetica-Oblique", "Helvetica-Oblique");
+ registerBase14Font(helveticaFamily, "Base14-Helvetica-Bold", "Helvetica-Bold");
+ registerBase14Font(helveticaFamily, "Base14-Helvetica-BoldOblique", "Helvetica-BoldOblique");
+
+ registerBase14Font(timesFamily, "Base14-Times", "Times-Roman");
+ registerBase14Font(timesFamily, "Base14-Times-Italic", "Times-Italic");
+ registerBase14Font(timesFamily, "Base14-Times-Bold", "Times-Bold");
+ registerBase14Font(timesFamily, "Base14-Times-BoldItalic", "Times-BoldItalic");
+
+ registerBase14Font(symbolFamily, "Base14-Symbol", "Symbol");
+ registerBase14Font(dingbatsFamily, "Base14-ZapfDingbats", "ZapfDingbats");
}
/**
* Registers one base-14 font.
+ * @param registeredFontFamily The font family into which the font will be registered.
* @param fontName The name of the font to register.
* @param fileName The name of the file from which metrics should be
* obtained.
*/
- private void registerBase14Font(final String fontName, final String fileName) {
+ private void registerBase14Font(final RegisteredFontFamily registeredFontFamily, final String fontName,
+ final String fileName) {
final String resourceName = "classpath:/resources/org/foray/font/base14/" + fileName + ".jbso";
URL metricURL = null;
try {
@@ -891,10 +893,11 @@
/**
* Register a font-family for use by the system.
* @param name The name of the font-family (e.g. "Courier").
+ * @return The font family instance.
* @throws FontException If the font-family is already registered.
*/
- public void registerFontFamily(final String name) throws FontException {
- registerFontFamily2(name);
+ public RegisteredFontFamily registerFontFamily(final String name) throws FontException {
+ return registerFontFamily2(name);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-13 11:33:25
|
Revision: 13844
http://sourceforge.net/p/foray/code/13844
Author: victormote
Date: 2025-06-13 11:33:22 +0000 (Fri, 13 Jun 2025)
Log Message:
-----------
Clarify heritage of RegisteredFont.
Modified Paths:
--------------
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/FontServer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java
trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java
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-06-13 10:59:57 UTC (rev 13843)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java 2025-06-13 11:33:22 UTC (rev 13844)
@@ -213,7 +213,7 @@
// final Encoding encoding = findEncoding(rfd, codePoint);
if (encoding == null) {
/* No encoding was configured, meaning that the native encoding should be used. */
- final RegisteredFontContent content = rfd.getRegisteredFont();
+ final RegisteredFontContent content = rfd.getRegisteredFontContent();
final Font4a font = content.getBestFont();
encoding = font.getInternalEncoding();
}
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-06-13 10:59:57 UTC (rev 13843)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-06-13 11:33:22 UTC (rev 13844)
@@ -293,9 +293,9 @@
}
Font4a fontSelected = null;
if (this.selectionConstraints.canSelectFreeStandingFonts()) {
- fontSelected = fontDescSelected.getRegisteredFont().getFreeStandingFont();
+ fontSelected = fontDescSelected.getRegisteredFontContent().getFreeStandingFont();
} else {
- fontSelected = fontDescSelected.getRegisteredFont().getSystemFont();
+ fontSelected = fontDescSelected.getRegisteredFontContent().getSystemFont();
}
final ConsumerFont4a consumerFont = registerFontUse(fontSelected);
return consumerFont.getFontUse(fontDescSelected, fontSelected.getInternalEncoding());
@@ -319,7 +319,7 @@
* @return The FontUse instance dictated by the parameters of consumer.
*/
protected Font4a whichUse(final RegisteredFont rfd) {
- final RegisteredFontContent rf = rfd.getRegisteredFont();
+ final RegisteredFontContent rf = rfd.getRegisteredFontContent();
/* Avoid instantiating the non-preferred manifestation if it won't be
* used anyway. */
@@ -356,7 +356,7 @@
if (! this.selectionConstraints.canSelectFreeStandingFonts()) {
return null;
}
- final FreeStandingFont fsf = rfd.getRegisteredFont().getFreeStandingFont();
+ final FreeStandingFont fsf = rfd.getRegisteredFontContent().getFreeStandingFont();
if (fsf == null) {
return null;
}
@@ -509,7 +509,7 @@
for (RegisteredFontFamily rff : this.server.registeredFontFamilies()) {
for (int i = 0; i < rff.getRegisteredFonts().size(); i++) {
final RegisteredFont rfd = rff.getRegisteredFonts().get(i);
- final Panose4a panoseInstance = rfd.getRegisteredFont()
+ final Panose4a panoseInstance = rfd.getRegisteredFontContent()
.getPanose();
final long difference = panoseInstance.difference(desiredPanose, null);
if (difference < bestDifference) {
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 10:59:57 UTC (rev 13843)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 11:33:22 UTC (rev 13844)
@@ -240,12 +240,14 @@
}
/* Punt and try to create something that will work. */
try {
- final RegisteredFontContent rf = new RegisteredFontContent(this, null, null, null, null, null, "serif");
- final RegisteredFontFamily rff = this.registerFontFamily2("serif");
- final RegisteredFont font = new RegisteredFont(rf, rff, null, FontStyle.NORMAL,
+ final RegisteredFontContent registeredFontContent =
+ new RegisteredFontContent(this, null, null, null, null, null, "serif");
+ final RegisteredFontFamily registeredFontFamily = this.registerFontFamily2("serif");
+ final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, null, FontStyle.NORMAL,
FontWeight.NORMAL, FontVariant.NORMAL,
FontStretch.NORMAL, FontFeatureSimulation.DEFAULT);
- rff.registerFont(font);
+ registeredFontFamily.registerFont(registeredFont);
+ registeredFont.registerContent(registeredFontContent);
} catch (final FontException e) {
getLogger().error("Unable to create default system font.");
}
@@ -595,11 +597,10 @@
}
for (int i = 0; i < fontList.size(); i++) {
final Font awtFont = fontList.get(i);
- RegisteredFontFamily rff = this.getRegisteredFontFamily(
- awtFont.getFamily());
- if (rff == null) {
+ RegisteredFontFamily registeredFontFamily = this.getRegisteredFontFamily(awtFont.getFamily());
+ if (registeredFontFamily == null) {
try {
- rff = registerFontFamily2(awtFont.getFamily());
+ registeredFontFamily = registerFontFamily2(awtFont.getFamily());
} catch (final FontException e) {
/* This should never happen. We just made sure it doesn't
* already exist. */
@@ -606,9 +607,9 @@
continue;
}
}
- final RegisteredFontContent rf;
+ final RegisteredFontContent registeredFontContent;
try {
- rf = new RegisteredFontContent(this, awtFont.getFontName(),
+ registeredFontContent = new RegisteredFontContent(this, awtFont.getFontName(),
null, null, null, org.axsl.font.Font.Embedding.NONE, awtFont.getFontName());
} catch (final FontException e) {
this.logger.error(e.getMessage());
@@ -624,10 +625,11 @@
}
final FontVariant fontVariant = FontVariant.NORMAL;
final FontStretch fontStretch = FontStretch.NORMAL;
- final RegisteredFont font = new RegisteredFont(rf, rff, null, fontStyle, fontWeight, fontVariant,
- fontStretch, FontFeatureSimulation.DEFAULT);
+ final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, null, fontStyle, fontWeight,
+ fontVariant, fontStretch, FontFeatureSimulation.DEFAULT);
+ registeredFont.registerContent(registeredFontContent);
try {
- rff.registerFont(font);
+ registeredFontFamily.registerFont(registeredFont);
} catch (final FontException e) {
this.logger.error(e.getMessage());
}
@@ -838,7 +840,7 @@
if (rfdList != null) {
for (int i = 0; i < rfdList.size(); i++) {
final RegisteredFont rfd = rfdList.get(i);
- final RegisteredFontContent rf = rfd.getRegisteredFont();
+ final RegisteredFontContent rf = rfd.getRegisteredFontContent();
if (freeStandingFonts
&& rf.getFreeStandingFont() != null) {
fontList.add(rf.getFreeStandingFont());
@@ -1038,10 +1040,12 @@
final FontStretch stretch,
final FontFeatureSimulation simulation)
throws FontException {
- final RegisteredFontFamily rff = this.getRegisteredFontFamily(fontFamily);
- final RegisteredFontContent rf = this.getRegisteredFont(fontID);
- final RegisteredFont font = new RegisteredFont(rf, rff, encoding, style, weight, variant, stretch, simulation);
- rff.registerFont(font);
+ final RegisteredFontFamily registeredFontFamily = this.getRegisteredFontFamily(fontFamily);
+ final RegisteredFontContent registeredFontContent = this.getRegisteredFont(fontID);
+ final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily, encoding, style, weight, variant,
+ stretch, simulation);
+ registeredFont.registerContent(registeredFontContent);
+ registeredFontFamily.registerFont(registeredFont);
}
/**
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2025-06-13 10:59:57 UTC (rev 13843)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2025-06-13 11:33:22 UTC (rev 13844)
@@ -464,10 +464,11 @@
/* TODO: Reactivate parsing of the simulation parameters and add them to simulation below. */
final FontFeatureSimulation4a simulation = new FontFeatureSimulation4a();
- final RegisteredFont font = new RegisteredFont(content, this.currentFontFamily, encoding, style, weight,
+ final RegisteredFont font = new RegisteredFont(this.currentFontFamily, encoding, style, weight,
variant, stretch, simulation);
+ font.registerContent(content);
- if (font.getRegisteredFont() == null) {
+ if (font.getRegisteredFontContent() == null) {
final UnresolvedFont unresolved = new UnresolvedFont();
unresolved.font = font;
unresolved.fontContentId = contentString;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java 2025-06-13 10:59:57 UTC (rev 13843)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFont.java 2025-06-13 11:33:22 UTC (rev 13844)
@@ -80,10 +80,7 @@
* stretch bucket. */
public static final byte SIMULATE_ULTRA_EXPANDED_INDEX = 7;
- /** The RegisteredFont instance. */
- private RegisteredFontContent registeredFont;
-
- /** The parent RegisteredFontFamily instance. */
+ /** The parent {@link RegisteredFontFamily} instance. */
private RegisteredFontFamily registeredFontFamily;
/** The encoding to be used. */
@@ -104,11 +101,13 @@
/** The font feature simulation for this registered font. */
private FontFeatureSimulation fontFeatureSimulation;
+ /** The content for this registered font. */
+ private RegisteredFontContent registeredFontContent;
+
/**
* Constructor.
- * @param rf The parent registered font.
- * @param rff The parent registered font family.
- * @param encoding The specified encoding.
+ * @param registeredFontFamily The parent registered font family.
+ * @param defaultEncoding The specified encoding.
* @param fontStyle The font style (normal, italic, etc.)
* @param fontWeight The font weight(100, 200, bold, etc.)
* @param fontVariant The font variant (normal, small-caps)
@@ -115,12 +114,11 @@
* @param fontStretch The font stretch (normal, condensed, etc.)
* @param simulation The font features to be simulated if not natively present.
*/
- public RegisteredFont(final RegisteredFontContent rf, final RegisteredFontFamily rff, final Encoding encoding,
+ public RegisteredFont(final RegisteredFontFamily registeredFontFamily, final Encoding defaultEncoding,
final FontStyle fontStyle, final FontWeight fontWeight, final FontVariant fontVariant,
final FontStretch fontStretch, final FontFeatureSimulation simulation) {
- this.registeredFont = rf;
- this.registeredFontFamily = rff;
- this.encoding = encoding;
+ this.registeredFontFamily = registeredFontFamily;
+ this.encoding = defaultEncoding;
this.fontStyle = fontStyle;
this.fontWeight = fontWeight;
this.fontVariant = fontVariant;
@@ -129,6 +127,14 @@
}
/**
+ * Registers the content for this font.
+ * @param registeredFontContent The parent registered font.
+ */
+ public void registerContent(final RegisteredFontContent registeredFontContent) {
+ this.registeredFontContent = registeredFontContent;
+ }
+
+ /**
* Returns the font style.
* @return The font style.
*/
@@ -164,8 +170,8 @@
* Returns the related registered font instance.
* @return The related registered font instance.
*/
- public RegisteredFontContent getRegisteredFont() {
- return this.registeredFont;
+ public RegisteredFontContent getRegisteredFontContent() {
+ return this.registeredFontContent;
}
/**
@@ -178,8 +184,8 @@
* @throws IllegalStateException If this method is called on an instance for which the content is already set.
*/
public void setRegisteredFontContent(final RegisteredFontContent content) {
- if (this.registeredFont == null) {
- this.registeredFont = content;
+ if (this.registeredFontContent == null) {
+ this.registeredFontContent = content;
} else {
throw new IllegalStateException("The content of this font has already been set.");
}
@@ -420,10 +426,10 @@
*/
public boolean generalTypeMatches(final boolean freeStandingFonts,
final boolean systemFonts) {
- if (freeStandingFonts && this.registeredFont.hasFreeStandingFont()) {
+ if (freeStandingFonts && this.registeredFontContent.hasFreeStandingFont()) {
return true;
}
- if (systemFonts && this.registeredFont.hasSystemFont()) {
+ if (systemFonts && this.registeredFontContent.hasSystemFont()) {
return true;
}
return false;
@@ -433,7 +439,7 @@
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append("[");
- builder.append(this.registeredFont.getConfiguredFontName());
+ builder.append(this.registeredFontContent.getConfiguredFontName());
builder.append(", ");
builder.append(this.registeredFontFamily.getName());
builder.append(", ");
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-06-13 10:59:57 UTC (rev 13843)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java 2025-06-13 11:33:22 UTC (rev 13844)
@@ -224,7 +224,7 @@
this.fsFont = createFSFont();
if (this.fsFont == null) {
this.fsFont = getFontServer().getDefaultFreeStandingFont()
- .getRegisteredFont().fsFont;
+ .getRegisteredFontContent().fsFont;
getLogger().error("Unable to open font "
+ this.configuredFontName + ".");
getLogger().error("Using a default font instead.");
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java 2025-06-13 10:59:57 UTC (rev 13843)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java 2025-06-13 11:33:22 UTC (rev 13844)
@@ -88,7 +88,7 @@
*/
public void registerFont(final RegisteredFont font) throws FontException {
/* Check basic completeness. */
- if (font.getRegisteredFont() == null) {
+ if (font.getRegisteredFontContent() == null) {
throw new FontException(RegisteredFontContent.class.getName() + " is required.");
}
if (font.getFontStyle() == null) {
Modified: trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java
===================================================================
--- trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java 2025-06-13 10:59:57 UTC (rev 13843)
+++ trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java 2025-06-13 11:33:22 UTC (rev 13844)
@@ -98,14 +98,15 @@
final PsServer4a psServer = new PsServer4a();
final FontServer4a fontServer = new FontServer4a(psServer);
final FontConsumer4a fontConsumer = fontServer.createFontConsumer(null);
- final RegisteredFontContent rf = fontServer.getRegisteredFont("Base14-Helvetica");
- final RegisteredFontFamily rff = fontServer.getRegisteredFontFamily("Base14-Helvetica");
- final FreeStandingFont font = rf.getFreeStandingFont();
- final RegisteredFont rfd = new RegisteredFont(rf, rff,
- rf.getFreeStandingFont().getInternalEncoding(), FontStyle.NORMAL, FontWeight.NORMAL,
+ final RegisteredFontContent registeredFontContent = fontServer.getRegisteredFont("Base14-Helvetica");
+ final RegisteredFontFamily registeredFontFamily = fontServer.getRegisteredFontFamily("Base14-Helvetica");
+ final FreeStandingFont font = registeredFontContent.getFreeStandingFont();
+ final RegisteredFont registeredFont = new RegisteredFont(registeredFontFamily,
+ registeredFontContent.getFreeStandingFont().getInternalEncoding(), FontStyle.NORMAL, FontWeight.NORMAL,
FontVariant.NORMAL, FontStretch.NORMAL, FontFeatureSimulation.DEFAULT);
+ registeredFont.registerContent(registeredFontContent);
final ConsumerFont4a consumerFont = new ConsumerFont4a(font, fontConsumer);
- final FontUse fontUse = new FontUse4a(consumerFont, rfd, EncodingStandard.getInstance());
+ final FontUse fontUse = new FontUse4a(consumerFont, registeredFont, EncodingStandard.getInstance());
final PdfFont pdfFont = doc.getPdfFont(fontUse);
contentStream.setFont(pdfFont, 12);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-13 10:59:59
|
Revision: 13843
http://sourceforge.net/p/foray/code/13843
Author: victormote
Date: 2025-06-13 10:59:57 +0000 (Fri, 13 Jun 2025)
Log Message:
-----------
Connect RegisteredFontFamily instance with its parent FontServer.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-12 21:44:15 UTC (rev 13842)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2025-06-13 10:59:57 UTC (rev 13843)
@@ -706,7 +706,7 @@
if (rff != null) {
throw new FontException("font-family already registered: " + name);
}
- rff = new RegisteredFontFamily(name);
+ rff = new RegisteredFontFamily(this, name);
this.fontFamilies.put(name, rff);
return rff;
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java 2025-06-12 21:44:15 UTC (rev 13842)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontFamily.java 2025-06-13 10:59:57 UTC (rev 13843)
@@ -28,6 +28,8 @@
package org.foray.font.config;
+import org.foray.font.FontServer4a;
+
import org.axsl.font.FontException;
import org.axsl.value.FontStretch;
import org.axsl.value.FontStyle;
@@ -38,10 +40,9 @@
import java.util.List;
/**
- * Class representing a font family that has been registered for use with FOray.
- * This currently is just a collection of the fonts that are in this family.
- * The actual font characteristics used in font resolution should be stored in
- * the RegisteredFont itself.
+ * A font family that has been registered for use with FOray.
+ * This is a collection of the fonts that are in this family.
+ * The actual font characteristics used in font resolution are stored in the child {@link RegisteredFont} instances.
*/
public class RegisteredFontFamily {
@@ -52,6 +53,9 @@
* items, (0, 1, etc.). */
private static final byte WEIGHT_INDEX_FACTOR = 100;
+ /** The parent {@link FontServer4a} instance. */
+ private FontServer4a server;
+
/** The name of this font family, for example "Courier", as presented in the font configuration. **/
private String name;
@@ -60,9 +64,11 @@
/**
* Constructor.
+ * @param server The parent {@link FontServer4a} instance.
* @param name The name of this font family (e.g. "Courier").
*/
- public RegisteredFontFamily(final String name) {
+ public RegisteredFontFamily(final FontServer4a server, final String name) {
+ this.server = server;
this.name = name;
}
@@ -321,4 +327,12 @@
return this.name;
}
+ /**
+ * Returns the parent server.
+ * @return The parent server.
+ */
+ public FontServer4a getServer() {
+ return this.server;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-12 21:44:18
|
Revision: 13842
http://sourceforge.net/p/foray/code/13842
Author: victormote
Date: 2025-06-12 21:44:15 +0000 (Thu, 12 Jun 2025)
Log Message:
-----------
Conform to aXSL change: Move listing of FontUse instances from FontConsumer to ConsumerFont, to clean up the tree structure.
Modified Paths:
--------------
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-render/src/main/java/org/foray/render/ps/PsRenderer.java
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-06-12 20:18:16 UTC (rev 13841)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java 2025-06-12 21:44:15 UTC (rev 13842)
@@ -39,6 +39,7 @@
import org.axsl.font.ConsumerFont;
import org.axsl.font.FontException;
+import org.axsl.font.FontUse;
import org.axsl.primitive.sequence.ByteSequence;
import org.axsl.ps.Encoding;
import org.axsl.ps.EncodingVector;
@@ -48,6 +49,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -450,4 +452,9 @@
}
}
+ @Override
+ public List<? extends FontUse> getUsedFontUses() {
+ return Collections.unmodifiableList(this.fontUses);
+ }
+
}
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-06-12 20:18:16 UTC (rev 13841)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-06-12 21:44:15 UTC (rev 13842)
@@ -407,31 +407,6 @@
return Collections.unmodifiableList(consumerFonts);
}
- @Override
- public List<FontUse4a> getUsedFontUses() {
- if (this.usedFonts.size() < 1) {
- return Collections.emptyList();
- }
- /* How big should the array be? */
- int count = 0;
- for (ConsumerFont4a consumerFont : this.usedFonts.values()) {
- count += consumerFont.getFontUses().size();
- }
- if (count < 1) {
- return Collections.emptyList();
- }
- final List<FontUse4a> toReturn = new ArrayList<FontUse4a>(count);
-
- for (ConsumerFont4a consumerFont : this.usedFonts.values()) {
- final List<FontUse4a> fontUses = consumerFont.getFontUses();
- for (int i = 0; i < fontUses.size(); i++) {
- final FontUse4a fontUse = fontUses.get(i);
- toReturn.add(fontUse);
- }
- }
- return toReturn;
- }
-
/**
* Record the fact that this FontConsumer has used this font.
* @param font The Font instance that was used.
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-06-12 20:18:16 UTC (rev 13841)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2025-06-12 21:44:15 UTC (rev 13842)
@@ -43,6 +43,7 @@
import org.axsl.constants.MimeConstants;
import org.axsl.constants.PrimitiveConstants;
import org.axsl.constants.TypographicConstants;
+import org.axsl.font.ConsumerFont;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
import org.axsl.galley.AreaG5;
@@ -342,7 +343,14 @@
* @throws IOException For errors writing to output.
*/
protected void writeFontDict() throws IOException {
- final List<? extends FontUse> fontUses = getFontConsumer().getUsedFontUses();
+ final List<? extends ConsumerFont> consumerFonts = getFontConsumer().getUsedFonts();
+ final List<FontUse> fontUses = new ArrayList<FontUse>();
+ for (int index = 0; index < consumerFonts.size(); index ++) {
+ final ConsumerFont consumerFont = consumerFonts.get(index);
+ for (int index2 = 0; index2 < consumerFont.getUsedFontUses().size(); index2 ++) {
+ fontUses.add(consumerFont.getUsedFontUses().get(index2));
+ }
+ }
/* Embed fonts. */
for (int i = 0; i < fontUses.size(); i++) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-12 20:18:19
|
Revision: 13841
http://sourceforge.net/p/foray/code/13841
Author: victormote
Date: 2025-06-12 20:18:16 +0000 (Thu, 12 Jun 2025)
Log Message:
-----------
Conform to aXSL change: Provide better information by reporting the list of ConsumerFont instances, which contain pointers to the Font.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java
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-06-12 17:28:53 UTC (rev 13840)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontConsumer4a.java 2025-06-12 20:18:16 UTC (rev 13841)
@@ -398,15 +398,13 @@
}
@Override
- public List<Font4a> getUsedFonts() {
+ public List<ConsumerFont4a> getUsedFonts() {
if (this.usedFonts.size() < 1) {
return Collections.emptyList();
}
- final List<Font4a> usedFontsToReturn = new ArrayList<Font4a>(this.usedFonts.size());
- for (Font4a realFont : this.usedFonts.keySet()) {
- usedFontsToReturn.add(realFont);
- }
- return usedFontsToReturn;
+ final List<ConsumerFont4a> consumerFonts = new ArrayList<ConsumerFont4a>(this.usedFonts.values().size());
+ consumerFonts.addAll(this.usedFonts.values());
+ return Collections.unmodifiableList(consumerFonts);
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-12 17:28:59
|
Revision: 13840
http://sourceforge.net/p/foray/code/13840
Author: victormote
Date: 2025-06-12 17:28:53 +0000 (Thu, 12 Jun 2025)
Log Message:
-----------
Conform to aXSL change: Clarify relationships between interfaces be eliminating some shortcuts.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/BlockTests.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/VerticalTests.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java
trunk/foray/foray-content/src/main/java/org/foray/content/TextTokensContent4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java
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
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/KpContext4a.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfCidFont.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFont4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFontFileStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfToUnicodeCmap.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/lb/LineBreaker.java
trunk/foray/foray-render/src/main/java/org/foray/render/PrintRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/awt/AwtRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/BlockTests.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/BlockTests.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/BlockTests.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -273,7 +273,7 @@
final FontUse fontUse = getHelveticaFont();
/* The following computation is tested in {@link TestFont4a#testWidth()}. */
final String testString = "Test of Centering";
- final int textWidth = fontUse.getFont().width(
+ final int textWidth = fontUse.getConsumerFont().getFont().width(
testString, 0, testString.length(), 12000, 0, 0, this.fontOptionsWithKerning, null);
assertEquals(textWidth, textArea.crIpd());
@@ -306,7 +306,7 @@
final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
/* Tests of the block area. */
- assertEquals("Helvetica", blockArea.traitNominalFont().getFont().getFontName());
+ assertEquals("Helvetica", blockArea.traitNominalFont().getConsumerFont().getFont().getFontName());
assertEquals(12000, blockArea.traitFontSize());
assertEquals(TextAlign.CENTER, blockArea.traitTextAlign());
@@ -339,8 +339,8 @@
/* The following computation is tested in {@link TestFont4a#testWidth()}.
* The extra word spacing is .3em = .3 * 12000 = 3600. */
final String testString = "Centered with Word Spacing";
- final int textWidth = fontUse.getFont().width(testString, 0, testString.length(), 12000, 0, 3600,
- this.fontOptionsWithKerning, null);
+ final int textWidth = fontUse.getConsumerFont().getFont().width(testString, 0, testString.length(), 12000, 0,
+ 3600, this.fontOptionsWithKerning, null);
assertEquals(textWidth, textArea.crIpd());
/* The x value of the text area content rectangle should be at the x
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/VerticalTests.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/VerticalTests.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/VerticalTests.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -77,7 +77,7 @@
assertTrue(node instanceof NormalBlockArea4a);
final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
final FontUse font = blockArea.traitNominalFont();
- assertEquals("Courier", font.getFont().getPostscriptName());
+ assertEquals("Courier", font.getConsumerFont().getFont().getPostscriptName());
assertEquals(12000, blockArea.traitFontSize());
/* The first child of the block area is a line-area. */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -829,7 +829,7 @@
return DEFAULT_NORMAL_LINE_HEIGHT_FACTOR;
} else {
final Font.LineHeightAlgorithm algorithm = Font.LineHeightAlgorithm.DEFAULT;
- return fontUse.getFont().normalLineHeightFactor(algorithm);
+ return fontUse.getConsumerFont().getFont().normalLineHeightFactor(algorithm);
}
}
@@ -837,7 +837,7 @@
public FontData getFontData() {
if (this instanceof Area4a) {
final Area4a area = (Area4a) this;
- return area.traitNominalFont().getFont();
+ return area.traitNominalFont().getConsumerFont().getFont();
}
return null;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -480,7 +480,8 @@
public int getCharWidth(final int c) {
final FontUse fontUse = traitNominalFont();
fontUse.registerCharUsed(c);
- return fontUse.getFont().width(c, traitFontSize()) + this.traitGeneratedBy().traitLetterSpacingOpt(this);
+ return fontUse.getConsumerFont().getFont().width(c, traitFontSize()) +
+ this.traitGeneratedBy().traitLetterSpacingOpt(this);
}
@Override
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -742,7 +742,7 @@
* whole issue needs to be revisited. */
// final Baseline baseline = this.traitDominantBaseline();
final Font.Baseline baseline = Font.Baseline.ALPHABETIC;
- final Font font = traitNominalFont().getFont();
+ final Font font = traitNominalFont().getConsumerFont().getFont();
return font.baselineOffset(axis, baseline, this.traitFontSize());
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -228,7 +228,7 @@
public int getWordWidth(final CharSequence word) {
final FontUse fontUse = traitNominalFont();
fontUse.registerCharsUsed(word);
- return fontUse.getFont().width(word, 0, word.length(), traitFontSize(),
+ return fontUse.getConsumerFont().getFont().width(word, 0, word.length(), traitFontSize(),
traitGeneratedBy().traitLetterSpacingOpt(this), traitGeneratedBy().traitWordSpacingOpt(this),
fontContext(), getOrthography());
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -249,7 +249,7 @@
public int getWordWidth(final CharSequence word) {
final FontUse fontUse = traitNominalFont();
fontUse.registerCharsUsed(word);
- return fontUse.getFont().width(word, 0, word.length(), traitFontSize(),
+ return fontUse.getConsumerFont().getFont().width(word, 0, word.length(), traitFontSize(),
traitGeneratedBy().traitLetterSpacingOpt(this), traitGeneratedBy().traitWordSpacingOpt(this),
fontContext(), getOrthography());
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -249,7 +249,7 @@
public int getWordWidth(final CharSequence word) {
final FontUse fontUse = traitNominalFont();
fontUse.registerCharsUsed(word);
- return fontUse.getFont().width(word, 0, word.length(), traitFontSize(),
+ return fontUse.getConsumerFont().getFont().width(word, 0, word.length(), traitFontSize(),
traitGeneratedBy().traitLetterSpacingOpt(this), traitGeneratedBy().traitWordSpacingOpt(this),
fontContext(), getOrthography());
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -234,7 +234,7 @@
public int getWordWidth(final CharSequence word) {
final FontUse fontUse = traitNominalFont();
fontUse.registerCharsUsed(word);
- return fontUse.getFont().width(word, 0, word.length(), traitFontSize(),
+ return fontUse.getConsumerFont().getFont().width(word, 0, word.length(), traitFontSize(),
traitGeneratedBy().traitLetterSpacingOpt(this), traitGeneratedBy().traitWordSpacingOpt(this),
fontContext(), getOrthography());
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -400,7 +400,7 @@
*/
int recomputeProgressionDimension() {
final CharSequence text = getText();
- final int pd = traitNominalFont().getFont().width(text, 0, text.length(), traitFontSize(),
+ final int pd = traitNominalFont().getConsumerFont().getFont().width(text, 0, text.length(), traitFontSize(),
traitLetterSpacingOpt(), traitWordSpacingOpt(), fontContext(), getOrthography());
return pd;
}
@@ -603,7 +603,8 @@
*/
public int getIdealIpd() {
final FontUse fontUse = traitNominalFont();
- final int ideal = fontUse.getFont().width(getText(), traitFontSize(), FontContext.DEFAULT, getOrthography());
+ final int ideal = fontUse.getConsumerFont().getFont().width(getText(), traitFontSize(), FontContext.DEFAULT,
+ getOrthography());
return ideal;
}
Modified: trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -69,7 +69,7 @@
/* TODO: Fix this method after we add the context to this class. */
final CommonFontPa asText = (CommonFontPa) this.content;
final int fontSize = asText.traitFontSize(null);
- final int zeroWidth = getFontUse().getFont().width('0', fontSize);
+ final int zeroWidth = getFontUse().getConsumerFont().getFont().width('0', fontSize);
// This is an estimate for purposes of layout.
return zeroWidth * QTY_PLACEHOLDER_DIGITS;
}
Modified: trunk/foray/foray-content/src/main/java/org/foray/content/TextTokensContent4a.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/TextTokensContent4a.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/TextTokensContent4a.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -120,7 +120,7 @@
final Orthography orthography = this.content.getOrthography();
if (leaf instanceof CharSequence) {
final CharSequence chars = (CharSequence) leaf;
- return getFontUse().getFont().width(chars, fontSize, FontContext.DEFAULT, orthography);
+ return getFontUse().getConsumerFont().getFont().width(chars, fontSize, FontContext.DEFAULT, orthography);
}
return 0;
}
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-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -84,6 +84,11 @@
}
}
+ @Override
+ public Font4a getFont() {
+ return this.font;
+ }
+
/**
* Returns the parent font.
* @return The font.
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-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -42,7 +42,6 @@
import org.axsl.constants.TypographicConstants;
import org.axsl.font.ConsumerFont;
import org.axsl.font.Font;
-import org.axsl.font.FontConsumer;
import org.axsl.font.FontContext;
import org.axsl.font.FontFeatureSimulation;
import org.axsl.font.FontUse;
@@ -105,11 +104,6 @@
return this.consumerFont;
}
- @Override
- public Font4a getFont() {
- return this.consumerFont.getFOrayFont();
- }
-
/**
* Return the Font instance cast as a {@link Font4a}.
* @return The {@link Font4a} instance.
@@ -284,7 +278,7 @@
return fontSize;
}
if (percent.equals(FontFeatureSimulation.SMALL_CAP_SIMULATION_NATIVE)) {
- final Font4a font = getFont();
+ final Font4a font = this.consumerFont.getFont();
int smallCapsSize = font.getXheight(TypographicConstants.MILLIPOINTS_PER_POINT);
smallCapsSize /= font.getAscender(TypographicConstants.MILLIPOINTS_PER_POINT);
smallCapsSize *= NumericConstants.PERCENT_CONVERSION;
@@ -310,18 +304,13 @@
@Override
public String getPostscriptName() {
- final String postScriptName = this.getFont().getPostscriptName();
- if (this.encoding == this.getFont().getInternalEncoding()) {
+ final String postScriptName = getConsumerFont().getFont().getPostscriptName();
+ if (this.encoding == getConsumerFont().getFont().getInternalEncoding()) {
return postScriptName;
}
return postScriptName + "-" + this.encoding.getName();
}
- @Override
- public FontConsumer getFontConsumer() {
- return this.consumerFont.getFontConsumer();
- }
-
/**
* Returns the font consumer instance.
* @return The font consumer instance.
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-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-font-tf/src/main/java/org/foray/font/fixture/MockFontUse.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -29,8 +29,6 @@
package org.foray.font.fixture;
import org.axsl.font.ConsumerFont;
-import org.axsl.font.Font;
-import org.axsl.font.FontConsumer;
import org.axsl.font.FontContext;
import org.axsl.font.FontUse;
import org.axsl.orthography.Orthography;
@@ -47,34 +45,22 @@
public class MockFontUse implements FontUse {
/** The font. */
- private Font font;
+ private ConsumerFont font;
@Override
- public Font getFont() {
+ public ConsumerFont getConsumerFont() {
return this.font;
}
- @Override
- public ConsumerFont getConsumerFont() {
- // TODO Auto-generated method stub
- return null;
- }
-
/**
* Set the font.
* @param font The new font.
*/
- public void setFont(final Font font) {
+ public void setFont(final ConsumerFont font) {
this.font = font;
}
@Override
- public FontConsumer getFontConsumer() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
public FontUse getNextBest(final int codePoint) {
// TODO Auto-generated method stub
return 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-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -276,7 +276,7 @@
/* TODO: If letter-spacing is used, it needs to come from the SVG. */
final int letterSpacing = 0;
/* TODO: Pass the font options below instead of hard-coding them. */
- final int width = fontToUse.getFont().width(txt, 0, txt.length(),
+ final int width = fontToUse.getConsumerFont().getFont().width(txt, 0, txt.length(),
awtFontSize * TypographicConstants.MILLIPOINTS_PER_POINT, letterSpacing, 0, FontContext.DEFAULT,
this.orthography);
final float advance = width / (float) TypographicConstants.MILLIPOINTS_PER_POINT;
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/KpContext4a.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/KpContext4a.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/KpContext4a.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -81,7 +81,7 @@
public int getIdealWidth(final KpLeaf leaf) {
if (leaf instanceof CharSequence) {
final CharSequence chars = (CharSequence) leaf;
- return this.fontUse.getFont().width(chars, fontSize, fontContext, orthography);
+ return this.fontUse.getConsumerFont().getFont().width(chars, fontSize, fontContext, orthography);
}
return 0;
}
@@ -98,7 +98,7 @@
@Override
public int getHyphenCharacterWidth() {
- return this.fontUse.getFont().width(this.hyphenationCharacter, this.fontSize);
+ return this.fontUse.getConsumerFont().getFont().width(this.hyphenationCharacter, this.fontSize);
}
/**
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -34,6 +34,7 @@
import org.foray.orthography.Punctuation4a;
import org.axsl.context.LineBreakContext;
+import org.axsl.font.ConsumerFont;
import org.axsl.kp.KpBoxTf;
import org.axsl.kp.KpBranchTf;
import org.axsl.kp.KpContext;
@@ -109,7 +110,9 @@
public static void initializeClass() {
font = new MockMonotypeFont(true);
fontUse = new MockFontUse();
- fontUse.setFont(font);
+ final ConsumerFont consumerFont = Mockito.mock(ConsumerFont.class);
+ Mockito.when(consumerFont.getFont()).thenReturn(font);
+ fontUse.setFont(consumerFont);
/* Set up the same glue items used by Knuth-Plass, so that our computations of adjustments can be compared.
* See "Knuth, Digital Typography, p. 75" for values. */
kpSpaceAfterComma = createSpecialGlue(font, 6, 4, 2);
@@ -463,7 +466,7 @@
protected LineBreakContext createGrimmLineBreakContext(final KpContext4a kpContext) {
/* Line width of 390 Monotype "units" is obtained from "Digital Typography," p. 73.
* We convert to millipoints to match the line-breaking logic. */
- final int lineWidth = kpContext.getFontUse().getFont().toMillipoints(390, GRIMM_FONT_SIZE);
+ final int lineWidth = kpContext.getFontUse().getConsumerFont().getFont().toMillipoints(390, GRIMM_FONT_SIZE);
assertEquals(390_000, lineWidth);
final LineBreakContext lbContext = createLineBreakTarget(lineWidth);
return lbContext;
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -487,7 +487,7 @@
* @return The appropriate PdfFont4a instance.
*/
public PdfFont4a getPdfFont(final FontUse fontUse) {
- final Font font = fontUse.getFont();
+ final Font font = fontUse.getConsumerFont().getFont();
/* Look for a match in the existing fonts. */
for (int i = 0; i < this.usedFonts.size(); i++) {
final PdfFont4a pdfFont = this.usedFonts.get(i);
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfCidFont.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfCidFont.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfCidFont.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -125,7 +125,7 @@
@Override
public ByteSequencePlus serialize() {
- final Font font = this.fsFont.getFont();
+ final Font font = this.fsFont.getConsumerFont().getFont();
final StringBuilder p = new StringBuilder();
p.append(getSerializedId() + EOL);
p.append("<< /Type /Font");
@@ -171,7 +171,7 @@
* @return The CID Font subtype for {@code fsFont}.
*/
protected static PdfCidFont.SubType getCidType(final FontUse fsFont) {
- final Font font = fsFont.getFont();
+ final Font font = fsFont.getConsumerFont().getFont();
if (font.getFormat() == FontFormat.TRUETYPE) {
return PdfCidFont.SubType.CID_TYPE2;
}
@@ -183,7 +183,7 @@
* @return The array of glyph widths for this font.
*/
private ShortSequence getCIDWidths() {
- if (! this.fsFont.getFont().isEmbeddable()) {
+ if (! this.fsFont.getConsumerFont().getFont().isEmbeddable()) {
return null;
}
return this.fsFont.getWidths();
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFont4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFont4a.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFont4a.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -140,7 +140,7 @@
*/
public static PdfFont4a makeFont(final PdfDocument4a pdfDoc, final FontUse fsFont) {
PdfFont4a font = null;
- if (fsFont.getFont().isPdfStandardFont()) {
+ if (fsFont.getConsumerFont().getFont().isPdfStandardFont()) {
font = new PdfFont4a(pdfDoc, fsFont);
} else {
switch (PdfFont4a.getFontSubtype(fsFont)) {
@@ -408,10 +408,10 @@
* @return The font subtype.
*/
public static SubType getFontSubtype(final FontUse fontUse) {
- if (fontUse.getFont().getFontComplexity() == Font.Complexity.COMPOSITE) {
+ if (fontUse.getConsumerFont().getFont().getFontComplexity() == Font.Complexity.COMPOSITE) {
return PdfFont4a.SubType.TYPE0;
}
- if (FontFormat.TYPE1 == fontUse.getFont().getFormat()) {
+ if (FontFormat.TYPE1 == fontUse.getConsumerFont().getFont().getFormat()) {
return PdfFont4a.SubType.TYPE1;
}
return PdfFont4a.SubType.TRUETYPE;
@@ -451,7 +451,7 @@
@Override
public Font getFont() {
/* If available, delegate this to the FontUse instance. */
- return this.fsFont == null ? null : this.fsFont.getFont();
+ return this.fsFont == null ? null : this.fsFont.getConsumerFont().getFont();
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFontFileStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFontFileStream.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFontFileStream.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -51,7 +51,7 @@
* @throws PdfException If the font is not embeddable.
*/
public PdfFontFileStream(final FontUse font) throws PdfException {
- if (! font.getFont().isEmbeddable()) {
+ if (! font.getConsumerFont().getFont().isEmbeddable()) {
throw new PdfException("Can't create PdfFontFileStream for a Font "
+ "that is not embeddable.");
}
@@ -81,12 +81,12 @@
* @return The String containing the "Additional entries".
*/
public String getPdfFontFileStreamAdditional() {
- if (! font.getFont().isEmbeddable()) {
+ if (! font.getConsumerFont().getFont().isEmbeddable()) {
return null;
}
final ConsumerFont consumerFont = font.getConsumerFont();
- if (FontFormat.TYPE1 == font.getFont().getFormat()) {
+ if (FontFormat.TYPE1 == font.getConsumerFont().getFont().getFormat()) {
return " /Length1 " + consumerFont.getEmbeddableLength1()
+ " /Length2 " + consumerFont.getEmbeddableLength2()
+ " /Length3 " + consumerFont.getEmbeddableLength3();
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfToUnicodeCmap.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfToUnicodeCmap.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfToUnicodeCmap.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -98,7 +98,7 @@
writeCIDSystemInfo(builder);
writeVersionTypeName(builder);
writeCodeSpaceRange(builder);
- if (this.fsFont.getFont().isEmbeddable()) {
+ if (this.fsFont.getConsumerFont().getFont().isEmbeddable()) {
final String bfEntries = getToUnicodeBf();
builder.append(bfEntries);
writeBFEntries(builder);
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/lb/LineBreaker.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/lb/LineBreaker.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/lb/LineBreaker.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -93,7 +93,8 @@
codePointToUse = java.lang.Character.toUpperCase((char) codePoint);
}
fontUse.registerCharUsed(codePointToUse);
- return fontUse.getFont().width(codePointToUse, fontSize) + lineText.inlineLetterSpacingOptimum();
+ return fontUse.getConsumerFont().getFont().width(codePointToUse, fontSize) +
+ lineText.inlineLetterSpacingOptimum();
}
/**
@@ -323,7 +324,7 @@
public int getWordWidth(final CharContent lineText, final CharSequence word, final int offset, final int length) {
final FontUse fontUse = lineText.inlinePrimaryFont();
fontUse.registerCharsUsed(word);
- return fontUse.getFont().width(word, offset, length, lineText.inlineFontSize(),
+ return fontUse.getConsumerFont().getFont().width(word, offset, length, lineText.inlineFontSize(),
lineText.inlineLetterSpacingOptimum(), 0, lineText.inlineFontContext(), lineText.inlineOrthography());
}
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/PrintRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/PrintRenderer.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/PrintRenderer.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -114,7 +114,7 @@
final int startX = area.crOriginX();
int startY;
final int endX = area.crOriginX() + area.crIpd();
- final Font font = area.traitNominalFont().getFont();
+ final Font font = area.traitNominalFont().getConsumerFont().getFont();
if (area.traitUnderlineScore()) {
startY = getUnderlineYPosition(area);
drawLine(startX, startY, endX, startY,
@@ -141,7 +141,7 @@
* @return The Y position that should be used for the underline stroke.
*/
protected int getUnderlineYPosition(final GlyphAreaSequenceG5 area) {
- final Font font = area.traitNominalFont().getFont();
+ final Font font = area.traitNominalFont().getConsumerFont().getFont();
final int underlinePosition = font.underlinePosition(area.traitFontSize());
return area.baselineY() + underlinePosition;
}
@@ -152,7 +152,7 @@
* @return The Y position that should be used for the overline stroke.
*/
protected int getOverlineYPosition(final GlyphAreaSequenceG5 area) {
- final Font font = area.traitNominalFont().getFont();
+ final Font font = area.traitNominalFont().getConsumerFont().getFont();
final int overlinePosition = font.overlinePosition(area.traitFontSize());
return area.baselineY() + overlinePosition;
}
@@ -163,7 +163,7 @@
* @return The Y position that should be used for the through stroke.
*/
protected int getThroughYPosition(final GlyphAreaSequenceG5 area) {
- final Font font = area.traitNominalFont().getFont();
+ final Font font = area.traitNominalFont().getConsumerFont().getFont();
final int strikeoutPosition = font.strikeoutPosition(area.traitFontSize());
return area.baselineY() + strikeoutPosition;
}
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-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/awt/AwtRenderer.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -576,7 +576,7 @@
final Color oldColor = this.graphics.getColor();
final java.awt.Font oldFont = this.graphics.getFont();
- final java.awt.Font f = area.traitNominalFont().getFont().getAwtFont(size);
+ final java.awt.Font f = area.traitNominalFont().getConsumerFont().getFont().getAwtFont(size);
if (this.saveColor != null) {
if (this.saveColor.getRed() != red
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -453,7 +453,7 @@
}
/* If the two fonts are really the same font, don't change. */
- if (primaryFont.getFont() == currentFont.getFont()) {
+ if (primaryFont.getConsumerFont().getFont() == currentFont.getConsumerFont().getFont()) {
if (currentFont.glyphAvailable(c)) {
return currentFont;
}
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-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -351,7 +351,7 @@
if (! (fontUse.getEncoding() instanceof EncodingVector)) {
continue;
}
- final Font font = fontUse.getFont();
+ final Font font = fontUse.getConsumerFont().getFont();
if (! font.isEmbeddable()) {
continue;
}
@@ -385,7 +385,7 @@
for (int i = 0; i < fontUses.size(); i++) {
final FontUse fontUse = fontUses.get(i);
final Encoding encoding = fontUse.getEncoding();
- final Font font = fontUse.getFont();
+ final Font font = fontUse.getConsumerFont().getFont();
/* If the FontUse has the same encoding as the Font, there is no
* need to write the encoding again, because it is already defined
* in the Font dictionary itself. */
@@ -417,7 +417,7 @@
/* Bind the proper encoding to each font. */
for (int i = 0; i < fontUses.size(); i++) {
final FontUse fontUse = fontUses.get(i);
- final Font font = fontUse.getFont();
+ final Font font = fontUse.getConsumerFont().getFont();
EncodingVector vector = null;
if (! (fontUse.getEncoding() instanceof EncodingVector)) {
/* For now, we don't know how to handle TrueType fonts here. */
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java 2025-06-12 16:42:29 UTC (rev 13839)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java 2025-06-12 17:28:53 UTC (rev 13840)
@@ -354,7 +354,7 @@
writeStartTag(area, buffer);
outputAllRectangles(area);
if (this.printFont) {
- final Font font = area.traitNominalFont().getFont();
+ final Font font = area.traitNominalFont().getConsumerFont().getFont();
final StringBuilder fontBuffer = new StringBuilder();
outputAttribute(fontBuffer, "name", font.getFontName());
outputAttribute(fontBuffer, "size", area.traitFontSize());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-12 16:42:32
|
Revision: 13839
http://sourceforge.net/p/foray/code/13839
Author: victormote
Date: 2025-06-12 16:42:29 +0000 (Thu, 12 Jun 2025)
Log Message:
-----------
Conform to aXSL change: Reintroduce the ConsumerFont interface, as being necessary to keep encoding-related issues separate from font-related issues.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java
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
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFontFileStream.java
trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
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-06-12 13:01:07 UTC (rev 13838)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java 2025-06-12 16:42:29 UTC (rev 13839)
@@ -34,12 +34,17 @@
import org.foray.font.ttf.TrueTypeFont;
import org.foray.font.ttf.TtfSubSetFile;
import org.foray.font.type1.Type1Font;
+import org.foray.primitive.sequence.ByteArray;
import org.foray.ps.encode.EncodingVector4a;
+import org.axsl.font.ConsumerFont;
import org.axsl.font.FontException;
+import org.axsl.primitive.sequence.ByteSequence;
import org.axsl.ps.Encoding;
import org.axsl.ps.EncodingVector;
+import org.slf4j.LoggerFactory;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -46,17 +51,9 @@
import java.util.List;
/**
- * <p>A ConsumerFont represents a Font as used by a specific FontConsumer.
- * The key fields are therefore a Font and a FontConsumer.
- * The main responsibilities of this class are:</p>
- * <ul>
- * <li>To supply a FontUse with the proper encoding when it is requested by
- * a FontConsumer.</li>
- * <li>To handle subsetting.</li>
- * </ul>
- *
+ * FOray implementation of {@link ConsumerFont}.
*/
-public class ConsumerFont4a {
+public class ConsumerFont4a implements ConsumerFont {
/** Constant indicating the maximum expected file size. */
private static final int EXPECTED_FILE_SIZE = 128000;
@@ -358,5 +355,94 @@
return null;
}
+ @Override
+ public ByteSequence getContent() {
+ if (! getFOrayFont().isEmbeddable()) {
+ return null;
+ }
+ if (! (getFOrayFont() instanceof FreeStandingFont)) {
+ return null;
+ }
+ final FreeStandingFont fsf = (FreeStandingFont) getFOrayFont();
+ byte[] embeddableFont = null;
+ try {
+ embeddableFont = getRawFontFile();
+ } catch (final IOException | FontException e) {
+ final String message = "Failed to get contents for " + fsf.getPostscriptName();
+ LoggerFactory.getLogger(this.getClass()).error(message, e);
+ }
+ return new ByteArray(embeddableFont);
+ }
+ @Override
+ public ByteSequence getContentPostScriptHex() {
+ if (! (this.font instanceof FsType1Font)) {
+ return null;
+ }
+ final FsType1Font type1Font = (FsType1Font) font;
+ Type1Font pfb = null;
+ try {
+ pfb = type1Font.getType1File();
+ } catch (final FontException e1) {
+ /* TODO: Handle the exception at a lower level and remove this catch. */
+ return null;
+ }
+ return new ByteArray(pfb.getByteArray());
+ }
+
+ /**
+ * Return the type1 font, if any, associated with this font use.
+ * @return The type1 font.
+ */
+ private Type1Font getType1Font() {
+ final Font4a forayFont = getFOrayFont();
+ if (forayFont instanceof FsType1Font) {
+ final FsType1Font type1Font = (FsType1Font) forayFont;
+ try {
+ return type1Font.getType1File();
+ } catch (final FontException e) {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public int getEmbeddableLength1() {
+ /* TODO: This needs to handle subsets. */
+ final Type1Font type1Font = getType1Font();
+ if (type1Font == null) {
+ final ByteSequence content = getContent();
+ if (content == null) {
+ return 0;
+ }
+ return content.length();
+ } else {
+ return type1Font.getLength1();
+ }
+ }
+
+ @Override
+ public int getEmbeddableLength2() {
+ /* TODO: This needs to handle subsets. */
+ final Type1Font type1Font = getType1Font();
+ if (type1Font == null) {
+ return 0;
+ } else {
+ return type1Font.getLength2();
+ }
+ }
+
+ @Override
+ public int getEmbeddableLength3() {
+ /* TODO: This needs to handle subsets. */
+ final Type1Font type1Font = getType1Font();
+ if (type1Font == null) {
+ return 0;
+ } else {
+ return type1Font.getLength3();
+ }
+ }
+
}
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-06-12 13:01:07 UTC (rev 13838)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2025-06-12 16:42:29 UTC (rev 13839)
@@ -33,8 +33,6 @@
import org.foray.font.config.RegisteredFont;
import org.foray.font.ttf.TrueTypeFont;
import org.foray.font.ttf.table.GsubTable;
-import org.foray.font.type1.Type1Font;
-import org.foray.primitive.sequence.ByteArray;
import org.foray.primitive.sequence.IntArrayBuilder;
import org.foray.primitive.sequence.ShortArrayBuilder;
import org.foray.ps.encode.CharSet;
@@ -42,14 +40,13 @@
import org.axsl.constants.NumericConstants;
import org.axsl.constants.PrimitiveConstants;
import org.axsl.constants.TypographicConstants;
+import org.axsl.font.ConsumerFont;
import org.axsl.font.Font;
import org.axsl.font.FontConsumer;
import org.axsl.font.FontContext;
-import org.axsl.font.FontException;
import org.axsl.font.FontFeatureSimulation;
import org.axsl.font.FontUse;
import org.axsl.orthography.Orthography;
-import org.axsl.primitive.sequence.ByteSequence;
import org.axsl.primitive.sequence.IntSequence;
import org.axsl.primitive.sequence.ShortSequence;
import org.axsl.ps.Encoding;
@@ -56,10 +53,6 @@
import org.axsl.unicode.block.U0000_Basic_Latin;
import org.axsl.value.FontStretch;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
@@ -108,6 +101,11 @@
}
@Override
+ public ConsumerFont getConsumerFont() {
+ return this.consumerFont;
+ }
+
+ @Override
public Font4a getFont() {
return this.consumerFont.getFOrayFont();
}
@@ -465,53 +463,6 @@
}
@Override
- public ByteSequence getContent() {
- /*
- * Returns the Collection of byte arrays to be placed in the embedded
- * font stream in the PDF file, as documented in the PDF Reference,
- * Second Edition, Section 5.8.
- * A collection is used so that, if the user of this method is able to,
- * it can write the elements one at a time, to (in some cases) reduce
- * the amount of memory used.
- */
- if (! getFOrayFont().isEmbeddable()) {
- return null;
- }
- if (! (getFOrayFont() instanceof FreeStandingFont)) {
- return null;
- }
- final FreeStandingFont fsf = (FreeStandingFont) getFOrayFont();
- byte[] embeddableFont = null;
- try {
- embeddableFont = this.consumerFont.getRawFontFile();
- } catch (final IOException e) {
- this.getLogger().error("Failed to get contents for "
- + fsf.getPostscriptName() + ": " + e.getMessage());
- } catch (final FontException e) {
- this.getLogger().error("Error reading contents of "
- + fsf.getPostscriptName() + ": " + e.getMessage());
- }
- return new ByteArray(embeddableFont);
- }
-
- @Override
- public ByteSequence getContentPostScriptHex() {
- final Font font = getFont();
- if (! (font instanceof FsType1Font)) {
- return null;
- }
- final FsType1Font type1Font = (FsType1Font) font;
- Type1Font pfb = null;
- try {
- pfb = type1Font.getType1File();
- } catch (final FontException e1) {
- /* TODO: Handle the exception at a lower level and remove this catch. */
- return null;
- }
- return new ByteArray(pfb.getByteArray());
- }
-
- @Override
public String textToPdf(final CharSequence theString, final FontContext fontContext,
final Orthography orthography) {
final Font font = getFOrayFont();
@@ -697,62 +648,7 @@
return new String(charArray);
}
- /**
- * Return the type1 font, if any, associated with this font use.
- * @return The type1 font.
- */
- private Type1Font getType1Font() {
- final Font4a forayFont = this.consumerFont.getFOrayFont();
- if (forayFont instanceof FsType1Font) {
- final FsType1Font type1Font = (FsType1Font) forayFont;
- try {
- return type1Font.getType1File();
- } catch (final FontException e) {
- return null;
- }
- } else {
- return null;
- }
- }
-
@Override
- public int getEmbeddableLength1() {
- /* TODO: This needs to handle subsets. */
- final Type1Font type1Font = getType1Font();
- if (type1Font == null) {
- final ByteSequence content = getContent();
- if (content == null) {
- return 0;
- }
- return content.length();
- } else {
- return type1Font.getLength1();
- }
- }
-
- @Override
- public int getEmbeddableLength2() {
- /* TODO: This needs to handle subsets. */
- final Type1Font type1Font = getType1Font();
- if (type1Font == null) {
- return 0;
- } else {
- return type1Font.getLength2();
- }
- }
-
- @Override
- public int getEmbeddableLength3() {
- /* TODO: This needs to handle subsets. */
- final Type1Font type1Font = getType1Font();
- if (type1Font == null) {
- return 0;
- } else {
- return type1Font.getLength3();
- }
- }
-
- @Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append("[");
@@ -763,13 +659,4 @@
return builder.toString();
}
- /**
- * Returns the logger.
- * @return The logger.
- */
- private Logger getLogger() {
- /* Not cached because not expected to get used much. */
- return LoggerFactory.getLogger(getClass());
- }
-
}
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-06-12 13:01:07 UTC (rev 13838)
+++ trunk/foray/foray-font-tf/src/main/java/org/foray/font/fixture/MockFontUse.java 2025-06-12 16:42:29 UTC (rev 13839)
@@ -28,12 +28,12 @@
package org.foray.font.fixture;
+import org.axsl.font.ConsumerFont;
import org.axsl.font.Font;
import org.axsl.font.FontConsumer;
import org.axsl.font.FontContext;
import org.axsl.font.FontUse;
import org.axsl.orthography.Orthography;
-import org.axsl.primitive.sequence.ByteSequence;
import org.axsl.primitive.sequence.IntSequence;
import org.axsl.primitive.sequence.ShortSequence;
import org.axsl.ps.Encoding;
@@ -54,6 +54,12 @@
return this.font;
}
+ @Override
+ public ConsumerFont getConsumerFont() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
/**
* Set the font.
* @param font The new font.
@@ -185,36 +191,6 @@
}
@Override
- public ByteSequence getContent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public int getEmbeddableLength1() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getEmbeddableLength2() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getEmbeddableLength3() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public ByteSequence getContentPostScriptHex() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
public CharSequence textToPdf(final CharSequence theString, final FontContext fontOptions,
final Orthography orthography) {
// TODO Auto-generated method stub
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFontFileStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFontFileStream.java 2025-06-12 13:01:07 UTC (rev 13838)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFontFileStream.java 2025-06-12 16:42:29 UTC (rev 13839)
@@ -31,6 +31,7 @@
import org.foray.pdf.document.PdfDocument4a;
import org.foray.pdf.type.PdfStream;
+import org.axsl.font.ConsumerFont;
import org.axsl.font.FontFormat;
import org.axsl.font.FontUse;
import org.axsl.pdf.PdfException;
@@ -59,7 +60,7 @@
@Override
protected void finalizeStreamContent() throws PdfException {
- final ByteSequence fontFileStream = this.font.getContent();
+ final ByteSequence fontFileStream = this.font.getConsumerFont().getContent();
/* TODO: The addition of the filters below was prohibited by the parent class, PdfStream, because content
* had already been written into the stream without them. There is perhaps some sequencing problem that has
* resulted from the one-step serialization process recently (Dec 2020) implemented. */
@@ -83,13 +84,14 @@
if (! font.getFont().isEmbeddable()) {
return null;
}
+ final ConsumerFont consumerFont = font.getConsumerFont();
if (FontFormat.TYPE1 == font.getFont().getFormat()) {
- return " /Length1 " + font.getEmbeddableLength1()
- + " /Length2 " + font.getEmbeddableLength2()
- + " /Length3 " + font.getEmbeddableLength3();
+ return " /Length1 " + consumerFont.getEmbeddableLength1()
+ + " /Length2 " + consumerFont.getEmbeddableLength2()
+ + " /Length3 " + consumerFont.getEmbeddableLength3();
}
- return " /Length1 " + font.getEmbeddableLength1();
+ return " /Length1 " + consumerFont.getEmbeddableLength1();
}
@Override
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-06-12 13:01:07 UTC (rev 13838)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2025-06-12 16:42:29 UTC (rev 13839)
@@ -355,7 +355,8 @@
if (! font.isEmbeddable()) {
continue;
}
- final String fontContents = ByteArray.fromByteSequence(fontUse.getContentPostScriptHex()).toString();
+ final String fontContents = ByteArray.fromByteSequence(
+ fontUse.getConsumerFont().getContentPostScriptHex()).toString();
write(fontContents);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-12 13:01:10
|
Revision: 13838
http://sourceforge.net/p/foray/code/13838
Author: victormote
Date: 2025-06-12 13:01:07 +0000 (Thu, 12 Jun 2025)
Log Message:
-----------
Move methods to return font content to ConsumerFont4a.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/FsTrueTypeFont.java
trunk/foray/foray-font/src/main/java/org/foray/font/FsType1Font.java
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-06-11 21:53:14 UTC (rev 13837)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/ConsumerFont4a.java 2025-06-12 13:01:07 UTC (rev 13838)
@@ -28,13 +28,20 @@
package org.foray.font;
+import org.foray.common.IoUtil;
import org.foray.font.config.RegisteredFont;
import org.foray.font.config.RegisteredFontContent;
+import org.foray.font.ttf.TrueTypeFont;
+import org.foray.font.ttf.TtfSubSetFile;
+import org.foray.font.type1.Type1Font;
import org.foray.ps.encode.EncodingVector4a;
+import org.axsl.font.FontException;
import org.axsl.ps.Encoding;
import org.axsl.ps.EncodingVector;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -51,6 +58,9 @@
*/
public class ConsumerFont4a {
+ /** Constant indicating the maximum expected file size. */
+ private static final int EXPECTED_FILE_SIZE = 128000;
+
/** The parent Font instance. */
private Font4a font;
@@ -316,4 +326,37 @@
return this.font.toString();
}
+ /**
+ * Returns the font file contents in a byte array.
+ * If the file is subsetted, returns the content of the subset.
+ * @return The font file contents.
+ * @throws IOException For I/O errors.
+ * @throws FontException For errors parsing the font.
+ */
+ public byte[] getRawFontFile() throws IOException, FontException {
+ if (! (this.font instanceof FreeStandingFont)) {
+ return null;
+ }
+ final FreeStandingFont fsf = (FreeStandingFont) this.font;
+ if (fsf instanceof FsTrueTypeFont) {
+ final FsTrueTypeFont fsTrueType = (FsTrueTypeFont) fsf;
+ final TrueTypeFont ttf = fsTrueType.getFont();
+ if (subset != null) {
+ final TtfSubSetFile ttfSubset = new TtfSubSetFile(ttf, subset);
+ return ttfSubset.buildEmbeddableSubset(ttf.getTTFFile().getReader().getRandomInput());
+ }
+ final InputStream instream = fsf.getFontInputStream();
+ return IoUtil.toByteArray(instream, ConsumerFont4a.EXPECTED_FILE_SIZE);
+ }
+
+ if (fsf instanceof FsType1Font) {
+ final FsType1Font fsType1 = (FsType1Font) fsf;
+ final Type1Font pfb = fsType1.getType1File();
+ return pfb.getByteArray();
+ }
+
+ return 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-06-11 21:53:14 UTC (rev 13837)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2025-06-12 13:01:07 UTC (rev 13838)
@@ -483,7 +483,7 @@
final FreeStandingFont fsf = (FreeStandingFont) getFOrayFont();
byte[] embeddableFont = null;
try {
- embeddableFont = fsf.getRawFontFile(this);
+ embeddableFont = this.consumerFont.getRawFontFile();
} catch (final IOException e) {
this.getLogger().error("Failed to get contents for "
+ fsf.getPostscriptName() + ": " + e.getMessage());
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java 2025-06-11 21:53:14 UTC (rev 13837)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FreeStandingFont.java 2025-06-12 13:01:07 UTC (rev 13838)
@@ -35,7 +35,6 @@
import org.axsl.constants.TypographicConstants;
import org.axsl.font.Font;
-import org.axsl.font.FontException;
import org.axsl.font.FontFormat;
import org.axsl.primitive.sequence.ShortSequence;
import org.axsl.ps.BoundingBox;
@@ -297,17 +296,6 @@
}
/**
- * Returns the font file contents in a byte array.
- * @param fontUse The specific font use, which is needed to get encoding and
- * subsetting information.
- * @return The font file contents.
- * @throws IOException For I/O errors.
- * @throws FontException For errors parsing the font.
- */
- public abstract byte[] getRawFontFile(FontUse4a fontUse)
- throws IOException, FontException;
-
- /**
* {@inheritDoc}
* FreeStandingFonts are never AWTFonts, so this always returns null.
*/
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FsTrueTypeFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FsTrueTypeFont.java 2025-06-11 21:53:14 UTC (rev 13837)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FsTrueTypeFont.java 2025-06-12 13:01:07 UTC (rev 13838)
@@ -28,7 +28,6 @@
package org.foray.font;
-import org.foray.common.IoUtil;
import org.foray.common.data.BoundingBoxShort;
import org.foray.common.data.BoundingBoxUtils;
import org.foray.font.config.RegisteredFontContent;
@@ -36,7 +35,6 @@
import org.foray.font.ttf.TrueTypeContainer;
import org.foray.font.ttf.TrueTypeFont;
import org.foray.font.ttf.TrueTypeSingle;
-import org.foray.font.ttf.TtfSubSetFile;
import org.axsl.font.Font;
import org.axsl.font.FontException;
@@ -47,7 +45,6 @@
import org.slf4j.LoggerFactory;
import java.io.IOException;
-import java.io.InputStream;
/**
* High-level representation of a TrueType font.
@@ -57,9 +54,6 @@
/** Constant indicating the default units per text-space unit used by TrueType fonts. */
public static final int DEFAULT_UNITS_PER_TEXT_SPACE = 2048;
- /** Constant indicating the maximum expected file size. */
- private static final int EXPECTED_FILE_SIZE = 128000;
-
/** The TTFFont instance backing this. */
private TrueTypeFont ttf;
@@ -83,17 +77,6 @@
parseFont();
}
- @Override
- public byte[] getRawFontFile(final FontUse4a fontUse) throws IOException {
- final Subset subset = fontUse.getSubset();
- if (subset != null) {
- final TtfSubSetFile ttfSubset = new TtfSubSetFile(this.ttf, subset);
- return ttfSubset.buildEmbeddableSubset(this.ttf.getTTFFile().getReader().getRandomInput());
- }
- final InputStream instream = getFontInputStream();
- return IoUtil.toByteArray(instream, FsTrueTypeFont.EXPECTED_FILE_SIZE);
- }
-
/**
* Parses the font contents for needed information.
* @throws FontException For errors parsing the font.
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FsType1Font.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FsType1Font.java 2025-06-11 21:53:14 UTC (rev 13837)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FsType1Font.java 2025-06-12 13:01:07 UTC (rev 13838)
@@ -77,12 +77,6 @@
parseFont();
}
- @Override
- public byte[] getRawFontFile(final FontUse4a fontUse) throws FontException {
- final Type1Font pfb = getType1File();
- return pfb.getByteArray();
- }
-
/**
* Returns the related Type1File.
* @return The related Type1File.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-11 21:53:17
|
Revision: 13837
http://sourceforge.net/p/foray/code/13837
Author: victormote
Date: 2025-06-11 21:53:14 +0000 (Wed, 11 Jun 2025)
Log Message:
-----------
Upgrade checkstyle to 10.23, to match Eclipse plugin. Fix config change to JavadocVariable made in 10.22.
Modified Paths:
--------------
trunk/foray/buildSrc/src/main/groovy/foray.common-conventions.gradle
trunk/foray/foray-00-dev/config/checkstyle/checkstyle-config.xml
Modified: trunk/foray/buildSrc/src/main/groovy/foray.common-conventions.gradle
===================================================================
--- trunk/foray/buildSrc/src/main/groovy/foray.common-conventions.gradle 2025-06-10 15:04:27 UTC (rev 13836)
+++ trunk/foray/buildSrc/src/main/groovy/foray.common-conventions.gradle 2025-06-11 21:53:14 UTC (rev 13837)
@@ -69,7 +69,7 @@
// logbackClassic: '1.3.5', // Latest is 1.3.5 as of 2022-11-26.
/* Build-time-only dependencies that should never be permanently used in build.gradle files. */
- checkstyle: '10.4', // Latest is 10.6 as of 2023-01-23. See Note 6.
+ checkstyle: '10.23', // Latest is 10.25 as of 2025-06-11. See Note 6.
]
/*
* Notes on Dependency Releases (See above for references)
@@ -91,7 +91,7 @@
* Java version used to start Gradle. For now, using a JDK that matches the javaTargetCompatibility value above
* seems to solve the problem.
*
- * 6. The current (as of 2023-01-23) Eclipse plugin for checkstyle uses Checkstyle 10.4.
+ * 6. The current (as of 2025-06-11) Eclipse plugin for checkstyle uses Checkstyle 10.23.
* We will use that for now to avoid configuration conflicts between the two versions.
*/
Modified: trunk/foray/foray-00-dev/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-dev/config/checkstyle/checkstyle-config.xml 2025-06-10 15:04:27 UTC (rev 13836)
+++ trunk/foray/foray-00-dev/config/checkstyle/checkstyle-config.xml 2025-06-11 21:53:14 UTC (rev 13837)
@@ -149,7 +149,7 @@
<!-- Make sure each variable has javadoc. -->
<module name="JavadocVariable">
- <property name="scope" value="private"/>
+ <property name="accessModifiers" value="private"/>
</module>
<!-- Check the javadoc style. If there is a javadoc comment, it must be well-formed, even if it is private. -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-10 15:04:29
|
Revision: 13836
http://sourceforge.net/p/foray/code/13836
Author: victormote
Date: 2025-06-10 15:04:27 +0000 (Tue, 10 Jun 2025)
Log Message:
-----------
Fix off-by-one error in PFB segments.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java 2025-06-10 14:15:54 UTC (rev 13835)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java 2025-06-10 15:04:27 UTC (rev 13836)
@@ -80,25 +80,29 @@
@Override
public int read() throws IOException {
- int intRead = in.read();
- this.offset ++;
- if (intRead < 0) {
- in.close();
- return -1;
- }
- if (this.offset - 1 == this.nextSegmentOffset) {
+ if (this.offset == this.nextSegmentOffset) {
/* We are at the beginning of a segment. */
+ /* Read & check the segment delimiter. */
+ final int intRead = in.read();
+ this.offset ++;
+ if (intRead < 0) {
+ return -1;
+ }
if (intRead != START_OF_SEGMENT_MARKER) {
throw new IOException("Unexpected value at start of segment: 0x" +
ByteUtils.toHexString((byte) intRead));
}
+
+ /* Read the segment type. */
this.currentSegmentType = in.read();
+ if (this.currentSegmentType < 0) {
+ return -1;
+ }
this.offset ++;
if (this.currentSegmentType == SEGMENT_TYPE_END_OF_FILE) {
/* We are at the end of the file. */
- in.close();
return -1;
}
@@ -105,18 +109,19 @@
/* Read the size of the segment. Reverse the bytes, as they are little-endian. */
final int segmentSize = Integer.reverseBytes(readInt());
this.offset += Integer.BYTES;
- this.nextSegmentOffset = this.offset + segmentSize - 1;
+ this.nextSegmentOffset = this.offset + segmentSize;
if (this.currentSegmentType == SEGMENT_TYPE_BINARY_DATA) {
/* Mark immediately after the segment delimiter for the binary portion of the file, and immediately
* before the content of that section. This allows the eexec filter to reset to the beginning of the
* content instead of the beginning of the segment marker. */
- in.mark(MeasurementConstants.BYTES_PER_KILOBYTE);
+ mark(MeasurementConstants.BYTES_PER_KILOBYTE);
}
- intRead = in.read();
}
+ final int intRead = in.read();
+ this.offset ++;
return intRead;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-10 14:15:56
|
Revision: 13835
http://sourceforge.net/p/foray/code/13835
Author: victormote
Date: 2025-06-10 14:15:54 +0000 (Tue, 10 Jun 2025)
Log Message:
-----------
Fix processing of end-of-file marker.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java 2025-06-10 13:47:30 UTC (rev 13834)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java 2025-06-10 14:15:54 UTC (rev 13835)
@@ -88,12 +88,6 @@
}
if (this.offset - 1 == this.nextSegmentOffset) {
- if (this.currentSegmentType == SEGMENT_TYPE_END_OF_FILE) {
- /* We are immediately after the last segment. This should probably never happen, as we should have read
- * a -1 above before we get here. */
- in.close();
- return -1;
- }
/* We are at the beginning of a segment. */
if (intRead != START_OF_SEGMENT_MARKER) {
throw new IOException("Unexpected value at start of segment: 0x" +
@@ -101,6 +95,13 @@
}
this.currentSegmentType = in.read();
this.offset ++;
+
+ if (this.currentSegmentType == SEGMENT_TYPE_END_OF_FILE) {
+ /* We are at the end of the file. */
+ in.close();
+ return -1;
+ }
+
/* Read the size of the segment. Reverse the bytes, as they are little-endian. */
final int segmentSize = Integer.reverseBytes(readInt());
this.offset += Integer.BYTES;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-10 13:47:33
|
Revision: 13834
http://sourceforge.net/p/foray/code/13834
Author: victormote
Date: 2025-06-10 13:47:30 +0000 (Tue, 10 Jun 2025)
Log Message:
-----------
Keep the pfb offset synchronized with the cursor in the underlying for mark and reset.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java 2025-06-10 13:32:13 UTC (rev 13833)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/type1/PfbFontDecodeFilter.java 2025-06-10 13:47:30 UTC (rev 13834)
@@ -60,6 +60,10 @@
/** The index to the next byte to be read. Also equals the number of bytes read. */
private int offset;
+ /** Tracks the offset when "mark" is set, so that we can reset to that when "reset" is called. This is needed for
+ * this class, not for the underlying stream. */
+ private int markOffset;
+
/** Indicator for the current segment type. */
private int currentSegmentType;
@@ -118,10 +122,12 @@
@Override
public synchronized void mark(final int readlimit) {
in.mark(readlimit);
+ this.markOffset = this.offset;
}
@Override
public synchronized void reset() throws IOException {
+ this.offset = this.markOffset;
in.reset();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-10 13:32:15
|
Revision: 13833
http://sourceforge.net/p/foray/code/13833
Author: victormote
Date: 2025-06-10 13:32:13 +0000 (Tue, 10 Jun 2025)
Log Message:
-----------
Allow PFB fonts to be included in the test document again.
Modified Paths:
--------------
trunk/foray/src/dist/resource/fo-examples/basic/fonts.fo
Modified: trunk/foray/src/dist/resource/fo-examples/basic/fonts.fo
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/basic/fonts.fo 2025-06-10 13:17:23 UTC (rev 13832)
+++ trunk/foray/src/dist/resource/fo-examples/basic/fonts.fo 2025-06-10 13:32:13 UTC (rev 13833)
@@ -825,8 +825,7 @@
to a pfb (Type 1, PC format) font file.
</fo:block>
- <fo:block font-family="serif" space-after.optimum="12pt">
- ***** BROKEN ***** TODO: Change font-family back to "pfb-test" after fixed.
+ <fo:block font-family="pfb-test" space-after.optimum="12pt">
This is a test. Most of the text in this paragraph is here only to make sure
that the paragraph is long enough to need more than one line. In this way it
provides a general reasonableness test that the font character width metrics
@@ -853,8 +852,7 @@
to a pfa (Type 1, Hexadecimal format) font file.
</fo:block>
- <fo:block font-family="serif" space-after.optimum="12pt">
- ***** BROKEN ***** TODO: Change font-family back to "pfa-test" after fixed.
+ <fo:block font-family="pfa-test" space-after.optimum="12pt">
This is a test. Most of the text in this paragraph is here only to make sure
that the paragraph is long enough to need more than one line. In this way it
provides a general reasonableness test that the font character width metrics
@@ -1026,9 +1024,7 @@
This is a test.
</fo:block>
- <fo:block font-family="serif" font-style="italic"
- space-after.optimum="12pt">
- ***** BROKEN ***** TODO: Change font-family back to "pfb-test-italic" after fixed.
+ <fo:block font-family="pfb-test-italic" font-style="italic" space-after.optimum="12pt">
This paragraph is set in "pfb-test-italic" and is useful for getting an
italic font embedded in the output.
</fo:block>
@@ -1051,9 +1047,7 @@
is set in the typeface "sans-serif".
</fo:block>
- <fo:block font-family="sans-serif" space-after.optimum="12pt">
- AWAY again.
- </fo:block>
+ <fo:block font-family="sans-serif" space-after.optimum="12pt">AWAY again.</fo:block>
<fo:block font-family="serif" space-after.optimum="12pt">
The following paragraph is a test of the Type1 font kerning. It
@@ -1060,10 +1054,7 @@
is set in the typeface "pfb-test".
</fo:block>
- <fo:block font-family="serif" space-after.optimum="12pt">
- ***** BROKEN ***** TODO: Change font-family back to "pfb-test" after fixed.
- AWAY again.
- </fo:block>
+ <fo:block font-family="pfb-test" space-after.optimum="12pt">AWAY again.</fo:block>
<fo:block font-family="serif" space-after.optimum="12pt">
The following paragraph is a test of the TrueType font kerning. It
@@ -1070,9 +1061,7 @@
is set in the typeface "ttf-test".
</fo:block>
- <fo:block font-family="ttf-test-cid" space-after.optimum="12pt">
- AWAY again.
- </fo:block>
+ <fo:block font-family="ttf-test-cid" space-after.optimum="12pt">AWAY again.</fo:block>
</fo:flow>
</fo:page-sequence>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-06-10 13:17:26
|
Revision: 13832
http://sourceforge.net/p/foray/code/13832
Author: victormote
Date: 2025-06-10 13:17:23 +0000 (Tue, 10 Jun 2025)
Log Message:
-----------
Add page numbers for better synchronization.
Modified Paths:
--------------
trunk/foray/src/dist/resource/fo-examples/basic/fonts.fo
Modified: trunk/foray/src/dist/resource/fo-examples/basic/fonts.fo
===================================================================
--- trunk/foray/src/dist/resource/fo-examples/basic/fonts.fo 2025-06-10 13:12:09 UTC (rev 13831)
+++ trunk/foray/src/dist/resource/fo-examples/basic/fonts.fo 2025-06-10 13:17:23 UTC (rev 13832)
@@ -23,6 +23,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 1.</fo:block>
<fo:block>Helvetica (WinAnsiEncoding), sorted by Unicode code point.</fo:block>
</fo:block-container>
@@ -364,6 +365,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 2.</fo:block>
<fo:block>Times Roman (WinAnsiEncoding)</fo:block>
</fo:block-container>
@@ -402,6 +404,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 3.</fo:block>
<fo:block>Courier (WinAnsiEncoding)</fo:block>
</fo:block-container>
@@ -440,6 +443,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 4.</fo:block>
<fo:block>ZapfDingbats</fo:block>
</fo:block-container>
@@ -505,6 +509,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 5.</fo:block>
<fo:block>Symbol</fo:block>
</fo:block-container>
@@ -708,6 +713,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 6.</fo:block>
<fo:block>Different font sizes:</fo:block>
</fo:block-container>
@@ -750,6 +756,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 7.</fo:block>
<fo:block>Test of ToUnicode CMap</fo:block>
</fo:block-container>
@@ -778,6 +785,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 8.</fo:block>
<fo:block>Tests of Subsetting Composite Glyphs</fo:block>
</fo:block-container>
@@ -806,6 +814,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 9.</fo:block>
<fo:block>Tests of Type 1 PFB Fonts</fo:block>
</fo:block-container>
@@ -833,6 +842,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 10.</fo:block>
<fo:block>Tests of Type 1 PFA Fonts</fo:block>
</fo:block-container>
@@ -860,6 +870,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 11.</fo:block>
<fo:block>Tests of OTF TTF Fonts</fo:block>
</fo:block-container>
@@ -886,6 +897,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 12.</fo:block>
<fo:block>Tests of OTF CFF Fonts</fo:block>
</fo:block-container>
@@ -912,6 +924,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 13.</fo:block>
<fo:block>Tests of Font Weights and Styles</fo:block>
</fo:block-container>
@@ -980,6 +993,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 14.</fo:block>
<fo:block>Tests of Font Selection</fo:block>
</fo:block-container>
@@ -1028,6 +1042,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 15.</fo:block>
<fo:block>Tests of Kerning</fo:block>
</fo:block-container>
@@ -1068,6 +1083,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 16.</fo:block>
<fo:block>Tests of Pseudo Small Caps</fo:block>
</fo:block-container>
@@ -1092,6 +1108,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 17.</fo:block>
<fo:block>Tests of Relative Font Weights</fo:block>
</fo:block-container>
<fo:block font-family="sans-serif" font-weight="bold"
@@ -1121,6 +1138,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 18.</fo:block>
<fo:block>Unicode Secondary Multilingual Plane (SMP), aka Plane One</fo:block>
</fo:block-container>
@@ -1185,6 +1203,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 19.</fo:block>
<fo:block>Combining Diacriticals</fo:block>
</fo:block-container>
@@ -1217,6 +1236,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 20.</fo:block>
<fo:block>Hebrew</fo:block>
</fo:block-container>
@@ -1251,6 +1271,7 @@
<fo:flow flow-name="xsl-region-body" language="eng" country="US">
<fo:block-container font-family="Helvetica" font-weight="bold" font-size="14pt" space-after=".5em">
+ <fo:block>Page 21.</fo:block>
<fo:block>Ligatures</fo:block>
</fo:block-container>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|