diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index e6ce77e93d..a08b147c2f 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -490,6 +490,8 @@ String::String (const unsigned short number) : text (NumberToStringConverters::c String::String (const int64 number) : text (NumberToStringConverters::createFromInteger (number)) {} String::String (const uint64 number) : text (NumberToStringConverters::createFromInteger (number)) {} +String::String (const float number) : text (NumberToStringConverters::createFromDouble ((double) number, 0)) {} +String::String (const double number) : text (NumberToStringConverters::createFromDouble (number, 0)) {} String::String (const float number, const int numberOfDecimalPlaces) : text (NumberToStringConverters::createFromDouble ((double) number, numberOfDecimalPlaces)) {} String::String (const double number, const int numberOfDecimalPlaces) : text (NumberToStringConverters::createFromDouble (number, numberOfDecimalPlaces)) {} diff --git a/modules/juce_core/text/juce_String.h b/modules/juce_core/text/juce_String.h index a40a36df05..032fb4ee56 100644 --- a/modules/juce_core/text/juce_String.h +++ b/modules/juce_core/text/juce_String.h @@ -888,63 +888,64 @@ public: // Numeric conversions.. /** Creates a string containing this signed 32-bit integer as a decimal number. - @see getIntValue, getFloatValue, getDoubleValue, toHexString */ explicit String (int decimalInteger); /** Creates a string containing this unsigned 32-bit integer as a decimal number. - @see getIntValue, getFloatValue, getDoubleValue, toHexString */ explicit String (unsigned int decimalInteger); /** Creates a string containing this signed 16-bit integer as a decimal number. - @see getIntValue, getFloatValue, getDoubleValue, toHexString */ explicit String (short decimalInteger); /** Creates a string containing this unsigned 16-bit integer as a decimal number. - @see getIntValue, getFloatValue, getDoubleValue, toHexString */ explicit String (unsigned short decimalInteger); /** Creates a string containing this signed 64-bit integer as a decimal number. - @see getLargeIntValue, getFloatValue, getDoubleValue, toHexString */ explicit String (int64 largeIntegerValue); /** Creates a string containing this unsigned 64-bit integer as a decimal number. - @see getLargeIntValue, getFloatValue, getDoubleValue, toHexString */ explicit String (uint64 largeIntegerValue); /** Creates a string representing this floating-point number. + @param floatValue the value to convert to a string + @see getDoubleValue, getIntValue + */ + explicit String (float floatValue); + /** Creates a string representing this floating-point number. + @param doubleValue the value to convert to a string + @see getFloatValue, getIntValue + */ + explicit String (double doubleValue); + + /** Creates a string representing this floating-point number. @param floatValue the value to convert to a string @param numberOfDecimalPlaces if this is > 0, it will format the number using that many decimal places, and will not use exponent notation. If 0 or less, it will use exponent notation if necessary. @see getDoubleValue, getIntValue */ - explicit String (float floatValue, - int numberOfDecimalPlaces = 0); + String (float floatValue, int numberOfDecimalPlaces); /** Creates a string representing this floating-point number. - @param doubleValue the value to convert to a string @param numberOfDecimalPlaces if this is > 0, it will format the number using that many decimal places, and will not use exponent notation. If 0 or less, it will use exponent notation if necessary. - @see getFloatValue, getIntValue */ - explicit String (double doubleValue, - int numberOfDecimalPlaces = 0); + String (double doubleValue, int numberOfDecimalPlaces); /** Reads the value of the string as a decimal number (up to 32 bits in size). diff --git a/modules/juce_graphics/fonts/juce_TextLayout.cpp b/modules/juce_graphics/fonts/juce_TextLayout.cpp index e9724eeac6..08ca04afea 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.cpp +++ b/modules/juce_graphics/fonts/juce_TextLayout.cpp @@ -555,7 +555,7 @@ namespace TextLayoutHelpers //============================================================================== void TextLayout::createLayoutWithBalancedLineLengths (const AttributedString& text, float maxWidth) { - const float minimumWidth = maxWidth / 2.0; + const float minimumWidth = maxWidth / 2.0f; float bestWidth = maxWidth; float bestLineProportion = 0.0f; diff --git a/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp b/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp index 8bf9231ff5..d67fcb2948 100644 --- a/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp +++ b/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp @@ -72,6 +72,9 @@ namespace DirectWriteTypeLayout lastOriginY = baselineOriginY; ++currentLine; + if (currentLine == layout->getNumLines()) + return S_OK; + // The x value is only correct when dealing with LTR text layout->getLine (currentLine).lineOrigin = Point (baselineOriginX, baselineOriginY); }