This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 77ecd3a Added xScale and yScale
77ecd3a is described below
commit 77ecd3a87ad9fe2edc585e35117ce38aa97febd2
Author: Harbs <[email protected]>
AuthorDate: Fri Nov 17 10:22:03 2017 +0200
Added xScale and yScale
---
.../royale/textLayout/compose/BaseCompose.as | 2 +-
.../royale/textLayout/compose/TextFlowLine.as | 2 +-
.../royale/textLayout/elements/FlowLeafElement.as | 14 +++--
.../royale/textLayout/elements/IFlowElement.as | 2 +
.../elements/utils/GeometricElementUtils.as | 6 +-
.../royale/textLayout/formats/ITextLayoutFormat.as | 28 ++++++++++
.../royale/textLayout/formats/TextLayoutFormat.as | 64 ++++++++++++++++++++++
.../textLayout/formats/TextLayoutFormatBase.as | 46 ++++++++++++++++
8 files changed, 155 insertions(+), 9 deletions(-)
diff --git
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/compose/BaseCompose.as
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/compose/BaseCompose.as
index df426e0..40d21f1 100644
---
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/compose/BaseCompose.as
+++
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/compose/BaseCompose.as
@@ -2110,7 +2110,7 @@ package org.apache.royale.textLayout.compose
// adjust for the NumberLine
if (effectiveListMarkerFormat)
- _curLineLeading =
Math.max(_curLineLeading,TextLayoutFormat.lineHeightProperty.computeActualPropertyValue(effectiveListMarkerFormat.lineHeight,
effectiveListMarkerFormat.fontSize));
+ _curLineLeading =
Math.max(_curLineLeading,TextLayoutFormat.lineHeightProperty.computeActualPropertyValue(effectiveListMarkerFormat.lineHeight,
effectiveListMarkerFormat.fontSize * effectiveListMarkerFormat.yScale));
return 0;
}
diff --git
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/compose/TextFlowLine.as
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/compose/TextFlowLine.as
index add9aed..d9c78b1 100644
---
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/compose/TextFlowLine.as
+++
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/compose/TextFlowLine.as
@@ -1194,7 +1194,7 @@ package org.apache.royale.textLayout.compose
// for lines that contain only a float (which
can otherwise recurse infinitely), and TCY spans in vertical text.
var elemLeading:Number =
elem.getEffectiveLineHeight(bp);
if (!elemLeading && elem.textLength ==
this.textLength)
- elemLeading =
TextLayoutFormat.lineHeightProperty.computeActualPropertyValue(elem.computedFormat.lineHeight,
elem.computedFormat.fontSize);
+ elemLeading =
TextLayoutFormat.lineHeightProperty.computeActualPropertyValue(elem.computedFormat.lineHeight,
elem.computedFormat.fontSize * elem.computedFormat.yScale);
totalLeading = Math.max(totalLeading,
elemLeading);
elemStart += elem.textLength;
if (elemStart >= endPos)
diff --git
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/FlowLeafElement.as
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/FlowLeafElement.as
index 70a8fb2..02c4e99 100644
---
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/FlowLeafElement.as
+++
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/FlowLeafElement.as
@@ -336,10 +336,10 @@ package org.apache.royale.textLayout.elements
COMPILE::JS
{
var metrics:FontMetrics = ef.getFontMetrics();
- metrics.underlineOffset *= ef.fontSize;
- metrics.underlineThickness *= ef.fontSize;
- metrics.strikethroughOffset *= ef.fontSize;
- metrics.strikethroughThickness *= ef.fontSize;
+ metrics.underlineOffset *= ef.fontSize *
ef.yScale;
+ metrics.underlineThickness *= ef.fontSize *
ef.yScale;
+ metrics.strikethroughOffset *= ef.fontSize *
ef.yScale;
+ metrics.strikethroughThickness *= ef.fontSize *
ef.yScale;
return metrics;
}
}
@@ -414,10 +414,12 @@ package org.apache.royale.textLayout.elements
return
GeometricElementUtils.getCSSInlineBoxHelper(computedFormat,
getComputedFontMetrics(), textLine, para);
}
- /** Returns the fontSize from this element's properties.
@private */
+ /** Returns the fontSize from this element's properties.
+ * We multiply by yScale because the important dimension of the
font size is the vertical size.
+ * @private */
public function getEffectiveFontSize():Number
{
- return Number(computedFormat.fontSize);
+ return Number(computedFormat.fontSize *
computedFormat.yScale);
}
/** @private */
CONFIG::debug
diff --git
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/IFlowElement.as
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/IFlowElement.as
index a3a7c14..41f5ee5 100644
---
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/IFlowElement.as
+++
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/IFlowElement.as
@@ -106,6 +106,8 @@ package org.apache.royale.textLayout.elements
function set listMarkerFormat(listMarkerFormat:*):void;
function calculateComputedFormat():ITextLayoutFormat;
function set fontSize(value:*):void;
+ function set xScale(value:*):void;
+ function set yScale(value:*):void;
function set columnWidth(columnWidthValue:*):void;
}
}
diff --git
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/utils/GeometricElementUtils.as
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/utils/GeometricElementUtils.as
index df5a440..26d1717 100644
---
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/utils/GeometricElementUtils.as
+++
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/elements/utils/GeometricElementUtils.as
@@ -80,7 +80,7 @@ package org.apache.royale.textLayout.elements.utils
var ascent:Number = -emBox.top;
var descent:Number = emBox.bottom;
var textHeight:Number = emBox.height;
-
+ //TODO deal with horizontalScale and verticalScale
var fontSize:Number = computedFormat.fontSize;
var lineHeight:Number =
TextLayoutFormat.lineHeightProperty.computeActualPropertyValue(computedFormat.lineHeight,
fontSize);
var halfLeading:Number = (lineHeight - textHeight) / 2;
@@ -144,8 +144,11 @@ package org.apache.royale.textLayout.elements.utils
format.digitWidth =
computedFormat.digitWidth;
format.ligatureLevel =
computedFormat.ligatureLevel;
format.fontSize =
Number(computedFormat.fontSize);
+ format.xScale =
Number(computedFormat.xScale);
+ format.yScale =
Number(computedFormat.yScale);
format.kerning =
computedFormat.kerning;
format.locale =
computedFormat.locale;
+ //TODO adjust tracking based on xScale? Maybe it can be
handled downstream.
format.trackingLeft =
TextLayoutFormat.trackingLeftProperty.computeActualPropertyValue(computedFormat.trackingLeft,format.fontSize);
format.trackingRight =
TextLayoutFormat.trackingRightProperty.computeActualPropertyValue(computedFormat.trackingRight,format.fontSize);
format.textRotation =
computedFormat.textRotation;
@@ -219,6 +222,7 @@ package org.apache.royale.textLayout.elements.utils
//Since getFontMetrics returns the value of
blockElement.elementFormat.getFontMetrics(), we cannot call this
//until after the element has been set. Watson 1820571
- gak 06.11.08
// Adjust format for superscript/subscript
+ //TODO adjust for x/y scale too? Not sure...
if (computedFormat.baselineShift ==
BaselineShift.SUPERSCRIPT ||
computedFormat.baselineShift ==
BaselineShift.SUBSCRIPT)
{
diff --git
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/ITextLayoutFormat.as
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/ITextLayoutFormat.as
index 15bba57..92a0120 100644
---
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/ITextLayoutFormat.as
+++
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/ITextLayoutFormat.as
@@ -187,6 +187,34 @@ package org.apache.royale.textLayout.formats
function get fontSize():*;
/**
+ * The horizontal scale of the text as a multiplier.
+ * <p>Legal values are numbers from 0.01 to 100 and
FormatValue.INHERIT.</p>
+ * <p>Default value is undefined indicating not set.</p>
+ * <p>If undefined during the cascade this property will
inherit its value from an ancestor. If no ancestor has set this property, it
will have a value of 1.</p>
+ *
+ * @throws RangeError when set value is not within range for
this property
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function get xScale():*;
+
+ /**
+ * The vertical scale of the text as a multiplier.
+ * <p>Legal values are numbers from 0.01 to 100 and
FormatValue.INHERIT.</p>
+ * <p>Default value is undefined indicating not set.</p>
+ * <p>If undefined during the cascade this property will
inherit its value from an ancestor. If no ancestor has set this property, it
will have a value of 1.</p>
+ *
+ * @throws RangeError when set value is not within range for
this property
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function get yScale():*;
+
+ /**
* Amount to shift the baseline from the
<code>dominantBaseline</code> value. Units are in pixels, or a percentage of
<code>fontSize</code> (in which case, enter a string value, like 140%).
Positive values shift the line up for horizontal text (right for vertical) and
negative values shift it down for horizontal (left for vertical).
* <p>Legal values are BaselineShift.SUPERSCRIPT,
BaselineShift.SUBSCRIPT, FormatValue.INHERIT.</p>
* <p>Legal values as a number are from -1000 to 1000.</p>
diff --git
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/TextLayoutFormat.as
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/TextLayoutFormat.as
index 51c8534..4017fc9 100644
---
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/TextLayoutFormat.as
+++
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/TextLayoutFormat.as
@@ -148,6 +148,26 @@ package org.apache.royale.textLayout.formats
}
/** @private */
+ static private var _xScaleProperty:Property;
+
+ static public function get xScaleProperty():Property
+ {
+ if (!_xScaleProperty)
+ _xScaleProperty =
PropertyFactory.number("xScale", 1, true,
Vector.<String>([Category.CHARACTER]), 0.01, 100);
+ return _xScaleProperty;
+ }
+
+ /** @private */
+ static private var _yScaleProperty:Property;
+
+ static public function get yScaleProperty():Property
+ {
+ if (!_yScaleProperty)
+ _yScaleProperty =
PropertyFactory.number("yScale", 1, true,
Vector.<String>([Category.CHARACTER]), 0.01, 100);
+ return _yScaleProperty;
+ }
+
+ /** @private */
static private var _baselineShiftProperty:Property;
static public function get baselineShiftProperty():Property
@@ -1744,6 +1764,50 @@ package org.apache.royale.textLayout.formats
}
/**
+ * The horizontal scale of the text as a multiplier.
+ * <p>Legal values are numbers from 0.01 to 100 and
FormatValue.INHERIT.</p>
+ * <p>Default value is undefined indicating not set.</p>
+ * <p>If undefined during the cascade this property will
inherit its value from an ancestor. If no ancestor has set this property, it
will have a value of 1.</p>
+ *
+ * @throws RangeError when set value is not within range for
this property
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get xScale():*
+ {
+ return _styles.xScale;
+ }
+
+ public function set xScale(value:*):void
+ {
+ setStyleByProperty(TextLayoutFormat.xScaleProperty,
value);
+ }
+
+ /**
+ * The vertical scale of the text as a multiplier.
+ * <p>Legal values are numbers from 0.01 to 100 and
FormatValue.INHERIT.</p>
+ * <p>Default value is undefined indicating not set.</p>
+ * <p>If undefined during the cascade this property will
inherit its value from an ancestor. If no ancestor has set this property, it
will have a value of 1.</p>
+ *
+ * @throws RangeError when set value is not within range for
this property
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get yScale():*
+ {
+ return _styles.yScale;
+ }
+
+ public function set yScale(value:*):void
+ {
+ setStyleByProperty(TextLayoutFormat.yScaleProperty,
value);
+ }
+
+ /**
* Amount to shift the baseline from the
<code>dominantBaseline</code> value. Units are in pixels, or a percentage of
<code>fontSize</code> (in which case, enter a string value, like 140%).
Positive values shift the line up for horizontal text (right for vertical) and
negative values shift it down for horizontal (left for vertical).
* <p>Legal values are BaselineShift.SUPERSCRIPT,
BaselineShift.SUBSCRIPT, FormatValue.INHERIT.</p>
* <p>Legal values as a number are from -1000 to 1000.</p>
diff --git
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/TextLayoutFormatBase.as
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/TextLayoutFormatBase.as
index fe86c1a..cca31e1 100644
---
a/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/TextLayoutFormatBase.as
+++
b/frameworks/projects/TLF/src/main/royale/org/apache/royale/textLayout/formats/TextLayoutFormatBase.as
@@ -325,6 +325,52 @@ package org.apache.royale.textLayout.formats
/**
* TextLayoutFormat:
+ * The horizontal scale of the text as a multiplier.
+ * <p>Legal values are numbers from 0.01 to 100 and
FormatValue.INHERIT.</p>
+ * <p>Default value is undefined indicating not set.</p>
+ * <p>If undefined during the cascade this property will
inherit its value from an ancestor. If no ancestor has set this property, it
will have a value of 1.</p>
+ *
+ * @throws RangeError when set value is not within range for
this property
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get xScale():*
+ {
+ return _format ? _format.xScale : undefined;
+ }
+ public function set xScale(xScaleValue:*):void
+ {
+ writableTextLayoutFormat().xScale = xScaleValue;
+ formatChanged();
+ }
+
+ /**
+ * TextLayoutFormat:
+ * The vertical scale of the text as a multiplier.
+ * <p>Legal values are numbers from 0.01 to 100 and
FormatValue.INHERIT.</p>
+ * <p>Default value is undefined indicating not set.</p>
+ * <p>If undefined during the cascade this property will
inherit its value from an ancestor. If no ancestor has set this property, it
will have a value of 1.</p>
+ *
+ * @throws RangeError when set value is not within range for
this property
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get yScale():*
+ {
+ return _format ? _format.yScale : undefined;
+ }
+ public function set yScale(yScaleValue:*):void
+ {
+ writableTextLayoutFormat().yScale = yScaleValue;
+ formatChanged();
+ }
+
+ /**
+ * TextLayoutFormat:
* Amount to shift the baseline from the
<code>dominantBaseline</code> value. Units are in pixels, or a percentage of
<code>fontSize</code> (in which case, enter a string value, like 140%).
Positive values shift the line up for horizontal text (right for vertical) and
negative values shift it down for horizontal (left for vertical).
* <p>Legal values are BaselineShift.SUPERSCRIPT,
BaselineShift.SUBSCRIPT, FormatValue.INHERIT.</p>
* <p>Legal values as a number are from -1000 to 1000.</p>
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].