@@ -205,32 +205,32 @@ pub fn xml_to_pdf_pages(
205205
206206 // Add embedded fonts from options to the font cache
207207 // This is critical for WASM where there are no system fonts
208- #[ cfg( target_family = "wasm" ) ]
208+ #[ cfg( all ( target_family = "wasm" , feature = "js-sys" ) ) ]
209209 {
210210 web_sys:: console:: log_1 ( & format ! ( "Loading {} embedded fonts..." , options. fonts. len( ) ) . into ( ) ) ;
211211 }
212212
213213 for ( font_name, font_bytes) in & options. fonts {
214- #[ cfg( target_family = "wasm" ) ]
214+ #[ cfg( all ( target_family = "wasm" , feature = "js-sys" ) ) ]
215215 {
216216 web_sys:: console:: log_1 ( & format ! ( " Parsing font: {} ({} bytes)" , font_name, font_bytes. len( ) ) . into ( ) ) ;
217217 }
218218
219219 if let Some ( parsed_fonts) = rust_fontconfig:: FcParseFontBytes ( font_bytes, font_name) {
220- #[ cfg( target_family = "wasm" ) ]
220+ #[ cfg( all ( target_family = "wasm" , feature = "js-sys" ) ) ]
221221 {
222222 web_sys:: console:: log_1 ( & format ! ( " -> Successfully parsed {} font variants" , parsed_fonts. len( ) ) . into ( ) ) ;
223223 }
224224 fc_cache. with_memory_fonts ( parsed_fonts) ;
225225 } else {
226- #[ cfg( target_family = "wasm" ) ]
226+ #[ cfg( all ( target_family = "wasm" , feature = "js-sys" ) ) ]
227227 {
228228 web_sys:: console:: log_1 ( & format ! ( " -> Failed to parse font!" ) . into ( ) ) ;
229229 }
230230 }
231231 }
232232
233- #[ cfg( target_family = "wasm" ) ]
233+ #[ cfg( all ( target_family = "wasm" , feature = "js-sys" ) ) ]
234234 {
235235 let font_list = fc_cache. list ( ) ;
236236 web_sys:: console:: log_1 ( & format ! ( "Font cache now contains {} fonts" , font_list. len( ) ) . into ( ) ) ;
0 commit comments