TextLayoutFormat.fontFamily is null for a selection containing multiple fonts
first use richeditabletext.getformatofrange() retreive textlayoutformat object. attempt determine fonts used in selection textlayoutformat.fontfamily. works fine if 1 font set on selection. however, if type in 1 font, change font , type more, , select text containing both fonts, textlayoutformat.fontfamily return null. hope return comma-separated list or array of fonts used in selection. known bug/limitation, , if so, there workaround or plan address in future? kind of thing common use case our rich text input, , need figure out fonts selected.
i still using tlf framework came flex 4.0.
adam
that's design. property undefined when multi valued. comma separated list wouldn't work anyhow that's legal value fontfamily - understand point in general. want array each multi-valued property.
getformatofrange calling underlying selectionmanager function getcommoncharacterformat.
this code looks this:
public function getcommoncharacterformat():textlayoutformat
{
var firstleaf:flowleafelement = textflow.findleaf(absolutestart);
var lastleaf:flowleafelement = textflow.findleaf(absoluteend);
var leaf:flowleafelement = firstleaf;
var attr:textlayoutformat = new textlayoutformat(leaf.computedformat);
(;;)
{
if (leaf == lastleaf)
break;
leaf = leaf.getnextleaf();
attr.removeclashing(leaf.computedformat);
}
return property.extractincategory(textlayoutformat, textlayoutformat.description, attr, category.character) textlayoutformat;
}
for specialized behavior i'd suggest writing new version of function takes textflow, absolutestart , absoluteend parameters , makes calculation. instead of returning textlayoutformat dictionary more appropriate.
hope helps,
richard
More discussions in Text Layout Framework
adobe
Comments
Post a Comment