KurtCode/PDFKitten — Issue #7: Selection frames not considering CTM
Author: Pstoppani
Created: 2011-11-12 00:22:08+00:00
State: open

Using this file: http://dl.dropbox.com/u/8069980/neuAnnotate%20Guide.pdf

Try searching for "select". You'll notice that on the second page the "Select" in bullet 3 is has only the "Sel" highlighted.

The problem is that Selection -finalizeWithState does not take the CTM into consideration. In the search for "Sel" we see a cm and TD right after finding the "sel". The the TD resets the text matrix so -finalizeWithState calculates an incorrect width. The fix is to take the CTM into consideration, which has been adjusted accordingly to compensate for the TD's reset of the text matrix.

CGFloat width = [state textMatrix].tx - [initialState textMatrix].tx + ([state ctm].tx - [initialState ctm].tx) / [state ctm].a;