I have used css to link to font files in the conventional way, as seen here:
How can I use Google's Roboto font on a website?
However there are a few instances where I may need more complicated style rules, and I use javascript in such cases. Strangely google searches only returned css font link methods, but I'm suspecting js has a way. I got as far as:
d3.select('body').append('text').text('my text')
.attr('font-family', 'Roboto')
.attr('src', 'url(my_url) format('truetype')');
However I'm not sure if it's supposed to look like that. Given that it's not working, my hunch is no. Any ideas?