Skip to content

feat: add font_src to TextShape, UiText, UiDropdown and UiInput - #489

Merged
robtfm merged 1 commit into
mainfrom
feat/font-src-main
Oct 5, 2026
Merged

robtfm merged 1 commit into
mainfrom
feat/font-src-main

Conversation

@robtfm

@robtfm robtfm commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

currently scenes can only pick from the six built-in font enum values. adds font_src to let a scene name its own face.

Adds optional string font_src to PBTextShape, PBUiText, PBUiDropdown and PBUiInput. The value resolves as:

  1. a ttf file in the scene content, addressed by its content-map path,
  2. otherwise a Google Fonts family name,
  3. otherwise the existing font enum, which stays the fallback whenever the source can't be resolved.

Unset changes nothing, so existing scenes are unaffected.

Field numbering

The field numbers match the ones already carried on experimental-bevy, so the wire format is identical on both branches and no renumber is needed when they converge. That leaves deliberate gaps on main:

  • PBUiText skips 7-8 and takes font_src = 9.
  • PBUiInput skips 14-15 and takes font_src = 16. 14 and 15 are multi_line and clear_on_submit on experimental-bevy, and stay reserved for them to land on main separately.

PBTextShape (22) and PBUiDropdown (13) are the next free numbers on both branches.

Implementation

Implemented in the bevy explorer (decentraland/bevy-explorer#1263), and unity explorer (decentraland/unity-explorer#10118), both resolve scene files through the content map and Google Fonts families through the Fontsource API (CORS-open, static per-weight ttfs — the Google Fonts CSS API can't serve a browser client a ttf).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Test this pull request

  • The @dcl/protocol package can be tested in scenes by running
    npm install "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-37323326836.commit-50ce3d7.tgz"

Scenes can only pick from the six built-in `font` enum values. `font_src`
lets a scene name its own face: a ttf file in the scene content, or a
Google Fonts family name. `font` remains the fallback when the source
can't be resolved, so unset changes nothing.

Field numbers match the ones already carried on `experimental-bevy`, so
the wire format is identical on both branches: PBUiText skips 7-8 and
PBUiInput skips 14-15 (multi_line, clear_on_submit), which stay reserved
for the experimental fields that will land on main separately.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@robtfm
robtfm force-pushed the feat/font-src-main branch from 784a1b8 to 3518fb2 Compare October 5, 2026 14:16
@robtfm
robtfm merged commit d7ddc10 into main Oct 5, 2026
3 checks passed
@robtfm
robtfm deleted the feat/font-src-main branch October 5, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants