[FOray-commit] SF.net SVN: foray: [10330] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2008-02-02 21:25:21
|
Revision: 10330
http://foray.svn.sourceforge.net/foray/?rev=10330&view=rev
Author: victormote
Date: 2008-02-02 13:25:24 -0800 (Sat, 02 Feb 2008)
Log Message:
-----------
Conform to axsl changes creating a font-oriented enumeration of baseline types.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java
trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java
trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2008-02-02 18:22:25 UTC (rev 10329)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2008-02-02 21:25:24 UTC (rev 10330)
@@ -31,7 +31,6 @@
import org.foray.common.OrderedTreeNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.common.value.Baseline;
import org.axsl.common.value.Conditionality;
import org.axsl.common.value.LineStackingStrategy;
import org.axsl.common.value.RelativeAxis;
@@ -732,7 +731,7 @@
* could be set on a line or any other block or reference area. This
* whole issue needs to be revisited. */
// final Baseline baseline = this.traitDominantBaseline();
- final Baseline baseline = Baseline.ALPHABETIC;
+ final Font.Baseline baseline = Font.Baseline.ALPHABETIC;
final Font font = this.getPrimaryFont().getFont();
return font.baselineOffset(axis, baseline, this.traitFontSize());
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2008-02-02 18:22:25 UTC (rev 10329)
+++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2008-02-02 21:25:24 UTC (rev 10330)
@@ -30,7 +30,6 @@
import org.foray.font.charset.CharSet;
import org.foray.font.format.Kerning;
-import org.axsl.common.value.Baseline;
import org.axsl.common.value.Iso15924;
import org.axsl.font.Font;
@@ -411,41 +410,36 @@
* @return The estimated value of the baseline.
*/
public int estimateBaseline(final Font.WritingMode writingMode,
- final Baseline baselineType, final int fontSize) {
- if (baselineType == Baseline.ALPHABETIC) {
+ final Font.Baseline baselineType, final int fontSize) {
+ switch(baselineType) {
+ case ALPHABETIC: {
return fontSize + this.getDescender(fontSize);
}
- if (baselineType == Baseline.IDEOGRAPHIC) {
- return fontSize;
+ case MATH: {
+ /* For now, estimate this as the middle. */
+ return fontSize / 2;
}
- if (baselineType == Baseline.HANGING) {
+ case HANGING: {
return Math.round(fontSize
* FOrayFont.DEFAULT_HANGING_BASELINE_POSITION);
}
- if (baselineType == Baseline.MATHEMATICAL) {
- /* For now, this is the same as Alphabetic. */
- return fontSize + this.getDescender(fontSize);
+ case IDEO_BOTTOM_LEFT: {
+ /* TODO: This needs to comply with the Note under "text-after-edge"
+ * at Section 7.14 of XSL-FO 1.1. */
+ return fontSize;
}
- if (baselineType == Baseline.CENTRAL) {
- return fontSize / 2;
- }
- if (baselineType == Baseline.MIDDLE) {
- /* First get the Alphabetic baseline. */
- int baseline = baselineOffset(writingMode,
- Baseline.ALPHABETIC, fontSize);
- baseline -= this.getXHeight(fontSize) / 2;
- return baseline;
- }
- if (baselineType == Baseline.TEXT_BEFORE_EDGE) {
+ case IDEO_TOP_RIGHT: {
/* TODO: This needs to comply with the Note under "text-before-edge"
- * at Section 7.13 of XSL-FO 1.0. */
+ * at Section 7.14 of XSL-FO 1.1. */
return 0;
}
- if (baselineType == Baseline.TEXT_AFTER_EDGE) {
- /* TODO: This needs to comply with the Note under "text-after-edge"
- * at Section 7.13 of XSL-FO 1.0. */
+ case ICF_BOTTOM_LEFT: {
return fontSize;
}
+ case ICF_TOP_RIGHT: {
+ return - this.getAscender(fontSize);
+ }
+ }
return 0;
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2008-02-02 18:22:25 UTC (rev 10329)
+++ trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2008-02-02 21:25:24 UTC (rev 10330)
@@ -35,7 +35,6 @@
import org.foray.font.format.Panose;
import org.foray.ps.encode.Encoding;
-import org.axsl.common.value.Baseline;
import org.axsl.font.Font;
import java.io.IOException;
Modified: trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2008-02-02 18:22:25 UTC (rev 10329)
+++ trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2008-02-02 21:25:24 UTC (rev 10330)
@@ -34,7 +34,6 @@
import org.foray.font.format.FontFileReader;
import org.foray.font.format.Kerning;
-import org.axsl.common.value.Baseline;
import org.axsl.font.FontException;
import java.awt.Font;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2008-02-02 18:22:25 UTC (rev 10329)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2008-02-02 21:25:24 UTC (rev 10330)
@@ -2640,7 +2640,19 @@
}
final Font font = fontUse.getFont();
final Iso15924 script = this.traitScript(context);
- return font.baseline(script);
+ final Font.Baseline fontBaseline = font.baseline(script);
+ switch (fontBaseline) {
+ case ALPHABETIC: return Baseline.ALPHABETIC;
+ case MATH: return Baseline.MATHEMATICAL;
+ case HANGING: return Baseline.HANGING;
+ case IDEO_BOTTOM_LEFT: return Baseline.TEXT_AFTER_EDGE;
+ case IDEO_TOP_RIGHT: return Baseline.TEXT_BEFORE_EDGE;
+ case ICF_BOTTOM_LEFT: return Baseline.IDEOGRAPHIC;
+ /* TODO: There does not seem to be a good match between the font baselines provided and the
+ * XSL-FO baseline for ICF_TOP_RIGHT. */
+ case ICF_TOP_RIGHT: return Baseline.TEXT_BEFORE_EDGE;
+ }
+ return Baseline.ALPHABETIC;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|