|
15 | 15 | #import <React/RCTTextView.h> |
16 | 16 | #import "NSTextStorage+FontScaling.h" |
17 | 17 |
|
18 | | -#import <react/featureflags/ReactNativeFeatureFlags.h> |
19 | | - |
20 | 18 | @implementation RCTTextShadowView { |
21 | 19 | __weak RCTBridge *_bridge; |
22 | 20 | BOOL _needsUpdateView; |
@@ -379,38 +377,17 @@ - (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext |
379 | 377 | attribute:NSFontAttributeName |
380 | 378 | atIndex:0 |
381 | 379 | effectiveRange:nil]; |
382 | | - |
383 | | - if (facebook::react::ReactNativeFeatureFlags::enableLineHeightCenteringOnIOS()) { |
384 | | - CGFloat ascender = font.ascender; |
385 | | - CGFloat descender = fabs(font.descender); |
386 | | - CGFloat textHeight = ascender + descender; |
387 | | - CGFloat leading = usedRect.size.height - textHeight; |
388 | | - CGFloat adjustedAscender = ascender + ceil(leading / 2.0); |
389 | | - CGFloat adjustedDescender = descender + floor(leading / 2.0); |
390 | | - [lineData addObject:@{ |
391 | | - @"text" : renderedString, |
392 | | - @"x" : @(usedRect.origin.x), |
393 | | - @"y" : @(usedRect.origin.y), |
394 | | - @"width" : @(usedRect.size.width), |
395 | | - @"height" : @(usedRect.size.height), |
396 | | - @"descender" : @(adjustedDescender), |
397 | | - @"capHeight" : @(font.capHeight), |
398 | | - @"ascender" : @(adjustedAscender), |
399 | | - @"xHeight" : @(font.xHeight), |
400 | | - }]; |
401 | | - } else { |
402 | | - [lineData addObject:@{ |
403 | | - @"text" : renderedString, |
404 | | - @"x" : @(usedRect.origin.x), |
405 | | - @"y" : @(usedRect.origin.y), |
406 | | - @"width" : @(usedRect.size.width), |
407 | | - @"height" : @(usedRect.size.height), |
408 | | - @"descender" : @(-font.descender), |
409 | | - @"capHeight" : @(font.capHeight), |
410 | | - @"ascender" : @(font.ascender), |
411 | | - @"xHeight" : @(font.xHeight), |
412 | | - }]; |
413 | | - } |
| 380 | + [lineData addObject:@{ |
| 381 | + @"text" : renderedString, |
| 382 | + @"x" : @(usedRect.origin.x), |
| 383 | + @"y" : @(usedRect.origin.y), |
| 384 | + @"width" : @(usedRect.size.width), |
| 385 | + @"height" : @(usedRect.size.height), |
| 386 | + @"descender" : @(-font.descender), |
| 387 | + @"capHeight" : @(font.capHeight), |
| 388 | + @"ascender" : @(font.ascender), |
| 389 | + @"xHeight" : @(font.xHeight), |
| 390 | + }]; |
414 | 391 | }]; |
415 | 392 | NSDictionary *payload = @{ |
416 | 393 | @"lines" : lineData, |
|
0 commit comments