Archive for November, 2010

Padding Changes in TLF 2.0

TLF has 4 padding properties: paddingLeft, paddingRight, paddingTop and paddingBottom. In TLF 1.0 the padding properties only applied to TextFlow and ContainerController objects. The effective padding on each side of each container is the sum of the two paddings.

TLF 2.0 adds additional support for padding on DivElements, ParagraphElements, InlineGraphicElements as well as the new list related elements ListElement and ListItemElement. Each element will have a padding specified inset around it.

During import of TLF markup padding properties are ignored on these additional classes unless the attribute version="2.0.0" is specified on the TextFlow tag. The goal is that existing markup won’t render differently if padding properties were specified on elements that didn’t implement padding in 1.0.

The padding properties don’t inherit by default. If not specified they have their default value. In 1.0 and 1.1 the default value was "0". In TLF 2.0 this default value is "auto". For all elements except ListElement "auto" is interpreted as "0".

For ListElements "auto" is "0" except on the start side of the list where the value of the new listAutoPadding property is used. The default value of listAutoPadding is 40. This was done to give lists a default indent.

The following markup creates a list with the marker placed outside the box of the ListItem.

<TextFlow><list><li>First list item</li></list></TextFlow>

Without listAutoPadding the list item would have no padding and the marker would be to the left of the clip and would not be visible. TLF 2.0 applies the listAutoPadding to the start side and indents the list 40 pixels and places the outside marker in the visible area to the left side of the indentation.

Word spacing

Word spacing is a new feature that allows you to better control the how much space is left between words. In unjustified text, the space between words is set by the size of the space character in the font. Different fonts may look better with more or less space, and so the font designer specifies a preferred width for the space the font is created. But you can choose to have your text set looser or tighter by adjusting the space between the words as a percentage of what is defined in the font.

In justified text, the text is aligned on both edges to the margin, and the width of the spaces is adjusted to make this happen. Spaces may be compressed or expanded so that the text may best fit the column. Now you can control the minimum and maximum size of the spaces in justified text, as a percentage of the size of the space in the font.

The new property is called wordSpacing. It goes on paragraphs (or it can be inherited from the TextFlow, div or list that the paragraph is in) and it is an array of three percentages. The first is the desired or optimal space width. The second is the minimum space width, and the last is the maximum space width. Continue reading…

Box Leading Model

The leadingModel property controls the placement of lines, and we’ve added a new possible value for it — “box”. The box leading model approximates how lines are laid out in the browser. TLF’s default leading model is a baseline-to-baseline model that allows designers to exactly specify the distance from one baseline to the next, but it doesn’t allow “corrections” for situations the designer may not have envisioned or planned for, such as extra space required for superscripts, subscripts, or inline graphics. With the box leading model, TLF calculates the “natural” bounding box of the line, based on the size and vertical locations of the items in the line. Then it places the line using the maximum of the line height and natural height, so you can add space between the lines by adjusting the line height, but the space will never be smaller than the natural height.

You should consider using the new box leading model if you more concerned about lines overlapping than you are about uneven spacing. In particular, I would suggest using it if you are having problems with inline graphics, baselineShifts, or other content that may cause lines to overlap. Continue using the existing leading models if it is more important to have all lines spaced evenly. Continue reading…

Custom Clipboard Formats

Ever wished you could copy and paste using more clipboard formats? We do too. We haven’t had the time to add new converters for this release, but we did the next best thing. We added the ability for an application to add its own text converters, which can then be used to either paste data that was posted to the clipboard, or copy data from TLF to the clipboard. This allows you to add new formats — for instance, RTF or HTML — and have them work in copy/paste with other applications. Continue reading…

TLF 1.1 and 2.0 TextLayoutEditor Demo Source

Quick updates on links to the TextLayoutEditor demo source.

TLF 1.1 was included in Flex 4.1.  The complete source for the TextLayoutEditor is posted here:

TLF 2.0 is in development and will be part of Flex 4.5.  The TLF sourceforge site is being updated with changes on a regular basis.

Not quite as frequently a single zip containing all TLF sources and the TextLayoutEditor demo source is posted here:

During development we are trying to minimize changes to the API – that said there are changes in 1.1 and 2.0 and updates to the TextLayoutEditor demo are made as needed.  Check the ReleaseNotes.txt file for more information on specific changes.