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

Missing sharp solid style in pro version? #224

Open
steve3d opened this issue Sep 12, 2022 · 11 comments
Open

Missing sharp solid style in pro version? #224

steve3d opened this issue Sep 12, 2022 · 11 comments

Comments

@steve3d
Copy link

steve3d commented Sep 12, 2022

fontawesome-pro 6.2's major change is the sharp solid style icons.

Then I tried to follow the readme to create my own pro version, and I found that the sharp solid style are completely ignored.

here is the styles: https://fontawesome.com/search?o=r&s=solid&f=sharp

as you can see, the sharp solid is just a solid variation, but in generated pubspec.yaml:

flutter:
  fonts:
    - family: FontAwesomeBrands
      fonts:
        - asset: lib/fonts/fa-brands-400.ttf
          weight: 400
    - family: FontAwesomeRegular
      fonts:
        - asset: lib/fonts/fa-regular-400.ttf
          weight: 400
    - family: FontAwesomeSolid
      fonts:
        - asset: lib/fonts/fa-solid-900.ttf
          weight: 900
    - family: FontAwesomeLight
      fonts:
        - asset: lib/fonts/fa-light-300.ttf
          weight: 300
    - family: FontAwesomeThin
      fonts:
        - asset: lib/fonts/fa-thin-100.ttf
          weight: 100

there is no fa-sharp-solid-900.ttf, I think the simplest way and maybe annoying way is duplicate and add sharp prefix to all solid icons. like FontAwesomeIcons.solidZero and FontAwesomeIcons.sharpSolidZero? indeed a little strange 😅

@michaelspiss
Copy link
Collaborator

