I have the fonts declarations in css rule @font-face
and I'm trying to list them with js
something like that :
css :
@font-face {font-family: font-name-1; src: ...}
@font-face {font-family: font-name-2; src: ...}
@font-face {font-family: font-name-3; src: ...}
js :
let font_list = list_my_fonts(); // ["font-name-1", "font-name-2", "font-name-3"];
i've tried :
let font_list = getComputedStyle(document.documentElement).getPropertyValue('font-face');
// empty string
or :
let font_list = Array.from(document.styleSheets);
// it gives me a big array of array in which i can't find the font-face rules
but I really don't know anything in js, so I'm having trouble knowing exactly what to do to reach my goal