Skip to content

Add Pango-based TextLayoutManager for CXX platform#55600

Open
NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman:export-D93564131
Open

Add Pango-based TextLayoutManager for CXX platform#55600
NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman:export-D93564131

Conversation

@NickGerleman
Copy link
Contributor

Summary:
Replace the CXX TextLayoutManager stub (which returns minimumSize/zero for all text) with a real Pango-based text measurement implementation. This enables actual text layout in Fantom tests on Linux, providing real font metrics, line breaking, and attachment positioning.

Uses #ifdef RCT_USE_PANGO guards so that builds without Pango (e.g. Granite on non-Linux) continue to get the old stub behavior.

The Pango path provides:

  • Full text measurement via PangoLayout (font family, size, weight, style, letter spacing, line height)
  • Per-line measurement via measureLines() detected by TextLayoutManagerExtended C++20 concepts
  • Attachment positioning via cursor positions at U+FFFC object replacement characters
  • Thread-safe caching for both measure() and measureLines()
  • Text transform support (uppercase, lowercase, capitalize)
  • Paragraph attributes (alignment, ellipsize mode, max lines, justify)

For Buck builds, pango/pangoft2 deps are added under PLATFORMS_USING_CXX. For Fantom/CMake builds, 8 vendored libraries are added (freetype, harfbuzz, expat, libffi, fribidi, glib, fontconfig, pango) with custom CMakeLists.txt files and pre-generated config headers for Linux x86_64.

Differential Revision: D93564131

@meta-codesync
Copy link

meta-codesync bot commented Feb 18, 2026

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

@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 Feb 18, 2026
Summary:

Replace the CXX TextLayoutManager stub (which returns minimumSize/zero for all text) with a real Pango-based text measurement implementation. This enables actual text layout in Fantom tests on Linux, providing real font metrics, line breaking, and attachment positioning.

Uses `#ifdef RCT_USE_PANGO` guards so that builds without Pango (e.g. Granite on non-Linux) continue to get the old stub behavior.

The Pango path provides:
- Full text measurement via PangoLayout (font family, size, weight, style, letter spacing, line height)
- Per-line measurement via measureLines() detected by TextLayoutManagerExtended C++20 concepts
- Attachment positioning via cursor positions at U+FFFC object replacement characters
- Thread-safe caching for both measure() and measureLines()
- Text transform support (uppercase, lowercase, capitalize)
- Paragraph attributes (alignment, ellipsize mode, max lines, justify)

For Buck builds, pango/pangoft2 deps are added under PLATFORMS_USING_CXX. For Fantom/CMake builds, 8 vendored libraries are added (freetype, harfbuzz, expat, libffi, fribidi, glib, fontconfig, pango) with custom CMakeLists.txt files and pre-generated config headers for Linux x86_64.

Differential Revision: D93564131
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. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments