A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(text): the project's default font family reaches the text it is for
esengine633f89d38312
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0d9e2ed5d..e23a59670 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,17 @@ published separately; it ships inside the editor.### Changed+- **A `Text` that names no family is drawn in the project's.** `fontFamily`+ defaults to empty now, and empty means "whatever this project uses" — resolved+ where the family is already decided (`resolveTextFamily`), so the measured wrap+ and the rendered glyphs cannot end up on different fonts. A scene that stored+ `"Arial"` still asks for Arial; nothing on disk changes meaning.++ `RuntimeConfig.canvasScaleMode` and `canvasMatchWidthOrHeight` are **removed**,+ along with `applyRuntimeConfig` and the two matching `RuntimeBuildConfig`+ fields: the project's canvas fit reaches a runtime as `screenFit`, and these+ were the leftovers of the path it replaced.+- **`AudioSource.priority` decides something now: there is a voice ceiling.**Nothing limited how many sounds played at once, so the field described anordering that never happened. 32 voices by default (`features.audio.maxVoices`@@ -153,6 +164,14 @@ published separately; it ships inside the editor.### Fixed+- **The project's default font family never took effect.** It was written into+ `RuntimeConfig` and read by exactly one function — `applyRuntimeConfig`, which+ nothing called — so setting it changed no text anywhere. Two more places+ answered "which font" with their own hard-coded `'Arial'` (widget composition,+ text measurement), which is how it stayed unnoticed: everything looked right+ because everything independently agreed on Arial. There is one default now,+ and it is the configurable one.+- **An `AudioSource` in the scene was outside everything the audio API decides.**It was played straight at the backend, so on a backend with no mixer graph —WeChat, a device — the bus volume and mute the API folds into each voice neverdiff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.jsonindex e0baa2cf0..7fb8d5adb 100644--- a/docs/astro/src/data/apiStability.generated.json+++ b/docs/astro/src/data/apiStability.generated.json@@ -3,10 +3,10 @@"counts": {"public": 113,"beta": 73,- "experimental": 1629,+ "experimental": 1628,"deprecated": 3},- "total": 1815,+ "total": 1814,"subsystems": [{"id": "ecs",diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.jsonindex 5d5179428..cafe07962 100644--- a/docs/astro/src/data/components.generated.json+++ b/docs/astro/src/data/components.generated.json@@ -3709,7 +3709,7 @@{"key": "fontFamily","type": "string",- "default": "\"Arial\"",+ "default": "empty","doc": "A font the HOST already has (system or page-loaded). Ignored when Font is set."},{@@ -3887,7 +3887,7 @@{"key": "fontFamily","type": "string",- "default": "\"Arial\"",+ "default": "empty","doc": "A font the HOST already has (system or page-loaded). Ignored when Font is set."},{diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 38d7a76d1..05390e441 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -1,7 +1,7 @@# API surface — esengine/index<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 113 public · 66 beta · 1515 experimental · 3 deprecated+Symbols: 113 public · 66 beta · 1514 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```@@ -6560,8 +6560,6 @@ textureImportSettings: ((ref: string) => ParsedTextureImportSettings | undefinedassetFailureCooldown: number | undefinedassetLoadTimeout: number | undefinedaudioCacheBudget: number | undefined-canvasMatchWidthOrHeight: number | undefined-canvasScaleMode: string | undefineddefaultFontFamily: string | undefinedmaxDeltaTime: number | undefinedmaxFixedSteps: number | undefined@@ -6573,7 +6571,7 @@ textureCacheBudget: number | undefined## RuntimeConfig — const @experimental```-{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; canvasScaleMode: number; canvasMatchWidthOrHeight: number; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }+{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }```## RuntimeInitConfig — interface @experimental@@ -9541,11 +9539,6 @@ AnimationPlugin(source: PrefabData, overrides: readonly PrefabOverride[]): PrefabData```-## applyRuntimeConfig — function @experimental-```-(components: { Text?: { _default: Record<string, unknown>; }; TextInput?: { _default: Record<string, unknown>; }; Canvas?: { _default: Record<string, unknown>; }; }): void-```-## applyThemeToWorld — function @experimental```(world: World): voiddiff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex 78aaca113..c072a17ec 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -1,7 +1,7 @@# API surface — esengine/index.native<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 113 public · 71 beta · 1534 experimental · 3 deprecated+Symbols: 113 public · 71 beta · 1533 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```@@ -6753,8 +6753,6 @@ textureImportSettings: ((ref: string) => ParsedTextureImportSettings | undefinedassetFailureCooldown: number | undefinedassetLoadTimeout: number | undefinedaudioCacheBudget: number | undefined-canvasMatchWidthOrHeight: number | undefined-canvasScaleMode: string | undefineddefaultFontFamily: string | undefinedmaxDeltaTime: number | undefinedmaxFixedSteps: number | undefined@@ -6766,7 +6764,7 @@ textureCacheBudget: number | undefined## RuntimeConfig — const @experimental```-{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; canvasScaleMode: number; canvasMatchWidthOrHeight: number; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }+{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }```## RuntimeInitConfig — interface @experimental@@ -9734,11 +9732,6 @@ AnimationPlugin(source: PrefabData, overrides: readonly PrefabOverride[]): PrefabData```-## applyRuntimeConfig — function @experimental-```-(components: { Text?: { _default: Record<string, unknown>; }; TextInput?: { _default: Record<string, unknown>; }; Canvas?: { _default: Record<string, unknown>; }; }): void-```-## applyThemeToWorld — function @experimental```(world: World): voiddiff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex 2c35060fd..665db18e5 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -1,7 +1,7 @@# API surface — esengine/index.node<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 113 public · 68 beta · 1514 experimental · 3 deprecated+Symbols: 113 public · 68 beta · 1513 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -6555,8 +6555,6 @@ textureImportSettings: ((ref: string) => ParsedTextureImportSettings | undefinedassetFailureCooldown: number | undefinedassetLoadTimeout: number | undefinedaudioCacheBudget: number | undefined-canvasMatchWidthOrHeight: number | undefined-canvasScaleMode: string | undefineddefaultFontFamily: string | undefinedmaxDeltaTime: number | undefinedmaxFixedSteps: number | undefined@@ -6568,7 +6566,7 @@ textureCacheBudget: number | undefined## RuntimeConfig — const @experimental```-{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; canvasScaleMode: number; canvasMatchWidthOrHeight: number; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }+{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }```## RuntimeInitConfig — interface @experimental@@ -9536,11 +9534,6 @@ AnimationPlugin(source: PrefabData, overrides: readonly PrefabOverride[]): PrefabData```-## applyRuntimeConfig — function @experimental-```-(components: { Text?: { _default: Record<string, unknown>; }; TextInput?: { _default: Record<string, unknown>; }; Canvas?: { _default: Record<string, unknown>; }; }): void-```-## applyThemeToWorld — function @experimental```(world: World): voiddiff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex 98c744aff..b65f9aca6 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -1,7 +1,7 @@# API surface — esengine/minigame<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 113 public · 66 beta · 1535 experimental · 3 deprecated+Symbols: 113 public · 66 beta · 1534 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -6800,8 +6800,6 @@ textureImportSettings: ((ref: string) => ParsedTextureImportSettings | undefinedassetFailureCooldown: number | undefinedassetLoadTimeout: number | undefinedaudioCacheBudget: number | undefined-canvasMatchWidthOrHeight: number | undefined-canvasScaleMode: string | undefineddefaultFontFamily: string | undefinedmaxDeltaTime: number | undefinedmaxFixedSteps: number | undefined@@ -6813,7 +6811,7 @@ textureCacheBudget: number | undefined## RuntimeConfig — const @experimental```-{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; canvasScaleMode: number; canvasMatchWidthOrHeight: number; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }+{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }```## RuntimeInitConfig — interface @experimental@@ -9781,11 +9779,6 @@ AnimationPlugin(source: PrefabData, overrides: readonly PrefabOverride[]): PrefabData```-## applyRuntimeConfig — function @experimental-```-(components: { Text?: { _default: Record<string, unknown>; }; TextInput?: { _default: Record<string, unknown>; }; Canvas?: { _default: Record<string, unknown>; }; }): void-```-## applyThemeToWorld — function @experimental```(world: World): voiddiff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex 88a2ae3a0..3888a70b5 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -1,7 +1,7 @@# API surface — esengine/wechat<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 113 public · 66 beta · 1525 experimental · 3 deprecated+Symbols: 113 public · 66 beta · 1524 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -6562,8 +6562,6 @@ textureImportSettings: ((ref: string) => ParsedTextureImportSettings | undefinedassetFailureCooldown: number | undefinedassetLoadTimeout: number | undefinedaudioCacheBudget: number | undefined-canvasMatchWidthOrHeight: number | undefined-canvasScaleMode: string | undefineddefaultFontFamily: string | undefinedmaxDeltaTime: number | undefinedmaxFixedSteps: number | undefined@@ -6575,7 +6573,7 @@ textureCacheBudget: number | undefined## RuntimeConfig — const @experimental```-{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; canvasScaleMode: number; canvasMatchWidthOrHeight: number; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }+{ sceneTransitionDuration: number; sceneTransitionColor: { r: number; g: number; b: number; a: number; }; defaultFontFamily: string; maxDeltaTime: number; maxFixedSteps: number; textCanvasSize: number; assetLoadTimeout: number; assetFailureCooldown: number; textureCacheBudget: number; audioCacheBudget: number; }```## RuntimeInitConfig — interface @experimental@@ -9563,11 +9561,6 @@ AnimationPlugin(source: PrefabData, overrides: readonly PrefabOverride[]): PrefabData```-## applyRuntimeConfig — function @experimental-```-(components: { Text?: { _default: Record<string, unknown>; }; TextInput?: { _default: Record<string, unknown>; }; Canvas?: { _default: Record<string, unknown>; }; }): void-```-## applyThemeToWorld — function @experimental```(world: World): voiddiff --git a/sdk/src/core-runtime.ts b/sdk/src/core-runtime.tsindex f23021caf..90713c337 100644--- a/sdk/src/core-runtime.ts+++ b/sdk/src/core-runtime.ts@@ -27,7 +27,6 @@ export {DEFAULT_GRAVITY,DEFAULT_FIXED_TIMESTEP,DEFAULT_SPINE_SKIN,- applyRuntimeConfig,} from './defaults';// =============================================================================diff --git a/sdk/src/defaults.ts b/sdk/src/defaults.tsindex 807f07d11..e2c5ede5e 100644--- a/sdk/src/defaults.ts+++ b/sdk/src/defaults.ts@@ -1,6 +1,5 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import { CanvasScaleMode } from './wasm/wasm.generated';import { COMPONENT_META } from './ecs/component.generated';import { getResourceManager, setTextureBudget } from './wasm/resourceManager';@@ -30,9 +29,8 @@ export const DEFAULT_SPINE_SKIN = 'default';export const RuntimeConfig = {sceneTransitionDuration: 0.3,sceneTransitionColor: { r: 0, g: 0, b: 0, a: 1 } as { r: number; g: number; b: number; a: number },- defaultFontFamily: 'Arial',- canvasScaleMode: 1,- canvasMatchWidthOrHeight: 0.5,+ /** The family a Text with no `fontFamily` of its own rasterizes with. */+ defaultFontFamily: DEFAULT_FONT_FAMILY,maxDeltaTime: 0.25,maxFixedSteps: 8,textCanvasSize: 512,@@ -55,19 +53,6 @@ export const RuntimeConfig = {audioCacheBudget: 32 * 1024 * 1024,};-export function applyRuntimeConfig(components: {- Text?: { _default: Record<string, unknown> };- TextInput?: { _default: Record<string, unknown> };- Canvas?: { _default: Record<string, unknown> };-}): void {- if (components.Text) components.Text._default.fontFamily = RuntimeConfig.defaultFontFamily;- if (components.TextInput) components.TextInput._default.fontFamily = RuntimeConfig.defaultFontFamily;- if (components.Canvas) {- components.Canvas._default.scaleMode = RuntimeConfig.canvasScaleMode;- components.Canvas._default.matchWidthOrHeight = RuntimeConfig.canvasMatchWidthOrHeight;- }-}-// =============================================================================// Build Runtime Config// =============================================================================@@ -76,8 +61,6 @@ export interface RuntimeBuildConfig {sceneTransitionDuration?: number;sceneTransitionColor?: string;defaultFontFamily?: string;- canvasScaleMode?: string;- canvasMatchWidthOrHeight?: number;maxDeltaTime?: number;maxFixedSteps?: number;textCanvasSize?: number;@@ -87,16 +70,6 @@ export interface RuntimeBuildConfig {audioCacheBudget?: number;}-/** Canvas scale-mode name → value. Canonical names are single-sourced from the- * C++ CanvasScaleMode enum; ShowAll/NoBorder are Cocos-compat aliases with no C++- * member. Unknown names fall back to FixedHeight (the C++ default). */-function canvasScaleModeValue(name: string): number {- if (name === 'ShowAll') return CanvasScaleMode.Expand;- if (name === 'NoBorder') return CanvasScaleMode.Shrink;- const v = (CanvasScaleMode as unknown as Record<string, number>)[name];- return typeof v === 'number' ? v : CanvasScaleMode.FixedHeight;-}-export function applyBuildRuntimeConfig(app: { setMaxDeltaTime(v: number): void; setMaxFixedSteps(v: number): void }, config: RuntimeBuildConfig): void {if (config.maxDeltaTime !== undefined) {RuntimeConfig.maxDeltaTime = config.maxDeltaTime;@@ -124,12 +97,6 @@ export function applyBuildRuntimeConfig(app: { setMaxDeltaTime(v: number): void;a: 1,};}- if (config.canvasScaleMode !== undefined) {- RuntimeConfig.canvasScaleMode = canvasScaleModeValue(config.canvasScaleMode);- }- if (config.canvasMatchWidthOrHeight !== undefined) {- RuntimeConfig.canvasMatchWidthOrHeight = config.canvasMatchWidthOrHeight;- }if (config.assetLoadTimeout !== undefined) {RuntimeConfig.assetLoadTimeout = config.assetLoadTimeout;}diff --git a/sdk/src/ui/core/compose.ts b/sdk/src/ui/core/compose.tsindex 70c61f2fb..e7977e352 100644--- a/sdk/src/ui/core/compose.ts+++ b/sdk/src/ui/core/compose.ts@@ -146,7 +146,7 @@ export function buildText(init: TextInit = {}): TextData {content: init.content ?? '',i18nKey: init.i18nKey ?? '',font: init.font ?? 0,- fontFamily: init.fontFamily ?? 'Arial',+ fontFamily: init.fontFamily ?? '',fontSize: init.fontSize ?? 14,color: init.color ?? { r: 1, g: 1, b: 1, a: 1 },align: init.align ?? TextAlign.Center,diff --git a/sdk/src/ui/core/text.ts b/sdk/src/ui/core/text.tsindex 068502ff6..c173a24fa 100644--- a/sdk/src/ui/core/text.ts+++ b/sdk/src/ui/core/text.ts@@ -133,7 +133,7 @@ export const Text = defineComponent<TextData>('Text', {content: '',i18nKey: '',font: 0,- fontFamily: 'Arial',+ fontFamily: '',fontSize: 24,color: { r: 1, g: 1, b: 1, a: 1 },align: TextAlign.Left,diff --git a/sdk/src/ui/text/font-registry.ts b/sdk/src/ui/text/font-registry.tsindex cb555d260..108cbce5f 100644--- a/sdk/src/ui/text/font-registry.ts+++ b/sdk/src/ui/text/font-registry.ts@@ -24,6 +24,8 @@* project font that happens to share a small integer.*/+import { RuntimeConfig } from '../../defaults';+/** Distinct from any ResourceManager handle (those count up from small ints). */const HANDLE_BASE = 0x4000_0000;@@ -74,10 +76,12 @@ export function unregisterProjectFont(path: string): void {/*** The family a `Text` should rasterize with: its project font when `font` names- * one, else the authored `fontFamily`. The single place that precedence lives.+ * one, else the authored `fontFamily`, else the project's default family. The+ * single place that precedence lives — an empty `fontFamily` is how a Text says+ * "whatever this project uses", which is what makes that project setting real.*/export function resolveTextFamily(font: number | undefined, fontFamily: string): string {- return (font ? projectFontFamily(font) : null) ?? fontFamily;+ return (font ? projectFontFamily(font) : null) ?? (fontFamily || RuntimeConfig.defaultFontFamily);}/** Test seam: drop every registration. */diff --git a/sdk/src/ui/text/measure-text.ts b/sdk/src/ui/text/measure-text.tsindex 0365b0774..8effa8fba 100644--- a/sdk/src/ui/text/measure-text.ts+++ b/sdk/src/ui/text/measure-text.ts@@ -13,7 +13,7 @@* {@link wrapByMeasure}, the one wrap algorithm the renderer uses. Only a host* with neither (headless/logic-only) falls back to an average-glyph estimate.*/-import { DEFAULT_FONT_FAMILY, DEFAULT_LINE_HEIGHT } from '../../defaults';+import { DEFAULT_LINE_HEIGHT, RuntimeConfig } from '../../defaults';import { platformHasGlyphRasterizer, platformRasterizeGlyph } from '../../platform';import { FONT_STYLE_BOLD, FONT_STYLE_ITALIC } from './glyph-rasterizer';import { wrapByMeasure } from './layout';@@ -72,7 +72,7 @@ function platformAdvance(* renderer draws with, so a measured wrap still matches the rendered one), and* an average-advance estimate only where there is neither (headless). */function measurer(opts: MeasureTextOptions): Measurer {- const family = opts.fontFamily ?? DEFAULT_FONT_FAMILY;+ const family = opts.fontFamily || RuntimeConfig.defaultFontFamily;const spacing = opts.letterSpacing ?? 0;if (ctx_ === undefined) {ctx_ = typeof document !== 'undefined' && document.createElementdiff --git a/sdk/src/ui/text/text-input.ts b/sdk/src/ui/text/text-input.tsindex dafecdcbc..59e75bcf4 100644--- a/sdk/src/ui/text/text-input.ts+++ b/sdk/src/ui/text/text-input.ts@@ -38,7 +38,7 @@ export const TextInput = defineComponent<TextInputData>('TextInput', {placeholder: '',placeholderColor: { r: 0.6, g: 0.6, b: 0.6, a: 1 },font: 0,- fontFamily: 'Arial',+ fontFamily: '',fontSize: 16,color: { r: 1, g: 1, b: 1, a: 1 },backgroundColor: { r: 0.15, g: 0.15, b: 0.15, a: 1 },diff --git a/sdk/src/ui/widgets/prefabs/Button.esprefab b/sdk/src/ui/widgets/prefabs/Button.esprefabindex a5a9a4a3b..6fe1c76a8 100644--- a/sdk/src/ui/widgets/prefabs/Button.esprefab+++ b/sdk/src/ui/widgets/prefabs/Button.esprefab@@ -370,7 +370,7 @@"content": "Button","i18nKey": "","font": 0,- "fontFamily": "Arial",+ "fontFamily": "","fontSize": 14,"color": {"r": 0.92,diff --git a/sdk/src/ui/widgets/prefabs/Dropdown.esprefab b/sdk/src/ui/widgets/prefabs/Dropdown.esprefabindex 4dc47ffbc..7bd68271d 100644--- a/sdk/src/ui/widgets/prefabs/Dropdown.esprefab+++ b/sdk/src/ui/widgets/prefabs/Dropdown.esprefab@@ -367,7 +367,7 @@"content": "One","i18nKey": "","font": 0,- "fontFamily": "Arial",+ "fontFamily": "","fontSize": 14,"color": {"r": 0.92,diff --git a/sdk/src/ui/widgets/prefabs/ListView.esprefab b/sdk/src/ui/widgets/prefabs/ListView.esprefabindex 8d90a83ac..cced7c879 100644--- a/sdk/src/ui/widgets/prefabs/ListView.esprefab+++ b/sdk/src/ui/widgets/prefabs/ListView.esprefab@@ -302,7 +302,7 @@"content": "List View","i18nKey": "","font": 0,- "fontFamily": "Arial",+ "fontFamily": "","fontSize": 14,"color": {"r": 0.92,diff --git a/sdk/src/ui/widgets/prefabs/TextInput.esprefab b/sdk/src/ui/widgets/prefabs/TextInput.esprefabindex 2ded4a11e..62c18385e 100644--- a/sdk/src/ui/widgets/prefabs/TextInput.esprefab+++ b/sdk/src/ui/widgets/prefabs/TextInput.esprefab@@ -144,7 +144,7 @@"b": 0.94,"a": 0.5},- "fontFamily": "Arial",+ "fontFamily": "","fontSize": 14,"color": {"r": 0.92,diff --git a/sdk/src/ui/widgets/prefabs/generated.ts b/sdk/src/ui/widgets/prefabs/generated.tsindex 308e87b7e..b65340318 100644--- a/sdk/src/ui/widgets/prefabs/generated.ts+++ b/sdk/src/ui/widgets/prefabs/generated.ts@@ -374,7 +374,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {"content": "Button","i18nKey": "","font": 0,- "fontFamily": "Arial",+ "fontFamily": "","fontSize": 14,"color": {"r": 0.92,@@ -1862,7 +1862,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {"b": 0.94,"a": 0.5},- "fontFamily": "Arial",+ "fontFamily": "","fontSize": 14,"color": {"r": 0.92,@@ -2602,7 +2602,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {"content": "One","i18nKey": "","font": 0,- "fontFamily": "Arial",+ "fontFamily": "","fontSize": 14,"color": {"r": 0.92,@@ -2954,7 +2954,7 @@ export const BUILTIN_UI_PREFABS: Record<string, PrefabData> = {"content": "List View","i18nKey": "","font": 0,- "fontFamily": "Arial",+ "fontFamily": "","fontSize": 14,"color": {"r": 0.92,diff --git a/sdk/src/ui/widgets/text-input.ts b/sdk/src/ui/widgets/text-input.tsindex 34160a6aa..92fcfe200 100644--- a/sdk/src/ui/widgets/text-input.ts+++ b/sdk/src/ui/widgets/text-input.ts@@ -77,7 +77,7 @@ export function createTextInput(opts: TextInputOptions): TextInputHandle {value: opts.value ?? '',placeholder: opts.placeholder ?? '',placeholderColor: opts.placeholderColor ?? { ...c.text, a: c.text.a * 0.5 },- fontFamily: opts.fontFamily ?? 'Arial',+ fontFamily: opts.fontFamily ?? '',fontSize: opts.fontSize ?? themeType().label,color: opts.color ?? { ...c.text },backgroundColor: opts.backgroundColor ?? { ...c.control },diff --git a/sdk/tests/text-default-family.test.ts b/sdk/tests/text-default-family.test.tsnew file mode 100644index 000000000..3f2b02e82--- /dev/null+++ b/sdk/tests/text-default-family.test.ts@@ -0,0 +1,47 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file text-default-family.test.ts+ * @brief Which typeface a Text that names none is drawn in.+ *+ * A Text that names no family gets the project's, answered where the+ * family is decided — one place, which is what keeps the measured wrap+ * and the rendered glyphs on the same font.+ */+import { describe, it, expect, afterEach } from 'vitest';+import { resolveTextFamily, registerProjectFont, resetProjectFonts } from '../src/ui/text/font-registry';+import { measureText } from '../src/ui/text/measure-text';+import { RuntimeConfig, DEFAULT_FONT_FAMILY } from '../src/defaults';++afterEach(() => {+ RuntimeConfig.defaultFontFamily = DEFAULT_FONT_FAMILY;+ resetProjectFonts();+});++describe('the family a Text is rasterized with', () => {+ it('falls back to the project default when the Text names none', () => {+ RuntimeConfig.defaultFontFamily = 'ProjectSans';+ expect(resolveTextFamily(undefined, '')).toBe('ProjectSans');+ });++ it('is the authored family when there is one', () => {+ RuntimeConfig.defaultFontFamily = 'ProjectSans';+ expect(resolveTextFamily(undefined, 'Georgia')).toBe('Georgia');+ });++ it('is a shipped project font ahead of both', () => {+ RuntimeConfig.defaultFontFamily = 'ProjectSans';+ const handle = registerProjectFont('assets/fonts/x.ttf', 'Shipped');+ expect(resolveTextFamily(handle, 'Georgia')).toBe('Shipped');+ });++ it('measures with the same default it draws with', () => {+ RuntimeConfig.defaultFontFamily = 'ProjectSans';+ // No DOM and no platform glyph source here, so the measurer is the+ // average-advance estimate — what it must NOT do is measure a family of+ // "" while the renderer draws ProjectSans.+ const withDefault = measureText('hello', { fontSize: 16 });+ const named = measureText('hello', { fontSize: 16, fontFamily: 'ProjectSans' });+ expect(withDefault.width).toBeCloseTo(named.width, 6);+ });+});diff --git a/tools/check-component-fields.mjs b/tools/check-component-fields.mjsindex f639ba38a..d858bde95 100644--- a/tools/check-component-fields.mjs+++ b/tools/check-component-fields.mjs@@ -28,8 +28,10 @@ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');* intended state: a field that earns an entry here is work, not permission.*/const DECLARED_GAPS = {- 'CacheAsBitmap.enabled': 'the component is declared and nothing renders a subtree to a'- + ' texture to draw it as one quad — the four fields below are the same gap',+ 'CacheAsBitmap.enabled': 'the bookkeeping half on purpose (docs graphics/sprites):'+ + ' the engine ships no system that walks the scene and caches subtrees, because'+ + ' it has no way to render ONE subtree to a target — a game drives the refresh'+ + ' with CacheBitmap. An example using it would read these and close all four.','CacheAsBitmap.dirty': 'see CacheAsBitmap.enabled','CacheAsBitmap.width': 'see CacheAsBitmap.enabled','CacheAsBitmap.height': 'see CacheAsBitmap.enabled',