Match family font in React tailwind and Wasm

hello, i just switched to tailwind css instead of customized css and when defining the font family in tailwind i set it to the system fonts. however, im also using font in wasm to render few things which some of them are under the react component. I was looking for a way to match the two font family both in react and wasm side. any help!!

web_sys offers bindings for all browser APIs. What framework are you using on the WASM side? Maybe it has a nicer API than using web_sys directly to query the font family from your document. Or if you create the element in WASM, can't you just add the correct tailwind class to it? Or inherit it from the parent react component?

im using web_sys directly to set the font and size to the web_sys::CanvasRenderingContext2d which is a canvas that has for example a title in the middle and i created a title box in react to be on top of it. i already set the font family for the text in react but still stuck to get the font in wasm the same.

Can you retrieve the style from the react element with web_sys::Window::get_computed_style on the WASM side?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.