0
我在使用TLF時遇到了一些問題,我需要解析文本並獲取文本字段中每個字符的x和y。這是我迄今爲止...來自TLF TextLine的數據
充分利用每次的TextFlow的TextLine:
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);
}
}
獲得每個 「原子」,爲的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);
}
這適用於獲取邊界對於每個字符,但我仍然需要一些更多的數據,如什麼字符,什麼字體大小,字體它有?當做一個textLine.dump();我想我得到這些數據,但不是角色,我得到了一個名爲gid女巫的東西似乎指向正在使用的角色,但我不知道如何得到到底是什麼角色。安妮的想法?
我想在第三行應該是'getLineAt(i)'而不是'findLineAtPosition(i)'。 – DoubleThink 2012-11-30 00:38:50