Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to pass in file specific overrides/defaults to FontData #23

Open
kontur opened this issue Apr 21, 2017 · 1 comment
Open

Option to pass in file specific overrides/defaults to FontData #23

kontur opened this issue Apr 21, 2017 · 1 comment
Assignees

Comments

@kontur
Copy link
Contributor

kontur commented Apr 21, 2017

Somewhat related to #22 it would be great to have an option to a) overwrite or b) provide defaults for FontData return values.

The most pressing use case for this is essentially overwriting the font family name; for example I have a page showing all fonts of a family; various widgets might use the getCSSFontName extracted from the file, but it is redundant to show the Family name repeatedly.

Equally this could be an option to provide a default, should the detection of a value from the file fail.

I'd image this could be a object that has the font file name as key, then objects for overrides and fallbacks, like

{
    "foo.woff":
    "overrides": {
        "familyName": "Bar"
    },
    "fallbacks": {
        "weight": "Normal"
    }
}

What you think, useful for you?

kontur added a commit to kontur/specimenTools that referenced this issue Jul 20, 2017
graphicore added a commit that referenced this issue Jul 20, 2017
Added possibility to overwrite font names as per #23
@graphicore
Copy link
Owner

I just merged #24, but in the long run, I'd prefer to make a more general solution to the problem.

I'm thinking of an interface definition as the API of FontData and then making it easy to create different implementations. One could be an implementation that takes multiple FontData implementations and falls back if one fontData does not provide the value to the next.

In general, the FontData Object is pretty important for almost everything, so maybe we should overthink it, how to make it useful for more cases.

Keeping this issue open as a reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants