mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Round text size to closest larger pixel size
Summary: Changelog: [Internal] Round calculated text size to closest larger pixel size. In Paper we do this as well in https://fburl.com/diffusion/w2pj6ea0 Why do we need this? For example, we calculate height of the text to be 16.707235, yoga takes this value and assigns text to have height 17 anyway. I assume Yoga uses this extra 0.3 points of height to move other things around a little bit because Yoga doesn't deal with exact values. Reviewed By: shergin Differential Revision: D21999032 fbshipit-source-id: 73923dc3e27fa110adb3f76cfa635e0bfdc672d4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
03443d77f5
commit
fb8411d4df
@@ -10,6 +10,7 @@
|
||||
#import "NSTextStorage+FontScaling.h"
|
||||
#import "RCTAttributedTextUtils.h"
|
||||
|
||||
#import <React/RCTUtils.h>
|
||||
#import <react/utils/ManagedObjectWrapper.h>
|
||||
#import <react/utils/SimpleThreadSafeCache.h>
|
||||
|
||||
@@ -56,6 +57,8 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
|
||||
|
||||
CGSize size = [layoutManager usedRectForTextContainer:textContainer].size;
|
||||
|
||||
size = (CGSize){RCTCeilPixelValue(size.width), RCTCeilPixelValue(size.height)};
|
||||
|
||||
__block auto attachments = TextMeasurement::Attachments{};
|
||||
|
||||
[textStorage
|
||||
|
||||
Reference in New Issue
Block a user