i use webfont-loader dynamic load fonts via css files,code like this
WebFont.load({
custom: {
families: 'Lobster',
urls:'mydomain.com/lobster.css'
}
}
and in the css file,it like this
@font-face {
font-family: 'Lobster';
src: url('Lobster_1.3-webfont.woff') format('woff'),
url('Lobster_1.3-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
i wonder as if there is a way to get the font face url,like "Lobster_1.3-webfont.ttf" and "Lobster_1.3-webfont.woff" which defined in css.
in webfont-loader,there is no such api,if there is no directly way,i have to load the css as text file first,but i relly don't want do such things
do you guys have any clue?
PS:the reason why i need the font's url,is because i use fabric.js to create svg file and render it to PDF by phantom.js in node side,but looks that phantom.js did not support svg with @import url('xxx.css'). so i have to use @font-face with src.