[aXSL-commit] SF.net SVN: axsl:[2863] trunk/axsl/axsl-font/src/main /java/org/axsl/font
An API for XSL-FO.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2025-06-12 16:41:59
|
Revision: 2863
http://sourceforge.net/p/axsl/code/2863
Author: victormote
Date: 2025-06-12 16:41:56 +0000 (Thu, 12 Jun 2025)
Log Message:
-----------
Reintroduce the ConsumerFont interface, as being necessary to keep encoding-related issues separate from font-related issues.
Modified Paths:
--------------
trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java
Added Paths:
-----------
trunk/axsl/axsl-font/src/main/java/org/axsl/font/ConsumerFont.java
Added: trunk/axsl/axsl-font/src/main/java/org/axsl/font/ConsumerFont.java
===================================================================
--- trunk/axsl/axsl-font/src/main/java/org/axsl/font/ConsumerFont.java (rev 0)
+++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/ConsumerFont.java 2025-06-12 16:41:56 UTC (rev 2863)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2025 The aXSL Project.
+ * http://www.axsl.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.axsl.font;
+
+import org.axsl.primitive.sequence.ByteSequence;
+
+/**
+ * <p>A {@link Font} as used by a specific {@link 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 embedding and subsetting.</li>
+ * </ul>
+ */
+public interface ConsumerFont {
+
+ /**
+ * Returns the raw font file content, so that it can be embedded in other documents.
+ * If the font use is configured to be subsetted, only the subsetted portion of the font file will be returned.
+ * @return The byte array containing the font file content that is available for embedding, or null if
+ * {@link Font#isEmbeddable()} is false.
+ */
+ ByteSequence getContent();
+
+ /**
+ * Returns the modified font file content, so that it can be embedded in other documents.
+ * The encrypted portion of the font file should be returned in the so-called "Hexadecimal Format" described in
+ * Section 3.1 of Adobe Technical Note #5040.
+ * This form is useful for embedding in documents that will be sent to PostScript interpreters, which must always
+ * have 7-bit ASCII input.
+ * If the font use is configured to be subsetted, only the subsetted portion of the font file will be returned.
+ * @return The byte array containing the font file content that is available for embedding, or null if
+ * {@link Font#isEmbeddable()} is false.
+ * @see FontUse#getContent()
+ */
+ ByteSequence getContentPostScriptHex();
+
+ /**
+ * Return the size, in bytes, of part 1 of the font content to be embedded.
+ * For non-Type1 fonts, this is the total size of the font to be embedded.
+ * @return The size, in bytes, of part 1 of the font content to be embedded.
+ */
+ int getEmbeddableLength1();
+
+ /**
+ * Return the size, in bytes, of part 2 of the font content to be embedded.
+ * For non-Type1 fonts, this should be zero.
+ * @return The size, in bytes, of part 2 of the font content to be embedded.
+ */
+ int getEmbeddableLength2();
+
+ /**
+ * Return the size, in bytes, of part 3 of the font content to be embedded.
+ * For non-Type1 fonts, this should be zero.
+ * @return The size, in bytes, of part 3 of the font content to be embedded.
+ */
+ int getEmbeddableLength3();
+
+}
Property changes on: trunk/axsl/axsl-font/src/main/java/org/axsl/font/ConsumerFont.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java
===================================================================
--- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java 2025-06-11 21:52:19 UTC (rev 2862)
+++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java 2025-06-12 16:41:56 UTC (rev 2863)
@@ -24,7 +24,6 @@
package org.axsl.font;
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 +53,12 @@
FontConsumer getFontConsumer();
/**
+ * Returns the {@link ConsumerFont} for this use.
+ * @return The {@link ConsumerFont} for this use.
+ */
+ ConsumerFont getConsumerFont();
+
+ /**
* <p>Returns a {@link FontUse} for the next best font for a specific code point, presumably because this instance
* either has no glyph for the code point, or cannot encode the code point using the encoding for this instance.
* This method is intended to handle step 4 in the CSS2 Font Matching Algorithm, and the part of step 5 that
@@ -316,48 +321,6 @@
CharSequence getCharsUsed();
/**
- * Returns the raw font file content, so that it can be embedded in other documents.
- * If the font use is configured to be subsetted, only the subsetted portion of the font file will be returned.
- * @return The byte array containing the font file content that is available for embedding, or null if
- * {@link Font#isEmbeddable()} is false.
- */
- ByteSequence getContent();
-
- /**
- * Return the size, in bytes, of part 1 of the font content to be embedded.
- * For non-Type1 fonts, this is the total size of the font to be embedded.
- * @return The size, in bytes, of part 1 of the font content to be embedded.
- */
- int getEmbeddableLength1();
-
- /**
- * Return the size, in bytes, of part 2 of the font content to be embedded.
- * For non-Type1 fonts, this should be zero.
- * @return The size, in bytes, of part 2 of the font content to be embedded.
- */
- int getEmbeddableLength2();
-
- /**
- * Return the size, in bytes, of part 3 of the font content to be embedded.
- * For non-Type1 fonts, this should be zero.
- * @return The size, in bytes, of part 3 of the font content to be embedded.
- */
- int getEmbeddableLength3();
-
- /**
- * Returns the modified font file content, so that it can be embedded in other documents.
- * The encrypted portion of the font file should be returned in the so-called "Hexadecimal Format" described in
- * Section 3.1 of Adobe Technical Note #5040.
- * This form is useful for embedding in documents that will be sent to PostScript interpreters, which must always
- * have 7-bit ASCII input.
- * If the font use is configured to be subsetted, only the subsetted portion of the font file will be returned.
- * @return The byte array containing the font file content that is available for embedding, or null if
- * {@link Font#isEmbeddable()} is false.
- * @see FontUse#getContent()
- */
- ByteSequence getContentPostScriptHex();
-
- /**
* Converts a String to the content that should be written into a PDF to show that String.
* @param theString The input String, that is, the text that needs to be shown in the PDF.
* @param fontOptions The font options, such as ligatures and small-caps that should be used when computing the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|