开发者

Data from TLF TextLine

开发者 https://www.devze.com 2023-03-09 22:02 出处:网络
i have some problem with utilizing TLF, i need to parse through the text and get x and y for each character inside the textfield. This is what i have so far...

i have some problem with utilizing TLF, i need to parse through the text and get x and y for each character inside the textfield. This is what i have so far...

Getting every TextLine from the TextFlow:

if (textflow.flowComposer) {
    for (var i:int = 0; i < textflow.flowComposer.numLines; i++) {
         var flowLine:TextFlowLine = textflow.flowComposer.findLineAtPosition(i);
         var textLine:TextLine = flowLine.getTextLine(true);
    }
}

Getting every "atom" for the TextLine:

var charPosition:int = textLine.textBlockBeginIndex;
while (charPosition < textLine.textBlockBeginIndex + textLine.rawTextLength) {
    var atomIndex:int = textLine.getAtomIndexAtCharIndex(charPosition);
    textLine.getAtomBounds(atomIndex);
    charPosition = textLine.getAtomTextBlockEndIndex(atomIndex);
}

This works for getting the bounding for each character but i still need some more data like what character is it and what font-size, font d开发者_Python百科oes it have? When doing a textLine.dump(); i think im getting this data but not the character, i get something called gid witch seems to point to the character in use but i don't know how to get exactly what character that is. Anny ideas?


Solved my problem with the help of Jin-Huang over at the adobe forum for TLF. I haven't tried it to full extent yet, but seems to work for now.

0

精彩评论

暂无评论...
验证码 换一张
取 消