axsl-commit Mailing List for aXSL (Page 5)
An API for XSL-FO.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(36) |
Apr
(36) |
May
(127) |
Jun
(193) |
Jul
(12) |
Aug
(46) |
Sep
(66) |
Oct
(28) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(39) |
Feb
(68) |
Mar
(58) |
Apr
(88) |
May
(40) |
Jun
(82) |
Jul
(213) |
Aug
(19) |
Sep
(2) |
Oct
(26) |
Nov
(2) |
Dec
|
2008 |
Jan
(5) |
Feb
(30) |
Mar
(26) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
(4) |
Apr
(44) |
May
(1) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
(7) |
May
(35) |
Jun
|
Jul
|
Aug
(48) |
Sep
(10) |
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(40) |
2017 |
Jan
(82) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(37) |
Mar
(28) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(27) |
2021 |
Jan
(52) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(8) |
Nov
(72) |
Dec
(100) |
2022 |
Jan
(119) |
Feb
(94) |
Mar
(4) |
Apr
|
May
|
Jun
(5) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
|
Nov
(10) |
Dec
(97) |
2023 |
Jan
(52) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(17) |
Sep
(21) |
Oct
(8) |
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(11) |
Feb
(1) |
Mar
|
Apr
(27) |
May
(62) |
Jun
(27) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <vic...@us...> - 2025-04-20 16:01:45
|
Revision: 2783 http://sourceforge.net/p/axsl/code/2783 Author: victormote Date: 2025-04-20 16:01:28 +0000 (Sun, 20 Apr 2025) Log Message: ----------- Introduce the "Checker" framework, but don't integrate into build yet. Modified Paths: -------------- trunk/axsl/build.gradle trunk/axsl/buildSrc/src/main/groovy/axsl.common-conventions.gradle Modified: trunk/axsl/build.gradle =================================================================== --- trunk/axsl/build.gradle 2025-04-20 12:05:34 UTC (rev 2782) +++ trunk/axsl/build.gradle 2025-04-20 16:01:28 UTC (rev 2783) @@ -30,6 +30,13 @@ id 'io.freefair.aggregate-javadoc' version "6.5.1" id 'java-library-distribution' id 'com.github.johnrengelman.shadow' version '8.1.1' + /* The Gradle Checker Framework Plugin (being invoked here) is a wrapper of, but is a separate product from, the + Checker Framework, has its own release cycle, and its own release numbering system. + https://github.com/kelloggm/checkerframework-gradle-plugin + Documentation of the Checker Framework itself can be found at + https://checkerframework.org/manual/#gradle + */ + id "org.checkerframework" version "0.6.53" } Modified: trunk/axsl/buildSrc/src/main/groovy/axsl.common-conventions.gradle =================================================================== --- trunk/axsl/buildSrc/src/main/groovy/axsl.common-conventions.gradle 2025-04-20 12:05:34 UTC (rev 2782) +++ trunk/axsl/buildSrc/src/main/groovy/axsl.common-conventions.gradle 2025-04-20 16:01:28 UTC (rev 2783) @@ -3,6 +3,7 @@ plugins { id 'java' + id "org.checkerframework" } @@ -23,14 +24,15 @@ javaSourceCompatibility: JavaVersion.VERSION_1_8, javaTargetCompatibility: JavaVersion.VERSION_1_8, - svgDom: '1.1', - mathMlDom: '2.0', + svgDom: '1.1', + mathMlDom: '2.0', - junit: '5.9.1', // Latest is 5.9.1 as of 2022-11-26. - mockito: '4.9.0', // Latest is 4.9.0 as of 2022-11-26. + checkerFramework: '3.49.2', // Latest is 3.49.2 as of 2025-04-20. + junit: '5.9.1', // Latest is 5.9.1 as of 2022-11-26. + mockito: '4.9.0', // Latest is 4.9.0 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 2. + checkstyle: '10.4', // Latest is 10.6 as of 2023-01-23. See Note 2. ] /* * Notes on Dependency Releases (See above for references) @@ -51,5 +53,26 @@ } } +checkerFramework { + checkers = [ + "org.checkerframework.checker.signedness.SignednessChecker" + ] + /* Uncomment the following line temporarily to disable checker, for testing. */ + /* Must be disabled for now, until we can resolve the build failure with it on. */ + skipCheckerFramework = true + + /* The following may be needed to avoid ClassCastException in Gradle. See + https://github.com/kelloggm/checkerframework-gradle-plugin?tab=readme-ov-file#incremental-compilation + Setting it did not help the build problem documented at "skipCheckerFramework" above. + Since we have disabled the entire framework, we leave this commented for now. */ +// incrementalize = false +} + +dependencies { + compileOnly (group: 'org.checkerframework', name: 'checker-qual', version: versions.checkerFramework) + testCompileOnly (group: 'org.checkerframework', name: 'checker-qual', version: versions.checkerFramework) + checkerFramework (group: 'org.checkerframework', name: 'checker', version: versions.checkerFramework) +} + /* Last line of script. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-20 12:05:50
|
Revision: 2782 http://sourceforge.net/p/axsl/code/2782 Author: victormote Date: 2025-04-20 12:05:34 +0000 (Sun, 20 Apr 2025) Log Message: ----------- Fix unnecessary cast. Modified Paths: -------------- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MeasurementConstants.java Modified: trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MeasurementConstants.java =================================================================== --- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MeasurementConstants.java 2025-04-19 18:47:34 UTC (rev 2781) +++ trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MeasurementConstants.java 2025-04-20 12:05:34 UTC (rev 2782) @@ -40,11 +40,11 @@ /** Well-known constant used to convert seconds to/from milliseconds, which is {@value}. */ public static final short MILLISECONDS_PER_SECOND = 1_000; - /** The number of centimeters per inch, which is {@value}. */ - public static final float CM_PER_INCH = (float) 2.54; + /** The number of centimeters per inch, which is 2.54. */ + public static final float CM_PER_INCH = Float.parseFloat("2.54"); /** The number of millimeters per centimeter, which is {@value}. */ - public static final float MM_PER_CM = 10; + public static final byte MM_PER_CM = 10; /** The number of bytes per kilobyte, which is {@value}. */ public static final short BYTES_PER_KILOBYTE = 1_024; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-19 18:47:51
|
Revision: 2781 http://sourceforge.net/p/axsl/code/2781 Author: victormote Date: 2025-04-19 18:47:34 +0000 (Sat, 19 Apr 2025) Log Message: ----------- Panose improvements. Modified Paths: -------------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Panose.java Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Panose.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Panose.java 2025-04-19 10:58:40 UTC (rev 2780) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Panose.java 2025-04-19 18:47:34 UTC (rev 2781) @@ -33,6 +33,9 @@ */ public interface Panose { + /** The quantity of element in a Panose 1.0 array. */ + byte QTY_PANOSE_ELEMENTS = 10; + /** * Describes the family kind of the font. * @return The family kind descriptor. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-19 10:58:56
|
Revision: 2780 http://sourceforge.net/p/axsl/code/2780 Author: victormote Date: 2025-04-19 10:58:40 +0000 (Sat, 19 Apr 2025) Log Message: ----------- Add enumeration of Java primitive types. Added Paths: ----------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/Primitive.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/package-info.java Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/Primitive.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/Primitive.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/Primitive.java 2025-04-19 10:58:40 UTC (rev 2780) @@ -0,0 +1,83 @@ +/* + * 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.primitive; + +/** + * Information about Java primitives. + */ +public interface Primitive { + + /** + * Enumeration of valid Java primitive types. + */ + enum Type { + + /** A "boolean". */ + BOOLEAN(1), + + /** A "byte". */ + BYTE(8), + + /** A "short". */ + SHORT(16), + + /** An "int". */ + INT(32), + + /** A "long". */ + LONG(64), + + /** A "float". */ + FLOAT(32), + + /** A "double". */ + DOUBLE(64), + + /** A "char". */ + CHAR(16); + + /** The conceptual size, in memory, of this primitive type. */ + private byte bitSize; + + /** + * Constructor. + * @param bitSize The conceptual size, in memory, of this primitive type. + */ + Type(final int bitSize) { + this.bitSize = (byte) bitSize; + } + + /** + * Returns the conceptual size, in memory, of this primitive type. + * For all types except boolean, the conceptual size is the same as the actual size. + * For boolean, the actual memory used is rounded up to the nearest byte, presumably with up to 8 boolean values + * stored in a single byte. + * @return The number of bits, in memory, conceptually used by this primitive type. + */ + public byte getBitSize() { + return this.bitSize; + } + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/Primitive.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/package-info.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/package-info.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/package-info.java 2025-04-19 10:58:40 UTC (rev 2780) @@ -0,0 +1,27 @@ +/* + * 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$ + */ + +/** + * Types related to handling Java primitives. + */ +package org.axsl.primitive; Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/package-info.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-18 15:06:56
|
Revision: 2779 http://sourceforge.net/p/axsl/code/2779 Author: victormote Date: 2025-04-18 15:06:38 +0000 (Fri, 18 Apr 2025) Log Message: ----------- Remove methods dependent on a Charset name for byte-to-char conversions. Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java 2025-04-17 18:39:20 UTC (rev 2778) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java 2025-04-18 15:06:38 UTC (rev 2779) @@ -23,8 +23,6 @@ package org.axsl.primitive.sequence; -import java.io.UnsupportedEncodingException; - /** * A readable sequence of {@link Byte#TYPE} values, providing uniform, read-only access to such values. * This is intended to be the equivalent of {@link CharSequence}, but for {@link Byte#TYPE} instead of @@ -35,6 +33,7 @@ /** * Returns the length of this byte sequence. * @return The number of {@link Byte#TYPE}s in this sequence. + * @see CharSequence#length() */ int length(); @@ -45,29 +44,24 @@ * the content were in an array. * @param index The index of the {@link Byte#TYPE} value to be returned. * @return The specified {@link Byte#TYPE} value. + * @see CharSequence#charAt(int) */ byte byteAt(int index); /** - * Converts the {@link Byte#TYPE}s in this array to a String, using the "US-ASCII" character set. - * @return A new string. - */ - String toString(); - - /** * Converts the {@link Byte#TYPE}s in this array to a String, using the specified character set. * @param charset The character set to use for converting bytes to chars. + * See {@link java.nio.charset.StandardCharsets} for charsets that are available on all Java implementations. * @return A new string. */ String toString(java.nio.charset.Charset charset); /** - * Converts the {@link Byte#TYPE}s in this array to a String, using the specified character set. - * @param charsetName The name of the character set to use for converting bytes to chars. + * Convenience method that converts the {@link Byte#TYPE}s in this array to a String, using the "US-ASCII" character + * set. * @return A new string. - * @throws UnsupportedEncodingException If the named charset is not supported. */ - String toString(String charsetName) throws UnsupportedEncodingException; + String toAscii(); /** * Returns this instance cast as {@link ByteSequencePlus}, if possible. Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java 2025-04-17 18:39:20 UTC (rev 2778) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java 2025-04-18 15:06:38 UTC (rev 2779) @@ -26,7 +26,6 @@ import java.io.IOException; import java.io.OutputStream; import java.io.Serializable; -import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.nio.charset.Charset; @@ -378,25 +377,10 @@ */ CharSequence charSubSequence(int start, int end, Charset charset); - /** - * Returns a new {@link CharSequence} that is a subsequence of this sequence, using the specified Charset. - * The subsequence starts with the {@code byte} value at index {@code start} and ends with the {@code byte} value at - * index {@code end - 1}. - * The length of the returned sequence is {@code end - @code start}, so if {@code start == @code end} then an empty - * sequence is returned. - * @param start The start index, inclusive. - * @param end The end index, exclusive. - * @param charsetName The name of the charset to use when converting the bytes in this sequence to the chars in the - * returned sequence. - * @return The specified subsequence. - * @throws UnsupportedEncodingException If the named charset is not supported. - */ - CharSequence charSubSequence(int start, int end, String charsetName) throws UnsupportedEncodingException; - /* End sub-sequence methods that convert to a CharSequence. */ /* ****************************************************************************************************************** */ @@ -419,8 +403,9 @@ /** * Parses the bytes in this sequence as the string representation of decimal digits. * This method should return the same value and throw the same exceptions as {@link Byte#parseByte(String)}, where - * the {@link String} is the result of this.{@link #toString()}. - * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion. + * the {@link String} is the result of {@link ByteSequence#toString(java.nio.charset.Charset)}. + * Implementations may wish to improve performance by avoiding the + * {@link #toString(java.nio.charset.Charset)} conversion. * @return The parsed byte. * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Byte#TYPE}. * To avoid this exception, call {@link #canParseByte()} first. @@ -431,8 +416,9 @@ /** * Parses the bytes in this sequence as the string representation of digits of a specified radix. * This method should return the same value and throw the same exceptions as {@link Byte#parseByte(String, int)}, - * where the {@link String} is the result of this.{@link #toString()}. - * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion. + * where the {@link String} is the result of {@link ByteSequence#toString(java.nio.charset.Charset)}. + * Implementations may wish to improve performance by avoiding the + * {@link #toString(java.nio.charset.Charset)} conversion. * @param radix The radix to be used while parsing this. * For example, if parsing base-10 (decimal), set this value to 10; if parsing base-16 (hexadecimal), set this value * to 16. @@ -453,8 +439,9 @@ /** * Parses the bytes in this sequence as the string representation of decimal digits. * This method should return the same value and throw the same exceptions as {@link Short#parseShort(String)}, where - * the {@link String} is the result of this.{@link #toString()}. - * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion. + * the {@link String} is the result of {@link ByteSequence#toString(java.nio.charset.Charset)}. + * Implementations may wish to improve performance by avoiding the + * {@link #toString(java.nio.charset.Charset)} conversion. * @return The parsed short. * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Short#TYPE}. * To avoid this exception, call {@link #canParseShort()} first. @@ -465,8 +452,9 @@ /** * Parses the bytes in this sequence as the string representation of digits of a specified radix. * This method should return the same value and throw the same exceptions as {@link Short#parseShort(String, int)}, - * where the {@link String} is the result of this.{@link #toString()}. - * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion. + * where the {@link String} is the result of {@link ByteSequence#toString(java.nio.charset.Charset)}. + * Implementations may wish to improve performance by avoiding the + * {@link #toString(java.nio.charset.Charset)} conversion. * @param radix The radix to be used while parsing this. * For example, if parsing base-10 (decimal), set this value to 10; if parsing base-16 (hexadecimal), set this value * to 16. @@ -487,8 +475,9 @@ /** * Parses the bytes in this sequence as the string representation of decimal digits. * This method should return the same value and throw the same exceptions as {@link Integer#parseInt(String)}, where - * the {@link String} is the result of this.{@link #toString()}. - * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion. + * the {@link String} is the result of {@link ByteSequence#toString(java.nio.charset.Charset)}. + * Implementations may wish to improve performance by avoiding the + * {@link #toString(java.nio.charset.Charset)} conversion. * @return The parsed int. * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Integer#TYPE}. * To avoid this exception, call {@link #canParseInt()} first. @@ -499,8 +488,9 @@ /** * Parses the bytes in this sequence as the string representation of digits of a specified radix. * This method should return the same value and throw the same exceptions as {@link Integer#parseInt(String, int)}, - * where the {@link String} is the result of this.{@link #toString()}. - * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion. + * where the {@link String} is the result of {@link ByteSequence#toString(java.nio.charset.Charset)}. + * Implementations may wish to improve performance by avoiding the + * {@link #toString(java.nio.charset.Charset)} conversion. * @param radix The radix to be used while parsing this. * For example, if parsing base-10 (decimal), set this value to 10; if parsing base-16 (hexadecimal), set this value * to 16. @@ -521,8 +511,9 @@ /** * Parses the bytes in this sequence as the string representation of decimal digits. * This method should return the same value and throw the same exceptions as {@link Long#parseLong(String)}, where - * the {@link String} is the result of this.{@link #toString()}. - * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion. + * the {@link String} is the result of {@link ByteSequence#toString(java.nio.charset.Charset)}. + * Implementations may wish to improve performance by avoiding the + * {@link #toString(java.nio.charset.Charset)} conversion. * @return The parsed long. * @throws NumberFormatException If the byte sequence does not contain a parsable {@link Long#TYPE}. * To avoid this exception, call {@link #canParseLong()} first. @@ -533,8 +524,9 @@ /** * Parses the bytes in this sequence as the string representation of digits of a specified radix. * This method should return the same value and throw the same exceptions as {@link Long#parseLong(String, int)}, - * where the {@link String} is the result of this.{@link #toString()}. - * Implementations may wish to improve performance by avoiding the {@link #toString()} conversion. + * where the {@link String} is the result of {@link ByteSequence#toString(java.nio.charset.Charset)}. + * Implementations may wish to improve performance by avoiding the + * {@link #toString(java.nio.charset.Charset)} conversion. * @param radix The radix to be used while parsing this. * For example, if parsing base-10 (decimal), set this value to 10; if parsing base-16 (hexadecimal), set this value * to 16. @@ -555,7 +547,8 @@ /** * Parses the bytes in this sequence as the string representation of decimal digits. * This method should return the same value and throw the same exceptions as - * {@link BigDecimal#BigDecimal(String)}, where the {@link String} is the result of this.{@link #toString()}. + * {@link BigDecimal#BigDecimal(String)}, where the {@link String} is the result of + * {@link ByteSequence#toString(java.nio.charset.Charset)}. * Implementations may or may not use that constructor to create the instance. * @return The parsed decimal. * @throws NumberFormatException If the byte sequence does not contain a parsable {@link BigDecimal}. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-17 18:39:39
|
Revision: 2778 http://sourceforge.net/p/axsl/code/2778 Author: victormote Date: 2025-04-17 18:39:20 +0000 (Thu, 17 Apr 2025) Log Message: ----------- Remove no-longer-needed utility class in favor of StandardCharsets class. Removed Paths: ------------- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/CharsetConstants.java Deleted: trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/CharsetConstants.java =================================================================== --- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/CharsetConstants.java 2025-04-16 14:47:21 UTC (rev 2777) +++ trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/CharsetConstants.java 2025-04-17 18:39:20 UTC (rev 2778) @@ -1,57 +0,0 @@ -/* - * Copyright 2022 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.constants; - -/** - * Constants related to {@link java.nio.charset.Charset}. - * This class exists to make these constants easier to find, and to make safer to get the correct string. - * The name is stored instead of the {@link java.nio.charset.Charset} itself to avoid the cost of creating and - * retaining in memory those instances that are not needed. - */ -public final class CharsetConstants { - - /** The name used to create the U.S. ASCII character set. */ - public static final String CHARSET_US_ASCII_NAME = "US-ASCII"; - - /** The name used to create the ISO-8859-1 character set. */ - public static final String CHARSET_ISO_8859_1_NAME = "ISO-8859-1"; - - /** The name used to create the UTF-8 character set. */ - public static final String CHARSET_UTF_8_NAME = "UTF-8"; - - /** The name used to create the UTF-16, big-endian character set. */ - public static final String CHARSET_UTF_16BE_NAME = "UTF-16BE"; - - /** The name used to create the UTF-16, little-endian character set. */ - public static final String CHARSET_UTF_16LE_NAME = "UTF-16LE"; - - /** The name used to create the UTF-16 character set. */ - public static final String CHARSET_UTF_16_NAME = "UTF-16"; - - /** - * Private constructor. This is a utility class, and should never be instantiated. - */ - private CharsetConstants() { } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-16 14:47:41
|
Revision: 2777 http://sourceforge.net/p/axsl/code/2777 Author: victormote Date: 2025-04-16 14:47:21 +0000 (Wed, 16 Apr 2025) Log Message: ----------- Move width and height compuations from FOray utility class to default aXSL implementations. Modified Paths: -------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/BoundingBox.java Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/BoundingBox.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/BoundingBox.java 2025-04-16 13:27:32 UTC (rev 2776) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/BoundingBox.java 2025-04-16 14:47:21 UTC (rev 2777) @@ -64,4 +64,44 @@ */ int getCoordinateAsInt(int index); + /** + * Computes the width of this bounding box. + * @return The width of the bounding box. + */ + default float computeWidthAsFloat() { + final float urx = getCoordinateAsFloat(BoundingBox.UPPER_RIGHT_X_INDEX); + final float llx = getCoordinateAsFloat(BoundingBox.LOWER_LEFT_X_INDEX); + return urx - llx; + } + + /** + * Computes the height of this bounding box. + * @return The height of the bounding box. + */ + default float computeHeightAsFloat() { + final float ury = getCoordinateAsFloat(BoundingBox.UPPER_RIGHT_Y_INDEX); + final float lly = getCoordinateAsFloat(BoundingBox.LOWER_LEFT_Y_INDEX); + return ury - lly; + } + + /** + * Computes the width of this bounding box. + * @return The width of the bounding box. + */ + default int computeWidthAsInt() { + final int urx = getCoordinateAsInt(BoundingBox.UPPER_RIGHT_X_INDEX); + final int llx = getCoordinateAsInt(BoundingBox.LOWER_LEFT_X_INDEX); + return urx - llx; + } + + /** + * Computes the height of this bounding box. + * @return The height of the bounding box. + */ + default int computeHeightAsInt() { + final int ury = getCoordinateAsInt(BoundingBox.UPPER_RIGHT_Y_INDEX); + final int lly = getCoordinateAsInt(BoundingBox.LOWER_LEFT_Y_INDEX); + return ury - lly; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-16 13:27:52
|
Revision: 2776 http://sourceforge.net/p/axsl/code/2776 Author: victormote Date: 2025-04-16 13:27:32 +0000 (Wed, 16 Apr 2025) Log Message: ----------- Remove unneeded methods from BoundingBox. Modified Paths: -------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/BoundingBox.java Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/BoundingBox.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/BoundingBox.java 2025-04-15 18:08:50 UTC (rev 2775) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/BoundingBox.java 2025-04-16 13:27:32 UTC (rev 2776) @@ -64,18 +64,4 @@ */ int getCoordinateAsInt(int index); - /** - * Returns the coordinate value for a given index, cast as a {@link java.lang.Short#TYPE}. - * @param index The index for the coordinate whose value is needed, which must be between 0 and 3 inclusive. - * @return The value for the coordinate at {@code index}. - */ - short getCoordinateAsShort(int index); - - /** - * Returns the type used by the implemenation to store the values, in case this is important for performance or - * memory use. - * @return The type used to natively store the values in this bounding box. - */ - Class<? extends Number> getNativeType(); - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-15 18:09:10
|
Revision: 2775 http://sourceforge.net/p/axsl/code/2775 Author: victormote Date: 2025-04-15 18:08:50 +0000 (Tue, 15 Apr 2025) Log Message: ----------- Move baselineForScript method to FontData. Modified Paths: -------------- trunk/axsl/axsl-context/build.gradle trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java trunk/axsl/axsl-linebreak/src/main/java/org/axsl/linebreak/package-info.java Modified: trunk/axsl/axsl-context/build.gradle =================================================================== --- trunk/axsl/axsl-context/build.gradle 2025-04-15 15:17:36 UTC (rev 2774) +++ trunk/axsl/axsl-context/build.gradle 2025-04-15 18:08:50 UTC (rev 2775) @@ -4,4 +4,9 @@ description = "axsl-context" +dependencies { + api (project(':axsl-i18n')) + implementation (project(':axsl-value')) +} + /* Last line of script. */ Modified: trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java =================================================================== --- trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java 2025-04-15 15:17:36 UTC (rev 2774) +++ trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java 2025-04-15 18:08:50 UTC (rev 2775) @@ -23,6 +23,9 @@ package org.axsl.context; +import org.axsl.i18n.Script; +import org.axsl.value.BaselineIdentifier; + /** * Implementations provide a read-only subset of information about an instance of org.axsl.font.Font. * Specifically, this interface exists allow axsl-fotree access to certain resolved font metrics without giving it @@ -79,4 +82,11 @@ */ int superscriptShift(int fontSize); + /** + * Returns the baseline to be used for a given script, as reported by the nominal-font for this area. + * @param script The script being used by the formatting object. + * @return The baseline to be used for a given script. + */ + BaselineIdentifier baselineForScript(Script script); + } Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2025-04-15 15:17:36 UTC (rev 2774) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2025-04-15 18:08:50 UTC (rev 2775) @@ -28,7 +28,6 @@ import org.axsl.fotree.fo.Marker; import org.axsl.fotree.fo.RetrieveMarker; import org.axsl.fotree.fo.RetrieveTableMarker; -import org.axsl.i18n.Script; import org.axsl.value.BaselineIdentifier; import org.axsl.value.group.TextModifiers; @@ -144,13 +143,6 @@ /* TODO: This method looks wrong. */ /** - * Returns the baseline to be used for a given script, as reported by the nominal-font for this area. - * @param script The script being used by the formatting object. - * @return The baseline to be used for a given script. - */ - BaselineIdentifier baselineForScript(Script script); - - /** * Returns the factor which should be applied to the font-size when computing a "line-height" value that is * specified as "normal". * This factor is specified by the user-agent, and the CSS2 documentation recommends a computed value of 1.0 to 1.2. Modified: trunk/axsl/axsl-linebreak/src/main/java/org/axsl/linebreak/package-info.java =================================================================== --- trunk/axsl/axsl-linebreak/src/main/java/org/axsl/linebreak/package-info.java 2025-04-15 15:17:36 UTC (rev 2774) +++ trunk/axsl/axsl-linebreak/src/main/java/org/axsl/linebreak/package-info.java 2025-04-15 18:08:50 UTC (rev 2775) @@ -23,7 +23,8 @@ /** * <p>Interfaces for breaking a block of text into lines, using the Knuth-Plass line-breaking model. - * See {@link org.axsl.kp} for citations of the description of this model.</p> + * See <a href="../axsl-kp-model/org.axsl.kp/package-summary.html">The aXSL KP Model project</a> for citations of the + * description of this model.</p> */ package org.axsl.linebreak; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-15 15:17:54
|
Revision: 2774 http://sourceforge.net/p/axsl/code/2774 Author: victormote Date: 2025-04-15 15:17:36 +0000 (Tue, 15 Apr 2025) Log Message: ----------- Move more font-related methods from FoContext to FontData. Modified Paths: -------------- trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java Modified: trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java =================================================================== --- trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java 2025-04-15 14:32:16 UTC (rev 2773) +++ trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java 2025-04-15 15:17:36 UTC (rev 2774) @@ -58,4 +58,25 @@ */ int getXheight(int fontSize); + /** + * The amount by which the alphabetic baseline should be shifted when writing subscripts for this font. + * If the font does not contain such a value, a reasonable estimate is provided. + * @param fontSize The size, in millipoints, at which the font is scaled. + * @return The distance, in millipoints, by which the alphabetic baseline should be shifted when writing subscripts. + * A positive value shifts the baseline up, and a negative value shifts it down. + * Since subscripts are normally below the alphabetic baseline, the expected value is negative. + */ + int subscriptShift(int fontSize); + + /** + * The amount by which the alphabetic baseline should be shifted when writing superscripts for this font. + * If the font does not contain such a value, a reasonable estimate is provided. + * @param fontSize The size, in millipoints, at which the font is scaled. + * @return The distance, in millipoints, by which the alphabetic baseline should be shifted when writing + * superscripts. + * A positive value shifts the baseline up, and a negative value shifts it down. + * Since superscripts are normally above the alphabetic baseline, the expected value is positive. + */ + int superscriptShift(int fontSize); + } Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-04-15 14:32:16 UTC (rev 2773) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-04-15 15:17:36 UTC (rev 2774) @@ -520,27 +520,6 @@ Font.Baseline baseline(String script); /** - * The amount by which the alphabetic baseline should be shifted when writing subscripts for this font. - * If the font does not contain such a value, a reasonable estimate is provided. - * @param fontSize The size, in millipoints, at which the font is scaled. - * @return The distance, in millipoints, by which the alphabetic baseline should be shifted when writing subscripts. - * A positive value shifts the baseline up, and a negative value shifts it down. - * Since subscripts are normally below the alphabetic baseline, the expected value is negative. - */ - int subscriptShift(int fontSize); - - /** - * The amount by which the alphabetic baseline should be shifted when writing superscripts for this font. - * If the font does not contain such a value, a reasonable estimate is provided. - * @param fontSize The size, in millipoints, at which the font is scaled. - * @return The distance, in millipoints, by which the alphabetic baseline should be shifted when writing - * superscripts. - * A positive value shifts the baseline up, and a negative value shifts it down. - * Since superscripts are normally above the alphabetic baseline, the expected value is positive. - */ - int superscriptShift(int fontSize); - - /** * The recommended thickness, in millipoints, of the underline stroke for this font. * If the font does not contain such a value, a reasonable estimate is provided. * @param fontSize The font size for which the underline thickness should be computed. Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2025-04-15 14:32:16 UTC (rev 2773) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2025-04-15 15:17:36 UTC (rev 2774) @@ -161,36 +161,6 @@ float normalLineHeightFactor(); /** - * Returns the "height" of the font above the dominant baseline as reported by the area's font. - * @param fontSize The size of the font, in millipoints. - * @return The "height" of the font above the dominant baseline. - */ - int fontMetricsTextAltitude(int fontSize); - - /** - * Returns the "depth" of the font below the dominant baseline as reported by the area's font. - * @param fontSize The size of the font, in millipoints. - * @return The "depth" of the font below the dominant baseline. - */ - int fontMetricsTextDepth(int fontSize); - - /** - * Returns the length, in millipoints, by which the baseline should be shifted for subscripts, using the font from - * this area. - * @param fontSize The size of the font, in millipoints. - * @return The baseline shift for subscripts. - */ - int subscriptShift(int fontSize); - - /** - * Returns the length, in millipoints, by which the baseline should be shifted for superscripts, using the font from - * this area. - * @param fontSize The size of the font, in millipoints. - * @return The baseline shift for superscripts. - */ - int superscriptShift(int fontSize); - - /** * Returns some information about the Font to be used in font-related calculations, such as x-height, subscript- and * superscript-shift, text-depth, etc. * @return The font data. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-15 14:32:37
|
Revision: 2773 http://sourceforge.net/p/axsl/code/2773 Author: victormote Date: 2025-04-15 14:32:16 +0000 (Tue, 15 Apr 2025) Log Message: ----------- Expose some font data in a new axsl-context interface, for the purpose of consolidating some FoContext logic. Modified Paths: -------------- trunk/axsl/axsl-context/src/main/java/org/axsl/context/package-info.java trunk/axsl/axsl-font/build.gradle trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java trunk/axsl/axsl-fotree/build.gradle trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java Added Paths: ----------- trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java Added: trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java =================================================================== --- trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java (rev 0) +++ trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java 2025-04-15 14:32:16 UTC (rev 2773) @@ -0,0 +1,61 @@ +/* + * 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.context; + +/** + * Implementations provide a read-only subset of information about an instance of org.axsl.font.Font. + * Specifically, this interface exists allow axsl-fotree access to certain resolved font metrics without giving it + * access to the axsl-font module. + */ +public interface FontData { + + /** + * Returns the Ascender value for this font, scaled to a specific point size. + * @param fontSize The font size, in millipoints. + * @return The Ascender value, in millipoints. + */ + int getAscender(int fontSize); + + /** + * Returns the Descender value for this font, scaled to a specific point size. + * @param fontSize The font size, in millipoints. + * @return The Descender value, in millipoints. + */ + int getDescender(int fontSize); + + /** + * Returns the CapHeight value for this font, scaled to a specific point size. + * @param fontSize The font size, in millipoints. + * @return The CapHeight value, in millipoints. + */ + int getCapHeight(int fontSize); + + /** + * Returns the XHeight value for this font, scaled to a specific point size. + * @param fontSize The font size, in millipoints. + * @return The XHeight value, in millipoints. + */ + int getXheight(int fontSize); + +} Property changes on: trunk/axsl/axsl-context/src/main/java/org/axsl/context/FontData.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Modified: trunk/axsl/axsl-context/src/main/java/org/axsl/context/package-info.java =================================================================== --- trunk/axsl/axsl-context/src/main/java/org/axsl/context/package-info.java 2025-04-15 11:44:54 UTC (rev 2772) +++ trunk/axsl/axsl-context/src/main/java/org/axsl/context/package-info.java 2025-04-15 14:32:16 UTC (rev 2773) @@ -22,10 +22,12 @@ */ /** - * <p>Interfaces that allow inter-project communication in an indirect way. + * <p>Interfaces that allow inter-project communication in an indirect and limited way. * For example, axsl-areatree does not need to know anything about the layout system that was used to create it, but * does need to provide information to that layout system. * The interfaces in this project are intended to facilitate that communication without breaking the separation of - * concerns between projects.</p> + * concerns between projects. + * To preserve this separation of concerns, <b>all interfaces in this module should contain only read-only + * methods.</b></p> */ package org.axsl.context; Modified: trunk/axsl/axsl-font/build.gradle =================================================================== --- trunk/axsl/axsl-font/build.gradle 2025-04-15 11:44:54 UTC (rev 2772) +++ trunk/axsl/axsl-font/build.gradle 2025-04-15 14:32:16 UTC (rev 2773) @@ -10,6 +10,7 @@ implementation (project(':axsl-ps')) implementation (project(':axsl-orthography')) implementation (project(':axsl-value')) + api (project(':axsl-context')) } /* We want the DTDs to live as part of the website files, so we need to copy them into the jar file here. */ Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-04-15 11:44:54 UTC (rev 2772) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-04-15 14:32:16 UTC (rev 2773) @@ -24,6 +24,7 @@ package org.axsl.font; import org.axsl.constants.TypographicConstants; +import org.axsl.context.FontData; import org.axsl.orthography.Orthography; import org.axsl.ps.BoundingBox; import org.axsl.ps.Encoding; @@ -32,7 +33,7 @@ /** * The Font interface exposes a font resource to the client application. */ -public interface Font { +public interface Font extends FontData { /** @@ -191,34 +192,6 @@ /** - * Returns the Ascender value for this font, scaled to a specific point size. - * @param fontSize The font size, in millipoints. - * @return The Ascender value, in millipoints. - */ - int getAscender(int fontSize); - - /** - * Returns the Descender value for this font, scaled to a specific point size. - * @param fontSize The font size, in millipoints. - * @return The Descender value, in millipoints. - */ - int getDescender(int fontSize); - - /** - * Returns the CapHeight value for this font, scaled to a specific point size. - * @param fontSize The font size, in millipoints. - * @return The CapHeight value, in millipoints. - */ - int getCapHeight(int fontSize); - - /** - * Returns the XHeight value for this font, scaled to a specific point size. - * @param fontSize The font size, in millipoints. - * @return The XHeight value, in millipoints. - */ - int getXheight(int fontSize); - - /** * Returns the index into the font metrics for a given code point. * @param codePoint The Unicode code point whose metric index is needed. * @return The metric index for {@code codePoint}, or -1 if there are no metrics for it. Modified: trunk/axsl/axsl-fotree/build.gradle =================================================================== --- trunk/axsl/axsl-fotree/build.gradle 2025-04-15 11:44:54 UTC (rev 2772) +++ trunk/axsl/axsl-fotree/build.gradle 2025-04-15 14:32:16 UTC (rev 2773) @@ -13,6 +13,7 @@ * The fotree stores descriptions of voices, but resolution and use of them are downstream. * 2. axsl-font * The fotree stores descriptions of fonts, but resolution and use of them are downstream. + * For limited read-only access to font information, we have a dependency on axsl-context. * 3. axsl-graphic * The fotree stores locations of graphics, and in the case of instream-foreign-object, parses their XML * content, but resolution and use of them are downstream. @@ -28,6 +29,7 @@ implementation (project(':axsl-orthography')) implementation (project(':axsl-value')) implementation (project(':axsl-primitive')) + api (project(':axsl-context')) } /* Last line of script. */ Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2025-04-15 11:44:54 UTC (rev 2772) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2025-04-15 14:32:16 UTC (rev 2773) @@ -23,6 +23,7 @@ package org.axsl.fotree; +import org.axsl.context.FontData; import org.axsl.fotree.fo.GraftingPoint; import org.axsl.fotree.fo.Marker; import org.axsl.fotree.fo.RetrieveMarker; @@ -31,6 +32,7 @@ import org.axsl.value.BaselineIdentifier; import org.axsl.value.group.TextModifiers; + /** * <p>Provides the FO Tree with information for cases where its contents may be used differently in one context than in * another, or that are otherwise not known at the time the FO tree is created. @@ -189,10 +191,10 @@ int superscriptShift(int fontSize); /** - * Returns the x-height, in millipoints, of font from this area. - * @param fontSize The size of the font, in millipoints. - * @return The x-height of the font. + * Returns some information about the Font to be used in font-related calculations, such as x-height, subscript- and + * superscript-shift, text-depth, etc. + * @return The font data. */ - int fontXheight(int fontSize); + FontData getFontData(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-15 11:45:12
|
Revision: 2772 http://sourceforge.net/p/axsl/code/2772 Author: victormote Date: 2025-04-15 11:44:54 +0000 (Tue, 15 Apr 2025) Log Message: ----------- Change Boolean parameters and return values to boolean, for consistency. Modified Paths: -------------- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/EndsRowPa.java trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/StartsRowPa.java trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/InlineProgressionDirectionTa.java trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/ShiftDirectionTa.java trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/Word.java Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/EndsRowPa.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/EndsRowPa.java 2025-04-15 11:17:32 UTC (rev 2771) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/EndsRowPa.java 2025-04-15 11:44:54 UTC (rev 2772) @@ -34,6 +34,6 @@ * @return The "ends-row" trait for this FO, or null if it has not been specified. * @see "XSL-FO Recommendation 1.1, Section 7.28.11" */ - Boolean traitEndsRow(); + boolean traitEndsRow(); } Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/StartsRowPa.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/StartsRowPa.java 2025-04-15 11:17:32 UTC (rev 2771) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/StartsRowPa.java 2025-04-15 11:44:54 UTC (rev 2772) @@ -34,6 +34,6 @@ * @return The "starts-row" trait for this FO, or null if it has not been specified. * @see "XSL-FO Recommendation 1.1, Section 7.28.15" */ - Boolean traitStartsRow(); + boolean traitStartsRow(); } Modified: trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/InlineProgressionDirectionTa.java =================================================================== --- trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/InlineProgressionDirectionTa.java 2025-04-15 11:17:32 UTC (rev 2771) +++ trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/InlineProgressionDirectionTa.java 2025-04-15 11:44:54 UTC (rev 2772) @@ -47,6 +47,6 @@ * @see "XSL-FO Recommendation 1.1, Section 4.1, last paragraph, indirectly-derived traits." * @see "XSL-FO Recommendation 1.1, Section 4.2.2, Common Traits." */ - AbsoluteDirection traitInlineProgressionDirection(Boolean isLineNumberOdd); + AbsoluteDirection traitInlineProgressionDirection(boolean isLineNumberOdd); } Modified: trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/ShiftDirectionTa.java =================================================================== --- trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/ShiftDirectionTa.java 2025-04-15 11:17:32 UTC (rev 2771) +++ trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/ShiftDirectionTa.java 2025-04-15 11:44:54 UTC (rev 2772) @@ -48,6 +48,6 @@ * @see "XSL-FO Recommendation 1.1, Section 4.1, last paragraph, indirectly-derived traits." * @see "XSL-FO Recommendation 1.1, Section 4.2.2, Common Traits." */ - AbsoluteDirection traitShiftDirection(Boolean isLineNumberOdd); + AbsoluteDirection traitShiftDirection(boolean isLineNumberOdd); } Modified: trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/Word.java =================================================================== --- trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/Word.java 2025-04-15 11:17:32 UTC (rev 2771) +++ trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/Word.java 2025-04-15 11:44:54 UTC (rev 2772) @@ -486,7 +486,7 @@ * @return True if and only if the word matches the specified criteria, or null if the word does not know. * @throws NullPointerException If {@code pos} is null. */ - Boolean isOfType(PartOfSpeech pos); + boolean isOfType(PartOfSpeech pos); /** * Indicates whether this word is of a specified part of speech and matches a specified qualifier, as defined in the @@ -502,6 +502,6 @@ * @see Dictionary#supportsQualifiedType(org.axsl.orthography.Word.PartOfSpeech, * org.axsl.orthography.Word.PosQualifier) where the dictionary can be tested for support of a specific qualifier. */ - Boolean isOfQualifiedType(PartOfSpeech pos, PosQualifier qualifier); + boolean isOfQualifiedType(PartOfSpeech pos, PosQualifier qualifier); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-15 11:17:49
|
Revision: 2771 http://sourceforge.net/p/axsl/code/2771 Author: victormote Date: 2025-04-15 11:17:32 +0000 (Tue, 15 Apr 2025) Log Message: ----------- Standardize some method names. Modified Paths: -------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java 2025-04-15 10:42:39 UTC (rev 2770) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java 2025-04-15 11:17:32 UTC (rev 2771) @@ -224,7 +224,7 @@ * Returns the block-progression-direction for this writing-mode. * @return The block-progression-direction for this writing-mode. */ - public AbsoluteDirection getBpDirection() { + public AbsoluteDirection getBlockProgressionDirection() { return this.bpd; } @@ -232,7 +232,7 @@ * Returns the inline-progression-direction for even-numbered lines for this writing-mode. * @return Returns the inline-progression-direction for even-numbered lines for this writing-mode. */ - public AbsoluteDirection getIpDirectionEven() { + public AbsoluteDirection getInlineProgressionDirectionEven() { return this.ipdEven; } @@ -240,7 +240,7 @@ * Returns the inline-progression-direction for odd-numbered lines for this writing-mode. * @return Returns the inline-progression-direction for odd-numbered lines for this writing-mode. */ - public AbsoluteDirection getIpDirectionOdd() { + public AbsoluteDirection getInlineProgressionDirectionOdd() { return this.ipdOdd; } @@ -309,7 +309,7 @@ * Tells which axis (horizontal or vertical) is the block-progression axis. * @return The block-progression axis for this writing mode. */ - public AbsoluteAxis getBpAxis() { + public AbsoluteAxis getBlockProgressionAxis() { if (this.bpd.isHorizontal()) { return AbsoluteAxis.HORIZONTAL; } @@ -320,7 +320,7 @@ * Tells which axis (horizontal or vertical) is the inline-progression axis. * @return The inline-progression axis for this writing mode. */ - public AbsoluteAxis getIpAxis() { + public AbsoluteAxis getInlineProgressionAxis() { if (this.bpd.isHorizontal()) { return AbsoluteAxis.VERTICAL; } @@ -335,10 +335,10 @@ */ public AbsoluteAxis getAbsoluteAxis(final RelativeAxis relativeAxis) { if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) { - return getBpAxis(); + return getBlockProgressionAxis(); } if (relativeAxis == RelativeAxis.INLINE_PROGRESSION) { - return getIpAxis(); + return getInlineProgressionAxis(); } throw new IllegalArgumentException("Invalid relative axis"); } @@ -525,7 +525,7 @@ * @param relativeDir The relative direction to be converted. * @return The absolute direction corresponding to {@code relativeDir} for this writing mode. */ - public AbsoluteCompass getAbsoluteDirection(final RelativeCompass relativeDir) { + public AbsoluteCompass getAbsoluteCompass(final RelativeCompass relativeDir) { if (relativeDir == RelativeCompass.START) { return getStart(); } @@ -553,7 +553,7 @@ * {@link AbsoluteDirection#RIGHT_TO_LEFT}, * or -1 for invalid input or writing mode. */ - public AbsoluteDirection getAbsoluteDirFromRelativeAxis(final RelativeAxis relativeAxis) { + public AbsoluteDirection getAbsoluteDirection(final RelativeAxis relativeAxis) { if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) { return this.bpd; } @@ -565,7 +565,7 @@ * @param absoluteDir The absolute direction to be converted. * @return The relative direction corresponding to {@code absoluteDir} for this writing mode. */ - public RelativeCompass getRelativeDirection(final AbsoluteCompass absoluteDir) { + public RelativeCompass getRelativeCompass(final AbsoluteCompass absoluteDir) { if (absoluteDir == AbsoluteCompass.LEFT) { return getLeft(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-15 10:42:57
|
Revision: 2770 http://sourceforge.net/p/axsl/code/2770 Author: victormote Date: 2025-04-15 10:42:39 +0000 (Tue, 15 Apr 2025) Log Message: ----------- Rename method to distinguish it from the items marked as traits in the XSL-FO Recommendation. Modified Paths: -------------- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/WritingModePa.java Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/WritingModePa.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/WritingModePa.java 2025-04-15 04:12:53 UTC (rev 2769) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/WritingModePa.java 2025-04-15 10:42:39 UTC (rev 2770) @@ -33,11 +33,12 @@ /** * Returns the writing-mode for this FO. - * This trait is inherited. + * Writing-mode is not a trait, but is a factor in resolving some traits. + * It is an inherited property. * @param context An object that knows how to resolve FO Tree context issues. * @return The writing-mode for this FO. * @see "XSL-FO Recommendation 1.1, Section 7.29.7" */ - WritingMode traitWritingMode(FoContext context); + WritingMode getWritingMode(FoContext context); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-15 04:13:11
|
Revision: 2769 http://sourceforge.net/p/axsl/code/2769 Author: victormote Date: 2025-04-15 04:12:53 +0000 (Tue, 15 Apr 2025) Log Message: ----------- Move code from FOray DtWritingMode to aXSL WritingMode, and make it an enum. Modified Paths: -------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java 2025-04-14 21:48:12 UTC (rev 2768) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java 2025-04-15 04:12:53 UTC (rev 2769) @@ -1,5 +1,5 @@ /* - * Copyright 2005 The aXSL Project. + * Copyright 2025 The aXSL Project. * http://www.axsl.org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,36 +23,226 @@ package org.axsl.value; - /** - * Writing Mode is not a datatype recognized in XSL-FO. - * However, the definition of the writing-mode property in the Recommendation requires a <em>de facto</em> compound data - * type. - * - * Please note that most applications using members of this class will not want to deal with the different ipd and shift - * values for odd and even line numbers. - * In that case, it is recommended that they simply use the odd value for each. + * Enumeration of valid writing-mode values. * @see "XSL-FO Recommendation 1.1, Section 7.29.7" */ -public interface WritingMode { +public enum WritingMode { + /** The "lr-tb" writing mode. */ + LR_TB("lr-tb", + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + false), + + /** The "rl-tb" writing mode. */ + RL_TB("rl-tb", + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + false), + + /** The "tb-rl" writing mode. */ + TB_RL("tb-rl", + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.LEFT_TO_RIGHT, + false), + + /** The "tb-lr" writing mode. */ + TB_LR("tb-lr", + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.RIGHT_TO_LEFT, + false), + + /** The "bt-lr" writing mode. */ + BT_LR("bt-lr", + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.RIGHT_TO_LEFT, + false), + + /** The "bt-rl" writing mode. */ + BT_RL("bt-rl", + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.LEFT_TO_RIGHT, + false), + + /** The "lr-bt" writing mode. */ + LR_BT("lr-bt", + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + false), + + /** The "rl-bt" writing mode. */ + RL_BT("rl-bt", + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + false), + + /** The "lr-alternating-rl-bt" writing mode. */ + LR_ALTERNATING_RL_BT("lr-alternating-rl-bt", + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + false), + + /** The "lr-alternating-rl-tb" writing mode. */ + LR_ALTERNATING_RL_TB("lr-alternating-rl-tb", + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + false), + + /** The "lr-inverting-rl-bt" writing mode. */ + LR_INVERTING_RL_BT("lr-inverting-rl-bt", + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.TOP_TO_BOTTOM, + false), + + /** The "lr-inverting-rl-tb" writing mode. */ + LR_INVERTING_RL_TB("lr-inverting-rl-tb", + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.BOTTOM_TO_TOP, + AbsoluteDirection.TOP_TO_BOTTOM, + false), + + /** The "tb-lr-in-lr-pairs" writing mode. */ + TB_LR_IN_LR_PAIRS("tb-lr-in-lr-pairs", + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.TOP_TO_BOTTOM, + AbsoluteDirection.LEFT_TO_RIGHT, + AbsoluteDirection.RIGHT_TO_LEFT, + AbsoluteDirection.RIGHT_TO_LEFT, + true); + + /** Copy of the array stored for performance reasons. */ + private static final WritingMode[] VALUES = WritingMode.values(); + + /** The external label for this instance. */ + private String label; + + /** The inline-progression direction for odd lines in this writing mode. */ + private AbsoluteDirection ipdOdd; + + /** The inline-progression direction for even lines in this writing mode. */ + private AbsoluteDirection ipdEven; + + /** The block-progression direction for this writing mode. */ + private AbsoluteDirection bpd; + + /** The shift-direction for odd lines in this writing mode. */ + private AbsoluteDirection shiftOdd; + + /** The shift-direction for even lines in this writing mode. */ + private AbsoluteDirection shiftEven; + + /** Indicates whether characters in this writing mode are written in pairs + * before forming the pairs of characters into a line. */ + private boolean paired; + /** + * Constructor. + * @param label The external label for this instance. + * @param ipdOdd The inline-progression direction for odd lines in this + * writing mode. + * @param ipdEven The inline-progression direction for even lines in this + * writing mode. + * @param bpd The block-progression direction for this writing mode. + * @param shiftOdd The shift-direction for odd lines in this writing mode. + * @param shiftEven The shift-direction for even lines in this writing mode. + * @param paired Indicates whether characters in this writing mode are + * written in pairs before forming the pairs of characters into a line. + */ + WritingMode(final String label, final AbsoluteDirection ipdOdd, + final AbsoluteDirection ipdEven, final AbsoluteDirection bpd, + final AbsoluteDirection shiftOdd, final AbsoluteDirection shiftEven, + final boolean paired) { + this.label = label; + this.ipdOdd = ipdOdd; + this.ipdEven = ipdEven; + this.bpd = bpd; + this.shiftOdd = shiftOdd; + this.shiftEven = shiftEven; + this.paired = paired; + } + + /** + * Finds the matching instance from a label. + * @param label The external label used to designate an instance. + * @return The instance that matches {@code label}, or null if none is found. + */ + public static WritingMode fromLabel(final String label) { + for (int index = 0; index < VALUES.length; index ++) { + final WritingMode wm = VALUES[index]; + if (wm.label.equals(label)) { + return wm; + } + } + return null; + } + + /** + * Returns the label for this instance. + * @return the label for this instance. + */ + public String getLabel() { + return this.label; + } + + /** * Returns the block-progression-direction for this writing-mode. * @return The block-progression-direction for this writing-mode. */ - AbsoluteDirection getBpDirection(); + public AbsoluteDirection getBpDirection() { + return this.bpd; + } /** * Returns the inline-progression-direction for even-numbered lines for this writing-mode. * @return Returns the inline-progression-direction for even-numbered lines for this writing-mode. */ - AbsoluteDirection getIpDirectionEven(); + public AbsoluteDirection getIpDirectionEven() { + return this.ipdEven; + } /** * Returns the inline-progression-direction for odd-numbered lines for this writing-mode. * @return Returns the inline-progression-direction for odd-numbered lines for this writing-mode. */ - AbsoluteDirection getIpDirectionOdd(); + public AbsoluteDirection getIpDirectionOdd() { + return this.ipdOdd; + } /** * <p>Indicates whether characters are written in pairs in this writing-mode. @@ -64,7 +254,9 @@ * * @return Returns true if characters are written in pairs in this writing-mode. */ - boolean isPaired(); + public boolean isPaired() { + return this.paired; + } /** * Returns the shift-direction for even-numbered lines for this writing-mode. @@ -74,7 +266,9 @@ * adjustments will move it down. * @return The shift-direction for even-numbered lines for this writing-mode. */ - AbsoluteDirection getShiftDirectionEven(); + public AbsoluteDirection getShiftDirectionEven() { + return this.shiftEven; + } /** * Returns the shift-direction for odd-numbered lines for this writing-mode. @@ -84,31 +278,54 @@ * adjustments will move it down. * @return Returns the shift-direction for odd-numbered lines for this writing-mode. */ - AbsoluteDirection getShiftDirectionOdd(); + public AbsoluteDirection getShiftDirectionOdd() { + return this.shiftOdd; + } /** * Tells which axis (block-progression or inline-progression) is the horizontal axis. * @return The horizontal axis for this writing mode. */ - RelativeAxis getHorizontalAxis(); + public RelativeAxis getHorizontalAxis() { + if (this.bpd.isHorizontal()) { + return RelativeAxis.BLOCK_PROGRESSION; + } + return RelativeAxis.INLINE_PROGRESSION; + } + /** * Tells which axis (block-progression or inline-progression) is the vertical axis. * @return The vertical axis for this writing mode. */ - RelativeAxis getVerticalAxis(); + public RelativeAxis getVerticalAxis() { + if (this.bpd.isHorizontal()) { + return RelativeAxis.INLINE_PROGRESSION; + } + return RelativeAxis.BLOCK_PROGRESSION; + } /** * Tells which axis (horizontal or vertical) is the block-progression axis. * @return The block-progression axis for this writing mode. */ - AbsoluteAxis getBpAxis(); + public AbsoluteAxis getBpAxis() { + if (this.bpd.isHorizontal()) { + return AbsoluteAxis.HORIZONTAL; + } + return AbsoluteAxis.VERTICAL; + } /** * Tells which axis (horizontal or vertical) is the inline-progression axis. * @return The inline-progression axis for this writing mode. */ - AbsoluteAxis getIpAxis(); + public AbsoluteAxis getIpAxis() { + if (this.bpd.isHorizontal()) { + return AbsoluteAxis.VERTICAL; + } + return AbsoluteAxis.HORIZONTAL; + } /** * Converts a relative axis (block-progression or inline-progress) to an absolute axis (horizontal or vertical) for @@ -116,7 +333,15 @@ * @param relativeAxis The relative axis to be converted. * @return The {@link AbsoluteAxis} that corresponds to {@code relativeAxis} for this writing mode. */ - AbsoluteAxis getAbsoluteAxis(RelativeAxis relativeAxis); + public AbsoluteAxis getAbsoluteAxis(final RelativeAxis relativeAxis) { + if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) { + return getBpAxis(); + } + if (relativeAxis == RelativeAxis.INLINE_PROGRESSION) { + return getIpAxis(); + } + throw new IllegalArgumentException("Invalid relative axis"); + } /** * Converts an absolute axis(horizontal or vertical) to a relative axis (inline-progression or block-progression) @@ -124,55 +349,176 @@ * @param absoluteAxis The absolute axis to be converted. * @return The {@link RelativeAxis} that corresponds to {@code absoluteAxis} for this writing mode. */ - RelativeAxis getRelativeAxis(AbsoluteAxis absoluteAxis); + public RelativeAxis getRelativeAxis(final AbsoluteAxis absoluteAxis) { + if (absoluteAxis == AbsoluteAxis.HORIZONTAL) { + return getHorizontalAxis(); + } + if (absoluteAxis == AbsoluteAxis.VERTICAL) { + return getVerticalAxis(); + } + throw new IllegalArgumentException("Invalid absolute axis"); + } /** * Tells which absolute direction is the "start" direction for this writing mode. * @return The absolute "start" direction for this writing mode. */ - AbsoluteCompass getStart(); + public AbsoluteCompass getStart() { + if (this.ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) { + return AbsoluteCompass.LEFT; + } + if (this.ipdOdd == AbsoluteDirection.RIGHT_TO_LEFT) { + return AbsoluteCompass.RIGHT; + } + if (this.ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) { + return AbsoluteCompass.TOP; + } + if (this.ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) { + return AbsoluteCompass.BOTTOM; + } + return null; + } /** * Tells which absolute direction is the "end" direction for this writing mode. * @return The absolute "end" direction for this writing mode. */ - AbsoluteCompass getEnd(); + public AbsoluteCompass getEnd() { + if (this.ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) { + return AbsoluteCompass.RIGHT; + } + if (this.ipdOdd == AbsoluteDirection.RIGHT_TO_LEFT) { + return AbsoluteCompass.LEFT; + } + if (this.ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) { + return AbsoluteCompass.BOTTOM; + } + if (this.ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) { + return AbsoluteCompass.TOP; + } + return null; + } /** * Tells which absolute direction is the "before" direction for this writing mode. * @return The absolute "before" direction for this writing mode. */ - AbsoluteCompass getBefore(); + public AbsoluteCompass getBefore() { + if (this.bpd == AbsoluteDirection.LEFT_TO_RIGHT) { + return AbsoluteCompass.LEFT; + } + if (this.bpd == AbsoluteDirection.RIGHT_TO_LEFT) { + return AbsoluteCompass.RIGHT; + } + if (this.bpd == AbsoluteDirection.TOP_TO_BOTTOM) { + return AbsoluteCompass.TOP; + } + if (this.bpd == AbsoluteDirection.BOTTOM_TO_TOP) { + return AbsoluteCompass.BOTTOM; + } + return null; + } /** * Tells which absolute direction is the "after" direction for this writing mode. * @return The absolute "after" direction for this writing mode. */ - AbsoluteCompass getAfter(); + public AbsoluteCompass getAfter() { + if (this.bpd == AbsoluteDirection.LEFT_TO_RIGHT) { + return AbsoluteCompass.RIGHT; + } + if (this.bpd == AbsoluteDirection.RIGHT_TO_LEFT) { + return AbsoluteCompass.LEFT; + } + if (this.bpd == AbsoluteDirection.TOP_TO_BOTTOM) { + return AbsoluteCompass.BOTTOM; + } + if (this.bpd == AbsoluteDirection.BOTTOM_TO_TOP) { + return AbsoluteCompass.TOP; + } + return null; + } /** * Tells which relative direction is the "left" direction for this writing mode. * @return The relative "left" direction for this writing mode. */ - RelativeCompass getLeft(); + public RelativeCompass getLeft() { + if (this.ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) { + return RelativeCompass.START; + } + if (this.ipdOdd == AbsoluteDirection.RIGHT_TO_LEFT) { + return RelativeCompass.END; + } + if (this.bpd == AbsoluteDirection.LEFT_TO_RIGHT) { + return RelativeCompass.BEFORE; + } + if (this.bpd == AbsoluteDirection.RIGHT_TO_LEFT) { + return RelativeCompass.AFTER; + } + return null; + } + /** * Tells which relative direction is the "right" direction for this writing mode. * @return The relative "right" direction for this writing mode. */ - RelativeCompass getRight(); + public RelativeCompass getRight() { + if (this.ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) { + return RelativeCompass.END; + } + if (this.ipdOdd == AbsoluteDirection.RIGHT_TO_LEFT) { + return RelativeCompass.START; + } + if (this.bpd == AbsoluteDirection.LEFT_TO_RIGHT) { + return RelativeCompass.AFTER; + } + if (this.bpd == AbsoluteDirection.RIGHT_TO_LEFT) { + return RelativeCompass.BEFORE; + } + return null; + } /** * Tells which relative direction is the "top" direction for this writing mode. * @return The relative "top" direction for this writing mode. */ - RelativeCompass getTop(); + public RelativeCompass getTop() { + if (this.ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) { + return RelativeCompass.START; + } + if (this.ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) { + return RelativeCompass.END; + } + if (this.bpd == AbsoluteDirection.TOP_TO_BOTTOM) { + return RelativeCompass.BEFORE; + } + if (this.bpd == AbsoluteDirection.BOTTOM_TO_TOP) { + return RelativeCompass.AFTER; + } + return null; + } /** * Tells which relative direction is the "bottom" direction for this writing mode. * @return The relative "bottom" direction for this writing mode. */ - RelativeCompass getBottom(); + public RelativeCompass getBottom() { + if (this.ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) { + return RelativeCompass.END; + } + if (this.ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) { + return RelativeCompass.START; + } + if (this.bpd == AbsoluteDirection.TOP_TO_BOTTOM) { + return RelativeCompass.AFTER; + } + if (this.bpd == AbsoluteDirection.BOTTOM_TO_TOP) { + return RelativeCompass.BEFORE; + } + return null; + } /** * Given a relative direction, this method returns the corresponding absolute direction for this writing mode. @@ -179,7 +525,21 @@ * @param relativeDir The relative direction to be converted. * @return The absolute direction corresponding to {@code relativeDir} for this writing mode. */ - AbsoluteCompass getAbsoluteDirection(RelativeCompass relativeDir); + public AbsoluteCompass getAbsoluteDirection(final RelativeCompass relativeDir) { + if (relativeDir == RelativeCompass.START) { + return getStart(); + } + if (relativeDir == RelativeCompass.END) { + return getEnd(); + } + if (relativeDir == RelativeCompass.BEFORE) { + return getBefore(); + } + if (relativeDir == RelativeCompass.AFTER) { + return getAfter(); + } + return null; + } /** * Given a relative axis, this method returns the corresponding absolute @@ -193,7 +553,12 @@ * {@link AbsoluteDirection#RIGHT_TO_LEFT}, * or -1 for invalid input or writing mode. */ - AbsoluteDirection getAbsoluteDirFromRelativeAxis(RelativeAxis relativeAxis); + public AbsoluteDirection getAbsoluteDirFromRelativeAxis(final RelativeAxis relativeAxis) { + if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) { + return this.bpd; + } + return this.ipdOdd; + } /** * Given an absolute direction, this method returns the corresponding relative direction for this writing-mode. @@ -200,6 +565,30 @@ * @param absoluteDir The absolute direction to be converted. * @return The relative direction corresponding to {@code absoluteDir} for this writing mode. */ - RelativeCompass getRelativeDirection(AbsoluteCompass absoluteDir); + public RelativeCompass getRelativeDirection(final AbsoluteCompass absoluteDir) { + if (absoluteDir == AbsoluteCompass.LEFT) { + return getLeft(); + } + if (absoluteDir == AbsoluteCompass.RIGHT) { + return getRight(); + } + if (absoluteDir == AbsoluteCompass.TOP) { + return getTop(); + } + if (absoluteDir == AbsoluteCompass.BOTTOM) { + return getBottom(); + } + return null; + } + /** + * Indicates whether this writing-mode is horizontal or vertical. + * The inline-progression-direction indicates whether the writing-mode is horizontal or + * vertical. + * @return True if this writing-mode is horizontal, false if it is vertical. + */ + public boolean isHorizontal() { + return this.ipdOdd.isHorizontal(); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-14 21:48:29
|
Revision: 2768 http://sourceforge.net/p/axsl/code/2768 Author: victormote Date: 2025-04-14 21:48:12 +0000 (Mon, 14 Apr 2025) Log Message: ----------- Remove Compass interface as it obscures the implementations. Modified Paths: -------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/AbsoluteCompass.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/RelativeCompass.java Removed Paths: ------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/Compass.java Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/AbsoluteCompass.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/AbsoluteCompass.java 2025-04-14 19:55:30 UTC (rev 2767) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/AbsoluteCompass.java 2025-04-14 21:48:12 UTC (rev 2768) @@ -29,7 +29,7 @@ /** * An enumeration for the various absolute compass-point directions. */ -public enum AbsoluteCompass implements Compass { +public enum AbsoluteCompass { /** Constant indicating the "left" (west) absolute compass-point. */ LEFT(3), @@ -57,16 +57,6 @@ this.cardinalValue = cardinalValue; } - @Override - public boolean isRelative() { - return false; - } - - @Override - public boolean isAbsolute() { - return true; - } - /** * Converts a cardinalValue to an instance of this enumeration. * @param cardinalValue The cardinal value to be converted. Deleted: trunk/axsl/axsl-value/src/main/java/org/axsl/value/Compass.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/Compass.java 2025-04-14 19:55:30 UTC (rev 2767) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/Compass.java 2025-04-14 21:48:12 UTC (rev 2768) @@ -1,43 +0,0 @@ -/* - * Copyright 2007 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.value; - -/** - * A common interface for {@link AbsoluteCompass} and {@link RelativeCompass}. - */ -public interface Compass { - - /** - * Indicates whether this compass direction is a relative direction. - * @return True if and only if this compass direction is a relative direction. - */ - boolean isRelative(); - - /** - * Indicates whether this compass direction is an absolute direction. - * @return True if and only if this compass direction is an absolute direction. - */ - boolean isAbsolute(); - -} Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/RelativeCompass.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/RelativeCompass.java 2025-04-14 19:55:30 UTC (rev 2767) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/RelativeCompass.java 2025-04-14 21:48:12 UTC (rev 2768) @@ -26,7 +26,7 @@ /** * An enumeration for the various compass-point directions. */ -public enum RelativeCompass implements Compass { +public enum RelativeCompass { /** Constant indicating the "start" relative compass-point. */ START, @@ -40,15 +40,4 @@ /** Constant indicating the "after" relative compass-point. */ AFTER; - @Override - public boolean isRelative() { - return true; - } - - @Override - public boolean isAbsolute() { - return false; - } - - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-14 19:55:47
|
Revision: 2767 http://sourceforge.net/p/axsl/code/2767 Author: victormote Date: 2025-04-14 19:55:30 +0000 (Mon, 14 Apr 2025) Log Message: ----------- Remove unnecessarily flexible method. Modified Paths: -------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java 2025-04-14 15:29:02 UTC (rev 2766) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/WritingMode.java 2025-04-14 19:55:30 UTC (rev 2767) @@ -202,14 +202,4 @@ */ RelativeCompass getRelativeDirection(AbsoluteCompass absoluteDir); - /** - * If given a relative direction, this method returns the corresponding absolute direction; if given an absolute - * direction, this method returns the corresponding relative direction. - * @param inputDirection Either a {@link RelativeCompass} or an {@link AbsoluteCompass} instance to be converted. - * @return For absolute direction input, the corresponding relative direction. - * For relative direction input, the corresponding absolute direction. - * For an error either in the input or a bad writing mode, -1. - */ - Compass getCorresponding(Compass inputDirection); - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-04-14 15:29:19
|
Revision: 2766 http://sourceforge.net/p/axsl/code/2766 Author: victormote Date: 2025-04-14 15:29:02 +0000 (Mon, 14 Apr 2025) Log Message: ----------- Remove intrinsic width and height methods from FoContext. These were probably included to obtain the pixels-per-inch factor that should be used. However, the area tree shouldn't be expected to know more about this than the fo tree. That factor should probably be obtained from something querying the environment, or should just use an assumed constant. Modified Paths: -------------- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoScalable.java Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2025-02-11 12:54:46 UTC (rev 2765) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2025-04-14 15:29:02 UTC (rev 2766) @@ -23,9 +23,7 @@ package org.axsl.fotree; -import org.axsl.fotree.fo.ExternalGraphic; import org.axsl.fotree.fo.GraftingPoint; -import org.axsl.fotree.fo.InstreamForeignObject; import org.axsl.fotree.fo.Marker; import org.axsl.fotree.fo.RetrieveMarker; import org.axsl.fotree.fo.RetrieveTableMarker; @@ -197,32 +195,4 @@ */ int fontXheight(int fontSize); - /** - * Returns the intrinsic width, in millipoints, of a given graphic. - * @param externalGraphic The graphic for which the intrinsic width is needed. - * @return The intrinsic width, in millipoints, of {@code externalGraphic}. - */ - int getIntrinsicWidth(ExternalGraphic externalGraphic); - - /** - * Returns the intrinsic height, in millipoints, of a given graphic. - * @param externalGraphic The graphic for which the intrinsic height is needed. - * @return The intrinsic height, in millipoints, of {@code externalGraphic}. - */ - int getIntrinsicHeight(ExternalGraphic externalGraphic); - - /** - * Returns the intrinsic width, in millipoints, of a given XML document. - * @param instreamForeign The XML document for which the intrinsic width is needed. - * @return The intrinsic width, in millipoints, of {@code foreignXml}. - */ - int getIntrinsicWidth(InstreamForeignObject instreamForeign); - - /** - * Returns the intrinsic height, in millipoints, of a given XML document. - * @param instreamForeign The XML document for which the intrinsic height is needed. - * @return The intrinsic height, in millipoints, of {@code foreignXml}. - */ - int getIntrinsicHeight(InstreamForeignObject instreamForeign); - } Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoScalable.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoScalable.java 2025-02-11 12:54:46 UTC (rev 2765) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoScalable.java 2025-04-14 15:29:02 UTC (rev 2766) @@ -67,4 +67,16 @@ */ int referenceBpd(FoContext context); + /** + * Returns the intrinsic width, in millipoints, of this object. + * @return The intrinsic width, in millipoints, of this object, or -1 if not known. + */ + int getIntrinsicWidth(); + + /** + * Returns the intrinsic height, in millipoints, of this object. + * @return The intrinsic height, in millipoints, of this object, or -1 if not known. + */ + int getIntrinsicHeight(); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-02-11 12:54:48
|
Revision: 2765 http://sourceforge.net/p/axsl/code/2765 Author: victormote Date: 2025-02-11 12:54:46 +0000 (Tue, 11 Feb 2025) Log Message: ----------- Upgrade Gradle from 8.12 to 8.12.1. Modified Paths: -------------- trunk/axsl/gradle/wrapper/gradle-wrapper.jar trunk/axsl/gradle/wrapper/gradle-wrapper.properties trunk/axsl/gradlew trunk/axsl/gradlew.bat Modified: trunk/axsl/gradle/wrapper/gradle-wrapper.jar =================================================================== (Binary files differ) Modified: trunk/axsl/gradle/wrapper/gradle-wrapper.properties =================================================================== --- trunk/axsl/gradle/wrapper/gradle-wrapper.properties 2025-01-11 16:59:46 UTC (rev 2764) +++ trunk/axsl/gradle/wrapper/gradle-wrapper.properties 2025-02-11 12:54:46 UTC (rev 2765) @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME Modified: trunk/axsl/gradlew =================================================================== --- trunk/axsl/gradlew 2025-01-11 16:59:46 UTC (rev 2764) +++ trunk/axsl/gradlew 2025-02-11 12:54:46 UTC (rev 2765) @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,7 +85,8 @@ # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +147,7 @@ case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +155,7 @@ '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +204,11 @@ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ Modified: trunk/axsl/gradlew.bat =================================================================== --- trunk/axsl/gradlew.bat 2025-01-11 16:59:46 UTC (rev 2764) +++ trunk/axsl/gradlew.bat 2025-02-11 12:54:46 UTC (rev 2765) @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-01-11 16:59:49
|
Revision: 2764 http://sourceforge.net/p/axsl/code/2764 Author: victormote Date: 2025-01-11 16:59:46 +0000 (Sat, 11 Jan 2025) Log Message: ----------- Add text-align and text-align last traits to NormalBlockArea. Modified Paths: -------------- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/NormalBlockArea.java trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/package-info.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/TextAlign.java Added Paths: ----------- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignLastTa.java trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignTa.java Modified: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/NormalBlockArea.java =================================================================== --- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/NormalBlockArea.java 2025-01-10 18:02:19 UTC (rev 2763) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/NormalBlockArea.java 2025-01-11 16:59:46 UTC (rev 2764) @@ -24,6 +24,8 @@ package org.axsl.area; import org.axsl.area.factory.BlockLevelAreaFactory; +import org.axsl.area.trait.TextAlignLastTa; +import org.axsl.area.trait.TextAlignTa; import org.axsl.context.LineBreakContext; import org.axsl.fotree.role.NormalBlockAreaGenerator; import org.axsl.galley.NormalBlockAreaG5; @@ -31,7 +33,13 @@ /** * Area for a normal block. */ -public interface NormalBlockArea extends Area, BlockLevelAreaFactory, LineBreakContext, NormalBlockAreaG5 { +public interface NormalBlockArea extends + Area, + BlockLevelAreaFactory, + LineBreakContext, + NormalBlockAreaG5, + TextAlignTa, + TextAlignLastTa { @Override NormalBlockAreaGenerator traitGeneratedBy(); Added: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignLastTa.java =================================================================== --- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignLastTa.java (rev 0) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignLastTa.java 2025-01-11 16:59:46 UTC (rev 2764) @@ -0,0 +1,39 @@ +/* + * 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.area.trait; + +import org.axsl.value.TextAlignLast; + +/** + * Accessor for the "text-align-last" trait. + */ +public interface TextAlignLastTa { + + /** + * Returns the text-align-last for this area. + * @return The text-align-last. + */ + TextAlignLast traitTextAlignLast(); + +} Property changes on: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignLastTa.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignTa.java =================================================================== --- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignTa.java (rev 0) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignTa.java 2025-01-11 16:59:46 UTC (rev 2764) @@ -0,0 +1,52 @@ +/* + * 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.area.trait; + +import org.axsl.value.TextAlign; + +/** + * Accessor for the "text-align" trait. + */ +public interface TextAlignTa { + + /** + * Returns the "text-align" trait. + * @return The "text-align" trait for this FO. + * If {@link TextAlign#STRING} is returned, this indicates that text should be aligned on a specific string, which + * string can be obtained from {@link #traitTextAlignString()}. + * @see #traitTextAlignString() + + */ + TextAlign traitTextAlign(); + + /** + * Returns the String value, if any, of the "text-align" trait. + * This trait is inherited. + * @return The String value specified for the "text-align" trait. + * This will always be null unless the return value from {@link #traitTextAlign()} is {@link TextAlign#STRING}. + * @see #traitTextAlign() + */ + String traitTextAlignString(); + +} Property changes on: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/TextAlignTa.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Modified: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/package-info.java =================================================================== --- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/package-info.java 2025-01-10 18:02:19 UTC (rev 2763) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/trait/package-info.java 2025-01-11 16:59:46 UTC (rev 2764) @@ -22,6 +22,6 @@ */ /** - * Trait accessor interfaces for those traits that cannot exist in axsl-galley. + * Trait accessor interfaces for those traits that cannot exist or do not need to exist in axsl-galley. */ package org.axsl.area.trait; Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/TextAlign.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/TextAlign.java 2025-01-10 18:02:19 UTC (rev 2763) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/TextAlign.java 2025-01-11 16:59:46 UTC (rev 2764) @@ -51,7 +51,7 @@ * neither, use "end". */ OUTSIDE, - /** The content will be aligned on specified string. */ + /** The content will be aligned on a specified string, which string is provided elsewhere. */ STRING, } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-01-10 18:02:20
|
Revision: 2763 http://sourceforge.net/p/axsl/code/2763 Author: victormote Date: 2025-01-10 18:02:19 +0000 (Fri, 10 Jan 2025) Log Message: ----------- Standardize method name. Modified Paths: -------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontSelectionStrategy.java Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontSelectionStrategy.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontSelectionStrategy.java 2025-01-10 13:25:20 UTC (rev 2762) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontSelectionStrategy.java 2025-01-10 18:02:19 UTC (rev 2763) @@ -67,7 +67,7 @@ * @param name The string name of the instance. * @return The instance matching {@code name}, or null if none is found. */ - public static FontSelectionStrategy fromName(final String name) { + public static FontSelectionStrategy parseFo(final String name) { if (name == null) { return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-01-10 13:25:23
|
Revision: 2762 http://sourceforge.net/p/axsl/code/2762 Author: victormote Date: 2025-01-10 13:25:20 +0000 (Fri, 10 Jan 2025) Log Message: ----------- Clean up some broken javadoc links. Standardize parsing method names, at least for font-related methods. Modified Paths: -------------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/Orthography.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStretch.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontVariant.java Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java 2025-01-10 04:09:54 UTC (rev 2761) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java 2025-01-10 13:25:20 UTC (rev 2762) @@ -56,13 +56,13 @@ * Client applications may use {@link FontUtility#foFontFamily(CharSequence)} to convert String input into the value * expected here. * @param style The style of the font desired. - * Use {@link Font.Style#fromName(String)} to convert String input. + * Use {@link FontStyle#parseFo(String)} to convert String input. * @param weight The weight of the font desired. - * Use {@link Font.Weight#fromName(String)} to convert String input. + * Use {@link FontWeight#parseFo(String)} to convert String input. * @param variant The variant (normal or small-caps) of the font desired. - * Use {@link Font.Variant#fromName(String)} to convert String input. + * Use {@link FontVariant#parseFo(String)} to convert String input. * @param stretch The stretch of the font desired. - * Use {@link Font.Stretch#fromName(String)} to convert String input. + * Use {@link FontStretch#parseFo(String)} to convert String input. * @param size The size (in millipoints) of the font. * This is only meaningful for bitmapped fonts. * @param codePoint The first character to be painted using the selected {@link FontUse}. @@ -81,18 +81,18 @@ /** * The same as {@link #selectFontXsl}, except that the algorithm specified by CSS 2.1 is used instead. * Note that CSS has no concept of specifying a font-selection-strategy as XSL-FO does. - * The implied font-selection-strategy for CSS is {@link Font.SelectionStrategy#CHARACTER_BY_CHARACTER}. + * The implied font-selection-strategy for CSS is {@link FontSelectionStrategy#CHARACTER_BY_CHARACTER}. * @param familyList See {@link #selectFontXsl}. * Client applications may use {@link FontUtility#cssFontFamily(CharSequence)} to convert String input into the * value expected here. * @param style See {@link #selectFontXsl}. - * Use {@link Font.Style#fromName(String)} to convert String input. + * Use {@link FontStyle#parseFo(String)} to convert String input. * @param weight See {@link #selectFontXsl}. - * Use {@link Font.Weight#fromName(String)} to convert String input. + * Use {@link FontWeight#parseFo(String)} to convert String input. * @param variant See {@link #selectFontXsl}. - * Use {@link Font.Variant#fromName(String)} to convert String input. + * Use {@link FontVariant#parseFo(String)} to convert String input. * @param stretch See {@link #selectFontXsl}. - * Use {@link Font.Stretch#fromName(String)} to convert String input. + * Use {@link FontStretch#parseFo(String)} to convert String input. * @param size The size (in millipoints) of the font. * This is only meaningful for bitmapped fonts. * @param codePoint The first character to be painted using the selected {@link FontUse}. Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java 2025-01-10 04:09:54 UTC (rev 2761) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java 2025-01-10 13:25:20 UTC (rev 2762) @@ -74,13 +74,11 @@ /** * Returns the percentage by which the font should be stretched horizontally to simulate a given - * {@link Font.Stretch} value. + * {@link FontStretch} value. * Values greater than 100 will result in wider characters. * Values less than 100 will result in narrower characters. * @param fontStretch The font-stretch descriptor for which a simulated value is wanted. - * Return values for {@link Font.Stretch#NORMAL} are meaningless, since that does not need to be simulated. - * Return values for {@link Font.Stretch#ANY} are also meaningless, the purpose of that value having no - * corresponding meaning for purposes of font feature simulation. + * Return values for {@link FontStretch#NORMAL} are meaningless, since that does not need to be simulated. * @return Returns the percentage by which the font should be stretched horizontally to simulat {@code fontStretch}, * or null if it should not simulate font-stretch. */ Modified: trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/Orthography.java =================================================================== --- trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/Orthography.java 2025-01-10 04:09:54 UTC (rev 2761) +++ trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/Orthography.java 2025-01-10 13:25:20 UTC (rev 2762) @@ -40,7 +40,6 @@ * @return The word matching the parameters, or null if none is found. * @see Dictionary#getWord(CharSequence, int) which retrieves a word directly from a dictionary without * consideration for other dictionaries or finding derivatives. - * All handling of derivatives should be handled by implementations of {@link Orthography}. */ Word recognizeWord(CharSequence wordChars, int offset, int length, Word.PartOfSpeech pos); Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStretch.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStretch.java 2025-01-10 04:09:54 UTC (rev 2761) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStretch.java 2025-01-10 13:25:20 UTC (rev 2762) @@ -104,7 +104,7 @@ * @param name The string name of the instance. * @return The instance matching {@code name}, or null if none is found. */ - public static FontStretch fromName(final String name) { + public static FontStretch parseFo(final String name) { if (name == null) { return null; } Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontVariant.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontVariant.java 2025-01-10 04:09:54 UTC (rev 2761) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontVariant.java 2025-01-10 13:25:20 UTC (rev 2762) @@ -66,7 +66,7 @@ * @param name The string name of the instance. * @return The instance matching {@code name}, or null if none is found. */ - public static FontVariant fromName(final String name) { + public static FontVariant parseFo(final String name) { if (name == null) { return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-01-10 04:09:57
|
Revision: 2761 http://sourceforge.net/p/axsl/code/2761 Author: victormote Date: 2025-01-10 04:09:54 +0000 (Fri, 10 Jan 2025) Log Message: ----------- Remove org.axsl.font.Font.Variant, org.axsl.font.Font.Stretch, and org.axs.font.Font.SelectionStrategy in favor of similar classes in org.axsl.value. Modified Paths: -------------- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontSelectionStrategy.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStretch.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontVariant.java Modified: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java =================================================================== --- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java 2025-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -26,7 +26,6 @@ import org.axsl.area.event.AreaTreeEvent; import org.axsl.area.event.AreaTreeListener; -import org.axsl.font.Font; import org.axsl.font.FontServer; import org.axsl.fotree.FoTree; import org.axsl.fotree.fo.PageSequence; @@ -33,9 +32,6 @@ import org.axsl.fotree.fo.Root; import org.axsl.galley.Galley; import org.axsl.graphic.GraphicServer; -import org.axsl.value.FontSelectionStrategy; -import org.axsl.value.FontStretch; -import org.axsl.value.FontVariant; /** * <p>An AreaTree is a document that has been laid out on pages. @@ -92,60 +88,4 @@ */ GraphicServer getGraphicServer(); - /** - * Converts an FO Tree "font-selection-strategy" value to its equivalent in the Font system. - * @param foFontSelectionStrategy The FO Tree "font-selection-strategy" value to be converted to a font value. - * @return The Font equivalent of {code foFontSelectionStrategy}, or null for unsupported input. - */ - static Font.SelectionStrategy fontSelectionStrategyFromFo(FontSelectionStrategy foFontSelectionStrategy) { - if (foFontSelectionStrategy == null) { - return null; - } - switch (foFontSelectionStrategy) { - case AUTO: return Font.SelectionStrategy.AUTO; - case CHARACTER_BY_CHARACTER: return Font.SelectionStrategy.CHARACTER_BY_CHARACTER; - default: return null; - } - } - - /** - * Converts an FO Tree "font-stretch" value to its equivalent in the Font system. - * @param foFontStretch The FO Tree "font-stretch" value to be converted to a font value. - * @return The Font equivalent of {code foFontStretch}, or null for unsupported input. - */ - static Font.Stretch fontStretchFromFo(FontStretch foFontStretch) { - if (foFontStretch == null) { - return null; - } - switch (foFontStretch) { - case NORMAL: return Font.Stretch.NORMAL; - case ULTRA_CONDENSED: return Font.Stretch.ULTRA_CONDENSED; - case EXTRA_CONDENSED: return Font.Stretch.EXTRA_CONDENSED; - case CONDENSED: return Font.Stretch.CONDENSED; - case SEMI_CONDENSED: return Font.Stretch.SEMI_CONDENSED; - case SEMI_EXPANDED: return Font.Stretch.SEMI_EXPANDED; - case EXPANDED: return Font.Stretch.EXPANDED; - case EXTRA_EXPANDED: return Font.Stretch.EXTRA_EXPANDED; - case ULTRA_EXPANDED: return Font.Stretch.ULTRA_EXPANDED; - default: return null; - } - } - - - /** - * Converts an FO Tree "font-variant" value to its equivalent in the Font system. - * @param foFontVariant The FO Tree "font-variant" value to be converted to a font value. - * @return The Font equivalent of {code foFontVariant}, or null for unsupported input. - */ - static Font.Variant fontVariantFromFo(FontVariant foFontVariant) { - if (foFontVariant == null) { - return null; - } - switch (foFontVariant) { - case NORMAL: return Font.Variant.NORMAL; - case SMALL_CAPS: return Font.Variant.SMALL_CAPS; - default: return null; - } - } - } Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -29,226 +29,13 @@ import org.axsl.ps.Encoding; import org.axsl.unicode.block.U0000_Basic_Latin; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - /** * The Font interface exposes a font resource to the client application. */ public interface Font { - /** The String "normal", defined as a constant to avoid duplication. */ - String NORMAL_STRING = "normal"; - /** The String "any", defined as a constant to avoid duplication. */ - String ANY_STRING = "any"; - - /** - * Enumeration of constants needed to describe the variant of a font. - */ - enum Variant { - - /** Font-variant constant indicating no preference. */ - ANY(ANY_STRING), - - /** Font-variant constant indicating that small-caps is <i>off</i>. */ - NORMAL(Font.NORMAL_STRING), - - /** Font-variant constant indicating that small-caps is <i>on</i>. */ - SMALL_CAPS("small-caps"); - - /** Keep a copy of the values for performance. */ - private static final List<Font.Variant> VALUES = Collections.unmodifiableList(Arrays.asList(Variant.values())); - - /** The external description of this variant. */ - private String name; - - /** - * Private Constructor. - * @param name The external description of this variant. - */ - Variant(final String name) { - this.name = name; - } - - /** - * Returns the external description of this variant. - * @return The external description of this variant. - */ - public String getName() { - return this.name; - } - - /** - * Convert a string name of an instance into the instance itself. - * @param name The string name of the instance. - * @return The instance matching {@code name}, or null if none is found. - */ - public static Variant fromName(final String name) { - if (name == null) { - return null; - } - for (int index = 0; index < VALUES.size(); index ++) { - final Variant variant = VALUES.get(index); - if (variant.name.equals(name)) { - return variant; - } - } - return null; - } - - } - - /** - * Enumeration of constants needed to describe the "stretch" value of a font. - */ - enum Stretch { - - /** Font-stretch constant indicating no preference. */ - ANY(Byte.MIN_VALUE, ANY_STRING), - - /** Font-stretch constant indicating ultra-condensed. */ - ULTRA_CONDENSED((byte) 10, "ultra-condensed"), - - /** Font-stretch constant indicating extra-condensed. */ - EXTRA_CONDENSED((byte) 20, "extra-condensed"), - - /** Font-stretch constant indicating condensed. */ - CONDENSED((byte) 30, "condensed"), - - /** Font-stretch constant indicating semi-condensed. */ - SEMI_CONDENSED((byte) 40, "semi-condensed"), - - /** Font-stretch constant indicating normal. */ - NORMAL((byte) 50, Font.NORMAL_STRING), - - /** Font-stretch constant indicating semi-expanded. */ - SEMI_EXPANDED((byte) 60, "semi-expanded"), - - /** Font-stretch constant indicating expanded. */ - EXPANDED((byte) 70, "expanded"), - - /** Font-stretch constant indicating extra-expanded. */ - EXTRA_EXPANDED((byte) 80, "extra-expanded"), - - /** Font-stretch constant indicating ultra-expanded. */ - ULTRA_EXPANDED((byte) 90, "ultra-expanded"); - - /** Keep a copy of the values for performance. */ - private static final List<Font.Stretch> VALUES = Collections.unmodifiableList(Arrays.asList(Stretch.values())); - - /** The numeric stretch value, smaller numbers being more condensed, larger numbers being more expanded. */ - private byte numericStretch; - - /** The external description of this stretch. */ - private String name; - - /** - * Private Constructor. - * @param numericStretch The numeric stretch value, smaller numbers being more condensed, larger numbers being - * more expanded. - * @param name The external description of this stretch. - */ - Stretch(final byte numericStretch, final String name) { - this.numericStretch = numericStretch; - this.name = name; - } - - /** - * Returns the numeric stretch value, or the relative stretch between different instances of this class. - * @return The numeric stretch value for this instance, smaller numbers being more condensed, larger numbers - * being more expanded, or {@link Byte#MIN_VALUE} for invalid values. - */ - public byte getNumericStretch() { - return this.numericStretch; - } - - /** - * Returns the external description of this stretch. - * @return The external description of this stretch. - */ - public String getName() { - return this.name; - } - - /** - * Convert a string name of an instance into the instance itself. - * @param name The string name of the instance. - * @return The instance matching {@code name}, or null if none is found. - */ - public static Stretch fromName(final String name) { - if (name == null) { - return null; - } - for (int index = 0; index < VALUES.size(); index ++) { - final Stretch stretch = VALUES.get(index); - if (stretch.name.equals(name)) { - return stretch; - } - } - return null; - } - - } - - /** - * Enumeration of constants needed to describe the various font selection - * strategies. - */ - enum SelectionStrategy { - - /** Font-selection-strategy constant indicating "character-by-character". */ - CHARACTER_BY_CHARACTER("character-by-character"), - - /** Font-selection-strategy constant indicating "auto". */ - AUTO("auto"); - - /** Keep a copy of the values for performance. */ - private static final List<Font.SelectionStrategy> VALUES = - Collections.unmodifiableList(Arrays.asList(SelectionStrategy.values())); - - /** The external description of this strategy. */ - private String name; - - /** - * Private Constructor. - * @param name The external description of this strategy. - */ - SelectionStrategy(final String name) { - this.name = name; - } - - /** - * Returns the external description of this stretch. - * @return The external description of this stretch. - */ - public String getName() { - return this.name; - } - - /** - * Convert a string name of an instance into the instance itself. - * @param name The string name of the instance. - * @return The instance matching {@code name}, or null if none is found. - */ - public static SelectionStrategy fromName(final String name) { - if (name == null) { - return null; - } - for (int index = 0; index < VALUES.size(); index ++) { - final SelectionStrategy strategy = VALUES.get(index); - if (strategy.name.equals(name)) { - return strategy; - } - } - return null; - } - - } - - /** * Enumeration of constants to describe the complexity of a font. */ enum Complexity { @@ -260,6 +47,7 @@ COMPOSITE; } + /** * Enumeration of constants to describe the format of a font. */ @@ -279,6 +67,7 @@ OTF_CFF; } + /** * Enumeration of possible algorithms that could be used to compute the line-height for a given font. * @see Font#normalLineHeightFactor(Font.LineHeightAlgorithm) for a more complete discussion. @@ -290,6 +79,7 @@ DEFAULT; } + /** * Enumeration of possible writing-modes that a font might have. */ @@ -302,6 +92,7 @@ VERTICAL; } + /** * Enumeration of the various baselines that can be defined in a font. * Note that baseline table information is not included in all font formats. @@ -341,6 +132,7 @@ ICF_TOP_RIGHT; } + /** * Enumeration of the types of font embedding. */ @@ -355,6 +147,7 @@ ALL; } + /** * Enumeration of the logical sources from which a font can be obtained. * Implementations of aXSL Font are not required to support all font Sources, but making this distinction allows Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java 2025-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -23,7 +23,10 @@ package org.axsl.font; +import org.axsl.value.FontSelectionStrategy; +import org.axsl.value.FontStretch; import org.axsl.value.FontStyle; +import org.axsl.value.FontVariant; import org.axsl.value.FontWeight; import java.util.List; @@ -72,8 +75,8 @@ * @see #selectFontFallback(int) * @see #selectFontFallback() */ - FontUse selectFontXsl(Font.SelectionStrategy selectionStrategy, List<String> familyList, FontStyle style, - FontWeight weight, Font.Variant variant, Font.Stretch stretch, int size, int codePoint); + FontUse selectFontXsl(FontSelectionStrategy selectionStrategy, List<String> familyList, FontStyle style, + FontWeight weight, FontVariant variant, FontStretch stretch, int size, int codePoint); /** * The same as {@link #selectFontXsl}, except that the algorithm specified by CSS 2.1 is used instead. @@ -101,8 +104,8 @@ * @see #selectFontFallback(int) * @see #selectFontFallback() */ - FontUse selectFontCss(List<String> familyList, FontStyle style, FontWeight weight, Font.Variant variant, - Font.Stretch stretch, int size, int codePoint); + FontUse selectFontCss(List<String> familyList, FontStyle style, FontWeight weight, FontVariant variant, + FontStretch stretch, int size, int codePoint); /** * Accepts the client's PANOSE description of the desired font, and returns the best-fitting Font found. Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java 2025-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -23,6 +23,8 @@ package org.axsl.font; +import org.axsl.value.FontStretch; + import java.math.BigDecimal; /** @@ -82,7 +84,7 @@ * @return Returns the percentage by which the font should be stretched horizontally to simulat {@code fontStretch}, * or null if it should not simulate font-stretch. */ - default BigDecimal getSimulatedStretch(Font.Stretch fontStretch) { + default BigDecimal getSimulatedStretch(FontStretch fontStretch) { return null; } Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java 2025-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -24,7 +24,9 @@ package org.axsl.font; import org.axsl.ps.Encoding; +import org.axsl.value.FontStretch; import org.axsl.value.FontStyle; +import org.axsl.value.FontVariant; import org.axsl.value.FontWeight; import java.net.URL; @@ -157,7 +159,7 @@ * @throws FontException If {@code fontFamily} or {@code fontID} are not already registered. */ void registerFontDescription(String fontFamily, String fontID, Encoding encoding, FontStyle style, - FontWeight weight, Font.Variant variant, Font.Stretch stretch, FontFeatureSimulation simulation) + FontWeight weight, FontVariant variant, FontStretch stretch, FontFeatureSimulation simulation) throws FontException; /** 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-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -28,6 +28,7 @@ import org.axsl.primitive.sequence.IntSequence; import org.axsl.primitive.sequence.ShortSequence; import org.axsl.ps.Encoding; +import org.axsl.value.FontStretch; import java.math.BigDecimal; @@ -240,7 +241,7 @@ * @return The percentage that should be applied to the width of characters from this font for {@code stretch}, or * null if the font has not been configured to simulate that stretch value. */ - BigDecimal simulateStretch(Font.Stretch stretch); + BigDecimal simulateStretch(FontStretch stretch); /** * Returns the PostScript name of the font. Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontSelectionStrategy.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontSelectionStrategy.java 2025-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontSelectionStrategy.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -23,6 +23,10 @@ package org.axsl.value; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + /** * Enumeration of font-selection-strategy values. * @see "XSL-FO Recommendation 1.1, Section 7.9.3" @@ -29,10 +33,51 @@ */ public enum FontSelectionStrategy { - /** The "auto" strategy. */ - AUTO, + /** Font-selection-strategy constant indicating "character-by-character". */ + CHARACTER_BY_CHARACTER("character-by-character"), - /** The "character-by-character" strategy. */ - CHARACTER_BY_CHARACTER; + /** Font-selection-strategy constant indicating "auto". */ + AUTO("auto"); + /** Keep a copy of the values for performance. */ + private static final List<FontSelectionStrategy> VALUES = + Collections.unmodifiableList(Arrays.asList(FontSelectionStrategy.values())); + + /** The external description of this strategy. */ + private String name; + + /** + * Private Constructor. + * @param name The external description of this strategy. + */ + FontSelectionStrategy(final String name) { + this.name = name; + } + + /** + * Returns the external description of this stretch. + * @return The external description of this stretch. + */ + public String getName() { + return this.name; + } + + /** + * Convert a string name of an instance into the instance itself. + * @param name The string name of the instance. + * @return The instance matching {@code name}, or null if none is found. + */ + public static FontSelectionStrategy fromName(final String name) { + if (name == null) { + return null; + } + for (int index = 0; index < VALUES.size(); index ++) { + final FontSelectionStrategy strategy = VALUES.get(index); + if (strategy.name.equals(name)) { + return strategy; + } + } + return null; + } + } Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStretch.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStretch.java 2025-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStretch.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -23,6 +23,10 @@ package org.axsl.value; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + /** * Enumeration of font-stretch values. * @see "XSL-FO Recommendation 1.1, Section 7.9.5" @@ -30,45 +34,62 @@ public enum FontStretch { /** Font-stretch constant indicating ultra-condensed. */ - ULTRA_CONDENSED((byte) 10), + ULTRA_CONDENSED("ultra-condensed", 10), /** Font-stretch constant indicating extra-condensed. */ - EXTRA_CONDENSED((byte) 20), + EXTRA_CONDENSED("extra-condensed", 20), /** Font-stretch constant indicating condensed. */ - CONDENSED((byte) 30), + CONDENSED("condensed", 30), /** Font-stretch constant indicating semi-condensed. */ - SEMI_CONDENSED((byte) 40), + SEMI_CONDENSED("semi-condensed", 40), /** Font-stretch constant indicating normal. */ - NORMAL((byte) 50), + NORMAL("normal", 50), /** Font-stretch constant indicating semi-expanded. */ - SEMI_EXPANDED((byte) 60), + SEMI_EXPANDED("semi-expanded", 60), /** Font-stretch constant indicating expanded. */ - EXPANDED((byte) 70), + EXPANDED("expanded", 70), /** Font-stretch constant indicating extra-expanded. */ - EXTRA_EXPANDED((byte) 80), + EXTRA_EXPANDED("extra-expanded", 80), /** Font-stretch constant indicating ultra-expanded. */ - ULTRA_EXPANDED((byte) 90); + ULTRA_EXPANDED("ultra-expanded", 90); + /** Keep a copy of the values for performance. */ + private static final List<FontStretch> VALUES = Collections.unmodifiableList(Arrays.asList(FontStretch.values())); + + /** The external description of this stretch. */ + private String name; + /** The numeric stretch value, smaller numbers being more condensed, larger numbers being more expanded. */ private byte numericStretch; /** * Constructor. + * @param name The name of this stretch value. * @param numericStretch The numeric stretch value, smaller numbers being more condensed, larger numbers being more * expanded. */ - FontStretch(final byte numericStretch) { - this.numericStretch = numericStretch; + FontStretch(final String name, final int numericStretch) { + this.name = name; + this.numericStretch = (byte) numericStretch; } + /** + * Returns the name of this stretch value. + * @return The name of this stretch value. + */ + public String getName() { + return this.name; + } + + /** * Returns the numeric stretch value, or the relative stretch between different instances of this class. * @return The numeric stretch value for this instance, smaller numbers being more condensed, larger numbers * being more expanded, or {@link Byte#MIN_VALUE} for invalid values. @@ -77,7 +98,27 @@ return this.numericStretch; } + /** + * Convert a string name of an instance into the instance itself. + * @param name The string name of the instance. + * @return The instance matching {@code name}, or null if none is found. + */ + public static FontStretch fromName(final String name) { + if (name == null) { + return null; + } + for (int index = 0; index < VALUES.size(); index ++) { + final FontStretch variant = VALUES.get(index); + if (variant.name.equals(name)) { + return variant; + } + } + return null; + } + + + /** * Returns the next narrowest stretch. * @return The next narrowest stretch, or "this" if it is the narrowest stretch (ultra-condensed). */ Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontVariant.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontVariant.java 2025-01-10 01:10:44 UTC (rev 2760) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontVariant.java 2025-01-10 04:09:54 UTC (rev 2761) @@ -23,6 +23,10 @@ package org.axsl.value; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + /** * Enumeration of specified font-variant values. * @see "XSL-FO Recommendation 1.1, Section 7.9.8" @@ -29,10 +33,50 @@ */ public enum FontVariant { - /** Normal font-variant. */ - NORMAL, + /** Font-variant constant indicating that small-caps is <i>off</i>. */ + NORMAL("normal"), - /** Small-caps font-variant. */ - SMALL_CAPS; + /** Font-variant constant indicating that small-caps is <i>on</i>. */ + SMALL_CAPS("small-caps"); + /** Keep a copy of the values for performance. */ + private static final List<FontVariant> VALUES = Collections.unmodifiableList(Arrays.asList(FontVariant.values())); + + /** The external description of this variant. */ + private String name; + + /** + * Private Constructor. + * @param name The external description of this variant. + */ + FontVariant(final String name) { + this.name = name; + } + + /** + * Returns the external description of this variant. + * @return The external description of this variant. + */ + public String getName() { + return this.name; + } + + /** + * Convert a string name of an instance into the instance itself. + * @param name The string name of the instance. + * @return The instance matching {@code name}, or null if none is found. + */ + public static FontVariant fromName(final String name) { + if (name == null) { + return null; + } + for (int index = 0; index < VALUES.size(); index ++) { + final FontVariant variant = VALUES.get(index); + if (variant.name.equals(name)) { + return variant; + } + } + return null; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-01-10 01:10:47
|
Revision: 2760 http://sourceforge.net/p/axsl/code/2760 Author: victormote Date: 2025-01-10 01:10:44 +0000 (Fri, 10 Jan 2025) Log Message: ----------- Remove org.axsl.font.Font.Weight in favor of org.axsl.value.FontWeight. Modified Paths: -------------- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontWeight.java Modified: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java =================================================================== --- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java 2025-01-09 23:19:07 UTC (rev 2759) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java 2025-01-10 01:10:44 UTC (rev 2760) @@ -36,7 +36,6 @@ import org.axsl.value.FontSelectionStrategy; import org.axsl.value.FontStretch; import org.axsl.value.FontVariant; -import org.axsl.value.FontWeight; /** * <p>An AreaTree is a document that has been laid out on pages. @@ -149,29 +148,4 @@ } } - /** - * Converts a resolved FO Tree "font-weight" value to its equivalent in the Font system. - * @param foFontWeight The FO Tree "font-weight" value to be converted to a font value. - * @return The Font equivalent of {code foFontWeight}, or null for unsupported input. - */ - static Font.Weight fontWeightFromFo(FontWeight foFontWeight) { - if (foFontWeight == null) { - return null; - } - switch (foFontWeight) { - case NORMAL: return Font.Weight.NORMAL; - case BOLD: return Font.Weight.BOLD; - case N100: return Font.Weight.EXTREMELY_LIGHT; - case N200: return Font.Weight.VERY_LIGHT; - case N300: return Font.Weight.LIGHT; - case N400: return Font.Weight.NORMAL; - case N500: return Font.Weight.DARK; - case N600: return Font.Weight.SEMI_BOLD; - case N700: return Font.Weight.BOLD; - case N800: return Font.Weight.EXTRA_BOLD; - case N900: return Font.Weight.BLACK; - default: return null; - } - } - } Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-01-09 23:19:07 UTC (rev 2759) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-01-10 01:10:44 UTC (rev 2760) @@ -29,7 +29,6 @@ import org.axsl.ps.Encoding; import org.axsl.unicode.block.U0000_Basic_Latin; -import java.awt.font.TextAttribute; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -47,212 +46,6 @@ /** - * Enumeration of constants needed to describe the weight of a font. - */ - enum Weight { - - /** Font-weight constant indicating no preference. */ - ANY(Short.MIN_VALUE, ANY_STRING), - - /** Font-weight constant indicating a weight of 100 (extremely light). */ - EXTREMELY_LIGHT((short) 100, "100"), - - /** Font-weight constant indicating a weight of 200 (very light). */ - VERY_LIGHT((short) 200, "200"), - - /** Font-weight constant indicating a weight of 300 (light). */ - LIGHT((short) 300, "300"), - - /** Font-weight constant indicating a weight of 400 (normal). */ - NORMAL((short) 400, Font.NORMAL_STRING), - - /** Font-weight constant indicating a weight of 500 (dark). */ - DARK((short) 500, "500"), - - /** Font-weight constant indicating a weight of 600 (semi-bold). */ - SEMI_BOLD((short) 600, "600"), - - /** Font-weight constant indicating a weight of 700 (bold). */ - BOLD((short) 700, "bold"), - - /** Font-weight constant indicating a weight of 800 (extra bold). */ - EXTRA_BOLD((short) 800, "800"), - - /** Font-weight constant indicating a weight of 900 (black). */ - BLACK((short) 900, "900"); - - /** Keep a copy of the values for performance. */ - private static final List<Font.Weight> VALUES = Collections.unmodifiableList(Arrays.asList(Weight.values())); - - /** The numeric weight. */ - private short numericWeight; - - /** The external description of this weight. */ - private String name; - - /** - * Private constructor. - * @param numericWeight The numeric weight for this weight. - * @param name The external description of this weight. - */ - Weight(final short numericWeight, final String name) { - this.numericWeight = numericWeight; - this.name = name; - } - - /** - * Return this weight's numeric weight. This is useful for mathematical comparisons of the relative weights. - * @return This weight's numeric weight. - * Valid values range from 100 to 900. - * Invalid values return {@link Short#MIN_VALUE}. - */ - public short getNumericWeight() { - return this.numericWeight; - } - - /** - * Returns the external description of this weight. - * @return The external description of this weight. - */ - public String getName() { - return this.name; - } - - /** - * Convert a string name of an instance into the instance itself. - * @param name The string name of the instance. - * @return The instance matching {@code name}, or null if none is found. - */ - public static Weight fromName(final String name) { - if (name == null) { - return null; - } - for (int index = 0; index < VALUES.size(); index ++) { - final Weight weight = VALUES.get(index); - if (weight.name.equals(name)) { - return weight; - } - } - return null; - } - - /** - * Returns the next heaviest weight. - * @return The next heaviest weight, null if this is not a valid weight, or if this is the heaviest weight, - * returns itself. - */ - public Weight nextHeaviest() { - switch (this) { - case EXTREMELY_LIGHT: return VERY_LIGHT; - case VERY_LIGHT: return LIGHT; - case LIGHT: return NORMAL; - case NORMAL: return DARK; - case DARK: return SEMI_BOLD; - case SEMI_BOLD: return BOLD; - case BOLD: return EXTRA_BOLD; - case EXTRA_BOLD: return BLACK; - case BLACK: return this; - default: return null; - } - } - - /** - * Returns the next lightest weight. - * @return The next lightest weight, null if this is not a valid weight, or if this is the lightest weight, - * returns itself. - */ - public Weight nextLightest() { - switch (this) { - case EXTREMELY_LIGHT: return this; - case VERY_LIGHT: return EXTREMELY_LIGHT; - case LIGHT: return VERY_LIGHT; - case NORMAL: return LIGHT; - case DARK: return NORMAL; - case SEMI_BOLD: return DARK; - case BOLD: return SEMI_BOLD; - case EXTRA_BOLD: return BOLD; - case BLACK: return EXTRA_BOLD; - default: return null; - } - } - - /** - * Returns the Weight constant corresponding to a given numeric weight. - * @param numericWeight The numeric weight for which a constant is needed. - * This should be 100, 200, 300, 400, 500, 600, 700, 800, or 900. - * @return The Weight instance, or null if none corresponds to {@code numericWeight.} - */ - public static Weight fromNumeric(final int numericWeight) { - for (Weight weight : values()) { - if (numericWeight == weight.getNumericWeight() - && numericWeight > -1) { - return weight; - } - } - return null; - } - - /** - * Indicates whether a given numeric weight has a corresponding {@link Font.Weight} instance. - * @param numericWeight The numeric weight being tested. - * @return True if and only if there is a Weight instance corresponding to {@code numericWeight} - */ - public static boolean isValidNumericWeight(final int numericWeight) { - return fromNumeric(numericWeight) != null; - } - - /** - * Converts a {@link TextAttribute} weight value to an instance of this enumeration. - * @param weight The numeric text attribute weight value. - * @return The instance of this enumeration that most closely matches {@code weight}. - * @see TextAttribute#WEIGHT - * @see TextAttribute#WEIGHT_EXTRA_LIGHT - * @see TextAttribute#WEIGHT_LIGHT - * @see TextAttribute#WEIGHT_DEMILIGHT - * @see TextAttribute#WEIGHT_REGULAR - * @see TextAttribute#WEIGHT_SEMIBOLD - * @see TextAttribute#WEIGHT_MEDIUM - * @see TextAttribute#WEIGHT_DEMIBOLD - * @see TextAttribute#WEIGHT_BOLD - * @see TextAttribute#WEIGHT_HEAVY - * @see TextAttribute#WEIGHT_EXTRABOLD - * @see TextAttribute#WEIGHT_ULTRABOLD - */ - public static Font.Weight fromTextAttributeWeight(final Number weight) { - /* The TextAttribute weight designations have 11 possible values, XSL-FO supports only 9. */ - if (weight == null) { - return NORMAL; - } - if (weight.floatValue() <= TextAttribute.WEIGHT_EXTRA_LIGHT) { - return EXTREMELY_LIGHT; - } - if (weight.floatValue() <= TextAttribute.WEIGHT_LIGHT) { - return VERY_LIGHT; - } - if (weight.floatValue() <= TextAttribute.WEIGHT_DEMILIGHT) { - return LIGHT; - } - if (weight.floatValue() <= TextAttribute.WEIGHT_REGULAR) { - return NORMAL; - } - if (weight.floatValue() <= TextAttribute.WEIGHT_SEMIBOLD) { - return DARK; - } - if (weight.floatValue() < TextAttribute.WEIGHT_BOLD) { - return SEMI_BOLD; - } - if (weight.floatValue() == TextAttribute.WEIGHT_BOLD) { - return BOLD; - } - if (weight.floatValue() <= TextAttribute.WEIGHT_HEAVY) { - return EXTRA_BOLD; - } - return BLACK; - } - - } - - /** * Enumeration of constants needed to describe the variant of a font. */ enum Variant { Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java 2025-01-09 23:19:07 UTC (rev 2759) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java 2025-01-10 01:10:44 UTC (rev 2760) @@ -24,6 +24,7 @@ package org.axsl.font; import org.axsl.value.FontStyle; +import org.axsl.value.FontWeight; import java.util.List; @@ -72,7 +73,7 @@ * @see #selectFontFallback() */ FontUse selectFontXsl(Font.SelectionStrategy selectionStrategy, List<String> familyList, FontStyle style, - Font.Weight weight, Font.Variant variant, Font.Stretch stretch, int size, int codePoint); + FontWeight weight, Font.Variant variant, Font.Stretch stretch, int size, int codePoint); /** * The same as {@link #selectFontXsl}, except that the algorithm specified by CSS 2.1 is used instead. @@ -100,7 +101,7 @@ * @see #selectFontFallback(int) * @see #selectFontFallback() */ - FontUse selectFontCss(List<String> familyList, FontStyle style, Font.Weight weight, Font.Variant variant, + FontUse selectFontCss(List<String> familyList, FontStyle style, FontWeight weight, Font.Variant variant, Font.Stretch stretch, int size, int codePoint); /** Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java 2025-01-09 23:19:07 UTC (rev 2759) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java 2025-01-10 01:10:44 UTC (rev 2760) @@ -25,6 +25,7 @@ import org.axsl.ps.Encoding; import org.axsl.value.FontStyle; +import org.axsl.value.FontWeight; import java.net.URL; import java.util.List; @@ -143,12 +144,10 @@ /** * 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 fontFamily The name of the font-family in which this 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 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.). @@ -158,7 +157,7 @@ * @throws FontException If {@code fontFamily} or {@code fontID} are not already registered. */ void registerFontDescription(String fontFamily, String fontID, Encoding encoding, FontStyle style, - Font.Weight weight, Font.Variant variant, Font.Stretch stretch, FontFeatureSimulation simulation) + FontWeight weight, Font.Variant variant, Font.Stretch stretch, FontFeatureSimulation simulation) throws FontException; /** Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontWeight.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontWeight.java 2025-01-09 23:19:07 UTC (rev 2759) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontWeight.java 2025-01-10 01:10:44 UTC (rev 2760) @@ -23,6 +23,7 @@ package org.axsl.value; +import java.awt.font.TextAttribute; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -33,42 +34,33 @@ */ public enum FontWeight { - /** Normal font-weight. */ - NORMAL((short) 400, "normal", false), - - /** Bold font-weight. */ - BOLD((short) 700, "bold", false), - /** Numeric font-weight mapping to "extremely light". */ - N100((short) 100, "100", true), + EXTREMELY_LIGHT("extremely light", 100), /** Numeric font-weight mapping to "very light". */ - N200((short) 200, "200", true), + VERY_LIGHT("very light", 200), /** Numeric font-weight mapping to "light". */ - N300((short) 300, "300", true), + LIGHT("light", 300), /** Numeric font-weight mapping to "normal". */ - N400((short) 400, "400", true), + NORMAL("normal", 400), /** Numeric font-weight mapping to "dark". */ - N500((short) 500, "500", true), + DARK("500", 500), /** Numeric font-weight mapping to "semi-bold". */ - N600((short) 600, "600", true), + SEMI_BOLD("600", 600), /** Numeric font-weight mapping to "bold". */ - N700((short) 700, "700", true), + BOLD("bold", 700), /** Numeric font-weight mapping to "extra bold". */ - N800((short) 800, "800", true), + EXTRA_BOLD("extra-bold", 800), /** Numeric font-weight mapping to "black". */ - N900((short) 900, "900", true); + BLACK("black", 900); - - - /** Immutable local copy of the enumeration, for performance. */ private static final List<FontWeight> VALUES = Collections.unmodifiableList(Arrays.asList(values())); @@ -78,22 +70,28 @@ /** The String describing this style in CSS and/or XSL-FO. */ private String name; - /** Indicates whether this instance is an explicitly numeric instance. */ - private boolean isNumeric; /** * Private constructor. * @param numericWeight The numeric weight for this weight. * @param name The String describing this style in CSS and/or XSL-FO. - * @param isNumeric Indicates whether this instance is an explicitly numeric instance. */ - FontWeight(final short numericWeight, final String name, final boolean isNumeric) { - this.numericWeight = numericWeight; + FontWeight(final String name, final int numericWeight) { this.name = name; - this.isNumeric = isNumeric; + this.numericWeight = (short) numericWeight; } + /** + * Returns the name of this weight. + * @return The name of this weight. + */ + public String getName() { + return this.name; + } + + + /** * Returns the String describing this weight in CSS. * @return The String describing this weight in CSS. */ @@ -110,7 +108,37 @@ return this.name; } + /** + * Returns the instance corresponding to a given CSS name. + * @param value The weight name for which a constant is needed. + * @return The Weight instance, or null if none corresponds to {@code name.} + */ + public static FontWeight parseCss(final String value) { + switch (value.toUpperCase()) { + case "NORMAL": return NORMAL; + case "BOLD": return BOLD; + } + try { + final int numericWeight = Integer.parseInt(value); + return fromNumeric(numericWeight); + } catch (final NumberFormatException e) { + } + return null; + } + + + /** + * Returns the instance corresponding to a given XSL-FO name. + * @param name The weight name for which a constant is needed. + * @return The Weight instance, or null if none corresponds to {@code name.} + */ + public static FontWeight parseFo(final String name) { + return parseCss(name); + } + + + /** * Returns the instance corresponding to a given numeric weight. * @param numericWeight The numeric weight for which a constant is needed. * This should be 100, 200, 300, 400, 500, 600, 700, 800, or 900. @@ -119,8 +147,7 @@ public static FontWeight fromNumeric(final int numericWeight) { for (int index = 0; index < VALUES.size(); index ++) { final FontWeight instance = VALUES.get(index); - if (instance.isNumeric - && instance.numericWeight == numericWeight) { + if (instance.numericWeight == numericWeight) { return instance; } } @@ -153,18 +180,16 @@ */ public FontWeight nextHeaviest() { switch (this) { - case N100: return N200; - case N200: return N300; - case N300: return NORMAL; - case N400: return N500; - case NORMAL: return N500; - case N500: return N600; - case N600: return N700; - case N700: return N800; - case BOLD: return N800; - case N800: return N900; - case N900: return this; - default: return null; + case EXTREMELY_LIGHT: return VERY_LIGHT; + case VERY_LIGHT: return LIGHT; + case LIGHT: return NORMAL; + case NORMAL: return DARK; + case DARK: return SEMI_BOLD; + case SEMI_BOLD: return BOLD; + case BOLD: return EXTRA_BOLD; + case EXTRA_BOLD: return BLACK; + case BLACK: return BLACK; + default: return null; } } @@ -175,19 +200,64 @@ */ public FontWeight nextLightest() { switch (this) { - case N100: return this; - case N200: return N100; - case N300: return N200; - case N400: return N300; - case NORMAL: return N300; - case N500: return N400; - case N600: return N500; - case N700: return N600; - case BOLD: return N600; - case N800: return N700; - case N900: return N800; - default: return null; + case EXTREMELY_LIGHT: return EXTREMELY_LIGHT; + case VERY_LIGHT: return EXTREMELY_LIGHT; + case LIGHT: return VERY_LIGHT; + case NORMAL: return LIGHT; + case DARK: return NORMAL; + case SEMI_BOLD: return DARK; + case BOLD: return SEMI_BOLD; + case EXTRA_BOLD: return BOLD; + case BLACK: return EXTRA_BOLD; + default: return null; } } + + /** + * Converts a {@link TextAttribute} weight value to an instance of this enumeration. + * @param weight The numeric text attribute weight value. + * @return The instance of this enumeration that most closely matches {@code weight}. + * @see TextAttribute#WEIGHT + * @see TextAttribute#WEIGHT_EXTRA_LIGHT + * @see TextAttribute#WEIGHT_LIGHT + * @see TextAttribute#WEIGHT_DEMILIGHT + * @see TextAttribute#WEIGHT_REGULAR + * @see TextAttribute#WEIGHT_SEMIBOLD + * @see TextAttribute#WEIGHT_MEDIUM + * @see TextAttribute#WEIGHT_DEMIBOLD + * @see TextAttribute#WEIGHT_BOLD + * @see TextAttribute#WEIGHT_HEAVY + * @see TextAttribute#WEIGHT_EXTRABOLD + * @see TextAttribute#WEIGHT_ULTRABOLD + */ + public static FontWeight fromTextAttributeWeight(final Number weight) { + /* The TextAttribute weight designations have 11 possible values, XSL-FO supports only 9. */ + if (weight == null) { + return NORMAL; + } + if (weight.floatValue() <= TextAttribute.WEIGHT_EXTRA_LIGHT) { + return EXTREMELY_LIGHT; + } + if (weight.floatValue() <= TextAttribute.WEIGHT_LIGHT) { + return VERY_LIGHT; + } + if (weight.floatValue() <= TextAttribute.WEIGHT_DEMILIGHT) { + return LIGHT; + } + if (weight.floatValue() <= TextAttribute.WEIGHT_REGULAR) { + return NORMAL; + } + if (weight.floatValue() <= TextAttribute.WEIGHT_SEMIBOLD) { + return SEMI_BOLD; + } + if (weight.floatValue() == TextAttribute.WEIGHT_BOLD) { + return BOLD; + } + if (weight.floatValue() <= TextAttribute.WEIGHT_HEAVY) { + return EXTRA_BOLD; + } + return BLACK; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-01-09 23:19:11
|
Revision: 2759 http://sourceforge.net/p/axsl/code/2759 Author: victormote Date: 2025-01-09 23:19:07 +0000 (Thu, 09 Jan 2025) Log Message: ----------- Remove org.axsl.font.Font.Style in favor of org.axsl.value.FontStyle. Modified Paths: -------------- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java trunk/axsl/axsl-font/build.gradle trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStyle.java Modified: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java =================================================================== --- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java 2025-01-09 21:31:42 UTC (rev 2758) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java 2025-01-09 23:19:07 UTC (rev 2759) @@ -35,7 +35,6 @@ import org.axsl.graphic.GraphicServer; import org.axsl.value.FontSelectionStrategy; import org.axsl.value.FontStretch; -import org.axsl.value.FontStyle; import org.axsl.value.FontVariant; import org.axsl.value.FontWeight; @@ -44,14 +43,6 @@ * To obtain an AreaTree instance, use * {@link AreaTreeFactory#createAreaTree(FoTree, FontServer, org.axsl.font.FontSelectionConstraints, GraphicServer)}. * Once created, the {@link AreaTree} itself becomes a factory for other area tree types.</p> - * - * <p>This interface contains static methods that convert font characteristics as found in {@link org.axsl.fotree} - * to those found in {@link org.axsl.font.Font}. - * For example, the method {@link #fontWeightFromFo(FontWeight)} converts a {@link FontWeight} instance to a - * {@link Font.Weight} instance. - * One of the design criteria for axsl-fotree and axsl-font is that neither should know anything about the other. - * The good from this is that it allows implementations of each to be used in systems that do not support the other. - * The downside is that there is a layer of translation needed between the two systems, which these methods provide.</p> */ public interface AreaTree extends AreaNode, Galley { @@ -141,23 +132,6 @@ } } - /** - * Converts an FO Tree "font-style" value to its equivalent in the Font system. - * @param foFontStyle The FO Tree "font-style" value to be converted to a font value. - * @return The Font equivalent of {code foFontStyle}, or null for unsupported input. - */ - static Font.Style fontStyleFromFo(FontStyle foFontStyle) { - if (foFontStyle == null) { - return null; - } - switch (foFontStyle) { - case NORMAL: return Font.Style.NORMAL; - case ITALIC: return Font.Style.ITALIC; - case OBLIQUE: return Font.Style.OBLIQUE; - case BACKSLANT: return Font.Style.BACKSLANT; - default: return null; - } - } /** * Converts an FO Tree "font-variant" value to its equivalent in the Font system. Modified: trunk/axsl/axsl-font/build.gradle =================================================================== --- trunk/axsl/axsl-font/build.gradle 2025-01-09 21:31:42 UTC (rev 2758) +++ trunk/axsl/axsl-font/build.gradle 2025-01-09 23:19:07 UTC (rev 2759) @@ -9,6 +9,7 @@ implementation (project(':axsl-primitive')) implementation (project(':axsl-ps')) implementation (project(':axsl-orthography')) + implementation (project(':axsl-value')) } /* We want the DTDs to live as part of the website files, so we need to copy them into the jar file here. */ Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-01-09 21:31:42 UTC (rev 2758) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-01-09 23:19:07 UTC (rev 2759) @@ -45,86 +45,7 @@ /** The String "any", defined as a constant to avoid duplication. */ String ANY_STRING = "any"; - /** - * Enumeration of constants needed to describe the style of a font. - */ - enum Style { - /** Font-style constant indicating no preference. */ - ANY(ANY_STRING), - - /** Font-style constant indicating an upright (Roman) typeface. */ - NORMAL(NORMAL_STRING), - - /** Font-style constant indicating an italic typeface. */ - ITALIC("italic"), - - /** Font-style constant indicating an oblique typeface. */ - OBLIQUE("oblique"), - - /** Font-style constant indicating a backslant typeface. */ - BACKSLANT("backslant"); - - /** Keep a copy of the values for performance. */ - private static final List<Font.Style> VALUES = Collections.unmodifiableList(Arrays.asList(Style.values())); - - /** The external description of this style. */ - private String name; - - /** - * Private Constructor. - * @param name The external description of this style. - */ - Style(final String name) { - this.name = name; - } - - /** - * Returns the external description of this style. - * @return The external description of this style. - */ - public String getName() { - return this.name; - } - - /** - * Convert a string name of an instance into the instance itself. - * @param name The string name of the instance. - * @return The instance matching {@code name}, or null if none is found. - */ - public static Style fromName(final String name) { - if (name == null) { - return null; - } - for (int index = 0; index < VALUES.size(); index ++) { - final Style style = VALUES.get(index); - if (style.name.equals(name)) { - return style; - } - } - return null; - } - - /** - * Converts a {@link TextAttribute} posture value to an instance of this enumeration. - * @param posture The numeric text attribute posture value. - * @return The instance of this enumeration that most closely matches {@code posture}. - * @see TextAttribute#POSTURE - * @see TextAttribute#POSTURE_REGULAR - * @see TextAttribute#POSTURE_OBLIQUE - */ - public static Font.Style fromTextAttributePosture(final Number posture) { - if (posture == null) { - return NORMAL; - } - if (posture.floatValue() <= TextAttribute.POSTURE_REGULAR) { - return NORMAL; - } - return ITALIC; - } - - } - /** * Enumeration of constants needed to describe the weight of a font. */ Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java 2025-01-09 21:31:42 UTC (rev 2758) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConsumer.java 2025-01-09 23:19:07 UTC (rev 2759) @@ -23,6 +23,8 @@ package org.axsl.font; +import org.axsl.value.FontStyle; + import java.util.List; /** @@ -69,7 +71,7 @@ * @see #selectFontFallback(int) * @see #selectFontFallback() */ - FontUse selectFontXsl(Font.SelectionStrategy selectionStrategy, List<String> familyList, Font.Style style, + FontUse selectFontXsl(Font.SelectionStrategy selectionStrategy, List<String> familyList, FontStyle style, Font.Weight weight, Font.Variant variant, Font.Stretch stretch, int size, int codePoint); /** @@ -98,7 +100,7 @@ * @see #selectFontFallback(int) * @see #selectFontFallback() */ - FontUse selectFontCss(List<String> familyList, Font.Style style, Font.Weight weight, Font.Variant variant, + FontUse selectFontCss(List<String> familyList, FontStyle style, Font.Weight weight, Font.Variant variant, Font.Stretch stretch, int size, int codePoint); /** Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java 2025-01-09 21:31:42 UTC (rev 2758) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontServer.java 2025-01-09 23:19:07 UTC (rev 2759) @@ -24,6 +24,7 @@ package org.axsl.font; import org.axsl.ps.Encoding; +import org.axsl.value.FontStyle; import java.net.URL; import java.util.List; @@ -156,7 +157,7 @@ * the font. * @throws FontException If {@code fontFamily} or {@code fontID} are not already registered. */ - void registerFontDescription(String fontFamily, String fontID, Encoding encoding, Font.Style style, + void registerFontDescription(String fontFamily, String fontID, Encoding encoding, FontStyle style, Font.Weight weight, Font.Variant variant, Font.Stretch stretch, FontFeatureSimulation simulation) throws FontException; Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStyle.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStyle.java 2025-01-09 21:31:42 UTC (rev 2758) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/FontStyle.java 2025-01-09 23:19:07 UTC (rev 2759) @@ -23,6 +23,8 @@ package org.axsl.value; +import java.awt.font.TextAttribute; + /** * Enumeration of specified font-style values. * @see "XSL-FO Recommendation 1.1, Section 7.9.7" @@ -53,6 +55,14 @@ } /** + * Returns the external description of this style. + * @return The external description of this style. + */ + public String getName() { + return this.name; + } + + /** * Returns the String describing this style in CSS. * @return The String describing this style in CSS. */ @@ -140,4 +150,23 @@ return null; } + + /** + * Converts a {@link TextAttribute} posture value to an instance of this enumeration. + * @param posture The numeric text attribute posture value. + * @return The instance of this enumeration that most closely matches {@code posture}. + * @see TextAttribute#POSTURE + * @see TextAttribute#POSTURE_REGULAR + * @see TextAttribute#POSTURE_OBLIQUE + */ + public static FontStyle fromTextAttributePosture(final Number posture) { + if (posture == null) { + return NORMAL; + } + if (posture.floatValue() <= TextAttribute.POSTURE_REGULAR) { + return NORMAL; + } + return ITALIC; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |