Generate property accessors in FiggleFonts class#39
Closed
drewnoakes wants to merge 1 commit intomasterfrom
Closed
Generate property accessors in FiggleFonts class#39drewnoakes wants to merge 1 commit intomasterfrom
drewnoakes wants to merge 1 commit intomasterfrom
Conversation
Uses a T4 template to generate property accessors for bundled fonts. Reduces the chance that this gets out of sync. Because several file names are not valid C# identifiers, or because they're really composite names, we add `Aliases.csv` as a mechanism to override the default name that would otherwise be calculated.
Collaborator
|
I don't think it would be too hard to create an internal source generator to generate the fonts from the csv—we just need to include the csv as an additional file (we could also hardcode the generator to look for Using a source generator should then make it easy to also implement #38 which I think is a really cool idea. Do you mind keeping this PR open while I take a stab at an internal source generator first? |
Owner
Author
|
Go for it! I'm not married to this approach and a source generator would be better in every way :) |
Owner
Author
|
Obsolete with the superior approach in #41. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses a T4 template to generate property accessors for bundled fonts. Reduces the chance that this gets out of sync, especially if we add more fonts (#2).
Because several file names are not valid C# identifiers, or because they're really composite names, we add
Aliases.csvas a mechanism to override the default name that would otherwise be calculated.I'm of two minds about this approach. It avoids having to manually keep the file up to date, which is good. It also allows us to do other kinds of generation in future (such as enumerating all fonts without reflection over properties).
The downside is that T4 is a VS-only thing. A source generator would be better, but it feels overkill to make one just for this single usage.
Doing this gave me another idea, which I filed as #38. That idea would be hard to achieve with T4 though.