Revision: 6984
Author: victormote
Date: 2006-03-19 18:25:17 -0800 (Sun, 19 Mar 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=6984&view=rev
Log Message:
-----------
Add overloaded method for normalized input.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontFamily.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontFamily.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontFamily.java 2006-03-20 02:24:44 UTC (rev 6983)
+++ trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontFamily.java 2006-03-20 02:25:17 UTC (rev 6984)
@@ -93,21 +93,43 @@
if (fontStretch < 0) {
fontStretch = org.axsl.font.Font.FONT_STRETCH_NORMAL;
}
- RegisteredFontDesc description = new RegisteredFontDesc(registeredFont,
- this, encoding, fontStyle, fontWeight, fontVariant,
- fontStretch);
- float percent = convertPercent(simulatedSmallCaps);
- description.setSimulateSmallCaps(percent);
- percent = convertPercent(simulatedOblique);
- description.setSimulateOblique(percent);
- percent = convertPercent(simulatedBackslant);
- description.setSimulateBackslant(percent);
+ float simSmallCaps = convertPercent(simulatedSmallCaps);
+ float simOblique = convertPercent(simulatedOblique);
+ float simBackslant = convertPercent(simulatedBackslant);
+ float[] simStretch = new float[8];
+ for (int i = 0; i < simStretch.length; i++) {
+ simStretch[i] = Float.NaN;
+ }
if (simulatedStretch != null) {
- for (int i = 0; i < simulatedStretch.length; i++) {
- percent = convertPercent(simulatedStretch[i]);
- description.setSimulateStretch(i, percent);
+ for (int i = 0; i < simStretch.length; i++) {
+ if (i < simulatedStretch.length) {
+ simStretch[i] = convertPercent(simulatedStretch[i]);
+ }
}
}
+ registerFontDesc(registeredFont, encoding, fontStyle, fontWeight,
+ fontVariant, fontStretch, simSmallCaps, simOblique,
+ simBackslant, simStretch);
+ }
+
+ /**
+ * Maps a font-description to a RegisteredFont for this font-family.
+ * @param style The style (normal, italic, etc.).
+ * @param weight The weight (normal, bold, 100, etc.).
+ * @param registeredFont the RegisteredFont that should be supplied when
+ * a font matching this description is requested.
+ */
+ protected void registerFontDesc(RegisteredFont registeredFont,
+ Encoding encoding, byte style, short weight, byte variant,
+ byte stretch, float simulatedSmallCaps, float simulatedOblique,
+ float simulatedBackslant, float[] simulatedStretch)
+ throws FontException {
+ RegisteredFontDesc description = new RegisteredFontDesc(registeredFont,
+ this, encoding, style, weight, variant, stretch);
+ description.setSimulateSmallCaps(simulatedSmallCaps);
+ description.setSimulateOblique(simulatedOblique);
+ description.setSimulateBackslant(simulatedBackslant);
+ description.setSimulateStretch(simulatedStretch);
for (int i = 0; i < fontDescriptions.size(); i++) {
RegisteredFontDesc registeredDesc
= (RegisteredFontDesc) fontDescriptions.get(i);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|