script::dom::fontface

Function parse_font_face_descriptors

Source
fn parse_font_face_descriptors(
    global: &GlobalScope,
    family_name: &DOMString,
    sources: Option<&str>,
    input_descriptors: &FontFaceDescriptors,
) -> Fallible<FontFaceRule>
Expand description

Given the various font face descriptors, construct the equivalent @font-face css rule as a string and parse it using style crate. Returns Err(Error::Syntax) if parsing fails.

Due to lack of support in the style crate, parsing the whole @font-face rule is much easier to implement than parsing each declaration on its own.