mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
LookAndFeel: Make portable typeface metrics the default
This commit is contained in:
parent
4533077b75
commit
03b1e918fe
2 changed files with 32 additions and 5 deletions
|
|
@ -2,6 +2,32 @@
|
||||||
|
|
||||||
# Version 8.0.0
|
# 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
|
## Change
|
||||||
|
|
||||||
Signatures of several Typeface member functions have been updated to accept a
|
Signatures of several Typeface member functions have been updated to accept a
|
||||||
|
|
|
||||||
|
|
@ -187,12 +187,13 @@ public:
|
||||||
/** Widgets can call this to find out the kind of metrics they should use when creating their
|
/** Widgets can call this to find out the kind of metrics they should use when creating their
|
||||||
own fonts.
|
own fonts.
|
||||||
|
|
||||||
The default implementation returns the legacy metrics kind, but you can override this if
|
The default implementation returns the portable metrics kind, but you can override this if
|
||||||
you want to use the portable metrics kind instead. Using portable metrics may cause text
|
you want to use the legacy metrics kind instead, to avoid rendering changes in existing
|
||||||
to render at a different size, so you should check that text in your app still renders at an
|
projects. Switching between metrics kinds may cause text to render at a different size, so you
|
||||||
appropriate size, and potentially adjust font sizes where necessary after overriding this.
|
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. */
|
/** Returns a copy of the FontOptions with the LookAndFeel's default metrics kind set. */
|
||||||
FontOptions withDefaultMetrics (FontOptions opt) const { return opt.withMetricsKind (getDefaultMetricsKind()); }
|
FontOptions withDefaultMetrics (FontOptions opt) const { return opt.withMetricsKind (getDefaultMetricsKind()); }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue