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

Text: Cache the display language

This commit is contained in:
Anthony Nicholls 2025-07-17 14:03:31 +01:00 committed by Anthony Nicholls
parent 667b3fae86
commit c0f164ee28
3 changed files with 2 additions and 13 deletions

View file

@ -215,9 +215,10 @@ static std::vector<ShapedGlyph> lowLevelShape (Span<const juce_wchar> string,
Range<int64> range,
const Font& font,
TextScript script,
const String& language,
uint8_t embeddingLevel)
{
static const auto language = SystemStats::getDisplayLanguage();
HbBuffer buffer { hb_buffer_create() };
hb_buffer_clear_contents (buffer.get());
@ -515,7 +516,6 @@ private:
struct ShapingParams
{
TextScript script;
String language;
uint8_t embeddingLevel;
Font resolvedFont;
};
@ -934,7 +934,6 @@ struct Shaper
{
shaperRuns.set (range,
{ scriptRun->front().script,
options.getLanguage(),
*it,
font },
ops,
@ -988,7 +987,6 @@ struct Shaper
shapingRange,
it->value.resolvedFont,
it->value.script,
it->value.language,
it->value.embeddingLevel);
shapedGlyphs.set (shapingRange,

View file

@ -53,7 +53,6 @@ private:
alignmentWidth,
height,
fontsForRange,
language,
firstLineIndent,
leading,
additiveLineSpacing,
@ -132,11 +131,6 @@ public:
return withMember (*this, &ShapedTextOptions::fontsForRange, x);
}
[[nodiscard]] ShapedTextOptions withLanguage (StringRef x) const
{
return withMember (*this, &ShapedTextOptions::language, x);
}
[[nodiscard]] ShapedTextOptions withFirstLineIndent (float x) const
{
return withMember (*this, &ShapedTextOptions::firstLineIndent, x);
@ -206,7 +200,6 @@ public:
const auto& getAlignmentWidth() const { return alignmentWidth; }
const auto& getHeight() const { return height; }
const auto& getFontsForRange() const { return fontsForRange; }
const auto& getLanguage() const { return language; }
const auto& getFirstLineIndent() const { return firstLineIndent; }
const auto& getLeading() const { return leading; }
const auto& getAdditiveLineSpacing() const { return additiveLineSpacing; }
@ -232,7 +225,6 @@ private:
return result;
});
String language = SystemStats::getDisplayLanguage();
float firstLineIndent = 0.0f;
float leading = 1.0f;
float additiveLineSpacing = 0.0f;

View file

@ -445,7 +445,6 @@ void TextLayout::createStandardLayout (const AttributedString& text)
}
auto shapedTextOptions = ShapedTextOptions{}.withFonts (fonts)
.withLanguage (SystemStats::getUserLanguage())
.withTrailingWhitespacesShouldFit (false)
.withJustification (justification)
.withReadingDirection (getTextDirection (text))