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

Change generation interface? #1

Open
adamyanalunas opened this issue Oct 9, 2015 · 0 comments
Open

Change generation interface? #1

adamyanalunas opened this issue Oct 9, 2015 · 0 comments

Comments

@adamyanalunas
Copy link
Owner

Currently a Font instance is used only to have a convenient place to keep calling generate. This works, but isn't very intuitive or nice to look at. For example, updating multiple fonts can get pretty noisy:

let headlineFont = Font.SourceSansPro(24, weight: .Black, style: .Italic).generate()
let bylineFont = Font.SourceSansPro(17, weight: .Semibold).generate()
let bodyFont = Font.SourceSansPro(17, weight: .Medium).generate()\

headlineLabel.font = headlineFont
bylineLabel.font = bylineFont
fooLabel.font = bodyFont
bazLabel.font = bodyFont
barLabel.font = bodyFont

What if Font extensions were meant to generate a function that accepted the size, weight, and style for that particular font? That way you could generate a function for a particular font and call it as needed for different font adjustments.

let sourceSansPro = SourceSansPro()
let bodyFont = sourceSansPro(17, weight: .Medium)

headlineLabel.font = sourceSansPro(24, weight: .Black, style: .Italic)
bylineLabel.font = sourceSansPro(17, weight: .Semibold)
fooLabel.font = bodyFont
bazLabel.font = bodyFont
barLabel.font = bodyFont

Thoughts?

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

1 participant