File tree Expand file tree Collapse file tree
vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,6 +158,28 @@ void WindowsTextLayoutManager::GetTextLayout(
158158 }
159159 winrt::check_hresult (spTextFormat->SetTextAlignment (alignment));
160160
161+ // Set reading direction based on baseWritingDirection
162+ if (outerFragment.textAttributes .baseWritingDirection ) {
163+ DWRITE_READING_DIRECTION readingDirection = DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
164+ switch (*outerFragment.textAttributes .baseWritingDirection ) {
165+ case facebook::react::WritingDirection::LeftToRight:
166+ readingDirection = DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
167+ break ;
168+ case facebook::react::WritingDirection::RightToLeft:
169+ readingDirection = DWRITE_READING_DIRECTION_RIGHT_TO_LEFT;
170+ break ;
171+ case facebook::react::WritingDirection::Natural:
172+ // For Natural, default to left-to-right. In a more complete implementation,
173+ // this could be determined based on the script/locale context.
174+ readingDirection = DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
175+ break ;
176+ default :
177+ readingDirection = DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
178+ break ;
179+ }
180+ winrt::check_hresult (spTextFormat->SetReadingDirection (readingDirection));
181+ }
182+
161183 // Get text with Object Replacement Characters for attachments
162184 auto str = GetTransformedText (attributedStringBox);
163185 winrt::check_hresult (Microsoft::ReactNative::DWriteFactory ()->CreateTextLayout (
You can’t perform that action at this time.
0 commit comments