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

[builder.names] set empty weight string if 'Regular' #301

Merged
merged 1 commit into from
Dec 18, 2017

Conversation

anthrotype
Copy link
Member

same as we do for the 'width'.

Fixes #300

@schriftgestalt
Copy link
Collaborator

schriftgestalt commented Dec 18, 2017

I solution is to put all pieces in an OrderedSet and remove "Regular" if it has more than 1 elements. Because you normally what to keep the "Regular" if there are not other elements?

@anthrotype
Copy link
Member Author

yeah, but that is already handled by the build_style_name function

def build_style_name(width='', weight='', custom='', is_italic=False):
    """Build style name from width, weight, and custom style strings
    and whether the style is italic.
    """

    return ' '.join(
        s for s in (custom, width, weight, 'Italic' if is_italic else '') if s
    ) or 'Regular'

@anthrotype
Copy link
Member Author

I could bake the logic of "treat the string 'Regular' as a special one but only for the width and weight attributes" inside the build_style_name function itself.
However, I prefer to leave it to the caller to pass correct input (and that is what we were already doing for the width -- where Regular was special-cased by the caller - but not for the weight).
Garbage in, garbage out.

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

Successfully merging this pull request may close these issues.

2 participants