Skip to content

properties() only returns properties for single font variation #263

@kiedtl

Description

@kiedtl

Consider the following font: http://0x0.st/8yNw.ttf (uploading to 0x0.st, since GitHub won't let me upload it here). This file is a single font with variation on the weight axis, and the Windows font viewer says it contains ExtraLight, Light, Normal, Medium, Semibold, Bold, ExtraBold -- i.e. all weights from 200 to 800. Some quick testing with ttf_parser shows that this is indeed the case.

When loaded, though, currently this information is lost, and only the default variation is returned (400.0).

For reference, this is what I'm trying:

    let data = std::fs::read("AtkinsonHyperlegibleNext-VariableFont_wght.ttf").unwrap();
    let handle = font_kit::handle::Handle::Memory {
        bytes: Arc::new(data),
        font_index: 0,
    };
    let props = handle.load().unwrap().properties();
    eprintln!("{props:?}");

I'm not saying that properties should return all variations, but maybe there should be additional APIs for querying this information...?

Maybe I'm missing something obvious. I've only discovered this bug last night and the research I've done since then doesn't make me an OpenType expert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions