Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
2.4 kB · 30 lines
at main
12345678910111213141516171819202122232425262728293031diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mmindex 5f9847a..0814305 100644--- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm+++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm@@ -621,15 +621,16 @@ - (TextMeasurement)_measureTextStorage:(NSTextStorage *)textStorage CGSize attachmentSize = attachment.bounds.size; CGRect glyphRect = [layoutManager boundingRectForGlyphRange:range inTextContainer:textContainer]; - CGRect frame;- UIFont *font = [[textStorage attributedSubstringFromRange:range] attribute:NSFontAttributeName- atIndex:0- effectiveRange:nil];- frame = {- .origin =- {glyphRect.origin.x,- glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender},- .size = attachmentSize};+ // Sit the attachment on the baseline TextKit laid its line out with. That baseline already+ // includes the offset that centers glyphs within a custom `lineHeight`, which the line+ // bottom plus the font's descender does not.+ NSUInteger glyphIndex = attachmentGlyphRange.location;+ CGRect lineFragmentRect = [layoutManager lineFragmentRectForGlyphAtIndex:glyphIndex+ effectiveRange:NULL];+ CGFloat baseline = lineFragmentRect.origin.y + [layoutManager locationForGlyphAtIndex:glyphIndex].y;++ CGRect frame = {+ .origin = {glyphRect.origin.x, baseline - attachmentSize.height}, .size = attachmentSize}; auto rect = facebook::react::Rect{ .origin = facebook::react::Point{.x = frame.origin.x, .y = frame.origin.y},