Bugfix for TextLayout under windows


#1

when using direct write.

juce_win32_DirectWriteTypeLayout.cpp: in `createLayout’ around line 347

need to update `lastLocation’ after, not before.

for (int i = 0; i < numLines; ++i) { layout.getLine(i).stringRange = Range<int> (lastLocation, (int) lastLocation + dwLineMetrics[i].length); lastLocation += dwLineMetrics[i].length; }

– hugh.


#2

This seems to be fixing two bugs.

The first is that existing code does not start at 0 properly like the previous code did.
http://juce.git.sourceforge.net/git/gitweb.cgi?p=juce/juce;a=commitdiff;h=e87b1a59ecf35246159abb3d1a84f383a4d063c0

The second is that the string ranges weren’t being calculated properly at any point (needed the += as hugh suggested).

Nice find.


#3

Doh! Thanks hugh, much appreciated!