This restores the JUCE 7 behaviour when the JUCE 8 font fallback
mechanism fails to resolve a non-null Typeface::Ptr. This behaviour is
significant when the base font specified is not available on the system.
The issue prior to this commit would be observable when using the
GlyphArrangement functions e.g. addFittedText.
This is a fix for a regression introduced in
9223805b9c.
Prior to this a soft break could occur between two characters printed in
different fonts, even though there was no break opportunity there in the
Unicode string.
This fixes an undesired behaviour where squashing the text using
GlyphArrangement::addFittedText would only squash the visible glyphs but
not the additional kerning space between them.
This commit fixes a regression added during the ShapedText based rewrite
of the class. The minimumHorizontalScale parameter was mistakenly
interpreted as an absolute scale, whereas its meaning in the old
implementation was a relative scalar applied to the Font's horizontal
scale.
This behaviour, previously available in JUCE 7, was missing since the
JUCE 8 changes related to Unicode text drawing.
With this commit, words that are too long to fit in a line are again
broken up, with the caveat, that we can expect this approach to produce
quirks with bidirectional text. We don't expect that such a feature
could be satisfactorily provided for bidirectional text, so this is a
stopgap measure for legacy applications.
Since 4122427748 assertions are guarding
the FontOptions::withName, withStyle and withTypeface member functions.
Since then the only way to replace an existing typeface without hitting
these assertions is to clear all three fields before calling
withTypeface, which then sets all three values. It is always legal to
just clear an existing Typeface and rely on the name and style fields.
Previously, code such as the following would return a smaller string
width for larger tracking values:
juce::Font f { juce::FontOptions{}.withPointHeight (16.0f) };
const auto g = f.withExtraKerningFactor (1.0f);
const auto a = f.getStringWidth ("foobar");
const auto b = g.getStringWidth ("foobar");
With this change applied, the width 'b' is greater than the width 'a',
as expected.
This fixes an issue with the text wrapping logic for text chunks ending
in a whitespace.
When trying to fit a text chunk, the logic works with two values: width
with trailing whitespace, and width without trailing whitespace.
When the trailingWhitespacesShouldFit option is false, the logic
checks if "withoutTrailingWhitespace" can still fit inside the remaining
width.
Prior to this fix, it then decremented the remaining width with
"withoutTrailingWhitespace", but it should have used
"withTrailingWhitespace" for the decrement operation, always, regardless
of the value of the withTrailingWhitespacesShouldFit option.
This mistake only caused an observable issue when multiple fonts were
used for the shaping operation, and a different font would be used
immediately after a whitespace falling at the end of a line.
Prior to this change, the spacing between line N and line N + 1 would be
lineHeight (N).
This resulted in incorrect spacing when using multiple fonts in a text.
This commit uses the correct spacing, which is
maxDescent (N) + maxAscent (N + 1). This is also the same rule that was
used by TextLayout prior to JUCE 8, and the rule that CoreText's
AttributedString features are using as a general rule.
Note: lineHeight (N) = maxAscent (N) + maxDescent (N).