Skip to main content
Participant
October 20, 2009
Answered

TextLayoutFormat Properties : Some work, some don't

  • October 20, 2009
  • 2 replies
  • 1320 views

I have been working with the TLF for the past week and a half. It started out quite rocky do to the various version differences. I tried, in Flex 3, the Beta 2 SDK (4.0.0.10485) and later builds to embed fonts with no success even with the ‘cff’ changed to ‘embedAsCFF’ the font swf would still fail to embed properly. I even tried the same process in Flash Builder 4 with no such luck.

I finally came to a working embed / loading scheme.
                                                                                                                                                                                                                                                        
To embed fonts I am using Flex 3 with the Adobe MAX 2008 SDK (4.0.0.4021) with this method :

[Embed(source="fonts/AdobeHebrew-Regular.otf", mimeType="application/x-font", fontFamily="_AdobeHebrewEmbeddedFont", cff="true")]
public static var _AdobeHebrewEmbeddedFont:Class;

As for the TLF I have been using the swc included in the Adobe Flash Builder Plug-in Beta 2 build with great success. There are a few things that don’t seem to be working and I was wondering if I can get some input from other people that may be running into the same issues. Perhaps I should be using a newer version of the TLF like nightly builds?

This is pretty much just an output of all the methods I have tested in the TextLayoutFormat class. Some work some don’t. Maybe some are dependent on the other? Any insight would be greatly appreciated. Thanks in advance.

steve

//Layout format
var objLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
     
objLayoutFormat.direction = Direction.RTL; //works
                 
//objLayoutFormat.paddingLeft = 15; //works
//objLayoutFormat.paddingTop = 15; //works
//objLayoutFormat.paddingRight = 15; //works
//objLayoutFormat.paddingBottom = 15; //works
           
//objLayoutFormat.textIndent = 2; //works
//objLayoutFormat.textDecoration = TextDecoration.NONE; //works
//objLayoutFormat.textRotation = TextRotation.ROTATE_180; //works
//objLayoutFormat.textAlign = TextAlign.CENTER; //works
//objLayoutFormat.textAlignLast = TextAlign.JUSTIFY; //nope
objLayoutFormat.textAlpha = 1; //works
           
objLayoutFormat.fontFamily = "_AdobeHebrewEmbeddedFont"; //works
objLayoutFormat.fontLookup = FontLookup.EMBEDDED_CFF; //works
objLayoutFormat.fontSize = 20; //works
objLayoutFormat.fontStyle = FontPosture.NORMAL; //works assuming the font supports it
objLayoutFormat.fontWeight = FontWeight.NORMAL; //works assuming the font supports it
objLayoutFormat.renderingMode = RenderingMode.CFF; //works
objLayoutFormat.cffHinting = CFFHinting.HORIZONTAL_STEM; //works
           
objLayoutFormat.color = 0xFFFFFF; //works
//objLayoutFormat.backgroundAlpha = 1; //nope
//objLayoutFormat.backgroundColor = 0x000000; //nope
                 
//objLayoutFormat.paragraphStartIndent = 10; //works
//objLayoutFormat.paragraphEndIndent = 50; //works
//objLayoutFormat.paragraphSpaceBefore = 20; //nope
//objLayoutFormat.paragraphSpaceAfter = 100; //nope
//objLayoutFormat.justificationRule = JustificationRule.SPACE; //nope
//objLayoutFormat.breakOpportunity = BreakOpportunity.ANY; //works
                 
//objLayoutFormat.kerning = Kerning.AUTO; //works assuming the font has the kerning table
//objLayoutFormat.trackingRight = 2; //works
//objLayoutFormat.trackingLeft = 2; //works
//objLayoutFormat.leadingModel = LeadingModel.AUTO; //works
//objLayoutFormat.whiteSpaceCollapse = WhiteSpaceCollapse.COLLAPSE; //nope
                 
//objLayoutFormat.digitCase = DigitCase.DEFAULT; //works assuming the font has that ability
//objLayoutFormat.digitWidth = DigitWidth.TABULAR; //works
objLayoutFormat.ligatureLevel = LigatureLevel.COMMON;
objLayoutFormat.locale = "en";
//objLayoutFormat.typographicCase = TLFTypographicCase.LOWERCASE; //works
//objLayoutFormat.justificationStyle
//objLayoutFormat.textJustify
//objLayoutFormat.columnCount
//objLayoutFormat.columnGap = 60; //works
//objLayoutFormat.columnWidth = 40; //works
                 
