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

Add Named Constructors for Font constructors #969

Open
cugone opened this issue Aug 2, 2021 · 1 comment
Open

Add Named Constructors for Font constructors #969

cugone opened this issue Aug 2, 2021 · 1 comment

Comments

@cugone
Copy link
Contributor

cugone commented Aug 2, 2021

Adding named constructors for True/OpenType and Bitmap Fonts that call the proper (now private) constructors will prevent confusion on which to use and will self-document the code.

@DanRStevens
Copy link
Collaborator

You're probably right. They're not well differentiated.

I suppose we could have a constructor taking a FontInfo instead, and factory methods that build a font based on font type. That does raise some validation concerns with the FontInfo struct though, since all fields are public, and they may not all be mutually consistent.

I should also point out that the change won't play well with the current ResourceCache usage, which requires constructors to function. We would need to extend ResourceCache to allow for alternate factory functions before we could really consider making this change for Font.

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

No branches or pull requests

2 participants