Broken Tip Code


#1

Hey Jules,

I’ve just pulled the latest tip code (as I do daily now) and I get a small handful of errors and a noticeable bug…

  1. The errors are related to the juce_win32_directwritetypelayout.cpp file (lines 87 and 88):
glyphLine.ascent  = jmax (glyphLine->ascent,  scaledFontSize (dwFontMetrics.ascent,  dwFontMetrics, glyphRun));
glyphLine.descent = jmax (glyphLine->descent, scaledFontSize (dwFontMetrics.descent, dwFontMetrics, glyphRun));

should be:

glyphLine.ascent  = jmax (glyphLine.ascent,  scaledFontSize (dwFontMetrics.ascent,  dwFontMetrics, glyphRun));
glyphLine.descent = jmax (glyphLine.descent, scaledFontSize (dwFontMetrics.descent, dwFontMetrics, glyphRun));

The variable glyphLine is not a pointer anymore, from the looks of it.

  1. There is something wrong now with using a char type in a juce::String like this:
char someChar = ';';
juce::String test = juce::String(someChar);

The juce::String named test will now contain the equivalent char number, instead of the actual semi-colon character I have in the example. (ie: test now has the string “59” - http://www.asciitable.com/)


#2

Oops! Sorry, messed up my check-in… Thanks, have fixed that now.

Nothing in the string class has changed recently though, and there hasn’t been a String (char) constructor for years… It’s not safe to use a char like that, because it’d be ambiguous as to whether it’s an int or a char, so you should use the String::charToString method instead.


#3

Alrighty!

Ah, I had not thought of it like that. Easy fix then, just thought it was a curious effect. Thanks for the heads up!