flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Improvement, but probably still needs more work
Date Mon, 31 Jul 2017 12:25:15 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 6bd14d2f1 -> 8ce67e226


Improvement, but probably still needs more work


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8ce67e22
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8ce67e22
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8ce67e22

Branch: refs/heads/develop
Commit: 8ce67e22618d74e2f5fef99a818fad78685786ad
Parents: 6bd14d2
Author: Harbs <harbs@in-tools.com>
Authored: Mon Jul 31 15:25:11 2017 +0300
Committer: Harbs <harbs@in-tools.com>
Committed: Mon Jul 31 15:25:11 2017 +0300

----------------------------------------------------------------------
 .../textLayout/elements/utils/GeometricElementUtils.as    |  7 +++++++
 .../flex/org/apache/flex/text/engine/ElementFormat.as     | 10 ++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8ce67e22/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/utils/GeometricElementUtils.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/utils/GeometricElementUtils.as
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/utils/GeometricElementUtils.as
index b31a6c0..225e15b 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/utils/GeometricElementUtils.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/utils/GeometricElementUtils.as
@@ -37,6 +37,8 @@ package org.apache.flex.textLayout.elements.utils
 	import org.apache.flex.textLayout.formats.TLFTypographicCase;
 	import org.apache.flex.textLayout.formats.TextLayoutFormat;
 	import org.apache.flex.textLayout.utils.LocaleUtil;
+	import org.apache.flex.textLayout.elements.ITextFlow;
+	import org.apache.flex.textLayout.factory.TLFFactory;
 	public class GeometricElementUtils
 	{
 		/** @private */
@@ -183,6 +185,11 @@ package org.apache.flex.textLayout.elements.utils
 			var fd:FontDescription = new FontDescription();
 			fd.fontStyle = computedFormat.fontStyle;
 			fd.fontName = computedFormat.fontFamily;
+			var tf:ITextFlow = para.getTextFlow();
+			if(tf)
+				fd.fontLoader = tf.tlfFactory.textFactory.getFontLoader();
+			else
+				fd.fontLoader = TLFFactory.defaultTLFFactory.textFactory.getFontLoader();
 //			fd.renderingMode = computedFormat.renderingMode;
 //			fd.cffHinting = computedFormat.cffHinting;
 			

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8ce67e22/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
index 1ef20ed..d5ab61c 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
@@ -19,6 +19,9 @@
 package org.apache.flex.text.engine
 {
 	import org.apache.flex.geom.Rectangle;
+	import org.apache.flex.debugging.assert;
+	import org.apache.flex.text.engine.IFont;
+	import org.apache.flex.text.engine.FontMetrics;
 	
 	public class ElementFormat
 	{
@@ -82,10 +85,9 @@ package org.apache.flex.text.engine
  	 	
 		public function getFontMetrics():FontMetrics
 		{
-			var fm:FontMetrics = new FontMetrics();
-			// just a guess for now
-			fm.emBox = new Rectangle(0, 1.2 - fontSize, fontSize, 1.2);
-			return fm;
+			assert(fontDescription != null,"fontDescription not assigned!");
+			var metrics:FontMetrics = fontDescription.fontLoader.getFont(fontDescription.fontName,fontDescription.fontStyle).fontMetrics;
+			return metrics.getScaledMetrics(fontSize);
 		}
 	}
 }
\ No newline at end of file


Mime
View raw message