Skip to content

Add fontFeatureSettings and resolve font features in shared C++ - #58266

Open
Abbondanzo wants to merge 2 commits into
react:mainfrom
Abbondanzo:export-D115621392
Open

Add fontFeatureSettings and resolve font features in shared C++#58266
Abbondanzo wants to merge 2 commits into
react:mainfrom
Abbondanzo:export-D115621392

Conversation

@Abbondanzo

Copy link
Copy Markdown
Contributor

Summary:
Adds the fontFeatureSettings style prop, and moves feature-list composition out of the two
per-platform tables into one function in shared C++ so both renderers resolve precedence
identically. Contributions are emitted least- to most-specific, so a tag named more than once
resolves last-wins and no separate conflict-resolution step has to be kept in sync.

Also fixes a pre-existing bug: the Android span-creation guards did not test fontFeatureSettings,
so a fragment whose only font prop was fontVariant produced no span at all and dropped its
features.

Changelog:
[General][Added] - Add fontFeatureSettings style prop to <Text>
[General][Fixed] - A text run whose only font prop was fontVariant produced no styled span on Android and silently dropped its features

Differential Revision: D115621392

Summary:
`hash_combine` mixes each field into the previous seed, so it forms a dependency chain the CPU
cannot overlap and an unset optional still costs a full link. `hash_combine_optionals` folds a run
of optionals into one presence-mask link plus the engaged values, so a further optional costs a bit
in the mask rather than a link. The mask is what keeps it collision-free: skipping disengaged
fields alone would make the same value in two different slots hash identically.

Equality moves from `std::tie` to a short-circuit chain ordered cheapest first, with the string and
vector fields last, because the dominant caller is a successful cache lookup where the keys are
equal and every field has to be examined.

Changelog:
[Internal] - Hash optional `TextAttributes` fields via a presence mask and compare them with a short-circuit chain

Differential Revision: D115621401
Summary:
Adds the `fontFeatureSettings` style prop, and moves feature-list composition out of the two
per-platform tables into one function in shared C++ so both renderers resolve precedence
identically. Contributions are emitted least- to most-specific, so a tag named more than once
resolves last-wins and no separate conflict-resolution step has to be kept in sync.

Also fixes a pre-existing bug: the Android span-creation guards did not test `fontFeatureSettings`,
so a fragment whose only font prop was `fontVariant` produced no span at all and dropped its
features.

Changelog:
[General][Added] - Add `fontFeatureSettings` style prop to `<Text>`
[General][Fixed] - A text run whose only font prop was `fontVariant` produced no styled span on Android and silently dropped its features

Differential Revision: D115621392
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 31, 2026
@meta-codesync

meta-codesync Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115621392.

@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@Abbondanzo

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown

🤖 AI code review

Decision: Ready for human review (with comments)

⚠️ The AI reviewer failed to run, so this change was not reviewed:

The configured model id(s) do not exist on the running OpenCode server:
meta/muse-spark-1.3-contributor — that provider has no such model. Close matches: muse-spark-1.1, muse-spark-1.2, muse-spark-1.2-contributor
Fix the model in .expo-code-review/config.jsonc (agents' model, coordinator.model) or REVIEWER_MODEL. Note that a model id must be "provider/model" (e.g. anthropic/claude-sonnet-5), and that an out-of-date opencode can reject an id a newer one accepts — run ecr doctor.

No findings.


This review is advisory — it never blocks a merge and never auto-approves.

@Abbondanzo

Copy link
Copy Markdown
Contributor Author

/review

2 similar comments
@Abbondanzo

Copy link
Copy Markdown
Contributor Author

/review

@Abbondanzo

Copy link
Copy Markdown
Contributor Author

/review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant