axsl-commit Mailing List for aXSL (Page 13)
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...> - 2022-12-11 15:45:48
|
Revision: 2583 http://sourceforge.net/p/axsl/code/2583 Author: victormote Date: 2022-12-11 15:45:45 +0000 (Sun, 11 Dec 2022) Log Message: ----------- Update allJavadoc task with current modules. Modified Paths: -------------- trunk/axsl/build.gradle Modified: trunk/axsl/build.gradle =================================================================== --- trunk/axsl/build.gradle 2022-12-11 14:47:44 UTC (rev 2582) +++ trunk/axsl/build.gradle 2022-12-11 15:45:45 UTC (rev 2583) @@ -35,21 +35,48 @@ options.header = "aXSL API ${version}" options.bottom = "<p>This documentation was created ${buildDate} by <a href=\"http://www.axsl.org\"" + "target=\"_new\">The aXSL Group</a> and may be freely copied. See license for details.</p>" - options.groups.put('The aXSL Common Module', ['org.axsl.common', 'org.axsl.common.*' ]) - options.groups.put('The aXSL PostScript Module', ['org.axsl.ps', 'org.axsl.ps.*' ]) - options.groups.put('The aXSL Graphic Module', ['org.axsl.graphic', 'org.axsl.graphic.*' ]) - options.groups.put('The aXSL Font Module', ['org.axsl.font', 'org.axsl.font.*' ]) - options.groups.put('The aXSL Speech Module', ['org.axsl.speech', 'org.axsl.speech.*' ]) + options.groups.put('The aXSL Area Tree Module', ['org.axsl.area', + 'org.axsl.area.*']) + options.groups.put('The aXSL Constants Module', ['org.axsl.constants', + 'org.axsl.constants.*', + 'org.axsl.unicode', + 'org.axsl.unicode.*']) + options.groups.put('The aXSL Content Module', ['org.axsl.content', + 'org.axsl.content.*']) + options.groups.put('The aXSL Context Module', ['org.axsl.context', + 'org.axsl.context.*']) + options.groups.put('The aXSL Font Module', ['org.axsl.font', + 'org.axsl.font.*']) + options.groups.put('The aXSL FO Tree Module', ['org.axsl.fotree', + 'org.axsl.fotree.*']) + options.groups.put('The aXSL Galley Module', ['org.axsl.galley', + 'org.axsl.galley.*']) + options.groups.put('The aXSL Graphic Module', ['org.axsl.graphic', + 'org.axsl.graphic.*']) + options.groups.put('The aXSL Internationalization Module', + ['org.axsl.i18n', + 'org.axsl.i18n.*']) + options.groups.put('The aXSL Knuth-Plass Model Module', + ['org.axsl.kp', + 'org.axsl.kp.*']) + options.groups.put('The aXSL Layout Module', ['org.axsl.layout', + 'org.axsl.layout.*']) + options.groups.put('The aXSL LineBreak Module', ['org.axsl.linebreak', + 'org.axsl.linebreak.*']) + options.groups.put('The aXSL MIF Writer Module', ['org.axsl.mif', + 'org.axsl.mif.*']) options.groups.put('The aXSL Orthography Module', ['org.axsl.orthography', - 'org.axsl.orthography.*' ]) - options.groups.put('The aXSL LineBreak Module', ['org.axsl.text', 'org.axsl.text.*', 'org.axsl.linebreak']) - options.groups.put('The aXSL FO Tree Module', ['org.axsl.fo', 'org.axsl.fo.*' ]) - options.groups.put('The aXSL Area Tree Module', ['org.axsl.area', 'org.axsl.area.*' ]) - options.groups.put('The aXSL Layout Module', ['org.axsl.layout', 'org.axsl.layout.*' ]) - options.groups.put('The aXSL Galley Module', ['org.axsl.galley', 'org.axsl.galley.*' ]) - options.groups.put('The aXSL Output Module', ['org.axsl.output', 'org.axsl.output.*' ]) - options.groups.put('The aXSL PDF Writer Module', ['org.axsl.pdf', 'org.axsl.pdf.*' ]) - options.groups.put('The aXSL MIF Writer Module', ['org.axsl.mif', 'org.axsl.mif.*' ]) + 'org.axsl.orthography.*' ]) + options.groups.put('The aXSL Output Module', ['org.axsl.output', + 'org.axsl.output.*']) + options.groups.put('The aXSL PDF Writer Module', ['org.axsl.pdf', + 'org.axsl.pdf.*']) + options.groups.put('The aXSL PostScript Module', ['org.axsl.ps', + 'org.axsl.ps.*']) + options.groups.put('The aXSL Speech Module', ['org.axsl.speech', + 'org.axsl.speech.*']) + options.groups.put('The aXSL Values Module', ['org.axsl.value', + 'org.axsl.value.*']) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-11 14:47:46
|
Revision: 2582 http://sourceforge.net/p/axsl/code/2582 Author: victormote Date: 2022-12-11 14:47:44 +0000 (Sun, 11 Dec 2022) Log Message: ----------- Complete renaming of axsl-unicode to axsl-constants. Modified Paths: -------------- trunk/axsl/axsl-constants/build.gradle trunk/axsl/axsl-value/build.gradle trunk/axsl/settings.gradle Modified: trunk/axsl/axsl-constants/build.gradle =================================================================== --- trunk/axsl/axsl-constants/build.gradle 2022-12-11 14:38:17 UTC (rev 2581) +++ trunk/axsl/axsl-constants/build.gradle 2022-12-11 14:47:44 UTC (rev 2582) @@ -2,6 +2,6 @@ id 'axsl.library-conventions' } -description = "axsl-unicode" +description = "axsl-constants" /* Last line of script. */ Modified: trunk/axsl/axsl-value/build.gradle =================================================================== --- trunk/axsl/axsl-value/build.gradle 2022-12-11 14:38:17 UTC (rev 2581) +++ trunk/axsl/axsl-value/build.gradle 2022-12-11 14:47:44 UTC (rev 2582) @@ -7,7 +7,7 @@ dependencies { api project(':axsl-i18n') - api project(':axsl-unicode') + api project(':axsl-constants') } /* Last line of script. */ Modified: trunk/axsl/settings.gradle =================================================================== --- trunk/axsl/settings.gradle 2022-12-11 14:38:17 UTC (rev 2581) +++ trunk/axsl/settings.gradle 2022-12-11 14:47:44 UTC (rev 2582) @@ -2,6 +2,7 @@ include 'axsl-00-master' include 'axsl-areatree' +include 'axsl-constants' include 'axsl-content' include 'axsl-context' include 'axsl-fotree' @@ -18,7 +19,6 @@ include 'axsl-pdf' include 'axsl-ps' include 'axsl-speech' -include 'axsl-unicode' include 'axsl-utility' include 'axsl-value' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-11 14:38:18
|
Revision: 2581 http://sourceforge.net/p/axsl/code/2581 Author: victormote Date: 2022-12-11 14:38:17 +0000 (Sun, 11 Dec 2022) Log Message: ----------- Rename project axsl-unicode to axsl-constants. Added Paths: ----------- trunk/axsl/axsl-constants/ Removed Paths: ------------- trunk/axsl/axsl-unicode/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-10 21:15:21
|
Revision: 2580 http://sourceforge.net/p/axsl/code/2580 Author: victormote Date: 2022-12-10 21:15:18 +0000 (Sat, 10 Dec 2022) Log Message: ----------- Provide the AreaTree with an instance of GraphicServer, in preparation for moving graphics resolution from the FoTree to the AreaTree. Modified Paths: -------------- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTreeFactory.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 2022-12-10 04:54:29 UTC (rev 2579) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTree.java 2022-12-10 21:15:18 UTC (rev 2580) @@ -29,11 +29,12 @@ import org.axsl.fotree.fo.PageSequence; import org.axsl.fotree.fo.Root; import org.axsl.galley.Galley; +import org.axsl.graphic.GraphicServer; /** * An AreaTree is a document that has been laid out on pages. * To obtain an AreaTree instance, use - * {@link AreaTreeFactory#makeAreaTree(org.axsl.fotree.FoTree)}. + * {@link AreaTreeFactory#makeAreaTree(org.axsl.fotree.FoTree, org.axsl.graphic.GraphicServer)}. * Once created, the {@link AreaTree} itself becomes a factory for other area tree types. */ public interface AreaTree extends AreaNode, Galley { @@ -73,4 +74,10 @@ */ PageCollection makePageCollection(PageSequence pageSequence); + /** + * Returns the graphic server instance for this area tree. + * @return The graphic server instance for this area tree. + */ + GraphicServer getGraphicServer(); + } Modified: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTreeFactory.java =================================================================== --- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTreeFactory.java 2022-12-10 04:54:29 UTC (rev 2579) +++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/AreaTreeFactory.java 2022-12-10 21:15:18 UTC (rev 2580) @@ -24,6 +24,7 @@ package org.axsl.area; import org.axsl.fotree.FoTree; +import org.axsl.graphic.GraphicServer; /** * Creates implementation-specific {@link AreaTree} instances. @@ -33,8 +34,9 @@ /** * Create an {@link AreaTree} instance. * @param foTree The {@link FoTree} instance for which the AreaTree is being created. + * @param graphicServer The graphic server used to resolve graphics. * @return An implementation-specific instance of an {@link AreaTree}. */ - AreaTree makeAreaTree(FoTree foTree); + AreaTree makeAreaTree(FoTree foTree, GraphicServer graphicServer); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-10 04:54:32
|
Revision: 2579 http://sourceforge.net/p/axsl/code/2579 Author: victormote Date: 2022-12-10 04:54:29 +0000 (Sat, 10 Dec 2022) Log Message: ----------- Minor doc fix. Modified Paths: -------------- trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle Modified: trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle =================================================================== --- trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle 2022-12-10 04:44:09 UTC (rev 2578) +++ trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle 2022-12-10 04:54:29 UTC (rev 2579) @@ -1,4 +1,4 @@ -/* Precompiled script plugin for aXSL projects that use JUnit tests. */ +/* Precompiled script plugin for aXSL projects that contain test fixtures. */ plugins { id 'axsl.common-conventions' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-10 04:44:11
|
Revision: 2578 http://sourceforge.net/p/axsl/code/2578 Author: victormote Date: 2022-12-10 04:44:09 +0000 (Sat, 10 Dec 2022) Log Message: ----------- Move text fixture classes to proper text fixture location. Added Paths: ----------- trunk/axsl/axsl-font/src/testFixtures/ trunk/axsl/axsl-font/src/testFixtures/java/ trunk/axsl/axsl-font/src/testFixtures/java/org/ trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/ trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/ trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/ trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/MockFont.java trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/MockFontUse.java Removed Paths: ------------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/ Copied: trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/MockFont.java (from rev 2574, trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java) =================================================================== --- trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/MockFont.java (rev 0) +++ trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/MockFont.java 2022-12-10 04:44:09 UTC (rev 2578) @@ -0,0 +1,333 @@ +/* + * 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.font.fixture; + +import org.axsl.font.Font; +import org.axsl.font.Panose; +import org.axsl.ps.BoundingBox; +import org.axsl.ps.CharSet; +import org.axsl.ps.Encoding; + +/** + * A mock implementation of {@link Font}, useful for tests. + */ +public class MockFont implements Font { + + /** Well-known constant use for converting millipoint to/from points. */ + public static final int MILLIUNITS_PER_UNIT = 1_000; + + + /** + * The factor for conversion of Monotype units to millipoints for a font set at 1 point. + * According to para. 54, 18 Monotype units at 12 points is one pica (1/6 of an inch). + * In millipoints, this is 72,000 / 6 = 12,000. + * To get to 18 Monotype units at 1 point, divide by 12 = 12,000 / 12 = 1,000. + * To get to 1 Monotype unit at 1 point, divide by 18 = 1,000 / 18 = 55.555556 millipoints. + * We check this against para. 55, which computes the same value at .0007685 inches. + * 72000 * .0007685 = 55.332. + * The difference is due to the Monotype computation rounding the size of a pica to .166 inches, which is not + * exactly 1/6 of an inch. + * Since FOray consistently treats one point as being 1/72 of an inch, we will do so here as well. + * @see <a href="https://books.google.com/books/download/The_monotype_system.pdf?id=6kU5AAAAMAAJ&output=pdf">1912, + * The Monotype System, Philadelphia, Lanston Monotype Machine Co.</a> + */ + public static final double MILLIPOINTS_PER_MONOTYPE_UNIT = 1000d / 18d; + + /** The character set. */ + private CharSet charSet; + + /** The array of glyph widths. */ + private int[] widths; + + @Override + public int getAscender(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getDescender(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getCapHeight(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getXheight(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int width(final int metricIndex, final int fontSize) { + return this.widths[metricIndex] * fontSize / MILLIUNITS_PER_UNIT; + } + + /** + * Sets the width of a given codepoint. + * @param codePoint The codepoint for which the new width is to be set. + * @param width The new width, in millipoints, for {@code codePoint}. + */ + public void setWidth(final int codePoint, final int width) { + final int metricIndex = metricIndex(codePoint); + this.widths[metricIndex] = width; + } + + /** + * Sets the width of a given codepoint, using the Monotype "unit" system. + * @param codePoint The codepoint for which the new width is to be set. + * @param monotypeUnits The number of Monotype "units" for {@code codePoint}. + * @see <a href="https://books.google.com/books/download/The_monotype_system.pdf?id=6kU5AAAAMAAJ&output=pdf">1912, + * The Monotype System, Philadelphia, Lanston Monotype Machine Co.</a> + */ + public void setMonotypeWidth(final int codePoint, final int monotypeUnits) { + final int width = (int) (monotypeUnits * MILLIPOINTS_PER_MONOTYPE_UNIT); + setWidth(codePoint, width); + } + + @Override + public boolean isEmbeddable() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isSubsettable() { + // TODO Auto-generated method stub + return false; + } + + @Override + public java.awt.Font getAwtFont(final int fontSize) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean usableInPostScriptOutput() { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getFamilyName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getFontName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getPostscriptName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Encoding getInternalEncoding() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Complexity getFontComplexity() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Format getFontFormat() { + // TODO Auto-generated method stub + return null; + } + + @Override + public float getItalicAngle() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getStemV() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getDefaultWidth() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean isPdfStandardFont() { + // TODO Auto-generated method stub + return false; + } + + @Override + public int underlineSize(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int underlinePosition(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int overlineSize(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int overlinePosition(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int strikeoutSize(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int strikeoutPosition(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Panose getPanose() { + // TODO Auto-generated method stub + return null; + } + + @Override + public BoundingBox getBoundingBox() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getFlags() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public BoundingBox getGlyphBoundingBox(final int glyphIndex, final int fontSize) { + // TODO Auto-generated method stub + return null; + } + + /** + * Sets the character set. + * @param charSet The new character set. + */ + public void setCharSet(final CharSet charSet) { + this.charSet = charSet; + this.widths = new int[charSet.size()]; + } + + /** + * Returns the metric index for a given codepoint. + * @param codePoint The codepoint for which a metric index is needed. + * @return The metric index for {@code codePoint}. + */ + public int metricIndex(final int codePoint) { + final int metricIndex = this.charSet.getIndex(codePoint); + if (metricIndex < 0) { + throw new IllegalArgumentException("Character contains no index for codepoint: " + codePoint); + } + return metricIndex; + } + + @Override + public Source getFontSource() { + return Source.FREE_STANDING; + } + + @Override + public int widthEstimate(final int codePoint, final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int kern(final int glyphIndex1, final int glyphIndex2) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float normalLineHeightFactor(final LineHeightAlgorithm algorithm) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int baselineOffset(final WritingMode writingMode, final Baseline baselineType, final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Baseline baseline(final String script) { + // TODO Auto-generated method stub + return null; + } + + @Override + public int subscriptShift(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int superscriptShift(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int widthUndefinedGlyph(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + +} Copied: trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/MockFontUse.java (from rev 2574, trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFontUse.java) =================================================================== --- trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/MockFontUse.java (rev 0) +++ trunk/axsl/axsl-font/src/testFixtures/java/org/axsl/font/fixture/MockFontUse.java 2022-12-10 04:44:09 UTC (rev 2578) @@ -0,0 +1,282 @@ +/* + * 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.font.fixture; + +import org.axsl.font.Font; +import org.axsl.font.Font.Weight; +import org.axsl.font.FontConsumer; +import org.axsl.font.FontContext; +import org.axsl.font.FontUse; +import org.axsl.orthography.Orthography; +import org.axsl.ps.Encoding; +import org.axsl.utility.sequence.ByteSequence; +import org.axsl.utility.sequence.IntSequence; + +/** + * A mock implementation of {@link FontUse}, useful for tests. + */ +public class MockFontUse implements FontUse { + + /** The font. */ + private Font font; + + @Override + public Font getFont() { + return this.font; + } + + /** + * Set the font. + * @param font The new font. + */ + public void setFont(final Font font) { + this.font = font; + } + + @Override + public FontConsumer getFontConsumer() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Encoding getEncoding() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int encode(final int codePoint) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public IntSequence encode(final CharSequence chars, final int offset, final int length, final FontContext options, + final Orthography orthography) { + // TODO Auto-generated method stub + return null; + } + + @Override + public int unavailableChar(final CharSequence chars, final int beginIndex) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public IntSequence unavailableChars(final CharSequence chars, final int beginIndex) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean glyphAvailable(final int codePoint) { + // TODO Auto-generated method stub + return false; + } + + @Override + public int width(final int codePoint, final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int width(final CharSequence chars, final int fontSize, final FontContext fontContext, + final Orthography orthography) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Weight nextBolderWeight() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Weight nextLighterWeight() { + // TODO Auto-generated method stub + return null; + } + + @Override + public FontUse nextBolderFont() { + // TODO Auto-generated method stub + return null; + } + + @Override + public FontUse nextLighterFont() { + // TODO Auto-generated method stub + return null; + } + + @Override + public float simulateSmallCaps() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int smallCapsSize(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateOblique() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateBackslant() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateUltraCondensed() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateExtraCondensed() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateCondensed() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateSemiCondensed() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateSemiExpanded() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateExpanded() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateExtraExpanded() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float simulateUltraExpanded() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getPostscriptName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void registerCharUsed(final int codePoint) { + // TODO Auto-generated method stub + + } + + @Override + public void registerCharsUsed(final CharSequence charSequence) { + // TODO Auto-generated method stub + + } + + @Override + public boolean wasUsed() { + // TODO Auto-generated method stub + return false; + } + + @Override + public short[] getWidths() { + // TODO Auto-generated method stub + return null; + } + + @Override + public CharSequence getCharsUsed() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ByteSequence getContent() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getEmbeddableLength1() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getEmbeddableLength2() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getEmbeddableLength3() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public ByteSequence getContentPostScriptHex() { + // TODO Auto-generated method stub + return null; + } + + @Override + public CharSequence textToPdf(final CharSequence theString, final FontContext fontOptions, + final Orthography orthography) { + // TODO Auto-generated method stub + return null; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-10 04:12:57
|
Revision: 2577 http://sourceforge.net/p/axsl/code/2577 Author: victormote Date: 2022-12-10 04:12:50 +0000 (Sat, 10 Dec 2022) Log Message: ----------- Basic setup to use test fixtures. Modified Paths: -------------- trunk/axsl/axsl-00-master/config/checkstyle/checkstyle-suppressions.xml trunk/axsl/axsl-font/build.gradle trunk/axsl/buildSrc/src/main/groovy/axsl.test-conventions.gradle Added Paths: ----------- trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle Modified: trunk/axsl/axsl-00-master/config/checkstyle/checkstyle-suppressions.xml =================================================================== --- trunk/axsl/axsl-00-master/config/checkstyle/checkstyle-suppressions.xml 2022-12-08 19:11:29 UTC (rev 2576) +++ trunk/axsl/axsl-00-master/config/checkstyle/checkstyle-suppressions.xml 2022-12-10 04:12:50 UTC (rev 2577) @@ -10,6 +10,8 @@ <!-- Suppress Javadoc package documentation for test directories. --> <suppress checks="JavadocPackage" files="src.test.java.*"/> + <suppress checks="JavadocPackage" + files="src.testFixtures.java.*"/> <!-- Suppress Magic Number check for test directories. --> <suppress checks="MagicNumber" files="src.test.java.*"/> Modified: trunk/axsl/axsl-font/build.gradle =================================================================== --- trunk/axsl/axsl-font/build.gradle 2022-12-08 19:11:29 UTC (rev 2576) +++ trunk/axsl/axsl-font/build.gradle 2022-12-10 04:12:50 UTC (rev 2577) @@ -1,5 +1,6 @@ plugins { id 'axsl.library-conventions' + id 'axsl.test-fixtures-conventions' } description = "axsl-font" Modified: trunk/axsl/buildSrc/src/main/groovy/axsl.test-conventions.gradle =================================================================== --- trunk/axsl/buildSrc/src/main/groovy/axsl.test-conventions.gradle 2022-12-08 19:11:29 UTC (rev 2576) +++ trunk/axsl/buildSrc/src/main/groovy/axsl.test-conventions.gradle 2022-12-10 04:12:50 UTC (rev 2577) @@ -6,8 +6,10 @@ dependencies { testImplementation (platform - (group: 'org.junit', name: 'junit-bom', version: versions.junit)) + (group: 'org.junit', name: 'junit-bom', version: versions.junit)) testImplementation (group: 'org.junit.jupiter', name: 'junit-jupiter') + + testImplementation (group: 'org.mockito', name: 'mockito-core', version: versions.mockito) } test { Added: trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle =================================================================== --- trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle (rev 0) +++ trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle 2022-12-10 04:12:50 UTC (rev 2577) @@ -0,0 +1,12 @@ +/* Precompiled script plugin for aXSL projects that use JUnit tests. */ + +plugins { + id 'axsl.common-conventions' + id 'java-test-fixtures' + id 'maven-publish' +} + +dependencies { +} + +/* Last line of script. */ Property changes on: trunk/axsl/buildSrc/src/main/groovy/axsl.test-fixtures-conventions.gradle ___________________________________________________________________ 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...> - 2022-12-08 19:11:32
|
Revision: 2576 http://sourceforge.net/p/axsl/code/2576 Author: victormote Date: 2022-12-08 19:11:29 +0000 (Thu, 08 Dec 2022) Log Message: ----------- Remove tracking of intra-segment characters in token flow locations, thus making token segment the atom. Modified Paths: -------------- trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlow.java trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlowLocation.java Modified: trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlow.java =================================================================== --- trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlow.java 2022-12-08 16:52:16 UTC (rev 2575) +++ trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlow.java 2022-12-08 19:11:29 UTC (rev 2576) @@ -53,10 +53,8 @@ * 65,535. * @param segmentIndex The index to the token segment of the location being marked, which should be in the range 0 * through 127. - * @param charIndex The index to the segment char of the location being marked, which should be in the range 0 - * through 127. * @return A new {@link TextTokenFlowLocation} instance storing the specified parameters. */ - TextTokenFlowLocation markLocation(int tokenIndex, int segmentIndex, int charIndex); + TextTokenFlowLocation markLocation(int tokenIndex, int segmentIndex); } Modified: trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlowLocation.java =================================================================== --- trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlowLocation.java 2022-12-08 16:52:16 UTC (rev 2575) +++ trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlowLocation.java 2022-12-08 19:11:29 UTC (rev 2576) @@ -31,12 +31,17 @@ * for example, to place part of it one line of output and other parts on other lines. * A {@link TextTokenFlow} is a shallow tree whose main branches are {@link TextToken} instances. * Within those tokens, {@link Word} instances are also branches having child {@link WordSegment} instances. - * These {@link WordSegment} instances can also be thought of as branches having {@link Character#TYPE} children. - * By allowing specification of all three of these items, we can precisely describe a location within the + * By allowing specification of both of these items, we can precisely describe a location within the * {@link TextTokenFlow}.</p> * + * <p>Although it is also true that these {@link WordSegment} instances can also be thought of as branches having + * {@link Character#TYPE} children, the {@link WordSegment} is atomic with regard to a location within a + * {@link TextTokenFlow} instance. + * In other words, by definition, a {@link WordSegment} is indivisible. + * Therefore there is no need nor benefit to storing an index into the {@link WordSegment}.</p> + * * <p>Design Note: It may seem wasteful to create a type for a struct-like value type instead of using primitives. - * However, we thought that result less wrong than managing a portion of a {@link TextTokenFlow} with six index + * However, we thought that result less wrong than managing a portion of a {@link TextTokenFlow} with four index * parameters instead of two locations. * The extra memory consumption resulting from the use of objects is partially mitigated by the fact that the one object * frequently will serve as the ending location for one extract as well as the beginning location for the next. @@ -48,6 +53,12 @@ */ public interface TextTokenFlowLocation extends ComparablePlus<TextTokenFlowLocation> { + /** String format possibly useful for {@link Object#toString()}. */ + String TO_STRING_FORMAT = "[%d, %d]"; + + /** The factor applied to token index differences to make scale larger than segment index differences. */ + int TOKEN_INDEX_FACTOR = 1000; + /** * Returns the token index of the location. * @return The token index. @@ -56,34 +67,18 @@ int getTokenIndex(); /** - * Returns the segment index of the location, if needed. + * Returns the segment index of the location. * @return The index to the first segment in {@link #getTokenIndex()} for this location. * This is always non-negative. */ byte getSegmentIndex(); - /** - * Returns the char index of the location, if needed. - * @return The index to the first char in {@link #getSegmentIndex()} for this location. - * This is always non-negative. - */ - byte getCharIndex(); - @Override default int compareTo(final TextTokenFlowLocation o) { - if (getTokenIndex() == o.getTokenIndex()) { - if (getSegmentIndex() == o.getSegmentIndex()) { - if (getCharIndex() == o.getCharIndex()) { - return 0; - } else { - return getCharIndex() - o.getCharIndex(); - } - } else { - return getSegmentIndex() - o.getSegmentIndex(); - } - } else { - return getTokenIndex() - o.getTokenIndex(); - } + int returnValue = 0; + returnValue += (getTokenIndex() - o.getTokenIndex()) * TOKEN_INDEX_FACTOR; + returnValue += getSegmentIndex() - o.getSegmentIndex(); + return returnValue; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-08 16:52:21
|
Revision: 2575 http://sourceforge.net/p/axsl/code/2575 Author: victormote Date: 2022-12-08 16:52:16 +0000 (Thu, 08 Dec 2022) Log Message: ----------- Javadoc changes. Modified Paths: -------------- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java Modified: trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java =================================================================== --- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java 2022-12-08 16:12:03 UTC (rev 2574) +++ trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java 2022-12-08 16:52:16 UTC (rev 2575) @@ -196,13 +196,8 @@ /* ****************************************************************************************************************** */ /* Begin extended search routines patterned after similar methods in String. */ - /* TODO: Clean up javadoc here. Replace "string" with "sequence" and "substring" with "subsequence". */ - /* TODO: Change usages of CharSequence to ByteSequence. */ - - /** - * Returns the index within this string of the first occurrence of the - * specified substring. + * Returns the index within this sequence of the first occurrence of the specified subsequence. * * <p>The returned index is the smallest value <i>k</i> for which: * <blockquote><pre> @@ -210,16 +205,16 @@ * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str the substring to search for. - * @return the index of the first occurrence of the specified substring, - * or {@code -1} if there is no such occurrence. + * @param str The subsequence to search for. + * @return The index of the first occurrence of the specified subsequence, or {@code -1} if there is no such + * occurrence. * @see java.lang.String#indexOf(java.lang.String) */ int indexOf(CharSequence str); /** - * Returns the index within this string of the first occurrence of the - * specified substring, starting at the specified index. + * Returns the index within this sequence of the first occurrence of the specified subsequence, starting at the + * specified index. * * <p>The returned index is the smallest value <i>k</i> for which: * <blockquote><pre> @@ -227,17 +222,16 @@ * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str the substring to search for. - * @param fromIndex the index from which to start the search. - * @return the index of the first occurrence of the specified substring, - * starting at the specified index, - * or {@code -1} if there is no such occurrence. + * @param str The subsequence to search for. + * @param fromIndex The index from which to start the search. + * @return The index of the first occurrence of the specified subsequence, starting at the specified index, or + * {@code -1} if there is no such occurrence. * @see java.lang.String#indexOf(java.lang.String, int) */ int indexOf(CharSequence str, int fromIndex); /** - * Returns the index within this string of the first occurrence of the specified substring. + * Returns the index within this sequence of the first occurrence of the specified subsequence. * * <p>The returned index is the smallest value <i>k</i> for which: * <blockquote><pre> @@ -245,15 +239,15 @@ * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str the substring to search for. - * @return the index of the first occurrence of the specified substring, - * or {@code -1} if there is no such occurrence. + * @param str The subsequence to search for. + * @return The index of the first occurrence of the specified subsequence, or {@code -1} if there is no such + * occurrence. * @see java.lang.String#indexOf(java.lang.String) */ int indexOf(ByteSequence str); /** - * Returns the index within this string of the first occurrence of the specified substring, starting at the + * Returns the index within this sequence of the first occurrence of the specified subsequence, starting at the * specified index. * * <p>The returned index is the smallest value <i>k</i> for which: @@ -262,18 +256,17 @@ * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str the substring to search for. - * @param fromIndex the index from which to start the search. - * @return the index of the first occurrence of the specified substring, - * starting at the specified index, - * or {@code -1} if there is no such occurrence. + * @param str The subsequence to search for. + * @param fromIndex The index from which to start the search. + * @return The index of the first occurrence of the specified subsequence, starting at the specified index, or + * {@code -1} if there is no such occurrence. * @see java.lang.String#indexOf(java.lang.String, int) */ int indexOf(ByteSequence str, int fromIndex); /** - * Returns the index within this byte sequence of the last occurrence of the specified substring. - * The last occurrence of the empty string "" is considered to occur at the index value {@code this.length()}. + * Returns the index within this byte sequence of the last occurrence of the specified subsequence. + * The last occurrence of the empty sequence "" is considered to occur at the index value {@code this.length()}. * * <p>The returned index is the largest value <i>k</i> for which: * <blockquote><pre> @@ -281,16 +274,16 @@ * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str the substring to search for. - * @return the index of the last occurrence of the specified substring, - * or {@code -1} if there is no such occurrence. + * @param str The subsequence to search for. + * @return The index of the last occurrence of the specified subsequence, or {@code -1} if there is no such + * occurrence. * @see java.lang.String#lastIndexOf(java.lang.String) */ int lastIndexOf(CharSequence str); /** - * Returns the index within this string of the last occurrence of the - * specified substring, searching backward starting at the specified index. + * Returns the index within this sequence of the last occurrence of the specified subsequence, searching backward + * starting at the specified index. * * <p>The returned index is the largest value <i>k</i> for which: * <blockquote><pre> @@ -298,18 +291,17 @@ * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str the substring to search for. - * @param fromIndex the index to start the search from. - * @return the index of the last occurrence of the specified substring, - * searching backward from the specified index, - * or {@code -1} if there is no such occurrence. + * @param str The subsequence to search for. + * @param fromIndex The index to start the search from. + * @return The index of the last occurrence of the specified subsequence, searching backward from the specified + * index, or {@code -1} if there is no such occurrence. * @see java.lang.String#lastIndexOf(java.lang.String, int) */ int lastIndexOf(CharSequence str, int fromIndex); /** - * Returns the index within this byte sequence of the last occurrence of the specified substring. - * The last occurrence of the empty string "" is considered to occur at the index value {@code this.length()}. + * Returns the index within this byte sequence of the last occurrence of the specified subsequence. + * The last occurrence of the empty sequence "" is considered to occur at the index value {@code this.length()}. * * <p>The returned index is the largest value <i>k</i> for which: * <blockquote><pre> @@ -317,16 +309,16 @@ * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str the substring to search for. - * @return the index of the last occurrence of the specified substring, - * or {@code -1} if there is no such occurrence. + * @param str The subsequence to search for. + * @return The index of the last occurrence of the specified subsequence, or {@code -1} if there is no such + * occurrence. * @see java.lang.String#lastIndexOf(java.lang.String) */ int lastIndexOf(ByteSequence str); /** - * Returns the index within this string of the last occurrence of the - * specified substring, searching backward starting at the specified index. + * Returns the index within this sequence of the last occurrence of the specified subsequence, searching backward + * starting at the specified index. * * <p>The returned index is the largest value <i>k</i> for which: * <blockquote><pre> @@ -334,11 +326,10 @@ * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str the substring to search for. - * @param fromIndex the index to start the search from. - * @return the index of the last occurrence of the specified substring, - * searching backward from the specified index, - * or {@code -1} if there is no such occurrence. + * @param str The subsequence to search for. + * @param fromIndex The index to start the search from. + * @return The index of the last occurrence of the specified subsequence, searching backward from the specified + * index, or {@code -1} if there is no such occurrence. * @see java.lang.String#lastIndexOf(java.lang.String, int) */ int lastIndexOf(ByteSequence str, int fromIndex); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-08 16:12:05
|
Revision: 2574 http://sourceforge.net/p/axsl/code/2574 Author: victormote Date: 2022-12-08 16:12:03 +0000 (Thu, 08 Dec 2022) Log Message: ----------- Remove code mimicking non-public methods. Modified Paths: -------------- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java Modified: trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java =================================================================== --- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java 2022-12-08 14:18:39 UTC (rev 2573) +++ trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java 2022-12-08 16:12:03 UTC (rev 2574) @@ -196,10 +196,8 @@ /* ****************************************************************************************************************** */ /* Begin extended search routines patterned after similar methods in String. */ - /* TODO: Fox each method in this section, those methods patterned after String, add an @see to the method that - * points to the pattern method in String. For those methods that are not public, remove them here, adding them - * to implementation code if needed. They should not be part of the API. */ /* TODO: Clean up javadoc here. Replace "string" with "sequence" and "substring" with "subsequence". */ + /* TODO: Change usages of CharSequence to ByteSequence. */ /** @@ -239,35 +237,6 @@ int indexOf(CharSequence str, int fromIndex); /** - * Code shared by String and AbstractStringBuilder to do searches. The - * source is the character array being searched, and the target - * is the string being searched for. - * - * @param sourceOffset offset of the source string. - * @param sourceCount count of the source string. - * @param target the characters being searched for. - * @param fromIndex the index to begin searching from. - * @return The index where {@code target} was found, or -1 if not found. - */ - int indexOf(int sourceOffset, int sourceCount, CharSequence target, int fromIndex); - - /** - * Code shared by String and StringBuffer to do searches. The - * source is the character array being searched, and the target - * is the string being searched for. - * - * @param sourceOffset offset of the source string. - * @param sourceCount count of the source string. - * @param target the characters being searched for. - * @param targetOffset offset of the target string. - * @param targetCount count of the target string. - * @param fromIndex the index to begin searching from. - * @return The index where {@code target} was found, or -1 if not found. - */ - int indexOf(int sourceOffset, int sourceCount, CharSequence target, int targetOffset, int targetCount, - int fromIndex); - - /** * Returns the index within this string of the first occurrence of the specified substring. * * <p>The returned index is the smallest value <i>k</i> for which: @@ -303,33 +272,6 @@ int indexOf(ByteSequence str, int fromIndex); /** - * Searches for one sequence in another. - * The source is the character array being searched, and the target is the string being searched for. - * - * @param sourceOffset offset of the source string. - * @param sourceCount count of the source string. - * @param target the characters being searched for. - * @param fromIndex the index to begin searching from. - * @return The index where {@code target} was found, or -1 if not found. - */ - int indexOf(int sourceOffset, int sourceCount, ByteSequence target, int fromIndex); - - /** - * Searches for one sequence in another. - * The source is the character array being searched, and the target is the string being searched for. - * - * @param sourceOffset offset of the source string. - * @param sourceCount count of the source string. - * @param target the characters being searched for. - * @param targetOffset offset of the target string. - * @param targetCount count of the target string. - * @param fromIndex the index to begin searching from. - * @return The index where {@code target} was found, or -1 if not found. - */ - int indexOf(int sourceOffset, int sourceCount, ByteSequence target, int targetOffset, int targetCount, - int fromIndex); - - /** * Returns the index within this byte sequence of the last occurrence of the specified substring. * The last occurrence of the empty string "" is considered to occur at the index value {@code this.length()}. * @@ -366,35 +308,6 @@ int lastIndexOf(CharSequence str, int fromIndex); /** - * Code shared by String and AbstractStringBuilder to do searches. The - * source is the character array being searched, and the target - * is the string being searched for. - * - * @param sourceOffset offset of the source string. - * @param sourceCount count of the source string. - * @param target the characters being searched for. - * @param fromIndex the index to begin searching from. - * @return The index, or -1 if not found. - */ - int lastIndexOf(int sourceOffset, int sourceCount, CharSequence target, int fromIndex); - - /** - * Code shared by String and StringBuffer to do searches. The - * source is the character array being searched, and the target - * is the string being searched for. - * - * @param sourceOffset offset of the source string. - * @param sourceCount count of the source string. - * @param target the characters being searched for. - * @param targetOffset offset of the target string. - * @param targetCount count of the target string. - * @param fromIndex the index to begin searching from. - * @return The index, or -1 if not found. - */ - int lastIndexOf(int sourceOffset, int sourceCount, CharSequence target, int targetOffset, int targetCount, - int fromIndex); - - /** * Returns the index within this byte sequence of the last occurrence of the specified substring. * The last occurrence of the empty string "" is considered to occur at the index value {@code this.length()}. * @@ -430,40 +343,11 @@ */ int lastIndexOf(ByteSequence str, int fromIndex); - /** - * Code shared by String and AbstractStringBuilder to do searches. The - * source is the character array being searched, and the target - * is the string being searched for. - * - * @param sourceOffset offset of the source string. - * @param sourceCount count of the source string. - * @param target the characters being searched for. - * @param fromIndex the index to begin searching from. - * @return The index, or -1 if not found. - */ - int lastIndexOf(int sourceOffset, int sourceCount, ByteSequence target, int fromIndex); - /** - * Code shared by String and StringBuffer to do searches. The - * source is the character array being searched, and the target - * is the string being searched for. - * - * @param sourceOffset offset of the source string. - * @param sourceCount count of the source string. - * @param target the characters being searched for. - * @param targetOffset offset of the target string. - * @param targetCount count of the target string. - * @param fromIndex the index to begin searching from. - * @return The index, or -1 if not found. - */ - int lastIndexOf(int sourceOffset, int sourceCount, ByteSequence target, int targetOffset, int targetCount, - int fromIndex); - - /* End extended search routines patterned after similar methods in String. */ /* ****************************************************************************************************************** */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-08 14:18:42
|
Revision: 2573 http://sourceforge.net/p/axsl/code/2573 Author: victormote Date: 2022-12-08 14:18:39 +0000 (Thu, 08 Dec 2022) Log Message: ----------- Minor doc and style changes. Modified Paths: -------------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java trunk/axsl/axsl-i18n/src/main/java/org/axsl/i18n/Script.java trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java 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 2022-12-08 04:55:03 UTC (rev 2572) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java 2022-12-08 14:18:39 UTC (rev 2573) @@ -116,8 +116,7 @@ * returned. * Unprintable code points for spacing, breaking, and layout control are * treated by all fonts as "available".</p> - * @param chars The String, StringBuffer or other CharSequence to be - * examined. + * @param chars The {@link String} or other {@link CharSequence} to be examined. * @param beginIndex The first index in {@code chars} to be examined. * @return The first index into {@code chars} at or after * {@code beginIndex} which contains an unencodable character. @@ -137,8 +136,7 @@ * is returned. * Unprintable code points for spacing, breaking, and layout control are * treated by all fonts as "available".</p> - * @param chars The String, StringBuffer or other CharSequence to be - * examined. + * @param chars The {@link String} or other {@link CharSequence} to be examined. * @param beginIndex The first index in {@code chars} to be examined. * @return An int array, each element of which contains the index to one * char in {@code chars} for which no glyph can be encoded. @@ -463,11 +461,9 @@ void registerCharUsed(int codePoint); /** - * Convenience method that provides the equivalent of running - * {@link #registerCharUsed(int)} for each char in a given - * String, StringBuffer or other {@link CharSequence}. - * @param charSequence The {@link CharSequence} whose contents should be - * registered. + * Convenience method that provides the equivalent of running {@link #registerCharUsed(int)} for each char in a + * given {@link String} or other {@link CharSequence}. + * @param charSequence The {@link CharSequence} whose contents should be registered. */ void registerCharsUsed(CharSequence charSequence); Modified: trunk/axsl/axsl-i18n/src/main/java/org/axsl/i18n/Script.java =================================================================== --- trunk/axsl/axsl-i18n/src/main/java/org/axsl/i18n/Script.java 2022-12-08 04:55:03 UTC (rev 2572) +++ trunk/axsl/axsl-i18n/src/main/java/org/axsl/i18n/Script.java 2022-12-08 14:18:39 UTC (rev 2573) @@ -46,7 +46,7 @@ * @see "XSL-FO Recommendation 1.1, Section 7.9.1." * @see "XSL-FO Recommendation 1.1, Section 7.14." */ - public enum NaturalBaseline { + enum NaturalBaseline { /** The natural baseline is unknown. */ UNKNOWN, Modified: trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java =================================================================== --- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java 2022-12-08 04:55:03 UTC (rev 2572) +++ trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/sequence/ByteSequencePlus.java 2022-12-08 14:18:39 UTC (rev 2573) @@ -196,6 +196,10 @@ /* ****************************************************************************************************************** */ /* Begin extended search routines patterned after similar methods in String. */ + /* TODO: Fox each method in this section, those methods patterned after String, add an @see to the method that + * points to the pattern method in String. For those methods that are not public, remove them here, adding them + * to implementation code if needed. They should not be part of the API. */ + /* TODO: Clean up javadoc here. Replace "string" with "sequence" and "substring" with "subsequence". */ /** @@ -460,7 +464,7 @@ -/* Begin extended search routines patterned after similar methods in String. */ +/* End extended search routines patterned after similar methods in String. */ /* ****************************************************************************************************************** */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-08 04:55:04
|
Revision: 2572 http://sourceforge.net/p/axsl/code/2572 Author: victormote Date: 2022-12-08 04:55:03 +0000 (Thu, 08 Dec 2022) Log Message: ----------- Add missing javadoc. Added Paths: ----------- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/package-info.java Added: trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/package-info.java =================================================================== --- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/package-info.java (rev 0) +++ trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/package-info.java 2022-12-08 04:55:03 UTC (rev 2572) @@ -0,0 +1,28 @@ +/* + * 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$ + */ + +/** + * <p>General interfaces and utility classes.</p> + */ + +package org.axsl.utility; Property changes on: trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/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...> - 2022-12-08 04:49:16
|
Revision: 2571 http://sourceforge.net/p/axsl/code/2571 Author: victormote Date: 2022-12-08 04:49:13 +0000 (Thu, 08 Dec 2022) Log Message: ----------- 1. Add ComparablePlus interface for a more literate use of Comparable. 2. Move comparison code for text token location to the aXSL interface. Modified Paths: -------------- trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlowLocation.java trunk/axsl/axsl-utility/build.gradle Added Paths: ----------- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/ComparablePlus.java trunk/axsl/axsl-utility/src/test/ trunk/axsl/axsl-utility/src/test/java/ trunk/axsl/axsl-utility/src/test/java/org/ trunk/axsl/axsl-utility/src/test/java/org/axsl/ trunk/axsl/axsl-utility/src/test/java/org/axsl/utility/ trunk/axsl/axsl-utility/src/test/java/org/axsl/utility/ComparablePlusTests.java Modified: trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlowLocation.java =================================================================== --- trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlowLocation.java 2022-12-08 00:14:38 UTC (rev 2570) +++ trunk/axsl/axsl-orthography/src/main/java/org/axsl/orthography/TextTokenFlowLocation.java 2022-12-08 04:49:13 UTC (rev 2571) @@ -23,6 +23,8 @@ package org.axsl.orthography; +import org.axsl.utility.ComparablePlus; + /** * <p>Description of a location in a {@link TextTokenFlow}. * The ability to describe a location in a {@link TextTokenFlow} is useful for applications that wish to subdivide it, @@ -44,7 +46,7 @@ * * @see <a href="https://en.wikipedia.org/wiki/Project_Valhalla_(Java_language)">Java Project Valhalla</a> */ -public interface TextTokenFlowLocation extends Comparable<TextTokenFlowLocation> { +public interface TextTokenFlowLocation extends ComparablePlus<TextTokenFlowLocation> { /** * Returns the token index of the location. @@ -67,4 +69,21 @@ */ byte getCharIndex(); + @Override + default int compareTo(final TextTokenFlowLocation o) { + if (getTokenIndex() == o.getTokenIndex()) { + if (getSegmentIndex() == o.getSegmentIndex()) { + if (getCharIndex() == o.getCharIndex()) { + return 0; + } else { + return getCharIndex() - o.getCharIndex(); + } + } else { + return getSegmentIndex() - o.getSegmentIndex(); + } + } else { + return getTokenIndex() - o.getTokenIndex(); + } + } + } Modified: trunk/axsl/axsl-utility/build.gradle =================================================================== --- trunk/axsl/axsl-utility/build.gradle 2022-12-08 00:14:38 UTC (rev 2570) +++ trunk/axsl/axsl-utility/build.gradle 2022-12-08 04:49:13 UTC (rev 2571) @@ -1,5 +1,6 @@ plugins { id 'axsl.library-conventions' + id 'axsl.test-conventions' } description = "axsl-utility" Added: trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/ComparablePlus.java =================================================================== --- trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/ComparablePlus.java (rev 0) +++ trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/ComparablePlus.java 2022-12-08 04:49:13 UTC (rev 2571) @@ -0,0 +1,85 @@ +/* + * 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.utility; + +/** + * Enhancements to the {@link Comparable} interface, to improve readability. + * @param <T> The type of the objects being compared. + */ +public interface ComparablePlus<T> extends Comparable<T> { + + /** + * Compares the value of this object to another. + * @param o The object to be compared to this. + * @return True if and only if this is equal to {@code o}. + */ + default boolean isEqualTo(T o) { + return compareTo(o) == 0; + } + + /** + * Compares the value of this object to another. + * @param o The object to be compared to this. + * @return True if and only if this is NOT equal to {@code o}. + */ + default boolean isNotEqualTo(T o) { + return compareTo(o) != 0; + } + + /** + * Compares the value of this object to another. + * @param o The object to be compared to this. + * @return True if and only if this is greater than {@code o}. + */ + default boolean isGreaterThan(T o) { + return compareTo(o) > 0; + } + + /** + * Compares the value of this object to another. + * @param o The object to be compared to this. + * @return True if and only if this is greater than or equal to {@code o}. + */ + default boolean isGreaterThanOrEqualTo(T o) { + return compareTo(o) >= 0; + } + + /** + * Compares the value of this object to another. + * @param o The object to be compared to this. + * @return True if and only if this is less than {@code o}. + */ + default boolean isLessThan(T o) { + return compareTo(o) < 0; + } + + /** + * Compares the value of this object to another. + * @param o The object to be compared to this. + * @return True if and only if this is less than or equal to {@code o}. + */ + default boolean isLessThanOrEqualTo(T o) { + return compareTo(o) <= 0; + } + +} Property changes on: trunk/axsl/axsl-utility/src/main/java/org/axsl/utility/ComparablePlus.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-utility/src/test/java/org/axsl/utility/ComparablePlusTests.java =================================================================== --- trunk/axsl/axsl-utility/src/test/java/org/axsl/utility/ComparablePlusTests.java (rev 0) +++ trunk/axsl/axsl-utility/src/test/java/org/axsl/utility/ComparablePlusTests.java 2022-12-08 04:49:13 UTC (rev 2571) @@ -0,0 +1,358 @@ +/* + * 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.utility; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; + +/** + * Test of {@link ComparablePlus}. + */ +public class ComparablePlusTests { + + /** A constant. */ + private final Bogus minus100instance1 = new Bogus(-100); + /** A constant. */ + private final Bogus minus100instance2 = new Bogus(-100); + /** A constant. */ + private final Bogus zeroinstance1 = new Bogus(0); + /** A constant. */ + private final Bogus zeroinstance2 = new Bogus(0); + /** A constant. */ + private final Bogus plus100instance1 = new Bogus(100); + /** A constant. */ + private final Bogus plus100instance2 = new Bogus(100); + + /** + * Wraps an primitive int. Used only for testing. + */ + private final class Bogus implements ComparablePlus<Bogus> { + + /** The wrapped value. */ + private Integer theInteger; + + /** + * Constructor. + * @param theInteger The wrapped value. + */ + private Bogus(final int theInteger) { + this.theInteger = theInteger; + } + + @Override + public int compareTo(final Bogus o) { + return this.theInteger.compareTo(o.theInteger); + } + } + + /** + * Tests of {@link #isEqualTo(Bogus)}. + */ + @Test + public void isEqualToTests() { + assertTrue(minus100instance1.isEqualTo(minus100instance1)); + assertTrue(minus100instance1.isEqualTo(minus100instance2)); + assertFalse(minus100instance1.isEqualTo(zeroinstance1)); + assertFalse(minus100instance1.isEqualTo(zeroinstance2)); + assertFalse(minus100instance1.isEqualTo(plus100instance1)); + assertFalse(minus100instance1.isEqualTo(plus100instance2)); + + assertTrue(minus100instance2.isEqualTo(minus100instance1)); + assertTrue(minus100instance2.isEqualTo(minus100instance2)); + assertFalse(minus100instance2.isEqualTo(zeroinstance1)); + assertFalse(minus100instance2.isEqualTo(zeroinstance2)); + assertFalse(minus100instance2.isEqualTo(plus100instance1)); + assertFalse(minus100instance2.isEqualTo(plus100instance2)); + + assertFalse(zeroinstance1.isEqualTo(minus100instance1)); + assertFalse(zeroinstance1.isEqualTo(minus100instance2)); + assertTrue(zeroinstance1.isEqualTo(zeroinstance1)); + assertTrue(zeroinstance1.isEqualTo(zeroinstance2)); + assertFalse(zeroinstance1.isEqualTo(plus100instance1)); + assertFalse(zeroinstance1.isEqualTo(plus100instance2)); + + assertFalse(zeroinstance2.isEqualTo(minus100instance1)); + assertFalse(zeroinstance2.isEqualTo(minus100instance2)); + assertTrue(zeroinstance2.isEqualTo(zeroinstance1)); + assertTrue(zeroinstance2.isEqualTo(zeroinstance2)); + assertFalse(zeroinstance2.isEqualTo(plus100instance1)); + assertFalse(zeroinstance2.isEqualTo(plus100instance2)); + + assertFalse(plus100instance1.isEqualTo(minus100instance1)); + assertFalse(plus100instance1.isEqualTo(minus100instance2)); + assertFalse(plus100instance1.isEqualTo(zeroinstance1)); + assertFalse(plus100instance1.isEqualTo(zeroinstance2)); + assertTrue(plus100instance1.isEqualTo(plus100instance1)); + assertTrue(plus100instance1.isEqualTo(plus100instance2)); + + assertFalse(plus100instance2.isEqualTo(minus100instance1)); + assertFalse(plus100instance2.isEqualTo(minus100instance2)); + assertFalse(plus100instance2.isEqualTo(zeroinstance1)); + assertFalse(plus100instance2.isEqualTo(zeroinstance2)); + assertTrue(plus100instance2.isEqualTo(plus100instance1)); + assertTrue(plus100instance2.isEqualTo(plus100instance2)); + } + + /** + * Tests of {@link #isNotEqualTo(Bogus)}. + */ + @Test + public void isNotEqualToTests() { + assertFalse(minus100instance1.isNotEqualTo(minus100instance1)); + assertFalse(minus100instance1.isNotEqualTo(minus100instance2)); + assertTrue(minus100instance1.isNotEqualTo(zeroinstance1)); + assertTrue(minus100instance1.isNotEqualTo(zeroinstance2)); + assertTrue(minus100instance1.isNotEqualTo(plus100instance1)); + assertTrue(minus100instance1.isNotEqualTo(plus100instance2)); + + assertFalse(minus100instance2.isNotEqualTo(minus100instance1)); + assertFalse(minus100instance2.isNotEqualTo(minus100instance2)); + assertTrue(minus100instance2.isNotEqualTo(zeroinstance1)); + assertTrue(minus100instance2.isNotEqualTo(zeroinstance2)); + assertTrue(minus100instance2.isNotEqualTo(plus100instance1)); + assertTrue(minus100instance2.isNotEqualTo(plus100instance2)); + + assertTrue(zeroinstance1.isNotEqualTo(minus100instance1)); + assertTrue(zeroinstance1.isNotEqualTo(minus100instance2)); + assertFalse(zeroinstance1.isNotEqualTo(zeroinstance1)); + assertFalse(zeroinstance1.isNotEqualTo(zeroinstance2)); + assertTrue(zeroinstance1.isNotEqualTo(plus100instance1)); + assertTrue(zeroinstance1.isNotEqualTo(plus100instance2)); + + assertTrue(zeroinstance2.isNotEqualTo(minus100instance1)); + assertTrue(zeroinstance2.isNotEqualTo(minus100instance2)); + assertFalse(zeroinstance2.isNotEqualTo(zeroinstance1)); + assertFalse(zeroinstance2.isNotEqualTo(zeroinstance2)); + assertTrue(zeroinstance2.isNotEqualTo(plus100instance1)); + assertTrue(zeroinstance2.isNotEqualTo(plus100instance2)); + + assertTrue(plus100instance1.isNotEqualTo(minus100instance1)); + assertTrue(plus100instance1.isNotEqualTo(minus100instance2)); + assertTrue(plus100instance1.isNotEqualTo(zeroinstance1)); + assertTrue(plus100instance1.isNotEqualTo(zeroinstance2)); + assertFalse(plus100instance1.isNotEqualTo(plus100instance1)); + assertFalse(plus100instance1.isNotEqualTo(plus100instance2)); + + assertTrue(plus100instance2.isNotEqualTo(minus100instance1)); + assertTrue(plus100instance2.isNotEqualTo(minus100instance2)); + assertTrue(plus100instance2.isNotEqualTo(zeroinstance1)); + assertTrue(plus100instance2.isNotEqualTo(zeroinstance2)); + assertFalse(plus100instance2.isNotEqualTo(plus100instance1)); + assertFalse(plus100instance2.isNotEqualTo(plus100instance2)); + } + + /** + * Tests of {@link #isGreaterThan(Bogus)}. + */ + @Test + public void isGreaterThanTests() { + assertFalse(minus100instance1.isGreaterThan(minus100instance1)); + assertFalse(minus100instance1.isGreaterThan(minus100instance2)); + assertFalse(minus100instance1.isGreaterThan(zeroinstance1)); + assertFalse(minus100instance1.isGreaterThan(zeroinstance2)); + assertFalse(minus100instance1.isGreaterThan(plus100instance1)); + assertFalse(minus100instance1.isGreaterThan(plus100instance2)); + + assertFalse(minus100instance2.isGreaterThan(minus100instance1)); + assertFalse(minus100instance2.isGreaterThan(minus100instance2)); + assertFalse(minus100instance2.isGreaterThan(zeroinstance1)); + assertFalse(minus100instance2.isGreaterThan(zeroinstance2)); + assertFalse(minus100instance2.isGreaterThan(plus100instance1)); + assertFalse(minus100instance2.isGreaterThan(plus100instance2)); + + assertTrue(zeroinstance1.isGreaterThan(minus100instance1)); + assertTrue(zeroinstance1.isGreaterThan(minus100instance2)); + assertFalse(zeroinstance1.isGreaterThan(zeroinstance1)); + assertFalse(zeroinstance1.isGreaterThan(zeroinstance2)); + assertFalse(zeroinstance1.isGreaterThan(plus100instance1)); + assertFalse(zeroinstance1.isGreaterThan(plus100instance2)); + + assertTrue(zeroinstance2.isGreaterThan(minus100instance1)); + assertTrue(zeroinstance2.isGreaterThan(minus100instance2)); + assertFalse(zeroinstance2.isGreaterThan(zeroinstance1)); + assertFalse(zeroinstance2.isGreaterThan(zeroinstance2)); + assertFalse(zeroinstance2.isGreaterThan(plus100instance1)); + assertFalse(zeroinstance2.isGreaterThan(plus100instance2)); + + assertTrue(plus100instance1.isGreaterThan(minus100instance1)); + assertTrue(plus100instance1.isGreaterThan(minus100instance2)); + assertTrue(plus100instance1.isGreaterThan(zeroinstance1)); + assertTrue(plus100instance1.isGreaterThan(zeroinstance2)); + assertFalse(plus100instance1.isGreaterThan(plus100instance1)); + assertFalse(plus100instance1.isGreaterThan(plus100instance2)); + + assertTrue(plus100instance2.isGreaterThan(minus100instance1)); + assertTrue(plus100instance2.isGreaterThan(minus100instance2)); + assertTrue(plus100instance2.isGreaterThan(zeroinstance1)); + assertTrue(plus100instance2.isGreaterThan(zeroinstance2)); + assertFalse(plus100instance2.isGreaterThan(plus100instance1)); + assertFalse(plus100instance2.isGreaterThan(plus100instance2)); + } + + /** + * Tests of {@link #isGreaterThanOrEqualTo(Bogus)}. + */ + @Test + public void isGreaterThanOrEqualToTests() { + assertTrue(minus100instance1.isGreaterThanOrEqualTo(minus100instance1)); + assertTrue(minus100instance1.isGreaterThanOrEqualTo(minus100instance2)); + assertFalse(minus100instance1.isGreaterThanOrEqualTo(zeroinstance1)); + assertFalse(minus100instance1.isGreaterThanOrEqualTo(zeroinstance2)); + assertFalse(minus100instance1.isGreaterThanOrEqualTo(plus100instance1)); + assertFalse(minus100instance1.isGreaterThanOrEqualTo(plus100instance2)); + + assertTrue(minus100instance2.isGreaterThanOrEqualTo(minus100instance1)); + assertTrue(minus100instance2.isGreaterThanOrEqualTo(minus100instance2)); + assertFalse(minus100instance2.isGreaterThanOrEqualTo(zeroinstance1)); + assertFalse(minus100instance2.isGreaterThanOrEqualTo(zeroinstance2)); + assertFalse(minus100instance2.isGreaterThanOrEqualTo(plus100instance1)); + assertFalse(minus100instance2.isGreaterThanOrEqualTo(plus100instance2)); + + assertTrue(zeroinstance1.isGreaterThanOrEqualTo(minus100instance1)); + assertTrue(zeroinstance1.isGreaterThanOrEqualTo(minus100instance2)); + assertTrue(zeroinstance1.isGreaterThanOrEqualTo(zeroinstance1)); + assertTrue(zeroinstance1.isGreaterThanOrEqualTo(zeroinstance2)); + assertFalse(zeroinstance1.isGreaterThanOrEqualTo(plus100instance1)); + assertFalse(zeroinstance1.isGreaterThanOrEqualTo(plus100instance2)); + + assertTrue(zeroinstance2.isGreaterThanOrEqualTo(minus100instance1)); + assertTrue(zeroinstance2.isGreaterThanOrEqualTo(minus100instance2)); + assertTrue(zeroinstance2.isGreaterThanOrEqualTo(zeroinstance1)); + assertTrue(zeroinstance2.isGreaterThanOrEqualTo(zeroinstance2)); + assertFalse(zeroinstance2.isGreaterThanOrEqualTo(plus100instance1)); + assertFalse(zeroinstance2.isGreaterThanOrEqualTo(plus100instance2)); + + assertTrue(plus100instance1.isGreaterThanOrEqualTo(minus100instance1)); + assertTrue(plus100instance1.isGreaterThanOrEqualTo(minus100instance2)); + assertTrue(plus100instance1.isGreaterThanOrEqualTo(zeroinstance1)); + assertTrue(plus100instance1.isGreaterThanOrEqualTo(zeroinstance2)); + assertTrue(plus100instance1.isGreaterThanOrEqualTo(plus100instance1)); + assertTrue(plus100instance1.isGreaterThanOrEqualTo(plus100instance2)); + + assertTrue(plus100instance2.isGreaterThanOrEqualTo(minus100instance1)); + assertTrue(plus100instance2.isGreaterThanOrEqualTo(minus100instance2)); + assertTrue(plus100instance2.isGreaterThanOrEqualTo(zeroinstance1)); + assertTrue(plus100instance2.isGreaterThanOrEqualTo(zeroinstance2)); + assertTrue(plus100instance2.isGreaterThanOrEqualTo(plus100instance1)); + assertTrue(plus100instance2.isGreaterThanOrEqualTo(plus100instance2)); + } + + /** + * Tests of {@link #isLessThan(Bogus)}. + */ + @Test + public void isLessThanTests() { + assertFalse(minus100instance1.isLessThan(minus100instance1)); + assertFalse(minus100instance1.isLessThan(minus100instance2)); + assertTrue(minus100instance1.isLessThan(zeroinstance1)); + assertTrue(minus100instance1.isLessThan(zeroinstance2)); + assertTrue(minus100instance1.isLessThan(plus100instance1)); + assertTrue(minus100instance1.isLessThan(plus100instance2)); + + assertFalse(minus100instance2.isLessThan(minus100instance1)); + assertFalse(minus100instance2.isLessThan(minus100instance2)); + assertTrue(minus100instance2.isLessThan(zeroinstance1)); + assertTrue(minus100instance2.isLessThan(zeroinstance2)); + assertTrue(minus100instance2.isLessThan(plus100instance1)); + assertTrue(minus100instance2.isLessThan(plus100instance2)); + + assertFalse(zeroinstance1.isLessThan(minus100instance1)); + assertFalse(zeroinstance1.isLessThan(minus100instance2)); + assertFalse(zeroinstance1.isLessThan(zeroinstance1)); + assertFalse(zeroinstance1.isLessThan(zeroinstance2)); + assertTrue(zeroinstance1.isLessThan(plus100instance1)); + assertTrue(zeroinstance1.isLessThan(plus100instance2)); + + assertFalse(zeroinstance2.isLessThan(minus100instance1)); + assertFalse(zeroinstance2.isLessThan(minus100instance2)); + assertFalse(zeroinstance2.isLessThan(zeroinstance1)); + assertFalse(zeroinstance2.isLessThan(zeroinstance2)); + assertTrue(zeroinstance2.isLessThan(plus100instance1)); + assertTrue(zeroinstance2.isLessThan(plus100instance2)); + + assertFalse(plus100instance1.isLessThan(minus100instance1)); + assertFalse(plus100instance1.isLessThan(minus100instance2)); + assertFalse(plus100instance1.isLessThan(zeroinstance1)); + assertFalse(plus100instance1.isLessThan(zeroinstance2)); + assertFalse(plus100instance1.isLessThan(plus100instance1)); + assertFalse(plus100instance1.isLessThan(plus100instance2)); + + assertFalse(plus100instance2.isLessThan(minus100instance1)); + assertFalse(plus100instance2.isLessThan(minus100instance2)); + assertFalse(plus100instance2.isLessThan(zeroinstance1)); + assertFalse(plus100instance2.isLessThan(zeroinstance2)); + assertFalse(plus100instance2.isLessThan(plus100instance1)); + assertFalse(plus100instance2.isLessThan(plus100instance2)); + } + + /** + * Tests of {@link #isLessThanOrEqualTo(Bogus)}. + */ + @Test + public void isLessThanOrEqualToTests() { + assertTrue(minus100instance1.isLessThanOrEqualTo(minus100instance1)); + assertTrue(minus100instance1.isLessThanOrEqualTo(minus100instance2)); + assertTrue(minus100instance1.isLessThanOrEqualTo(zeroinstance1)); + assertTrue(minus100instance1.isLessThanOrEqualTo(zeroinstance2)); + assertTrue(minus100instance1.isLessThanOrEqualTo(plus100instance1)); + assertTrue(minus100instance1.isLessThanOrEqualTo(plus100instance2)); + + assertTrue(minus100instance2.isLessThanOrEqualTo(minus100instance1)); + assertTrue(minus100instance2.isLessThanOrEqualTo(minus100instance2)); + assertTrue(minus100instance2.isLessThanOrEqualTo(zeroinstance1)); + assertTrue(minus100instance2.isLessThanOrEqualTo(zeroinstance2)); + assertTrue(minus100instance2.isLessThanOrEqualTo(plus100instance1)); + assertTrue(minus100instance2.isLessThanOrEqualTo(plus100instance2)); + + assertFalse(zeroinstance1.isLessThanOrEqualTo(minus100instance1)); + assertFalse(zeroinstance1.isLessThanOrEqualTo(minus100instance2)); + assertTrue(zeroinstance1.isLessThanOrEqualTo(zeroinstance1)); + assertTrue(zeroinstance1.isLessThanOrEqualTo(zeroinstance2)); + assertTrue(zeroinstance1.isLessThanOrEqualTo(plus100instance1)); + assertTrue(zeroinstance1.isLessThanOrEqualTo(plus100instance2)); + + assertFalse(zeroinstance2.isLessThanOrEqualTo(minus100instance1)); + assertFalse(zeroinstance2.isLessThanOrEqualTo(minus100instance2)); + assertTrue(zeroinstance2.isLessThanOrEqualTo(zeroinstance1)); + assertTrue(zeroinstance2.isLessThanOrEqualTo(zeroinstance2)); + assertTrue(zeroinstance2.isLessThanOrEqualTo(plus100instance1)); + assertTrue(zeroinstance2.isLessThanOrEqualTo(plus100instance2)); + + assertFalse(plus100instance1.isLessThanOrEqualTo(minus100instance1)); + assertFalse(plus100instance1.isLessThanOrEqualTo(minus100instance2)); + assertFalse(plus100instance1.isLessThanOrEqualTo(zeroinstance1)); + assertFalse(plus100instance1.isLessThanOrEqualTo(zeroinstance2)); + assertTrue(plus100instance1.isLessThanOrEqualTo(plus100instance1)); + assertTrue(plus100instance1.isLessThanOrEqualTo(plus100instance2)); + + assertFalse(plus100instance2.isLessThanOrEqualTo(minus100instance1)); + assertFalse(plus100instance2.isLessThanOrEqualTo(minus100instance2)); + assertFalse(plus100instance2.isLessThanOrEqualTo(zeroinstance1)); + assertFalse(plus100instance2.isLessThanOrEqualTo(zeroinstance2)); + assertTrue(plus100instance2.isLessThanOrEqualTo(plus100instance1)); + assertTrue(plus100instance2.isLessThanOrEqualTo(plus100instance2)); + } + +} Property changes on: trunk/axsl/axsl-utility/src/test/java/org/axsl/utility/ComparablePlusTests.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...> - 2022-12-08 00:14:40
|
Revision: 2570 http://sourceforge.net/p/axsl/code/2570 Author: victormote Date: 2022-12-08 00:14:38 +0000 (Thu, 08 Dec 2022) Log Message: ----------- Add some useful immutable instances of TextModifiers, probably mostly useful for testing. Modified Paths: -------------- trunk/axsl/axsl-value/build.gradle trunk/axsl/axsl-value/src/main/java/org/axsl/value/group/TextModifiers.java Modified: trunk/axsl/axsl-value/build.gradle =================================================================== --- trunk/axsl/axsl-value/build.gradle 2022-12-07 23:54:58 UTC (rev 2569) +++ trunk/axsl/axsl-value/build.gradle 2022-12-08 00:14:38 UTC (rev 2570) @@ -7,6 +7,7 @@ dependencies { api project(':axsl-i18n') + api project(':axsl-unicode') } /* Last line of script. */ Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/group/TextModifiers.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/group/TextModifiers.java 2022-12-07 23:54:58 UTC (rev 2569) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/group/TextModifiers.java 2022-12-08 00:14:38 UTC (rev 2570) @@ -23,6 +23,7 @@ package org.axsl.value.group; +import org.axsl.unicode.block.General_Punctuation_Block; import org.axsl.value.LinefeedTreatment; import org.axsl.value.TextTransform; import org.axsl.value.WhiteSpaceTreatment; @@ -33,6 +34,65 @@ */ public interface TextModifiers { + /** An immutable instance of {@link TextModifiers} that makes no changes to the original text. */ + TextModifiers NONE = new TextModifiers() { + + @Override + public LinefeedTreatment traitLinefeedTreatment() { + return LinefeedTreatment.PRESERVE; + } + + @Override + public TextTransform traitTextTransform() { + return TextTransform.NONE; + } + + @Override + public boolean traitWhiteSpaceCollapse() { + return false; + } + + @Override + public WhiteSpaceTreatment traitWhiteSpaceTreatment() { + return WhiteSpaceTreatment.PRESERVE; + } + + @Override + public CharSequence traitHyphenationCharacter() { + return ""; + } + }; + + /** An immutable instance of {@link TextModifiers} that reflects the default values in the XSL-FO Recommendation + * 1.1. */ + TextModifiers XSL_FO_DEFAULT = new TextModifiers() { + + @Override + public LinefeedTreatment traitLinefeedTreatment() { + return LinefeedTreatment.TREAT_AS_SPACE; + } + + @Override + public TextTransform traitTextTransform() { + return TextTransform.NONE; + } + + @Override + public boolean traitWhiteSpaceCollapse() { + return true; + } + + @Override + public WhiteSpaceTreatment traitWhiteSpaceTreatment() { + return WhiteSpaceTreatment.IGNORE_IF_SURROUNDING_LINEFEED; + } + + @Override + public CharSequence traitHyphenationCharacter() { + return Character.toString(General_Punctuation_Block.HYPHEN); + } + }; + /** * Returns the linefeed-treatment trait. * @return The linefeed-treatment trait. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-07 23:54:59
|
Revision: 2569 http://sourceforge.net/p/axsl/code/2569 Author: victormote Date: 2022-12-07 23:54:58 +0000 (Wed, 07 Dec 2022) Log Message: ----------- Change return type of hyphenation character to CharSequence from int, for greater flexibility to client applications. Modified Paths: -------------- trunk/axsl/axsl-content/src/main/java/org/axsl/content/TextContent.java trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonHyphenationPa.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/group/TextModifiers.java Modified: trunk/axsl/axsl-content/src/main/java/org/axsl/content/TextContent.java =================================================================== --- trunk/axsl/axsl-content/src/main/java/org/axsl/content/TextContent.java 2022-12-07 14:21:45 UTC (rev 2568) +++ trunk/axsl/axsl-content/src/main/java/org/axsl/content/TextContent.java 2022-12-07 23:54:58 UTC (rev 2569) @@ -117,11 +117,10 @@ int inlineHyphenationPushCount(); /** - * Tells the line-breaking system what character to use as the hyphen for purposes of hyphenation. - * @return The hyphenation character that should be used for discretionary hyphens for this text, as an - * unsigned 21-bit Unicode code point. + * Tells the line-breaking system what character(s) to use as the hyphen for purposes of hyphenation. + * @return The hyphenation character that should be used for discretionary hyphens for this text. */ - int inlineHyphenationCharacter(); + CharSequence inlineHyphenationCharacter(); /** * Tells the line-breaking system whether faux small-caps should be applied to this text. Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonHyphenationPa.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonHyphenationPa.java 2022-12-07 14:21:45 UTC (rev 2568) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonHyphenationPa.java 2022-12-07 23:54:58 UTC (rev 2569) @@ -61,12 +61,19 @@ /** * Returns the "hyphenation-character" trait for this FO. * This trait is inherited. + * <p>The XSL-FO Recommendation describes this value as a single Unicode character, and consideration was given to + * returning an int representing a Unicode codepoint. + * {@link CharSequence} was chosen instead as being flexible enough to handle the full range of Unicode values, as + * well as allowing a multi-character value, if for some reason that is useful. + * Implementations that wish to restrict this value to a single Unicode codepoint should do so in some upstream + * process.</p> * @param context An object that knows how to resolve FO Tree context issues. - * @return The hyphenation-character, as an unsigned 21-bit Unicode code point. + * @return The hyphenation-character trait. + * @see "XSL-FO Recommendation 1.0, Section 5.11." * @see "XSL-FO Recommendation 1.0, Section 7.9.5" * @see "XSL-FO Recommendation 1.1, Section 7.10.5" */ - int traitHyphenationCharacter(FoContext context); + CharSequence traitHyphenationCharacter(FoContext context); /** * Returns the "hyphenation-push-character-count" trait for this FO. Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/group/TextModifiers.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/group/TextModifiers.java 2022-12-07 14:21:45 UTC (rev 2568) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/group/TextModifiers.java 2022-12-07 23:54:58 UTC (rev 2569) @@ -61,6 +61,6 @@ * Returns the hyphenation-character trait. * @return The hyphenation-character trait. */ - int traitHyphenationCharacter(); + CharSequence traitHyphenationCharacter(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-07 14:21:48
|
Revision: 2568 http://sourceforge.net/p/axsl/code/2568 Author: victormote Date: 2022-12-07 14:21:45 +0000 (Wed, 07 Dec 2022) Log Message: ----------- Cleanup BaselineIdentifier items. Add method to FoContext to return the dominant baseline. Modified Paths: -------------- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java trunk/axsl/axsl-value/src/main/java/org/axsl/value/BaselineIdentifier.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 2022-12-06 16:22:00 UTC (rev 2567) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2022-12-07 14:21:45 UTC (rev 2568) @@ -27,6 +27,7 @@ import org.axsl.fotree.fo.Marker; import org.axsl.fotree.fo.RetrieveMarker; import org.axsl.fotree.fo.RetrieveTableMarker; +import org.axsl.value.BaselineIdentifier; import org.axsl.value.group.TextModifiers; /** @@ -132,4 +133,10 @@ */ int ipdParentArea(); + /** + * Returns the dominant baseline of this area. + * @return The dominant baseline of this area. + */ + BaselineIdentifier traitDominantBaseline(); + } Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/BaselineIdentifier.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/BaselineIdentifier.java 2022-12-06 16:22:00 UTC (rev 2567) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/BaselineIdentifier.java 2022-12-07 14:21:45 UTC (rev 2568) @@ -25,90 +25,41 @@ /** * <p>An enumeration of the possible baseline identifier values.</p> - * <p>CAVEAT: These values are used by both the XSL-FO "alignment-baseline" and "dominant-baseline". - * However, individual values may not be used by both. - * See {@link #appliesToAlignmentBaselineProperty()} and {@link #appliesToDominantBaselineProperty()} to distinguish - * between them.</p> + * + * @see "XSL-FO Recommendation 1.1, Section 4.2.6." + * @see "XSL-FO Recommendation 1.1, Section 7.9.1." + * @see "XSL-FO Recommendation 1.1, Section 7.14." */ public enum BaselineIdentifier { - /** The alignment-point of the object being aligned is aligned with the dominant-baseline of the parent area. */ - BASELINE(true, false), + /** The alphabetic baseline. */ + ALPHABETIC, - /** Constant indicating an alphabetic baseline. */ - ALPHABETIC(true, true), + /** The ideographic baseline. */ + IDEOGRAPHIC, - /** Constant indicating an ideographic baseline. */ - IDEOGRAPHIC(true, true), + /** The hanging baseline. */ + HANGING, - /** Constant indicating a hanging baseline. */ - HANGING(true, true), + /** The mathematical baseline. */ + MATHEMATICAL, - /** Constant indicating a mathematical baseline. */ - MATHEMATICAL(true, true), + /** The central baseline. */ + CENTRAL, - /** Constant indicating a central baseline. */ - CENTRAL(true, true), + /** The middle baseline. */ + MIDDLE, - /** Constant indicating a middle baseline. */ - MIDDLE(true, true), + /** The text-before-edge baseline. */ + TEXT_BEFORE_EDGE, - /** Constant indicating a text-before-edge baseline. */ - TEXT_BEFORE_EDGE(true, true), + /** The text-after-edge baseline. */ + TEXT_AFTER_EDGE, - /** Constant indicating a text-after-edge baseline. */ - TEXT_AFTER_EDGE(true, true), + /** The before-edge baseline. */ + BEFORE_EDGE, - /** The alignment-point of the object being aligned is aligned with the before-edge baseline of the parent area. */ - BEFORE_EDGE(true, false), + /** The after-edge baseline. */ + AFTER_EDGE; - /** The alignment-point of the object being aligned is aligned with the after-edge baseline of the parent area. */ - AFTER_EDGE(true, false), - - /** The baseline is determined from the nominal font. */ - USE_SCRIPT(false, true), - - /** The baseline traits are the same as the parent FO. */ - NO_CHANGE(false, true), - - /** Similar to {@link #NO_CHANGE}, but the baseline-table font-size is changed to the value of the font-size - * property of the FO, rescaling the baseline-table for the current font-size. */ - RESET_SIZE(false, true); - - - /** Indicates whether the enumerated item applies to the "alignment-baseline" property. */ - private boolean appliesToAlignmentBaselineProperty; - - /** Indicates whether the enumerated item applies to the "dominant-baseline" property. */ - private boolean appliesToDominantBaselineProperty; - - /** - * Constructor. - * @param appliesToAlignmentBaselineProperty Indicates whether the enumerated item applies to the - * "alignment-baseline" property. - * @param appliesToDominantBaselineProperty Indicates whether the enumerated item applies to the "dominant-baseline" - * property. - */ - BaselineIdentifier(final boolean appliesToAlignmentBaselineProperty, - final boolean appliesToDominantBaselineProperty) { - this.appliesToAlignmentBaselineProperty = appliesToAlignmentBaselineProperty; - this.appliesToDominantBaselineProperty = appliesToDominantBaselineProperty; - } - - /** - * Indicates whether this property applies to the "alignment-baseline" property. - * @return True if and only if this property applies to the "alignment-baseline" property. - */ - public boolean appliesToAlignmentBaselineProperty() { - return this.appliesToAlignmentBaselineProperty; - } - - /** - * Indicates whether this property applies to the "dominant-baseline" property. - * @return True if and only if this property applies to the "dominant-baseline" property. - */ - public boolean appliesToDominantBaselineProperty() { - return this.appliesToDominantBaselineProperty; - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-06 16:22:03
|
Revision: 2567 http://sourceforge.net/p/axsl/code/2567 Author: victormote Date: 2022-12-06 16:22:00 +0000 (Tue, 06 Dec 2022) Log Message: ----------- Add methods to return natural baseline and hyphenation characters for each Script. Modified Paths: -------------- trunk/axsl/axsl-i18n/src/main/java/org/axsl/i18n/Script.java Modified: trunk/axsl/axsl-i18n/src/main/java/org/axsl/i18n/Script.java =================================================================== --- trunk/axsl/axsl-i18n/src/main/java/org/axsl/i18n/Script.java 2022-12-06 13:45:03 UTC (rev 2566) +++ trunk/axsl/axsl-i18n/src/main/java/org/axsl/i18n/Script.java 2022-12-06 16:22:00 UTC (rev 2567) @@ -40,6 +40,32 @@ public interface Script { /** + * Enumeration of valid natural baseline descriptors for scripts. + * There are other baseline descriptors used in other contexts (such as "middle", and "text-before-edge") that are + * computed values that would not be used as a natural baseline descriptor for a script. + * @see "XSL-FO Recommendation 1.1, Section 7.9.1." + * @see "XSL-FO Recommendation 1.1, Section 7.14." + */ + public enum NaturalBaseline { + + /** The natural baseline is unknown. */ + UNKNOWN, + + /** The natural baseline is alphabetic, a line at or near the bottom of the capital letters, used for Western + * glyphs. */ + ALPHABETIC, + + /** The natural baseline is ideographic, a line either at the center or bottom of the em box of glyphs, used for + * Far Eastern glyphs. */ + IDEOGRAPHIC, + + /** The natural baseline is hanging, a line at the top of a horizontal stroke near the top of the glyphs, used + * for certain Indic glyphs. */ + HANGING; + + } + + /** * Returns the ISO-15924 four-letter alpha code for this script. * This alpha code must match exactly the value published by the Unicode Consortium (see class documentation for * references). @@ -85,4 +111,16 @@ */ Character.UnicodeScript getUnicodeScript(); + /** + * Returns the natural baseline for this script. + * @return The natural baseline for this script. + */ + NaturalBaseline getNaturalBaseline(); + + /** + * Returns the hyphenation character(s) for this script. + * @return The hyphenation character(s) for this script. + */ + CharSequence getHyphenationChar(); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-06 13:45:06
|
Revision: 2566 http://sourceforge.net/p/axsl/code/2566 Author: victormote Date: 2022-12-06 13:45:03 +0000 (Tue, 06 Dec 2022) Log Message: ----------- Rename Baseline to BaselineIdentifier for clarity. Modified Paths: -------------- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/AlignmentBaselinePa.java trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/DominantBaselinePa.java Added Paths: ----------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/BaselineIdentifier.java Removed Paths: ------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/AlignmentBaselinePa.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/AlignmentBaselinePa.java 2022-12-06 03:33:47 UTC (rev 2565) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/AlignmentBaselinePa.java 2022-12-06 13:45:03 UTC (rev 2566) @@ -24,7 +24,7 @@ package org.axsl.fotree.fo.prop; import org.axsl.fotree.FoContext; -import org.axsl.value.Baseline; +import org.axsl.value.BaselineIdentifier; /** @@ -40,6 +40,6 @@ * @see "XSL-FO Recommendation 1.0, Section 7.13.2" * @see "XSL-FO Recommendation 1.1, Section 7.14.2" */ - Baseline traitAlignmentBaseline(FoContext context); + BaselineIdentifier traitAlignmentBaseline(FoContext context); } Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/DominantBaselinePa.java =================================================================== --- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/DominantBaselinePa.java 2022-12-06 03:33:47 UTC (rev 2565) +++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/DominantBaselinePa.java 2022-12-06 13:45:03 UTC (rev 2566) @@ -24,7 +24,7 @@ package org.axsl.fotree.fo.prop; import org.axsl.fotree.FoContext; -import org.axsl.value.Baseline; +import org.axsl.value.BaselineIdentifier; /** * The XSL-FO dominant-baseline property. @@ -35,17 +35,17 @@ * Returns the resolved dominant baseline trait for this object. * This trait is not inherited. * @param context An object that knows how to resolve FO Tree context issues. - * @return One of {@link Baseline#ALPHABETIC}, - * {@link Baseline#IDEOGRAPHIC}, - * {@link Baseline#HANGING}, - * {@link Baseline#MATHEMATICAL}, - * {@link Baseline#CENTRAL}, - * {@link Baseline#MIDDLE}, - * {@link Baseline#TEXT_BEFORE_EDGE}, or - * {@link Baseline#TEXT_AFTER_EDGE}. + * @return One of {@link BaselineIdentifier#ALPHABETIC}, + * {@link BaselineIdentifier#IDEOGRAPHIC}, + * {@link BaselineIdentifier#HANGING}, + * {@link BaselineIdentifier#MATHEMATICAL}, + * {@link BaselineIdentifier#CENTRAL}, + * {@link BaselineIdentifier#MIDDLE}, + * {@link BaselineIdentifier#TEXT_BEFORE_EDGE}, or + * {@link BaselineIdentifier#TEXT_AFTER_EDGE}. * @see "XSL-FO Recommendation 1.0, Section 7.13.5" * @see "XSL-FO Recommendation 1.1, Section 7.14.5" */ - Baseline traitDominantBaseline(FoContext context); + BaselineIdentifier traitDominantBaseline(FoContext context); } Deleted: trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java 2022-12-06 03:33:47 UTC (rev 2565) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java 2022-12-06 13:45:03 UTC (rev 2566) @@ -1,116 +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; - -/** - * <p>An enumeration of the possible baseline values.</p> - * <p>CAVEAT: These values are used by both the XSL-FO "alignment-baseline" and "dominant-baseline". - * However, individual values may not be used by both. - * See {@link #appliesToAlignmentBaselineProperty()} and {@link #appliesToDominantBaselineProperty()} to distinguish - * between them.</p> - */ -public enum Baseline { - - /** Baseline is determined by the type of object. */ - AUTO(true, true), - - /** The alignment-point of the object being aligned is aligned with the dominant-baseline of the parent area. */ - BASELINE(true, false), - - /** Constant indicating an alphabetic baseline. */ - ALPHABETIC(true, true), - - /** Constant indicating an ideographic baseline. */ - IDEOGRAPHIC(true, true), - - /** Constant indicating a hanging baseline. */ - HANGING(true, true), - - /** Constant indicating a mathematical baseline. */ - MATHEMATICAL(true, true), - - /** Constant indicating a central baseline. */ - CENTRAL(true, true), - - /** Constant indicating a middle baseline. */ - MIDDLE(true, true), - - /** Constant indicating a text-before-edge baseline. */ - TEXT_BEFORE_EDGE(true, true), - - /** Constant indicating a text-after-edge baseline. */ - TEXT_AFTER_EDGE(true, true), - - /** The alignment-point of the object being aligned is aligned with the before-edge baseline of the parent area. */ - BEFORE_EDGE(true, false), - - /** The alignment-point of the object being aligned is aligned with the after-edge baseline of the parent area. */ - AFTER_EDGE(true, false), - - /** The baseline is determined from the nominal font. */ - USE_SCRIPT(false, true), - - /** The baseline traits are the same as the parent FO. */ - NO_CHANGE(false, true), - - /** Similar to {@link #NO_CHANGE}, but the baseline-table font-size is changed to the value of the font-size - * property of the FO, rescaling the baseline-table for the current font-size. */ - RESET_SIZE(false, true); - - - /** Indicates whether the enumerated item applies to the "alignment-baseline" property. */ - private boolean appliesToAlignmentBaselineProperty; - - /** Indicates whether the enumerated item applies to the "dominant-baseline" property. */ - private boolean appliesToDominantBaselineProperty; - - /** - * Constructor. - * @param appliesToAlignmentBaselineProperty Indicates whether the enumerated item applies to the - * "alignment-baseline" property. - * @param appliesToDominantBaselineProperty Indicates whether the enumerated item applies to the "dominant-baseline" - * property. - */ - Baseline(final boolean appliesToAlignmentBaselineProperty, final boolean appliesToDominantBaselineProperty) { - this.appliesToAlignmentBaselineProperty = appliesToAlignmentBaselineProperty; - this.appliesToDominantBaselineProperty = appliesToDominantBaselineProperty; - } - - /** - * Indicates whether this property applies to the "alignment-baseline" property. - * @return True if and only if this property applies to the "alignment-baseline" property. - */ - public boolean appliesToAlignmentBaselineProperty() { - return this.appliesToAlignmentBaselineProperty; - } - - /** - * Indicates whether this property applies to the "dominant-baseline" property. - * @return True if and only if this property applies to the "dominant-baseline" property. - */ - public boolean appliesToDominantBaselineProperty() { - return this.appliesToDominantBaselineProperty; - } - -} Copied: trunk/axsl/axsl-value/src/main/java/org/axsl/value/BaselineIdentifier.java (from rev 2565, trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java) =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/BaselineIdentifier.java (rev 0) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/BaselineIdentifier.java 2022-12-06 13:45:03 UTC (rev 2566) @@ -0,0 +1,114 @@ +/* + * 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; + +/** + * <p>An enumeration of the possible baseline identifier values.</p> + * <p>CAVEAT: These values are used by both the XSL-FO "alignment-baseline" and "dominant-baseline". + * However, individual values may not be used by both. + * See {@link #appliesToAlignmentBaselineProperty()} and {@link #appliesToDominantBaselineProperty()} to distinguish + * between them.</p> + */ +public enum BaselineIdentifier { + + /** The alignment-point of the object being aligned is aligned with the dominant-baseline of the parent area. */ + BASELINE(true, false), + + /** Constant indicating an alphabetic baseline. */ + ALPHABETIC(true, true), + + /** Constant indicating an ideographic baseline. */ + IDEOGRAPHIC(true, true), + + /** Constant indicating a hanging baseline. */ + HANGING(true, true), + + /** Constant indicating a mathematical baseline. */ + MATHEMATICAL(true, true), + + /** Constant indicating a central baseline. */ + CENTRAL(true, true), + + /** Constant indicating a middle baseline. */ + MIDDLE(true, true), + + /** Constant indicating a text-before-edge baseline. */ + TEXT_BEFORE_EDGE(true, true), + + /** Constant indicating a text-after-edge baseline. */ + TEXT_AFTER_EDGE(true, true), + + /** The alignment-point of the object being aligned is aligned with the before-edge baseline of the parent area. */ + BEFORE_EDGE(true, false), + + /** The alignment-point of the object being aligned is aligned with the after-edge baseline of the parent area. */ + AFTER_EDGE(true, false), + + /** The baseline is determined from the nominal font. */ + USE_SCRIPT(false, true), + + /** The baseline traits are the same as the parent FO. */ + NO_CHANGE(false, true), + + /** Similar to {@link #NO_CHANGE}, but the baseline-table font-size is changed to the value of the font-size + * property of the FO, rescaling the baseline-table for the current font-size. */ + RESET_SIZE(false, true); + + + /** Indicates whether the enumerated item applies to the "alignment-baseline" property. */ + private boolean appliesToAlignmentBaselineProperty; + + /** Indicates whether the enumerated item applies to the "dominant-baseline" property. */ + private boolean appliesToDominantBaselineProperty; + + /** + * Constructor. + * @param appliesToAlignmentBaselineProperty Indicates whether the enumerated item applies to the + * "alignment-baseline" property. + * @param appliesToDominantBaselineProperty Indicates whether the enumerated item applies to the "dominant-baseline" + * property. + */ + BaselineIdentifier(final boolean appliesToAlignmentBaselineProperty, + final boolean appliesToDominantBaselineProperty) { + this.appliesToAlignmentBaselineProperty = appliesToAlignmentBaselineProperty; + this.appliesToDominantBaselineProperty = appliesToDominantBaselineProperty; + } + + /** + * Indicates whether this property applies to the "alignment-baseline" property. + * @return True if and only if this property applies to the "alignment-baseline" property. + */ + public boolean appliesToAlignmentBaselineProperty() { + return this.appliesToAlignmentBaselineProperty; + } + + /** + * Indicates whether this property applies to the "dominant-baseline" property. + * @return True if and only if this property applies to the "dominant-baseline" property. + */ + public boolean appliesToDominantBaselineProperty() { + return this.appliesToDominantBaselineProperty; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-06 03:33:49
|
Revision: 2565 http://sourceforge.net/p/axsl/code/2565 Author: victormote Date: 2022-12-06 03:33:47 +0000 (Tue, 06 Dec 2022) Log Message: ----------- Add missing values for Baseline. Modified Paths: -------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java 2022-12-06 02:56:03 UTC (rev 2564) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java 2022-12-06 03:33:47 UTC (rev 2565) @@ -32,6 +32,12 @@ */ public enum Baseline { + /** Baseline is determined by the type of object. */ + AUTO(true, true), + + /** The alignment-point of the object being aligned is aligned with the dominant-baseline of the parent area. */ + BASELINE(true, false), + /** Constant indicating an alphabetic baseline. */ ALPHABETIC(true, true), @@ -60,9 +66,19 @@ BEFORE_EDGE(true, false), /** The alignment-point of the object being aligned is aligned with the after-edge baseline of the parent area. */ - AFTER_EDGE(true, false); + AFTER_EDGE(true, false), + /** The baseline is determined from the nominal font. */ + USE_SCRIPT(false, true), + /** The baseline traits are the same as the parent FO. */ + NO_CHANGE(false, true), + + /** Similar to {@link #NO_CHANGE}, but the baseline-table font-size is changed to the value of the font-size + * property of the FO, rescaling the baseline-table for the current font-size. */ + RESET_SIZE(false, true); + + /** Indicates whether the enumerated item applies to the "alignment-baseline" property. */ private boolean appliesToAlignmentBaselineProperty; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-06 02:56:05
|
Revision: 2564 http://sourceforge.net/p/axsl/code/2564 Author: victormote Date: 2022-12-06 02:56:03 +0000 (Tue, 06 Dec 2022) Log Message: ----------- Add flag to explicitly distinguish alignment-baseline from dominant-baseline values. Modified Paths: -------------- trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java =================================================================== --- trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java 2022-12-05 19:17:41 UTC (rev 2563) +++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/Baseline.java 2022-12-06 02:56:03 UTC (rev 2564) @@ -25,63 +25,71 @@ /** * <p>An enumeration of the possible baseline values.</p> - * <p>CAVEAT: Although all of the items in this enumeration apply to the "alignment-baseline" property, not all of them - * apply to the "dominant-baseline" property. - * See {@link #appliesToDominantBaselineProperty()} to distinguish between them.</p> + * <p>CAVEAT: These values are used by both the XSL-FO "alignment-baseline" and "dominant-baseline". + * However, individual values may not be used by both. + * See {@link #appliesToAlignmentBaselineProperty()} and {@link #appliesToDominantBaselineProperty()} to distinguish + * between them.</p> */ public enum Baseline { - /* The first 8 items are used by both "dominant-baseline" and "alignment-baseline". */ - /** Constant indicating an alphabetic baseline. */ - ALPHABETIC(true), + ALPHABETIC(true, true), /** Constant indicating an ideographic baseline. */ - IDEOGRAPHIC(true), + IDEOGRAPHIC(true, true), /** Constant indicating a hanging baseline. */ - HANGING(true), + HANGING(true, true), /** Constant indicating a mathematical baseline. */ - MATHEMATICAL(true), + MATHEMATICAL(true, true), /** Constant indicating a central baseline. */ - CENTRAL(true), + CENTRAL(true, true), /** Constant indicating a middle baseline. */ - MIDDLE(true), + MIDDLE(true, true), /** Constant indicating a text-before-edge baseline. */ - TEXT_BEFORE_EDGE(true), + TEXT_BEFORE_EDGE(true, true), /** Constant indicating a text-after-edge baseline. */ - TEXT_AFTER_EDGE(true), + TEXT_AFTER_EDGE(true, true), - /* The last 2 items items are used only by alignment-baseline. */ - /** The alignment-point of the object being aligned is aligned with the before-edge baseline of the parent area. */ - BEFORE_EDGE(false), + BEFORE_EDGE(true, false), /** The alignment-point of the object being aligned is aligned with the after-edge baseline of the parent area. */ - AFTER_EDGE(false); + AFTER_EDGE(true, false); + /** Indicates whether the enumerated item applies to the "alignment-baseline" property. */ + private boolean appliesToAlignmentBaselineProperty; - - /** Indicates whether the enumerated item applies to the "dominant-baseline" property, or applies only to the - * "alignment-baseline" property. */ + /** Indicates whether the enumerated item applies to the "dominant-baseline" property. */ private boolean appliesToDominantBaselineProperty; /** * Constructor. - * @param appliesToBaselineProperty Indicates whether the enumerated item applies to the "dominant-baseline" - * property, or applies only to the "alignment-baseline" property. + * @param appliesToAlignmentBaselineProperty Indicates whether the enumerated item applies to the + * "alignment-baseline" property. + * @param appliesToDominantBaselineProperty Indicates whether the enumerated item applies to the "dominant-baseline" + * property. */ - Baseline(final boolean appliesToBaselineProperty) { - this.appliesToDominantBaselineProperty = appliesToBaselineProperty; + Baseline(final boolean appliesToAlignmentBaselineProperty, final boolean appliesToDominantBaselineProperty) { + this.appliesToAlignmentBaselineProperty = appliesToAlignmentBaselineProperty; + this.appliesToDominantBaselineProperty = appliesToDominantBaselineProperty; } /** + * Indicates whether this property applies to the "alignment-baseline" property. + * @return True if and only if this property applies to the "alignment-baseline" property. + */ + public boolean appliesToAlignmentBaselineProperty() { + return this.appliesToAlignmentBaselineProperty; + } + + /** * Indicates whether this property applies to the "dominant-baseline" property. * @return True if and only if this property applies to the "dominant-baseline" property. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-05 19:17:43
|
Revision: 2563 http://sourceforge.net/p/axsl/code/2563 Author: victormote Date: 2022-12-05 19:17:41 +0000 (Mon, 05 Dec 2022) Log Message: ----------- Remove getText() method from KpNode. Modified Paths: -------------- trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpNode.java Modified: trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpNode.java =================================================================== --- trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpNode.java 2022-12-05 15:50:19 UTC (rev 2562) +++ trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpNode.java 2022-12-05 19:17:41 UTC (rev 2563) @@ -103,13 +103,4 @@ */ int qtyKpLeavesStrict(); - /* TODO: Remove getText(). This is an orthography concept that has bled into the KP logic. */ - /** - * Returns the text, if any, that this node encapsulates. - * This is different from {@link Object#toString()}, which may contain notional markup. - * Instead, this should return the text that was used to create the node. - * @return The text for this node. - */ - CharSequence getText(); - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-05 15:50:25
|
Revision: 2562 http://sourceforge.net/p/axsl/code/2562 Author: victormote Date: 2022-12-05 15:50:19 +0000 (Mon, 05 Dec 2022) Log Message: ----------- 1. Use more primitive parameter on width method. Move more default logic to aXSL. Modified Paths: -------------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFontUse.java 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 2022-12-05 05:42:52 UTC (rev 2561) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2022-12-05 15:50:19 UTC (rev 2562) @@ -26,7 +26,6 @@ import org.axsl.orthography.Orthography; import org.axsl.ps.BoundingBox; import org.axsl.ps.Encoding; -import org.axsl.utility.sequence.IntSequence; import java.awt.font.TextAttribute; import java.util.Arrays; @@ -977,7 +976,7 @@ * first be normalized to 0x20. * If there is no glyph for a character in {@code chars}, the width returned will be that of the "missing glyph". */ - default int width(IntSequence metricIndexes, int offset, int length, int fontSize, int letterSpacing, + default int width(int[] metricIndexes, int offset, int length, int fontSize, int letterSpacing, int wordSpacing, FontContext requestedFontContext, Orthography orthography) { final FontContext fontContext = requestedFontContext == null ? FontContext.DEFAULT : requestedFontContext; if (metricIndexes == null) { @@ -985,9 +984,9 @@ } final int spaceMetricIndex = this.metricIndex(' '); int width = 0; - for (int i = 0; i < metricIndexes.length(); i++) { + for (int i = 0; i < metricIndexes.length; i++) { // Add the width of the character itself. - final int charWidth = width(metricIndexes.intAt(i), fontSize); + final int charWidth = width(metricIndexes[i], fontSize); if (charWidth == Integer.MIN_VALUE) { width += widthUndefinedGlyph(fontSize); } else { @@ -995,8 +994,8 @@ } // Add any kerning. if (fontContext.isKerning() - && i < metricIndexes.length() - 1) { - final int kerning = kern(metricIndexes.intAt(i), metricIndexes.intAt(i + 1)); + && i < metricIndexes.length - 1) { + final int kerning = kern(metricIndexes[i], metricIndexes[i + 1]); /* Kerning is computed in 1/1000 of a text-space unit, regardless of how the value * is stored internally in the font. Therefore, we just need to adjust for the * font-size. */ @@ -1003,7 +1002,7 @@ width += Math.round(kerning * fontSize / FontConstants.MILLIPOINTS_PER_POINT); } // Add any word-spacing - if (metricIndexes.intAt(i) == spaceMetricIndex) { + if (metricIndexes[i] == spaceMetricIndex) { width += wordSpacing; } } @@ -1017,9 +1016,8 @@ * TODO: Characters like combining diacriticals should almost * certainly not be letter-spaced. */ - width += (metricIndexes.length() - 1) * letterSpacing; + width += (metricIndexes.length - 1) * letterSpacing; return width; - } /** 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 2022-12-05 05:42:52 UTC (rev 2561) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontUse.java 2022-12-05 15:50:19 UTC (rev 2562) @@ -193,8 +193,21 @@ * first be normalized to 0x20. * If there is no glyph for a character in {@code chars}, the width returned will be that of the "missing glyph". */ - int width(CharSequence chars, int offset, int length, int fontSize, int letterSpacing, int wordSpacing, - FontContext fontContext, Orthography orthography); + default int width(CharSequence chars, int offset, int length, int fontSize, int letterSpacing, int wordSpacing, + FontContext fontContext, Orthography orthography) { + final int[] metricIndexes = new int[chars.length()]; + for (int i = 0; i < chars.length(); i ++) { + final char c = chars.charAt(i); + final int metricIndex = getFont().metricIndex(c); + if (metricIndex < 0) { + metricIndexes[i] = 0; + } else { + metricIndexes[i] = metricIndex; + } + } + return getFont().width(metricIndexes, offset, length, fontSize, letterSpacing, wordSpacing, fontContext, + orthography); + } /** * Calculates the width of a given character sequence, considering font options such as kerning and ligatures. Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java 2022-12-05 05:42:52 UTC (rev 2561) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java 2022-12-05 15:50:19 UTC (rev 2562) @@ -24,13 +24,10 @@ package org.axsl.font.fixture; import org.axsl.font.Font; -import org.axsl.font.FontContext; import org.axsl.font.Panose; -import org.axsl.orthography.Orthography; import org.axsl.ps.BoundingBox; import org.axsl.ps.CharSet; import org.axsl.ps.Encoding; -import org.axsl.utility.sequence.IntSequence; /** * A mock implementation of {@link Font}, useful for tests. @@ -286,13 +283,6 @@ } @Override - public int width(final IntSequence metricIndexes, final int offset, final int length, final int fontSize, - final int letterSpacing, final int wordSpacing, final FontContext options, final Orthography orthography) { - // TODO Auto-generated method stub - return 0; - } - - @Override public int widthEstimate(final int codePoint, final int fontSize) { // TODO Auto-generated method stub return 0; Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFontUse.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFontUse.java 2022-12-05 05:42:52 UTC (rev 2561) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFontUse.java 2022-12-05 15:50:19 UTC (rev 2562) @@ -104,14 +104,6 @@ } @Override - public int width(final CharSequence chars, final int offset, final int length, final int fontSize, - final int letterSpacing, final int wordSpacing, final FontContext fontContext, - final Orthography orthography) { - // TODO Auto-generated method stub - return 0; - } - - @Override public int width(final CharSequence chars, final int fontSize, final FontContext fontContext, final Orthography orthography) { // TODO Auto-generated method stub This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-05 05:42:54
|
Revision: 2561 http://sourceforge.net/p/axsl/code/2561 Author: victormote Date: 2022-12-05 05:42:52 +0000 (Mon, 05 Dec 2022) Log Message: ----------- Move default computation of glyph sequence width to aXSL. Modified Paths: -------------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java Added Paths: ----------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConstants.java 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 2022-12-05 05:40:23 UTC (rev 2560) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2022-12-05 05:42:52 UTC (rev 2561) @@ -965,7 +965,7 @@ * @param fontSize The size, in millipoints, of the font. * @param letterSpacing The size, in millipoints, of any additional letter-spacing. * @param wordSpacing The size, in millipoints, of any additional word-spacing. - * @param options Options indicating how the font should use its features. + * @param requestedFontContext Options indicating how the font should use its features. * @param orthography The orthography that should be used when applying locale-sensitive font features. * @return The width, in millipoints, of {@code metricIndexes}. * Letter-spacing and kerning are added <em>between </em> characters in {@code metricIndexes}, but are not added @@ -977,9 +977,51 @@ * first be normalized to 0x20. * If there is no glyph for a character in {@code chars}, the width returned will be that of the "missing glyph". */ - int width(IntSequence metricIndexes, int offset, int length, int fontSize, int letterSpacing, int wordSpacing, - FontContext options, Orthography orthography); + default int width(IntSequence metricIndexes, int offset, int length, int fontSize, int letterSpacing, + int wordSpacing, FontContext requestedFontContext, Orthography orthography) { + final FontContext fontContext = requestedFontContext == null ? FontContext.DEFAULT : requestedFontContext; + if (metricIndexes == null) { + return 0; + } + final int spaceMetricIndex = this.metricIndex(' '); + int width = 0; + for (int i = 0; i < metricIndexes.length(); i++) { + // Add the width of the character itself. + final int charWidth = width(metricIndexes.intAt(i), fontSize); + if (charWidth == Integer.MIN_VALUE) { + width += widthUndefinedGlyph(fontSize); + } else { + width += charWidth; + } + // Add any kerning. + if (fontContext.isKerning() + && i < metricIndexes.length() - 1) { + final int kerning = kern(metricIndexes.intAt(i), metricIndexes.intAt(i + 1)); + /* Kerning is computed in 1/1000 of a text-space unit, regardless of how the value + * is stored internally in the font. Therefore, we just need to adjust for the + * font-size. */ + width += Math.round(kerning * fontSize / FontConstants.MILLIPOINTS_PER_POINT); + } + // Add any word-spacing + if (metricIndexes.intAt(i) == spaceMetricIndex) { + width += wordSpacing; + } + } + /* + * Letter-spacing should only be added between the characters. + * It cannot be added before or after the String without making + * assumptions about the String's context. + * At least as far as PDF is concerned, when letter spacing is set, it + * applies to all characters, including whitespace. + * We will handle it the same way here. + * TODO: Characters like combining diacriticals should almost + * certainly not be letter-spaced. + */ + width += (metricIndexes.length() - 1) * letterSpacing; + return width; + } + /** * Returns the estimated width of a Unicode character for this font, at a specified point size. * This method is implementation-dependent. @@ -1278,4 +1320,18 @@ */ int getFlags(); + /** + * For a given Unicode code point index, returns the index into the font metrics for that code point. + * @param codePoint The Unicode code point to be converted. + * @return The metric index. + */ + int metricIndex(int codePoint); + + /** + * Returns the width of the undefined or missing glyph. + * @param fontSize The font size at which the width should be computed. + * @return The width, in millipoints, of the undefined glyph at the specified point size. + */ + int widthUndefinedGlyph(int fontSize); + } Added: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConstants.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConstants.java (rev 0) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConstants.java 2022-12-05 05:42:52 UTC (rev 2561) @@ -0,0 +1,39 @@ +/* + * 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.font; + +/** + * Constants used by the Font system. + */ +public final class FontConstants { + + /** The number of millipoints in one point, which is {@value}. */ + public static final int MILLIPOINTS_PER_POINT = 1000; + + /** + * Private constructor. This utility class should never be instantiated. + */ + private FontConstants() { } + +} Property changes on: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontConstants.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java 2022-12-05 05:40:23 UTC (rev 2560) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/fixture/MockFont.java 2022-12-05 05:42:52 UTC (rev 2561) @@ -334,4 +334,10 @@ return 0; } + @Override + public int widthUndefinedGlyph(final int fontSize) { + // TODO Auto-generated method stub + return 0; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-05 05:40:25
|
Revision: 2560 http://sourceforge.net/p/axsl/code/2560 Author: victormote Date: 2022-12-05 05:40:23 +0000 (Mon, 05 Dec 2022) Log Message: ----------- Allow inline ternary expressions. Modified Paths: -------------- trunk/axsl/axsl-00-master/config/checkstyle/checkstyle-config.xml Modified: trunk/axsl/axsl-00-master/config/checkstyle/checkstyle-config.xml =================================================================== --- trunk/axsl/axsl-00-master/config/checkstyle/checkstyle-config.xml 2022-12-05 04:52:23 UTC (rev 2559) +++ trunk/axsl/axsl-00-master/config/checkstyle/checkstyle-config.xml 2022-12-05 05:40:23 UTC (rev 2560) @@ -174,7 +174,6 @@ <module name="FallThrough"/> <module name="FinalClass"/> <module name="FinalParameters"/> - <module name="AvoidInlineConditionals"/> <!-- Skip for now. The Ant build chokes on this. --> <!--<module name="j2ee.FinalStatic"/>--> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2022-12-05 04:52:26
|
Revision: 2559 http://sourceforge.net/p/axsl/code/2559 Author: victormote Date: 2022-12-05 04:52:23 +0000 (Mon, 05 Dec 2022) Log Message: ----------- Move default FontContext to aXSL. Modified Paths: -------------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontContext.java Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontContext.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontContext.java 2022-12-05 03:19:56 UTC (rev 2558) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontContext.java 2022-12-05 04:52:23 UTC (rev 2559) @@ -32,10 +32,20 @@ public interface FontContext { /** + * A default implementation of {@link FontContext}. + */ + class Default implements FontContext { } + + /** Singleton instance of the default implementation. */ + Default DEFAULT = new Default(); + + /** * Indicates whether kerning is active. * @return True if and only if kerning is active. */ - boolean isKerning(); + default boolean isKerning() { + return true; + } /** * Indicates whether a particular OpenType feature is active. @@ -44,7 +54,9 @@ * feature tags, it is safer to make this a String). * @return True if and only if {@code feature} is active. */ - boolean isFeatureActive(String feature); + default boolean isFeatureActive(String feature) { + return true; + } /** * Indicates whether any substitution features are active. @@ -52,6 +64,8 @@ * provide a more efficient means, as implementations can cache results or otherwise enhance performance. * @return True if there are any substitution features active. */ - boolean anySubsitutionActive(); + default boolean anySubsitutionActive() { + return true; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |