From 046cef8f8a700fe81ca78a0bfe85c4dec3a30c05 Mon Sep 17 00:00:00 2001 From: tsushanth <78000697+tsushanth@users.noreply.github.com> Date: Wed, 12 Aug 2026 16:54:15 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20FormattedString=20ignores=20font=20scale?= =?UTF-8?q?=20on=20Android=20=E2=80=94=20withFontScale=20hardcodes=201,=20?= =?UTF-8?q?AbsoluteSizeSpan=20skips=20scale=20multiply?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/ui/styling/font.android.ts | 8 ++++---- packages/core/ui/text-base/index.android.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/ui/styling/font.android.ts b/packages/core/ui/styling/font.android.ts index bb6a308e24..6e5a71c09a 100644 --- a/packages/core/ui/styling/font.android.ts +++ b/packages/core/ui/styling/font.android.ts @@ -24,19 +24,19 @@ export class Font extends FontBase { } public withFontWeight(weight: FontWeightType): Font { - return new Font(this.fontFamily, this.fontSize, this.fontStyle, weight, 1, this.fontVariationSettings); + return new Font(this.fontFamily, this.fontSize, this.fontStyle, weight, this.fontScale, this.fontVariationSettings); } public withFontSize(size: number): Font { - return new Font(this.fontFamily, size, this.fontStyle, this.fontWeight, 1, this.fontVariationSettings); + return new Font(this.fontFamily, size, this.fontStyle, this.fontWeight, this.fontScale, this.fontVariationSettings); } public withFontScale(scale: number): Font { - return new Font(this.fontFamily, this.fontSize, this.fontStyle, this.fontWeight, 1, this.fontVariationSettings); + return new Font(this.fontFamily, this.fontSize, this.fontStyle, this.fontWeight, scale, this.fontVariationSettings); } public withFontVariationSettings(variationSettings: Array | null): Font { - return new Font(this.fontFamily, this.fontSize, this.fontStyle, this.fontWeight, 1, variationSettings); + return new Font(this.fontFamily, this.fontSize, this.fontStyle, this.fontWeight, this.fontScale, variationSettings); } getAndroidTypeface(): android.graphics.Typeface { diff --git a/packages/core/ui/text-base/index.android.ts b/packages/core/ui/text-base/index.android.ts index 335c7d726b..e5d3061531 100644 --- a/packages/core/ui/text-base/index.android.ts +++ b/packages/core/ui/text-base/index.android.ts @@ -641,7 +641,7 @@ function setSpanModifiers(ssb: android.text.SpannableStringBuilder, span: Span, ssb.setSpan(typefaceSpan, start, end, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); if (spanStyle.fontSize) { - ssb.setSpan(new android.text.style.AbsoluteSizeSpan(layout.toDevicePixels(spanStyle.fontSize)), start, end, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + ssb.setSpan(new android.text.style.AbsoluteSizeSpan(layout.toDevicePixels(spanStyle.fontSize * (spanStyle.fontScaleInternal ?? 1))), start, end, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } const color = spanStyle.color;