[FOray-commit] SF.net SVN: foray: [7887] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-09-04 20:18:43
|
Revision: 7887
http://svn.sourceforge.net/foray/?rev=7887&view=rev
Author: victormote
Date: 2006-09-04 13:02:18 -0700 (Mon, 04 Sep 2006)
Log Message:
-----------
Conform to axsl change: Make hyphenation character 21-bits.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java
trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-09-04 18:24:24 UTC (rev 7886)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-09-04 20:02:18 UTC (rev 7887)
@@ -235,7 +235,7 @@
traitLetterSpacingOpt(), traitWordSpacingOpt());
}
- public int getCharWidth(final char c) {
+ public int getCharWidth(final int c) {
final FontUse fontUse = getPrimaryFont();
final Font font = getPrimaryFont().getFont();
fontUse.registerCharUsed(c);
@@ -1028,7 +1028,7 @@
return traitGeneratedBy().traitRefId(this);
}
- public char traitHyphenationCharacter() {
+ public int traitHyphenationCharacter() {
return traitGeneratedBy().traitHyphenationCharacter(this);
}
@@ -1089,7 +1089,7 @@
}
public int getHyphenWidth() {
- final char hyphenChar = traitHyphenationCharacter();
+ final int hyphenChar = traitHyphenationCharacter();
return getCharWidth(hyphenChar);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2006-09-04 18:24:24 UTC (rev 7886)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2006-09-04 20:02:18 UTC (rev 7887)
@@ -24,6 +24,7 @@
package org.foray.area;
+import org.foray.common.StringUtilPre5;
import org.foray.common.XMLCharacter;
import org.axsl.areaR.RenderVisitor;
@@ -179,15 +180,27 @@
return new char[0];
}
int arraySize = this.backingSize - ignoreAtStart - ignoreAtEnd;
+ final int hyphenChar = this.traitHyphenationCharacter();
+ int discretionaryHyphenSize = 0;
if (this.hasDiscretionaryHyphen) {
- arraySize ++;
+ discretionaryHyphenSize = StringUtilPre5.charCount(hyphenChar);
}
+ arraySize += discretionaryHyphenSize;
final char[] returnChars = new char[arraySize];
System.arraycopy(rawText, this.backingOffset + ignoreAtStart,
returnChars, 0, returnChars.length);
if (this.hasDiscretionaryHyphen) {
- returnChars[returnChars.length - 1]
- = this.traitHyphenationCharacter();
+ if (discretionaryHyphenSize == 1) {
+ returnChars[returnChars.length - discretionaryHyphenSize]
+ = (char) this.traitHyphenationCharacter();
+ } else {
+ final String hyphenString = StringUtilPre5.newString(
+ new int[] {hyphenChar}, 0, 1);
+ final char[] hyphenChars = hyphenString.toCharArray();
+ System.arraycopy(hyphenChars, 0, returnChars,
+ returnChars.length - hyphenChars.length,
+ hyphenChars.length);
+ }
}
/* Apply faux small-caps, if appropriate. */
if (hasFauxSmallCaps) {
@@ -414,7 +427,7 @@
* @param c The character to be tested.
* @return True iff word-spacing should be added for this character.
*/
- private boolean wordSpacingApplies(final char c) {
+ private boolean wordSpacingApplies(final int c) {
switch (c) {
case ' ': {
return true;
@@ -515,7 +528,7 @@
* @return The width of c plus any word-spacing or letter-spacing that is
* related to it.
*/
- private int charWidth(final char c, final boolean lastCharOnLine) {
+ private int charWidth(final int c, final boolean lastCharOnLine) {
FontUse fontUse = this.getPrimaryFont();
if (! fontUse.glyphAvailable(c)) {
fontUse = this.getSecondaryFont(c);
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java 2006-09-04 18:24:24 UTC (rev 7886)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java 2006-09-04 20:02:18 UTC (rev 7887)
@@ -201,14 +201,14 @@
/**
* {@inheritDoc}
*/
- public char inlineHyphenationCharacter() {
+ public int inlineHyphenationCharacter() {
return realLineText.inlineHyphenationCharacter(this.context);
}
/**
* {@inheritDoc}
*/
- public char inlineHyphenationCharacter(final FOContext context) {
+ public int inlineHyphenationCharacter(final FOContext context) {
return realLineText.inlineHyphenationCharacter(context);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-09-04 18:24:24 UTC (rev 7886)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-09-04 20:02:18 UTC (rev 7887)
@@ -635,11 +635,11 @@
return effectiveParent.traitHyphenationPushCharacterCount(context);
}
- public char inlineHyphenationCharacter() {
+ public int inlineHyphenationCharacter() {
return this.inlineHyphenationCharacter(null);
}
- public char inlineHyphenationCharacter(final FOContext context) {
+ public int inlineHyphenationCharacter(final FOContext context) {
final FObj effectiveParent = effectiveParent(context);
return effectiveParent.traitHyphenationCharacter(context);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-09-04 18:24:24 UTC (rev 7886)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-09-04 20:02:18 UTC (rev 7887)
@@ -1521,7 +1521,7 @@
/**
* {@inheritDoc}
*/
- public char traitHyphenationCharacter(final FOContext context) {
+ public int traitHyphenationCharacter(final FOContext context) {
return propertyList.getHyphenationCharacter(context);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2006-09-04 18:24:24 UTC (rev 7886)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2006-09-04 20:02:18 UTC (rev 7887)
@@ -1967,7 +1967,7 @@
Constants.FOPROP_HYPHENATE);
}
- public char getHyphenationCharacter(final FOContext context) {
+ public int getHyphenationCharacter(final FOContext context) {
final Character property = (Character) getProperty(Constants
.FOPROP_HYPHENATION_CHARACTER);
if (property != null) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java 2006-09-04 18:24:24 UTC (rev 7886)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java 2006-09-04 20:02:18 UTC (rev 7887)
@@ -72,7 +72,7 @@
}
/* For "hyphenation-character", which can be inherited. */
- public char getValue(final FOContext context, final FObj fobj) {
+ public int getValue(final FOContext context, final FObj fobj) {
if (this.value instanceof PropertyKeyword) {
switch (propertyType) {
case Constants.FOPROP_HYPHENATION_CHARACTER: {
@@ -98,7 +98,7 @@
}
/* For properties that can be inherited. */
- public static char getValueNoInstance(final FOContext context,
+ public static int getValueNoInstance(final FOContext context,
final short propertyType, final FObj fobj) {
switch (propertyType) {
case Constants.FOPROP_HYPHENATION_CHARACTER: {
Modified: trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java
===================================================================
--- trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java 2006-09-04 18:24:24 UTC (rev 7886)
+++ trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java 2006-09-04 20:02:18 UTC (rev 7887)
@@ -212,7 +212,7 @@
}
public int getHyphenWidth(final LineText lineText) {
- final char hyphenChar = lineText.inlineHyphenationCharacter();
+ final int hyphenChar = lineText.inlineHyphenationCharacter();
return getCharWidth(lineText, hyphenChar);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|