Hi, sharp is not supported with the newest release because the icons are limited to pro. I don't own a pro license and won't buy one just to then support a paid feature for free (we've discussed this thoroughly with duotone support). This means pro icons are supported solely by the community, more explicitly by people who already own/have access to a license.

Now let's get to the good part:
You may be able to get this working the following way:
add these lines to your pubspec under fonts:

    - family: FontAwesomeSharpSolid
      fonts:
        - asset: lib/fonts/fa-sharp-solid-900.ttf
          weight: 900

This makes sure flutter knows about the font file.

Now take a look at the icons.json file provided in the metadata folder. Check how the sharp icons are identified - in the best case, there only is a new style named sharp-solid or something. Otherwise, this would require significant changes to the configurator tool.

I may be able to assist further once I have this piece of information.

@steve3d
Copy link
Author

steve3d commented Sep 12, 2022

Thanks for the quick response, but your suggestion will not work, in version 6.2, every solid icon has a sharp version, so there is no any information in the icons.json. e.g, 360-degrees icon in icons.json:

  "360-degrees": {
    "changes": [
      "6.0.0-beta1",
      "6.2.0"
    ],
    "label": "360 Degrees",
    "search": {
      "terms": []
    },
    "styles": [
      "solid",
      "regular",
      "light",
      "thin",
      "duotone"
    ],
    "unicode": "e2dc",
    "voted": false
  },

and here is the web preview url for this icon : https://fontawesome.com/icons/360-degrees?s=solid&f=classic

as you can see, if there is a solid icon, then the sharp solid version exists.

@steve3d
Copy link
Author

steve3d commented Sep 12, 2022

and also, every solid sharp version has a normal rounded solid version, the two version seems equivalent.

you can also checkout the changelog of version 6.2 here:
https://fontawesome.com/docs/changelog/

@michaelspiss
Copy link
Collaborator

Ok, so the configurator would need to infer the "sharp" capability from the existence of the fa-sharp-solid-900.ttf file. This assumes that every solid icon is present in the sharp-solid style - which I'm not happy with, but that's the best we can do.

We could add a check like this in the pipeline at the first step when looking for the icons.json. Then add sharp-solid or sharpSolid to the list of styles and add a link to sharp-solid whenever a solid icon gets added.
This way we could make sure everything stays compatible.

I may work on this in the future, but it is not high on my list of priorities right now.

@steve3d
Copy link
Author

steve3d commented Sep 12, 2022

in order to the this sharp solid version, you might also need to check if this is a pro version later than 6.2.0, in previous 6.x version, there is no sharp solid version, I think fontaweome introduced the icon families, like classic icons, now sharp version for only solid, then might be sharp regular.

like this changelog line:

Two new files are now available from the metadata directory: icon-families.json and icon-families.yml which are restructured to support Font Awesome Families.

@michaelspiss
Copy link
Collaborator

That's why I'd check for the sharp font file directly.

Not sure what font awesome families are supposed to be - I guess classic and sharp?

@steve3d
Copy link
Author

steve3d commented Sep 14, 2022

here is the font-families.json icon example:

{
  "0": {
    "changes": [
      "6.0.0-beta1",
      "6.2.0"
    ],
    "ligatures": [],
    "unicode": "30",
    "label": "0",
    "voted": false,
    "svgs": {
      "classic": {
        "solid": {
          "lastModified": 1660321776,
          "raw": "",
          "viewBox": [
            0,
            0,
            320,
            512
          ],
          "width": 320,
          "height": 512,
          "path": ""
        },
        "regular": {
          "lastModified": 1660014469,
          "raw": "",
          "viewBox": [
            0,
            0,
            320,
            512
          ],
          "width": 320,
          "height": 512,
          "path": ""
        },
        "light": {
          "lastModified": 1660014469,
          "raw": "",
          "viewBox": [
            0,
            0,
            320,
            512
          ],
          "width": 320,
          "height": 512,
          "path": ""
        },
        "thin": {
          "lastModified": 1660014469,
          "raw": "",
          "viewBox": [
            0,
            0,
            320,
            512
          ],
          "width": 320,
          "height": 512,
          "path": ""
        }
      },
      "duotone": {
        "solid": {
          "lastModified": 1660014469,
          "raw": "",
          "viewBox": [
            0,
            0,
            320,
            512
          ],
          "width": 320,
          "height": 512,
          "path": [
            
          ]
        }
      },
      "sharp": {
        "solid": {
          "lastModified": 1660321776,
          "raw": "",
          "viewBox": [
            0,
            0,
            320,
            512
          ],
          "width": 320,
          "height": 512,
          "path": ""
        }
      }
    },
    "familyStylesByLicense": {
      "free": [
        {
          "family": "classic",
          "style": "solid"
        }
      ],
      "pro": [
        {
          "family": "classic",
          "style": "solid"
        },
        {
          "family": "classic",
          "style": "regular"
        },
        {
          "family": "classic",
          "style": "light"
        },
        {
          "family": "classic",
          "style": "thin"
        },
        {
          "family": "duotone",
          "style": "solid"
        },
        {
          "family": "sharp",
          "style": "solid"
        }
      ]
    }
  },
  ...

I've removed raw and path content, those are svg related, I have the pro license, so how can I provide this sharp font to you?

so you can see there are 3 families for now, each family might have more than one style.

@michaelspiss
Copy link
Collaborator

Thanks, it's good to know what this file looks like.

I won't work on this for now due to the reasons laid out above and even though it's very nice of you to offer to share the required files with me, it would violate font awesome's licensensing agreement.

Feel free to work on this and provide a pull request once you have a working solution, I'd be happy to merge it.

@michaelspiss michaelspiss pinned this issue Feb 10, 2023
@aebrahim
Copy link

@michaelspiss I would be happy to pay for 2 years of font awesome pro for you if that helps you implement this feature, but I'm a little surprised the font awesome folks haven't offered to give you a free perpetual license given how awesome this package is and your amazing work on it.

@michaelspiss
Copy link
Collaborator

Hey @aebrahim and thanks for the offer! We already contacted them and they declined. By now I've taken the stance that the community should not pay to implement their features out of their pocket. Because even if the license is paid for, it is still a lot of work to make sure the features are implemented correctly and stay up to date with their changes. I'd rather not introduce a feature than having to deal with feature regression/having to remove them again once people are already using them. We did this with Duotone icons for a while, but had to drop support exactly because of these reasons. In my opinion, if they want to extend their reach to the flutter ecosystem officially, they should also pay for the cost of implementation of their paid features.

We are committed to enable the use font awesome icons on flutter for the free version. When it comes to the pro icons, the configurator gives a lot of freedom already, but we will not implement any additions to the current state ourselves. We are happy to take contributions in form of pull requests however :)

@JudahMcNicholl
Copy link

Hi,
So I wanted to use the Sharp Icons through this package also, I have put a PR in on how to do this
#261
I don't expect this to be accepted but I hope that people will be able to use these code changes to get started using Sharp Icons.

Key points:
Copy in the contents of font-families.json from your downloaded font-awesome web into lib/fonts/icons.json
It it backwards compatible as it checks relevant keys in the icons.json

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

4 participants