diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm index 1a33fa977d82..3f7adc4a93b4 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm @@ -421,6 +421,10 @@ void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText) string = [NSString stringWithFormat:@"%C", (unichar)NSAttachmentCharacter]; attributes = [NSMutableDictionary dictionaryWithObject:attachment forKey:NSAttachmentAttributeName]; + UIFont *font = RCTEffectiveFontFromTextAttributes(fragment.textAttributes); + if (font) { + attributes[NSFontAttributeName] = font; + } } else { NSString *decoded = [[NSString alloc] initWithBytes:fragment.string.data() length:fragment.string.size() diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm index 3e93b60e64be..9d1d4a58cdc1 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm @@ -643,13 +643,15 @@ - (TextMeasurement)_measureTextStorage:(NSTextStorage *)textStorage CGRect glyphRect = [layoutManager boundingRectForGlyphRange:range inTextContainer:textContainer]; CGRect frame; - UIFont *font = [[textStorage attributedSubstringFromRange:range] attribute:NSFontAttributeName - atIndex:0 - effectiveRange:nil]; + NSDictionary *attributes = [textStorage attributesAtIndex:range.location + effectiveRange:nil]; + UIFont *font = attributes[NSFontAttributeName]; + CGFloat baselineOffset = [attributes[NSBaselineOffsetAttributeName] doubleValue]; frame = { .origin = {glyphRect.origin.x, - glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender}, + glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender - + baselineOffset}, .size = attachmentSize}; auto rect = facebook::react::Rect{