Problems with Text Layout Framework
I had hoped to release a beta version of e2publish after this weekend. But I got caught up in some problems with the Text Layout Framework – so it will be a little while longer. I’m still refining the workarounds, and I’ll be putting in some bug reports soon.
The first problem is that ContainerController.textLength is unreliable. Investigating further, I discovered that the problem occurs when the ContainerController contains a line of text that is not terminated by a newline. Like might happen at the end of the textflow.
I managed to get around the problem as follows (within a class that inherits ContainerController) …..
if (textLength==0 && getSubString(textFlow,absoluteStart,absoluteStart+1)!='') textLength=textFlow.textLength-absoluteStart-1;
If textLength is zero, yet we still detect a character in the first position of the ContainerController, then clearly, textLength shouldn’t be zero – so we calculate what it should be assuming that we’re at the end of the textflow and knowing what the total length of the textflow should be.
I’ve utilised a substring method that I found on adobe forums. I was using this anyway in my program – so it was convenient to call it here. No doubt there’s a better workaround that doesn’t rely this method.
But don’t try to override textLength. I tried, and it caused problems. I’m not entirely sure why, but this seemed to cause several other ContainerController methods to fail – as if they rely on the incorrect value.
The second problem I’ve encountered is that ContainerController.getScrollDelta(n) fails with a run time error depending on the contents of the ContainerController. If the ContainerController is empty, or has only newline characters – this causes a failure.