1
1
import * as P from '@react-pdf/primitives' ;
2
- import { Font , Fragment , fromFragments } from '@react-pdf/textkit' ;
2
+ import { Fragment , fromFragments } from '@react-pdf/textkit' ;
3
3
import FontStore from '@react-pdf/font' ;
4
4
5
5
import { embedEmojis } from './emoji' ;
@@ -65,14 +65,11 @@ const getFragments = (
65
65
// Fallback font
66
66
fontFamilies . push ( 'Helvetica' ) ;
67
67
68
- // TODO: Fix multiple fonts passed
69
68
const font = fontFamilies . map ( ( fontFamilyName ) => {
70
- if ( typeof fontFamilyName !== 'string' ) return fontFamilyName ;
71
-
72
69
const opts = { fontFamily : fontFamilyName , fontWeight, fontStyle } ;
73
70
const obj = fontStore . getFont ( opts ) ;
74
- return obj ? obj . data : fontFamilyName ;
75
- } ) as Font [ ] ;
71
+ return obj ? .data ;
72
+ } ) ;
76
73
77
74
// Don't pass main background color to textkit. Will be rendered by the render package instead
78
75
const backgroundColor = level === 0 ? null : instance . style . backgroundColor ;
@@ -111,7 +108,6 @@ const getFragments = (
111
108
if ( isImage ( child ) ) {
112
109
fragments . push ( {
113
110
string : String . fromCharCode ( 0xfffc ) ,
114
- // @ts -expect-error custom font substitution engine deals with multiple fonts. unify with textkit
115
111
attributes : {
116
112
...attributes ,
117
113
attachment : {
@@ -124,7 +120,6 @@ const getFragments = (
124
120
} else if ( isTextInstance ( child ) ) {
125
121
fragments . push ( {
126
122
string : transformText ( child . value , textTransform ) ,
127
- // @ts -expect-error custom font substitution engine deals with multiple fonts. unify with textkit
128
123
attributes,
129
124
} ) ;
130
125
} else if ( child ) {
0 commit comments