matthewrdev/fa2cs

How can we run this locally

Axemasta opened this issue · 4 comments

I'm interested in running this tool locally because I want to enhance the code generated by adding an attribute (that i've defined) for the supported fonts, updating the generated code to look something like:

[Description("arrow-right")]
[SupportedFonts(FontAwesome.Regular, ...)]
public const string ArrowRight = "\uf061";

[Description("apple")]
[SupportedFonts(FontAwesome.Brands)]
public const string Apple = "\uf179";

Looking at the tool, it requires an icons.json file on the desktop. How do I acquire this file, is it something publicly available or is it private?

Thanks

Hi @Axemasta,

There are some instructions attached to the main program.cs. To recap them:

To run the code generator, you will need:

  • A paid Font Awesome subscription
  • To download the 'Font Awesome Pro for the web' archive data: https://fontawesome.com/download
  • To place the 'metadata/icons.json' onto your Desktop and name it 'icons.json'

The icons.json file is found within the Web Pro version of font awesome; this contains the meta data for the entire iconset.

Let me know if you have any more questions!

Ok brilliant, I do have a pro license I didn't see that comment about where to find it. Thanks very much and thanks generally for this library, I use it daily & it's super useful ❤️

No problem. The instructions are a little buried, even took me a few moments to find the documentation I wrote to remember how to run the tool!

I got it up and running and have made some changes for my own personal needs, my use case was just displaying a list of all the fonts in a big collectionview and not all of the fonts in FA display (ie brand fonts), so I have added 2 new attributes to the generated fields:

/// <summary>
/// fa-5 unicode value ("\u0035").
/// <para/>
/// This icon supports the following styles: Light (Pro), Regular (Pro), Solid, Duotone (Pro), Thin (Pro)
/// <para/>
/// Introduced in '6.0.0-beta1', Last Modified in '6.5.0'.
/// <para/>
/// See https://fontawesome.com/icons/5
/// </summary>
[Description("5")]
++[SupportedFreeFonts(Style.Solid)]
++[SupportedProFonts(Style.Solid, Style.Regular, Style.Light, Style.Thin, Style.Duotone)]
public const string Five = "\u0035";

Which means I can now handle that within my little sample gallery app without having some dead icons in my collection view!

You can see those changes here, I doubt you're interested in adding them back in but I'd be happy to Pr if you thought it would be useful.