Skip to content

Commit

Permalink
Merge pull request #274 from dalthviz/fixes_issue_230_p2
Browse files Browse the repository at this point in the history
PR: Add FontAwesome 6 icons (6.7.2) and change font update command
  • Loading branch information
ccordoba12 authored Feb 21, 2025
2 parents 78018eb + 95da433 commit 36de05f
Show file tree
Hide file tree
Showing 14 changed files with 2,166 additions and 34 deletions.
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,17 @@ The following prefixes are currently available to use:

- [**FontAwesome**](https://fontawesome.com):

- FA 6.7.2 features 2,060 free icons in different styles:

- `fa6` prefix has [163 icons in the "**regular**" style.](https://fontawesome.com/v6/search?o=r&ic=free&s=regular)
- `fa6s` prefix has [1402 icons in the "**solid**" style.](https://fontawesome.com/v6/search?o=r&ic=free&s=solid)
- `fa6b` prefix has [495 icons of various **brands**.](https://fontawesome.com/v6/search?o=r&ic=free&ip=brands)

- FA 5.15.4 features 1,608 free icons in different styles:

- `fa5` prefix has [151 icons in the "**regular**" style.](https://fontawesome.com/v5/search?o=r&m=free&s=regular)
- `fa5s` prefix has [1001 icons in the "**solid**" style.](https://fontawesome.com/v5/search?o=r&m=free&s=solid)
- `fa5b` prefix has [456 icons of various **brands**.](https://fontawesome.com/v5/search?o=r&m=free&f=brands)
- `fa5` prefix has [151 icons in the "**regular**" style.](https://fontawesome.com/v5/search?o=r&ic=free&s=regular)
- `fa5s` prefix has [1001 icons in the "**solid**" style.](https://fontawesome.com/v5/search?o=r&ic=free&s=solid)
- `fa5b` prefix has [456 icons of various **brands**.](https://fontawesome.com/v5/search?ic=brands)

- `ei` prefix holds [**Elusive Icons** 2.0 with its 304 icons](http://elusiveicons.com/icons/).

Expand All @@ -80,13 +86,21 @@ import qtawesome as qta
- Use Font Awesome, Elusive Icons, Material Design Icons, Phosphor, Remix Icon or Microsoft's Codicons.

```python
# Get FontAwesome 5.x icons by name in various styles:
# Get FontAwesome 6.x icons by name in various styles:
fa6_icon = qta.icon('fa6.flag')
fa6_button = QtWidgets.QPushButton(fa6_icon, 'Font Awesome 6! (regular)')
fa6s_icon = qta.icon('fa6s.flag')
fa6s_button = QtWidgets.QPushButton(fa6s_icon, 'Font Awesome 6! (solid)')
fa6b_icon = qta.icon('fa6b.github')
fa6b_button = QtWidgets.QPushButton(fa6b_icon, 'Font Awesome 6! (brands)')

# or FontAwesome 5.x icons by name in various styles:
fa5_icon = qta.icon('fa5.flag')
fa5_button = QtWidgets.QPushButton(fa5_icon, 'Font Awesome! (regular)')
fa5_button = QtWidgets.QPushButton(fa5_icon, 'Font Awesome 5! (regular)')
fa5s_icon = qta.icon('fa5s.flag')
fa5s_button = QtWidgets.QPushButton(fa5s_icon, 'Font Awesome! (solid)')
fa5s_button = QtWidgets.QPushButton(fa5s_icon, 'Font Awesome 5! (solid)')
fa5b_icon = qta.icon('fa5b.github')
fa5b_button = QtWidgets.QPushButton(fa5b_icon, 'Font Awesome! (brands)')
fa5b_button = QtWidgets.QPushButton(fa5b_icon, 'Font Awesome 5! (brands)')

# or Elusive Icons:
asl_icon = qta.icon('ei.asl')
Expand Down
2 changes: 1 addition & 1 deletion UPDATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To update _FontAwesome_ icons, one must:
- check what is the latest released version here: https://github.com/FortAwesome/Font-Awesome/releases/
- update font version in \_\_init__.py
- remove outdated files in the fonts dir
- run: `python setup.py update_fa5 --fa-version X.X.X`
- run: `python setup.py update_fa6 --fa-version X.X.X`
- update FA version number, icon counts and URLs inside:
- README.md
- qtawesome/docs/source/usage.rst
Expand Down
33 changes: 26 additions & 7 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ The following prefixes are currently available to use:

- `FontAwesome`_:

- FA 6.7.2 features 2,060 free icons in different styles:

- ``fa6`` prefix has `163 icons in the "regular" style.`_
- ``fa6s`` prefix has `1402 icons in the "solid" style.`_
- ``fa6b`` prefix has `495 icons of various brands.`_

- FA 5.15.4 features 1,608 free icons in different styles:

- ``fa5`` prefix has `151 icons in the "regular" style.`_
Expand All @@ -31,9 +37,12 @@ The following prefixes are currently available to use:
- ``msc`` prefix holds Microsoft's `Codicons 0.0.35 with its 540 icons.`_

.. _FontAwesome: https://fontawesome.com
.. _151 icons in the "regular" style.: https://fontawesome.com/v5/search?o=r&m=free&s=regular
.. _1001 icons in the "solid" style.: https://fontawesome.com/v5/search?o=r&m=free&s=solid
.. _456 icons of various brands.: https://fontawesome.com/v5/search?o=r&m=free&f=brands
.. _163 icons in the "regular" style.: https://fontawesome.com/v6/search?o=r&ic=free&s=regular
.. _1402 icons in the "solid" style.: https://fontawesome.com/v6/search?o=r&ic=free&s=solid
.. _495 icons of various brands.: https://fontawesome.com/v6/search?o=r&ic=free&ip=brands
.. _151 icons in the "regular" style.: https://fontawesome.com/v5/search?o=r&ic=free&s=regular
.. _1001 icons in the "solid" style.: https://fontawesome.com/v5/search?o=r&ic=free&s=solid
.. _456 icons of various brands.: https://fontawesome.com/v5/search?ic=brands
.. _Elusive Icons 2.0 with its 304 icons: http://elusiveicons.com/icons/
.. _Material Design Icons: https://pictogrammers.com/library/mdi/
.. _Material Design Icons 6.9.96 with its 6997 icons.: https://cdn.materialdesignicons.com/6.9.96/
Expand All @@ -53,15 +62,25 @@ Examples

.. code:: python
# Get FontAwesome 5.x icons by name in various styles by name
# Get FontAwesome 6.x icons by name in various styles:
fa6_icon = qta.icon('fa6.flag')
fa6_button = QtWidgets.QPushButton(fa6_icon, 'Font Awesome 6! (regular)')
fa6s_icon = qta.icon('fa6s.flag')
fa6s_button = QtWidgets.QPushButton(fa6s_icon, 'Font Awesome 6! (solid)')
fa6b_icon = qta.icon('fa6b.github')
fa6b_button = QtWidgets.QPushButton(fa6b_icon, 'Font Awesome 6! (brands)')
# Get FontAwesome 5.x icons by name in various styles:
fa5_icon = qta.icon('fa5.flag')
fa5_button = QtWidgets.QPushButton(fa5_icon, 'Font Awesome! (regular)')
fa5_button = QtWidgets.QPushButton(fa5_icon, 'Font Awesome 5! (regular)')
fa5s_icon = qta.icon('fa5s.flag')
fa5s_button = QtWidgets.QPushButton(fa5s_icon, 'Font Awesome! (solid)')
fa5s_button = QtWidgets.QPushButton(fa5s_icon, 'Font Awesome 5! (solid)')
fa5b_icon = qta.icon('fa5b.github')
fa5b_button = QtWidgets.QPushButton(fa5b_icon, 'Font Awesome! (brands)')
fa5b_button = QtWidgets.QPushButton(fa5b_icon, 'Font Awesome 5! (brands)')
# Get Elusive icons by name
asl_icon = qta.icon('ei.asl')
Expand Down
22 changes: 18 additions & 4 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,31 @@
class AwesomeExample(QtWidgets.QDialog):
def __init__(self):
super().__init__()
self.setWindowIcon(qta.icon("fa5s.icons"))

# Label for supported fonts
supported_fonts_label = QtWidgets.QLabel("Supported fonts (prefix)")
supported_fonts_label.setAlignment(QtCore.Qt.AlignCenter)

# Get FontAwesome 5.x icons by name in various styles by name
# Get FontAwesome 6.x icons by name in various styles:
fa6_icon = qta.icon("fa6.flag")
fa6_button = QtWidgets.QPushButton(fa6_icon, "Font Awesome 6! (regular)")

fa6s_icon = qta.icon("fa6s.flag")
fa6s_button = QtWidgets.QPushButton(fa6s_icon, "Font Awesome 6! (solid)")

fa6b_icon = qta.icon("fa6b.github")
fa6b_button = QtWidgets.QPushButton(fa6b_icon, "Font Awesome 6! (brands)")

# Get FontAwesome 5.x icons by name in various styles:
fa5_icon = qta.icon("fa5.flag")
fa5_button = QtWidgets.QPushButton(fa5_icon, "Font Awesome regular (fa5)")
fa5_button = QtWidgets.QPushButton(fa5_icon, "Font Awesome 5! (regular)")

fa5s_icon = qta.icon("fa5s.flag")
fa5s_button = QtWidgets.QPushButton(fa5s_icon, "Font Awesome solid (fa5s)")
fa5s_button = QtWidgets.QPushButton(fa5s_icon, "Font Awesome 5! (solid)")

fa5b_icon = qta.icon("fa5b.github")
fa5b_button = QtWidgets.QPushButton(fa5b_icon, "Font Awesome brands (fa5b)")
fa5b_button = QtWidgets.QPushButton(fa5b_icon, "Font Awesome 5! (brands)")

# Get Elusive icons by name
asl_icon = qta.icon("ei.asl")
Expand Down Expand Up @@ -168,6 +179,9 @@ def __init__(self):
grid = QtWidgets.QGridLayout()
fonts_widgets = [
supported_fonts_label,
fa6_button,
fa6s_button,
fa6b_button,
fa5_button,
fa5s_button,
fa5b_button,
Expand Down
Binary file modified qtawesome-screenshot.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 24 additions & 4 deletions qtawesome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@
"fontawesome5-brands-webfont-5.15.4.ttf",
"fontawesome5-brands-webfont-charmap-5.15.4.json",
),
(
"fa6",
"fontawesome6-regular-webfont-6.7.2.ttf",
"fontawesome6-regular-webfont-charmap-6.7.2.json",
),
(
"fa6s",
"fontawesome6-solid-webfont-6.7.2.ttf",
"fontawesome6-solid-webfont-charmap-6.7.2.json",
),
(
"fa6b",
"fontawesome6-brands-webfont-6.7.2.ttf",
"fontawesome6-brands-webfont-charmap-6.7.2.json",
),
("ei", "elusiveicons-webfont-2.0.ttf", "elusiveicons-webfont-charmap-2.0.json"),
(
"mdi",
Expand All @@ -72,6 +87,9 @@
"fontawesome5-regular-webfont-5.15.4.ttf": "dc47e4089f5bcb25f241bdeb2de0fb58",
"fontawesome5-solid-webfont-5.15.4.ttf": "5de19800fc9ae73438c2e5c61d041b48",
"fontawesome5-brands-webfont-5.15.4.ttf": "513aa607d398efaccc559916c3431403",
"fontawesome6-regular-webfont-6.7.2.ttf": "2b9e6cb53822f6a9b42f15229a36811a",
"fontawesome6-solid-webfont-6.7.2.ttf": "07312c769a05b2c17133da1a09db4ccf",
"fontawesome6-brands-webfont-6.7.2.ttf": "15d54d142da2f2d6f2e90ed1d55121af",
"elusiveicons-webfont-2.0.ttf": "207966b04c032d5b873fd595a211582e",
"materialdesignicons5-webfont-5.9.55.ttf": "b7d40e7ef80c1d4af6d94902af66e524",
"materialdesignicons6-webfont-6.9.96.ttf": "ecaabfbb23fdac4ddbaf897b97257a92",
Expand Down Expand Up @@ -165,10 +183,12 @@ def icon(*names, **kwargs):
The ``prefix`` corresponds to the font to be used and ``name`` is the
name of the icon.
- The prefix corresponding to Font-Awesome 4.x is 'fa'
- The prefix corresponding to Font-Awesome 5.x (regular) is 'fa5'
- The prefix corresponding to Font-Awesome 5.x (solid) is 'fa5s'
- The prefix corresponding to Font-Awesome 5.x (brands) is 'fa5b'
- The prefix corresponding to Font-Awesome 6.x (regular) is 'fa6'
- The prefix corresponding to Font-Awesome 6.x (solid) is 'fa6s'
- The prefix corresponding to Font-Awesome 6.x (brands) is 'fa6b'
- The prefix corresponding to Font-Awesome 5 (regular) is 'fa5'
- The prefix corresponding to Font-Awesome 5 (solid) is 'fa5s'
- The prefix corresponding to Font-Awesome 5 (brands) is 'fa5b'
- The prefix corresponding to Elusive-Icons is 'ei'
- The prefix corresponding to Material-Design-Icons 5.x is 'mdi'
- The prefix corresponding to Material-Design-Icons 6.x is 'mdi6'
Expand Down
Binary file not shown.
Loading

0 comments on commit 36de05f

Please sign in to comment.