File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @react-pdf/layout " : minor
3
+ ---
4
+
5
+ Use monochrome emojis contained in the font family if no emoji source available
Original file line number Diff line number Diff line change @@ -69,8 +69,6 @@ export const fetchEmojis = (string, source) => {
69
69
return promises ;
70
70
} ;
71
71
72
- const specialCases = [ '©️' , '®' , '™' ] ; // Do not treat these as emojis if emoji not present
73
-
74
72
export const embedEmojis = ( fragments ) => {
75
73
const result = [ ] ;
76
74
@@ -82,8 +80,6 @@ export const embedEmojis = (fragments) => {
82
80
Array . from ( fragment . string . matchAll ( regex ) ) . forEach ( ( match ) => {
83
81
const { index } = match ;
84
82
const emoji = match [ 0 ] ;
85
- const isSpecialCase = specialCases . includes ( emoji ) ;
86
-
87
83
const emojiSize = fragment . attributes . fontSize ;
88
84
const chunk = fragment . string . slice ( lastIndex , index + match [ 0 ] . length ) ;
89
85
@@ -102,12 +98,10 @@ export const embedEmojis = (fragments) => {
102
98
} ,
103
99
} ,
104
100
} ) ;
105
- } else if ( isSpecialCase ) {
106
- result . push ( { string : chunk , attributes : fragment . attributes } ) ;
107
101
} else {
108
- // If no emoji data, we just replace the emoji with a nodef char
102
+ // If no emoji data, we try to use emojis in the font
109
103
result . push ( {
110
- string : chunk . replace ( match , String . fromCharCode ( 0 ) ) ,
104
+ string : chunk ,
111
105
attributes : fragment . attributes ,
112
106
} ) ;
113
107
}
You can’t perform that action at this time.
0 commit comments