mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fonts: Add OpenType feature support
This commit is contained in:
parent
a5797efeb0
commit
d651f6740c
42 changed files with 1104 additions and 33 deletions
|
|
@ -176,32 +176,53 @@ public:
|
|||
*/
|
||||
[[nodiscard]] FontOptions withDescentOverride (std::optional<float> x) const { return withMember (*this, &FontOptions::descentOverride, x.value_or (-1.0f)); }
|
||||
|
||||
/** Returns a copy of these options with the specified font feature setting added or updated. */
|
||||
[[nodiscard]] FontOptions withFeatureSetting (FontFeatureSetting featureSetting) const;
|
||||
|
||||
/** Returns a copy of these options with the specified feature removed.
|
||||
|
||||
If the `featureTag` corresponds to a recognised default-enabled font feature (e.g., "calt",
|
||||
"ccmp", "liga", "locl", "mark", "mkmk", "rlig"), it's setting will be reset to its default
|
||||
state.
|
||||
*/
|
||||
[[nodiscard]] FontOptions withFeatureRemoved (FontFeatureTag featureTag) const;
|
||||
|
||||
/** Returns a copy of these options with the specified feature enabled. */
|
||||
[[nodiscard]] FontOptions withFeatureEnabled (FontFeatureTag tag) const { return withFeatureSetting ({ tag, FontFeatureSetting::featureEnabled }); }
|
||||
|
||||
/** Returns a copy of these options with the specified feature disabled. */
|
||||
[[nodiscard]] FontOptions withFeatureDisabled (FontFeatureTag tag) const { return withFeatureSetting ({ tag, FontFeatureSetting::featureDisabled }); }
|
||||
|
||||
/** @see withName() */
|
||||
[[nodiscard]] auto getName() const { return name; }
|
||||
[[nodiscard]] auto getName() const { return name; }
|
||||
/** @see withStyle() */
|
||||
[[nodiscard]] auto getStyle() const { return style; }
|
||||
[[nodiscard]] auto getStyle() const { return style; }
|
||||
/** @see withTypeface() */
|
||||
[[nodiscard]] auto getTypeface() const { return typeface; }
|
||||
[[nodiscard]] auto getTypeface() const { return typeface; }
|
||||
/** @see withFallbacks() */
|
||||
[[nodiscard]] auto getFallbacks() const { return fallbacks; }
|
||||
[[nodiscard]] auto getFallbacks() const { return fallbacks; }
|
||||
/** @see withHeight() */
|
||||
[[nodiscard]] auto getHeight() const { return height; }
|
||||
[[nodiscard]] auto getHeight() const { return height; }
|
||||
/** @see withPointHeight() */
|
||||
[[nodiscard]] auto getPointHeight() const { return pointHeight; }
|
||||
[[nodiscard]] auto getPointHeight() const { return pointHeight; }
|
||||
/** @see withKerningFactor() */
|
||||
[[nodiscard]] auto getKerningFactor() const { return tracking; }
|
||||
[[nodiscard]] auto getKerningFactor() const { return tracking; }
|
||||
/** @see withHorizontalScale() */
|
||||
[[nodiscard]] auto getHorizontalScale() const { return horizontalScale; }
|
||||
[[nodiscard]] auto getHorizontalScale() const { return horizontalScale; }
|
||||
/** @see withFallbackEnabled() */
|
||||
[[nodiscard]] auto getFallbackEnabled() const { return fallbackEnabled; }
|
||||
[[nodiscard]] auto getFallbackEnabled() const { return fallbackEnabled; }
|
||||
/** @see withUnderline() */
|
||||
[[nodiscard]] auto getUnderline() const { return underlined; }
|
||||
[[nodiscard]] auto getUnderline() const { return underlined; }
|
||||
/** @see withMetricsKind() */
|
||||
[[nodiscard]] auto getMetricsKind() const { return metricsKind; }
|
||||
[[nodiscard]] auto getMetricsKind() const { return metricsKind; }
|
||||
/** @see withAscentOverride() */
|
||||
[[nodiscard]] auto getAscentOverride() const { return ascentOverride >= 0.0f ? std::make_optional (ascentOverride) : std::nullopt; }
|
||||
[[nodiscard]] auto getAscentOverride() const { return ascentOverride >= 0.0f ? std::make_optional (ascentOverride) : std::nullopt; }
|
||||
/** @see withDescentOverride() */
|
||||
[[nodiscard]] auto getDescentOverride() const { return descentOverride >= 0.0f ? std::make_optional (descentOverride) : std::nullopt; }
|
||||
[[nodiscard]] auto getDescentOverride() const { return descentOverride >= 0.0f ? std::make_optional (descentOverride) : std::nullopt; }
|
||||
|
||||
/** @see withFeatureSetting() */
|
||||
[[nodiscard]] Span<const FontFeatureSetting> getFeatureSettings() const& { return features; }
|
||||
[[nodiscard]] Span<const FontFeatureSetting> getFeatureSettings() const&& = delete;
|
||||
|
||||
/** Equality operator. */
|
||||
[[nodiscard]] bool operator== (const FontOptions& other) const;
|
||||
|
|
@ -222,6 +243,7 @@ private:
|
|||
String name, style;
|
||||
Typeface::Ptr typeface;
|
||||
std::vector<String> fallbacks;
|
||||
std::vector<FontFeatureSetting> features;
|
||||
TypefaceMetricsKind metricsKind { TypefaceMetricsKind::portable };
|
||||
float height = -1.0f;
|
||||
float pointHeight = -1.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue