1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

LookAndFeel: Make portable typeface metrics the default

This commit is contained in:
reuk 2024-03-21 15:04:31 +00:00
parent 4533077b75
commit 03b1e918fe
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 32 additions and 5 deletions

View file

@ -2,6 +2,32 @@
# Version 8.0.0
## Change
JUCE widgets now query the LookAndFeel to determine the TypefaceMetricsKind to
use. By default, the LookAndFeel will specify the "portable" metrics kind,
which may change the size of text in JUCE widgets, depending on the font and
platform.
**Possible Issues**
Using "portable" metrics may cause text to render at a different scale when
compared to the old "legacy" metrics.
**Workaround**
If you want to restore the old metrics, e.g. to maintain the same text scaling
in an existing app, you can override LookAndFeel::getDefaultMetricsKind() on
each LookAndFeel in your application, to return the "legacy" metrics kind.
**Rationale**
Using portable font metrics streamlines the development experience when working
on applications that must run on multiple platforms. Using portable metrics by
default means that new projects will benefit from this improved cross-platform
behaviour from the outset.
## Change
Signatures of several Typeface member functions have been updated to accept a

View file

@ -187,12 +187,13 @@ public:
/** Widgets can call this to find out the kind of metrics they should use when creating their
own fonts.
The default implementation returns the legacy metrics kind, but you can override this if
you want to use the portable metrics kind instead. Using portable metrics may cause text
to render at a different size, so you should check that text in your app still renders at an
appropriate size, and potentially adjust font sizes where necessary after overriding this.
The default implementation returns the portable metrics kind, but you can override this if
you want to use the legacy metrics kind instead, to avoid rendering changes in existing
projects. Switching between metrics kinds may cause text to render at a different size, so you
should check that text in your app still renders at an appropriate size, and potentially adjust
font sizes where necessary after overriding this function.
*/
virtual TypefaceMetricsKind getDefaultMetricsKind() const { return TypefaceMetricsKind::legacy; }
virtual TypefaceMetricsKind getDefaultMetricsKind() const { return TypefaceMetricsKind::portable; }
/** Returns a copy of the FontOptions with the LookAndFeel's default metrics kind set. */
FontOptions withDefaultMetrics (FontOptions opt) const { return opt.withMetricsKind (getDefaultMetricsKind()); }