Revision: 12849
http://sourceforge.net/p/foray/code/12849
Author: victormote
Date: 2022-12-13 17:45:47 +0000 (Tue, 13 Dec 2022)
Log Message:
-----------
Conform to aXSL change: Remove axsl-fotree dependency on axsl-speech.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-13 12:43:11 UTC (rev 12848)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-13 17:45:47 UTC (rev 12849)
@@ -79,8 +79,6 @@
import org.axsl.kp.KpLeaf;
import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyServer;
-import org.axsl.speech.SpeechServer;
-import org.axsl.speech.Voice;
import org.axsl.value.AbsoluteDirection;
import org.axsl.value.AbsolutePosition;
import org.axsl.value.ActiveState;
@@ -114,6 +112,7 @@
import org.axsl.value.PageCitationStrategy;
import org.axsl.value.PageNumberTreatment;
import org.axsl.value.PagePosition;
+import org.axsl.value.PitchRelative;
import org.axsl.value.ReferenceOrientation;
import org.axsl.value.RelativeAlign;
import org.axsl.value.RelativeCompass;
@@ -679,14 +678,6 @@
}
/**
- * Returns the speech server.
- * @return The speech server.
- */
- public SpeechServer getSpeechServer() {
- return getFoTree().getSpeechServer();
- }
-
- /**
* Returns the graphic server being used by this tree.
* @return The graphic server being used by this tree.
*/
@@ -2744,6 +2735,11 @@
}
@Override
+ public PitchRelative traitPitchRelative(final FoContext context) {
+ return getPropertyList().traitPitchRelative(this, context);
+ }
+
+ @Override
public double traitPitchRange(final FoContext context) {
return getPropertyList().traitPitchRange(this, context);
}
@@ -2915,20 +2911,6 @@
return getPropertyList().traitWordSpacingPrecedence();
}
- @Override
- public Voice getVoice(final FoContext context) {
- /* Don't spend the memory to cache this value. First, it is not
- * generally used right now. Second, it is (for now anyway) relatively
- * inexpensive to compute. */
- final SpeechServer speechServer = this.getSpeechServer();
- final String[] familyList = getPropertyList().getVoiceFamily(this, context);
- final Voice selectedVoice = speechServer.selectVoiceXsl(familyList);
- if (selectedVoice == null) {
- getFoTree().logError("Error creating Voice.\n" + this.getContextMessage());
- }
- return selectedVoice;
- }
-
/**
* Resolves the font to be used for this object.
* @param context An object that knows how to resolve FO Tree context issues.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-12-13 12:43:11 UTC (rev 12848)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-12-13 17:45:47 UTC (rev 12849)
@@ -40,7 +40,6 @@
import org.axsl.fotree.FoTree;
import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.speech.SpeechServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,9 +72,6 @@
/** The font consumer. */
private FontConsumer fontConsumer;
- /** The speech server. */
- private SpeechServer speechServer;
-
/** The orthography server. */
private FoOrthographyServer orthographyServer;
@@ -142,16 +138,6 @@
}
@Override
- public void setSpeechServer(final SpeechServer server) {
- this.speechServer = server;
- }
-
- @Override
- public SpeechServer getSpeechServer() {
- return this.speechServer;
- }
-
- @Override
public void setOrthographyServer(final FoOrthographyServer orthographyServer) {
this.orthographyServer = orthographyServer;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-13 12:43:11 UTC (rev 12848)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-13 17:45:47 UTC (rev 12849)
@@ -245,6 +245,7 @@
import org.axsl.value.LetterValue;
import org.axsl.value.OddOrEven;
import org.axsl.value.PagePosition;
+import org.axsl.value.PitchRelative;
import org.axsl.value.RelativeAxis;
import org.axsl.value.RelativeCompass;
import org.axsl.value.ShadowEffect;
@@ -4084,7 +4085,7 @@
}
/**
- * Returns the pitch property.
+ * Returns the absolute value (if any) of the pitch property.
* @param fobj The FoObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context issues.
* @return The pitch property.
@@ -4092,12 +4093,26 @@
public double traitPitch(final FoObj fobj, final FoContext context) {
final PdPitch property = (PdPitch) getProperty(FoPropertyId.PITCH);
if (property != null) {
- return property.getValue(context, fobj);
+ return property.getValueAbsolute(context, fobj);
}
- return PdPitch.getValueNoInstance(context, fobj);
+ return PdPitch.getValueNoInstanceAbsolute(context, fobj);
}
/**
+ * Returns the relative value (if any) of the pitch property.
+ * @param fobj The FoObj to which the property belongs.
+ * @param context An object that knows how to resolve FO Tree context issues.
+ * @return The pitch property.
+ */
+ public PitchRelative traitPitchRelative(final FoObj fobj, final FoContext context) {
+ final PdPitch property = (PdPitch) getProperty(FoPropertyId.PITCH);
+ if (property != null) {
+ return property.getValueRelative(context, fobj);
+ }
+ return PdPitch.getValueNoInstanceRelative(context, fobj);
+ }
+
+ /**
* Returns the pitch-range property.
* @param fobj The FoObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context issues.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java 2022-12-13 12:43:11 UTC (rev 12848)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java 2022-12-13 17:45:47 UTC (rev 12849)
@@ -37,7 +37,7 @@
import org.foray.fotree.value.PropertyValue;
import org.axsl.fotree.FoContext;
-import org.axsl.speech.Voice;
+import org.axsl.value.PitchRelative;
/**
* The "pitch" property in XSL-FO.
@@ -99,7 +99,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public double getValue(final FoContext context, final FoObj fobj) {
+ public double getValueAbsolute(final FoContext context, final FoObj fobj) {
if (value() instanceof DtFrequency) {
return ((DtFrequency) value()).getValue();
}
@@ -106,30 +106,33 @@
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
if (keyword == FoValue.INHERIT) {
- return getValueNoInstance(context, fobj);
+ return getValueNoInstanceAbsolute(context, fobj);
}
+ }
+ throw this.unexpectedRetrieval();
+ }
- final Voice voice = fobj.getVoice(context);
+ /**
+ * Returns the value of this property.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param fobj The FO for which this value is needed.
+ * @return The value of this property.
+ */
+ public PitchRelative getValueRelative(final FoContext context, final FoObj fobj) {
+ if (value().canEvalKeyword()) {
+ final FoValue keyword = this.convertValueToFoValue(value());
+ if (keyword == FoValue.INHERIT) {
+ return getValueNoInstanceRelative(context, fobj);
+ }
+
switch (keyword) {
- case X_LOW: {
- return voice.pitchExtraLow();
+ case X_LOW: return PitchRelative.X_LOW;
+ case LOW: return PitchRelative.LOW;
+ case MEDIUM: return PitchRelative.MEDIUM;
+ case HIGH: return PitchRelative.HIGH;
+ case X_HIGH: return PitchRelative.X_HIGH;
+ default: throw this.unexpectedRetrieval();
}
- case LOW: {
- return voice.pitchLow();
- }
- case MEDIUM: {
- return voice.pitchMedium();
- }
- case HIGH: {
- return voice.pitchHigh();
- }
- case X_HIGH: {
- return voice.pitchExtraHigh();
- }
- default: {
- throw this.unexpectedRetrieval();
- }
- }
}
throw this.unexpectedRetrieval();
}
@@ -140,16 +143,28 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static double getValueNoInstance(final FoContext context,
- final FoObj fobj) {
+ public static double getValueNoInstanceAbsolute(final FoContext context, final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
return parent.traitPitch(context);
}
- final Voice voice = fobj.getVoice(context);
- return voice.pitchMedium();
+ return Double.NEGATIVE_INFINITY;
}
+ /**
+ * Returns the default (initial) value for this property.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param fobj The FO for which this value is needed.
+ * @return The initial value for this property.
+ */
+ public static PitchRelative getValueNoInstanceRelative(final FoContext context, final FoObj fobj) {
+ final FoObj parent = fobj.effectiveParent(context);
+ if (parent != null) {
+ return parent.traitPitchRelative(context);
+ }
+ return PitchRelative.MEDIUM;
+ }
+
@Override
protected FoValue[] getValidKeywords() {
return PdPitch.VALID_KEYWORDS;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|