Skip to content

Commit f39a611

Browse files
authored
Revert "Add font support for emojis" (#682)
1 parent fa3e270 commit f39a611

9 files changed

+13
-28
lines changed

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ const FONT_FAMILY_MONOSPACE = Platform.select({
6666
default: 'monospace',
6767
});
6868

69-
const FONT_FAMILY_EMOJI = Platform.select({
70-
ios: 'Apple Color Emoji',
71-
android: 'Noto Color Emoji',
72-
default: 'Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji',
73-
});
74-
7569
const markdownStyle: MarkdownStyle = {
7670
syntax: {
7771
color: 'gray',
@@ -84,7 +78,6 @@ const markdownStyle: MarkdownStyle = {
8478
},
8579
emoji: {
8680
fontSize: 20,
87-
fontFamily: FONT_FAMILY_EMOJI,
8881
},
8982
blockquote: {
9083
borderColor: 'gray',

android/src/main/java/com/expensify/livemarkdown/MarkdownFormatter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ private void applyRange(@NonNull SpannableStringBuilder ssb, @NonNull MarkdownRa
7070
setSpan(ssb, new MarkdownStrikethroughSpan(), start, end);
7171
break;
7272
case "emoji":
73-
setSpan(ssb, new MarkdownFontFamilySpan(markdownStyle.getEmojiFontFamily(), mAssetManager), start, end);
74-
setSpan(ssb, new MarkdownFontSizeSpan(markdownStyle.getEmojiFontSize()), start, end);
73+
setSpan(ssb, new MarkdownEmojiSpan(markdownStyle.getEmojiFontSize()), start, end);
7574
break;
7675
case "mention-here":
7776
setSpan(ssb, new MarkdownForegroundColorSpan(markdownStyle.getMentionHereColor()), start, end);

android/src/main/java/com/expensify/livemarkdown/MarkdownStyle.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public class MarkdownStyle {
2121

2222
private final float mH1FontSize;
2323

24-
@NonNull
25-
private final String mEmojiFontFamily;
26-
2724
private final float mEmojiFontSize;
2825

2926
@ColorInt
@@ -80,7 +77,6 @@ public MarkdownStyle(@NonNull ReadableMap map, @NonNull Context context) {
8077
mLinkColor = parseColor(map, "link", "color", context);
8178
mH1FontSize = parseFloat(map, "h1", "fontSize");
8279
mEmojiFontSize = parseFloat(map, "emoji", "fontSize");
83-
mEmojiFontFamily = parseString(map, "emoji", "fontFamily");
8480
mBlockquoteBorderColor = parseColor(map, "blockquote", "borderColor", context);
8581
mBlockquoteBorderWidth = parseFloat(map, "blockquote", "borderWidth");
8682
mBlockquoteMarginLeft = parseFloat(map, "blockquote", "marginLeft");
@@ -146,10 +142,6 @@ public float getEmojiFontSize() {
146142
return mEmojiFontSize;
147143
}
148144

149-
public String getEmojiFontFamily() {
150-
return mEmojiFontFamily;
151-
}
152-
153145
@ColorInt
154146
public int getBlockquoteBorderColor() {
155147
return mBlockquoteBorderColor;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.expensify.livemarkdown.spans;
2+
3+
import android.text.style.AbsoluteSizeSpan;
4+
5+
import com.facebook.react.uimanager.PixelUtil;
6+
7+
public class MarkdownEmojiSpan extends AbsoluteSizeSpan implements MarkdownSpan {
8+
public MarkdownEmojiSpan(float fontSize) {
9+
super((int) PixelUtil.toPixelFromDIP(fontSize), false);
10+
}
11+
}

apple/MarkdownFormatter.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ - (void)applyRangeToAttributedString:(NSMutableAttributedString *)attributedStri
7272
variant:nil
7373
scaleMultiplier:0];
7474
} else if (type == "emoji") {
75-
font = [RCTFont updateFont:font withFamily:markdownStyle.emojiFontFamily
75+
font = [RCTFont updateFont:font withFamily:nil
7676
size:[NSNumber numberWithFloat:markdownStyle.emojiFontSize]
7777
weight:nil
7878
style:nil

apple/RCTMarkdownStyle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ NS_ASSUME_NONNULL_BEGIN
1010
@property (nonatomic) UIColor *linkColor;
1111
@property (nonatomic) CGFloat h1FontSize;
1212
@property (nonatomic) CGFloat emojiFontSize;
13-
@property (nonatomic) NSString *emojiFontFamily;
1413
@property (nonatomic) UIColor *blockquoteBorderColor;
1514
@property (nonatomic) CGFloat blockquoteBorderWidth;
1615
@property (nonatomic) CGFloat blockquoteMarginLeft;

apple/RCTMarkdownStyle.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ - (instancetype)initWithStruct:(const facebook::react::MarkdownTextInputDecorato
1414
_h1FontSize = style.h1.fontSize;
1515

1616
_emojiFontSize = style.emoji.fontSize;
17-
_emojiFontFamily = RCTNSStringFromString(style.emoji.fontFamily);
1817

1918
_blockquoteBorderColor = RCTUIColorFromSharedColor(style.blockquote.borderColor);
2019
_blockquoteBorderWidth = style.blockquote.borderWidth;

src/MarkdownTextInputDecoratorViewNativeComponent.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ interface MarkdownStyle {
99
};
1010
emoji: {
1111
fontSize: Float;
12-
fontFamily: string;
1312
};
1413
link: {
1514
color: ColorValue;

src/styleUtils.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ const FONT_FAMILY_MONOSPACE = Platform.select({
1010
default: 'monospace',
1111
});
1212

13-
const FONT_FAMILY_EMOJI = Platform.select({
14-
ios: 'Apple Color Emoji',
15-
android: 'Noto Color Emoji',
16-
default: 'Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji',
17-
});
18-
1913
function makeDefaultMarkdownStyle(): MarkdownStyle {
2014
return {
2115
syntax: {
@@ -29,7 +23,6 @@ function makeDefaultMarkdownStyle(): MarkdownStyle {
2923
},
3024
emoji: {
3125
fontSize: 20,
32-
fontFamily: FONT_FAMILY_EMOJI,
3326
},
3427
blockquote: {
3528
borderColor: 'gray',

0 commit comments

Comments
 (0)