//objLayoutFormat.lineHeight = "80%"; //works
objLayoutFormat.lineBreak = LineBreak.TO_FIT; //works
//objLayoutFormat.lineThrough = true; //works
                 
objLayoutFormat.blockProgression = BlockProgression.TB; //nope
                 
//objLayoutFormat.verticalAlign = VerticalAlign.BOTTOM; //works
//objLayoutFormat.firstBaselineOffset = BaselineOffset.LINE_HEIGHT; //works
//objLayoutFormat.alignmentBaseline = TextBaseline.USE_DOMINANT_BASELINE; //works
//objLayoutFormat.dominantBaseline = TextBaseline.IDEOGRAPHIC_BOTTOM; //works
//objLayoutFormat.baselineShift = 20; //works

This topic has been closed for replies.
Correct answer GordonSmith

Your code doesn't indicate what kind of FlowElement you're applying the TextLayoutFormat to, or what text you're rendering. For example, backgroundColor does not inherit from parent FlowElement to child FlowElement and therefore must be applied to a SpanElement rather than a TextFlow.

Gordon Smith

Adobe Flex SDK Team

2 replies

GordonSmithCorrect answer
Participating Frequently
October 21, 2009

Your code doesn't indicate what kind of FlowElement you're applying the TextLayoutFormat to, or what text you're rendering. For example, backgroundColor does not inherit from parent FlowElement to child FlowElement and therefore must be applied to a SpanElement rather than a TextFlow.

Gordon Smith

Adobe Flex SDK Team

nurgeAuthor
Participant
October 21, 2009

the text I'm rendering :

this._strHebrewText = "\u05DB\u05DC\u0020\u05D1\u05E0\u05D9\u0020\u05D0\u05D3\u05DD\u0020\u05E0\u05D5\u05DC\u05D3\u05D5\u0020\u05D1\u05E0\u05D9\u0020\u05D7\u05D5\u05E8\u05D9\u05DF\u0020\u05D5\u05E9\u05D5\u05D5\u05D9\u05DD\u0020\u05D1\u05E2\u05E8\u05DB\u05DD\u0020\u05D5\u05D1\u05D6\u05DB\u05D5\u05D9\u05D5\u05EA\u05D9\u05D4\u05DD\u002E\u0020\u05DB\u05D5\u05DC\u05DD\u0020\u05D7\u05D5\u05E0\u05E0\u05D5\u0020\u05D1\u05EA\u05D1\u05D5\u05E0\u05D4\u0020 \r \u05D5\u05D1\u05DE\u05E6\u05E4\u05D5\u05DF\u002C\u0020\u05DC\u05E4\u05D9\u05DB\u05DA\u0020\u05D7\u05D5\u05D1\u05D4\u0020\u05E2\u05DC\u05D9\u05D4\u05DD\u0020\u05DC\u05E0\u05D4\u05D5\u05D2\u0020\u05D0\u05D9\u05E9\u0020\u05D1\u05E8\u05E2\u05D4\u05D5\u0020\u05D1\u05E8\u05D5\u05D7\u0020\u05E9\u05DC\u0020\u05D0\u05D7\u05D5\u05D4\u002E";

the FlowElement :

//Adds the layout to the TextFlow
objTextFlow.hostFormat = objLayoutFormat;
           
var objParagraphElement:ParagraphElement = new ParagraphElement();
var objSpanElement:SpanElement = new SpanElement();
           
objSpanElement.text = this._strHebrewText;
objParagraphElement.addChildAt(0, objSpanElement);
objTextFlow.addChildAt(0, objParagraphElement);
           
objTextFlow.flowComposer.addController(new ContainerController(this._sprSprite, this.label2.width, this.label2.height));
objTextFlow.flowComposer.updateAllControllers();

So if I am understanding this corectly the hostFormat does not trickle down to the SpanElement. I have to format the SpanElement directly. I'm assuming this is so you can have multiple formats within the paragraph or flow?

btw i added :

objSpanElement.backgroundColor = 0xCCFF22;

I was able to get the backgroundColor so thank you for the response.

Adobe Employee
October 21, 2009

For all the properties you'lll need to carefully read the docs to understand how they work.  Some properties inherit by default - others use the default value when not specified.  As Gordon points out you don't say where you set the format.

blockProgression only has effect when set on the TextFlow.

paragraph*Indent and paragraphSpace* properties only apply to ParagraphElements

Participant
October 21, 2009

Same problem here...

impossible to make backgroundColor work.

Any Idea ?