andreinitescu / IconFont2Code

Generate C# class with constant fields for the icons in your font
277 stars 37 forks source link

Invalid field names get generated. #12

Closed Andrew-Oliveira closed 3 years ago

Andrew-Oliveira commented 3 years ago

Problem:

Invalid field names can get generated. (Specifically field names beginning with a number.)

Reproduction Steps:

  1. Upload font. https://github.com/google/material-design-icons/blob/master/font/MaterialIcons-Regular.ttf
  2. The following field will get generated: public const string 6_ft_apart = "\uf21e";

Suggested Fix:

Prefix any field that would start with a numeric value with an underscore. public const string _6_ft_apart = "\uf21e";

andreinitescu commented 3 years ago

Hi Andrew! Many thanks for reporting this. It should be fixed now