Update to 6.3.0, Aliases and Sharp Regular Pro fonts

- Aliases are now included in the icon list names
- Support for font style "Font Awesome Sharp Regular" (Pro)
- Update generator to include all alias names
- Update free font files to latest release
This commit is contained in:
Rick Blommers 2023-02-09 11:53:16 +01:00
parent a6051c8870
commit b304ec196e
13 changed files with 2253 additions and 18 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
.* .*
*.pro.user *.pro.user
*.pro.user*
CMakeLists.txt.user CMakeLists.txt.user
/*build* /*build*

8
CHANGES.md Normal file
View File

@ -0,0 +1,8 @@
# Changes
- (2023-02-09) Update to 6.3.0, Aliases and Sharp Regular Pro fonts
- Aliases are now included in the icon list names
- Support for font style "Font Awesome Sharp Regular" (Pro)
- Update generator to include all alias names
- Update free font files to latest release
- (2013-04-19) Initial release

View File

@ -214,6 +214,7 @@ const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Pro-Regu
const QString QtAwesome::FA_THIN_FONT_FILENAME = "pro/Font Awesome 6 Pro-Thin-100.otf"; const QString QtAwesome::FA_THIN_FONT_FILENAME = "pro/Font Awesome 6 Pro-Thin-100.otf";
const QString QtAwesome::FA_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Pro-Solid-900.otf"; const QString QtAwesome::FA_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Pro-Solid-900.otf";
const QString QtAwesome::FA_SHARP_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Solid-900.otf"; const QString QtAwesome::FA_SHARP_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Solid-900.otf";
const QString QtAwesome::FA_SHARP_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Regular-400.otf";
#else #else
const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "Font Awesome 6 Free-Regular-400.otf"; const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "Font Awesome 6 Free-Regular-400.otf";
const QString QtAwesome::FA_SOLID_FONT_FILENAME = "Font Awesome 6 Free-Solid-900.otf"; const QString QtAwesome::FA_SOLID_FONT_FILENAME = "Font Awesome 6 Free-Solid-900.otf";
@ -254,6 +255,7 @@ QtAwesome::QtAwesome(QObject* parent)
_fontDetails.insert(fa::fa_duotone, QtAwesomeFontData(FA_DUOTONE_FONT_FILENAME, FA_DUOTONE_FONT_WEIGHT)); _fontDetails.insert(fa::fa_duotone, QtAwesomeFontData(FA_DUOTONE_FONT_FILENAME, FA_DUOTONE_FONT_WEIGHT));
_fontDetails.insert(fa::fa_thin, QtAwesomeFontData(FA_THIN_FONT_FILENAME, FA_THIN_FONT_WEIGHT)); _fontDetails.insert(fa::fa_thin, QtAwesomeFontData(FA_THIN_FONT_FILENAME, FA_THIN_FONT_WEIGHT));
_fontDetails.insert(fa::fa_sharp_solid, QtAwesomeFontData(FA_SHARP_SOLID_FONT_FILENAME, FA_SHARP_SOLID_FONT_WEIGHT)); _fontDetails.insert(fa::fa_sharp_solid, QtAwesomeFontData(FA_SHARP_SOLID_FONT_FILENAME, FA_SHARP_SOLID_FONT_WEIGHT));
_fontDetails.insert(fa::fa_sharp_regular, QtAwesomeFontData(FA_SHARP_REGULAR_FONT_FILENAME, FA_SHARP_REGULAR_FONT_WEIGHT));
#endif #endif
} }
@ -316,6 +318,7 @@ bool QtAwesome::initFontAwesome()
_namedCodepointsByStyle.insert(fa::fa_thin, _namedCodepointsByStyle.value(fa::fa_solid)); _namedCodepointsByStyle.insert(fa::fa_thin, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_duotone, _namedCodepointsByStyle.value(fa::fa_solid)); _namedCodepointsByStyle.insert(fa::fa_duotone, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_solid, _namedCodepointsByStyle.value(fa::fa_solid)); _namedCodepointsByStyle.insert(fa::fa_sharp_solid, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_regular, _namedCodepointsByStyle.value(fa::fa_solid));
#else #else
addToNamedCodePoints(fa::fa_regular, faRegularFreeIconArray, sizeof(faRegularFreeIconArray)/sizeof(QtAwesomeNamedIcon)); addToNamedCodePoints(fa::fa_regular, faRegularFreeIconArray, sizeof(faRegularFreeIconArray)/sizeof(QtAwesomeNamedIcon));
#endif #endif
@ -489,6 +492,7 @@ int QtAwesome::stringToStyleEnum(const QString style) const
else if (style == "fa-thin") return fa::fa_thin; else if (style == "fa-thin") return fa::fa_thin;
else if (style == "fa-duotone") return fa::fa_duotone; else if (style == "fa-duotone") return fa::fa_duotone;
else if (style == "fa-sharp-solid") return fa::fa_sharp_solid; else if (style == "fa-sharp-solid") return fa::fa_sharp_solid;
else if (style == "fa-sharp-regular") return fa::fa_sharp_regular;
#endif #endif
return fa::fa_solid; return fa::fa_solid;
} }
@ -504,6 +508,7 @@ const QString QtAwesome::styleEnumToString(int style) const
case fa::fa_thin: return "fa=thin"; case fa::fa_thin: return "fa=thin";
case fa::fa_duotone: return "fa-duotone"; case fa::fa_duotone: return "fa-duotone";
case fa::fa_sharp_solid: return "fa-sharp-solid"; case fa::fa_sharp_solid: return "fa-sharp-solid";
case fa::fa_sharp_regular: return "fa-sharp-regular";
#endif #endif
} }
return "fa_solid"; return "fa_solid";

View File

@ -33,6 +33,7 @@ enum fa_styles {
fa_thin = 4, fa_thin = 4,
fa_duotone = 5, fa_duotone = 5,
fa_sharp_solid = 6, fa_sharp_solid = 6,
fa_sharp_regular = 7,
#endif #endif
fa_brands = 2 fa_brands = 2
}; };
@ -87,11 +88,13 @@ public:
static const QString FA_DUOTONE_FONT_FILENAME; // fa-duotone static const QString FA_DUOTONE_FONT_FILENAME; // fa-duotone
static const QString FA_THIN_FONT_FILENAME; // fa-thin static const QString FA_THIN_FONT_FILENAME; // fa-thin
static const QString FA_SHARP_SOLID_FONT_FILENAME; // fa-sharp fa-solid static const QString FA_SHARP_SOLID_FONT_FILENAME; // fa-sharp fa-solid
static const QString FA_SHARP_REGULAR_FONT_FILENAME; // fa-sharp fa-regular
static const int DUOTONE_HEX_ICON_VALUE = 0x100000; static const int DUOTONE_HEX_ICON_VALUE = 0x100000;
static const QFont::Weight FA_LIGHT_FONT_WEIGHT = QFont::Light; static const QFont::Weight FA_LIGHT_FONT_WEIGHT = QFont::Light;
static const QFont::Weight FA_THIN_FONT_WEIGHT = QFont::ExtraLight; static const QFont::Weight FA_THIN_FONT_WEIGHT = QFont::ExtraLight;
static const QFont::Weight FA_DUOTONE_FONT_WEIGHT = QFont::Black; static const QFont::Weight FA_DUOTONE_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_SHARP_SOLID_FONT_WEIGHT = QFont::Black; static const QFont::Weight FA_SHARP_SOLID_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_SHARP_REGULAR_FONT_WEIGHT = QFont::Normal;
#endif #endif
public: public:

File diff suppressed because it is too large Load Diff

View File

@ -7,5 +7,6 @@
<file>fonts/pro/Font Awesome 6 Pro-Solid-900.otf</file> <file>fonts/pro/Font Awesome 6 Pro-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 6 Pro-Thin-100.otf</file> <file>fonts/pro/Font Awesome 6 Pro-Thin-100.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp-Solid-900.otf</file> <file>fonts/pro/Font Awesome 6 Sharp-Solid-900.otf</file>
<file>fonts/pro/Font Awesome 6 Sharp-Regular-400.otf</file>
</qresource> </qresource>
</RCC> </RCC>

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->comboBox->addItem("Thin", fa::fa_thin); ui->comboBox->addItem("Thin", fa::fa_thin);
ui->comboBox->addItem("Duotone", fa::fa_duotone); ui->comboBox->addItem("Duotone", fa::fa_duotone);
ui->comboBox->addItem("Sharp Solid", fa::fa_sharp_solid); ui->comboBox->addItem("Sharp Solid", fa::fa_sharp_solid);
ui->comboBox->addItem("Sharp Regular", fa::fa_sharp_regular);
#endif #endif
// a simple beer button // a simple beer button

View File

@ -5,7 +5,8 @@ icons to your [Qt application](http://qt-project.org/).
## Table of Contents ## Table of Contents
- [Latest Release - Font Awesome 6](#latest-release---font-awesome-6) - [Latest Release 6.3.0](#latest-release-630)
- [Font Awesome 6 Release](#font-awesome-6-release)
- [Installation Free Version](#installation-free-version) - [Installation Free Version](#installation-free-version)
- [Installation Pro version](#installation-pro-version) - [Installation Pro version](#installation-pro-version)
- [Basic Usage](#basic-usage) - [Basic Usage](#basic-usage)
@ -18,7 +19,14 @@ icons to your [Qt application](http://qt-project.org/).
- [Contact](#contact) - [Contact](#contact)
- [License](#license) - [License](#license)
## Latest Release - Font Awesome 6 ## Latest Release 6.3.0
Support for "Font Awesome Sharp Regular" (Pro) icons.
All alias-names are now added to the to the icon-name map.
[View changelog](CHANGES.md)
## Font Awesome 6 Release
This is the Font Awesome 6 release. It replaces the main branch, which still was a Font Awesome 4 version. This is the Font Awesome 6 release. It replaces the main branch, which still was a Font Awesome 4 version.
(There's also a Font Awesome 5 branch, but was never merged to the main/master branch.) (There's also a Font Awesome 5 branch, but was never merged to the main/master branch.)

View File

@ -42,17 +42,37 @@ class Icons
def build_maps(icons) def build_maps(icons)
icons.each do |key, data| icons.each do |key, data|
if data['free'].length > 0 if data['free'].length > 0
if data['free'].first == 'brands' build_map_free(key, data)
@icons_brands[key] = data['unicode']
else else
@icons_regular_free[key] = data['unicode'] if data['free'].include?('regular') build_map_pro(key, data)
@icons_common[key] = data['unicode'] end
end end
end end
if data['free'].length == 0 def build_map_free(key, data)
@icons_pro[key] = data['unicode'] if data['free'].first == 'brands'
@icons_brands[key] = data['unicode']
add_aliasses(@icons_brands, data)
else
if data['free'].include?('regular')
@icons_regular_free[key] = data['unicode']
add_aliasses(@icons_regular_free, data)
end end
@icons_common[key] = data['unicode']
add_aliasses(@icons_common, data)
end
end
def build_map_pro(key, data)
@icons_pro[key] = data['unicode']
add_aliasses(@icons_pro, data)
end
def add_aliasses(hash, data)
data.dig('aliases', 'names')&.each do |alias_key|
raise "Duplicatie key found for alias!" if hash.key?(alias_key)
hash[alias_key] = data['unicode']
end end
end end