mirror of
https://github.com/gamecreature/QtAwesome.git
synced 2024-11-15 13:35:44 +08:00
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:
parent
a6051c8870
commit
b304ec196e
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
.*
|
||||
*.pro.user
|
||||
*.pro.user*
|
||||
CMakeLists.txt.user
|
||||
/*build*
|
||||
|
||||
|
8
CHANGES.md
Normal file
8
CHANGES.md
Normal 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
|
@ -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_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_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Regular-400.otf";
|
||||
#else
|
||||
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";
|
||||
@ -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_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_regular, QtAwesomeFontData(FA_SHARP_REGULAR_FONT_FILENAME, FA_SHARP_REGULAR_FONT_WEIGHT));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -316,6 +318,7 @@ bool QtAwesome::initFontAwesome()
|
||||
_namedCodepointsByStyle.insert(fa::fa_thin, _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_regular, _namedCodepointsByStyle.value(fa::fa_solid));
|
||||
#else
|
||||
addToNamedCodePoints(fa::fa_regular, faRegularFreeIconArray, sizeof(faRegularFreeIconArray)/sizeof(QtAwesomeNamedIcon));
|
||||
#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-duotone") return fa::fa_duotone;
|
||||
else if (style == "fa-sharp-solid") return fa::fa_sharp_solid;
|
||||
else if (style == "fa-sharp-regular") return fa::fa_sharp_regular;
|
||||
#endif
|
||||
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_duotone: return "fa-duotone";
|
||||
case fa::fa_sharp_solid: return "fa-sharp-solid";
|
||||
case fa::fa_sharp_regular: return "fa-sharp-regular";
|
||||
#endif
|
||||
}
|
||||
return "fa_solid";
|
||||
|
@ -33,6 +33,7 @@ enum fa_styles {
|
||||
fa_thin = 4,
|
||||
fa_duotone = 5,
|
||||
fa_sharp_solid = 6,
|
||||
fa_sharp_regular = 7,
|
||||
#endif
|
||||
fa_brands = 2
|
||||
};
|
||||
@ -87,11 +88,13 @@ public:
|
||||
static const QString FA_DUOTONE_FONT_FILENAME; // fa-duotone
|
||||
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_REGULAR_FONT_FILENAME; // fa-sharp fa-regular
|
||||
static const int DUOTONE_HEX_ICON_VALUE = 0x100000;
|
||||
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_DUOTONE_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
|
||||
|
||||
public:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,5 +7,6 @@
|
||||
<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 Sharp-Solid-900.otf</file>
|
||||
<file>fonts/pro/Font Awesome 6 Sharp-Regular-400.otf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -21,6 +21,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->comboBox->addItem("Thin", fa::fa_thin);
|
||||
ui->comboBox->addItem("Duotone", fa::fa_duotone);
|
||||
ui->comboBox->addItem("Sharp Solid", fa::fa_sharp_solid);
|
||||
ui->comboBox->addItem("Sharp Regular", fa::fa_sharp_regular);
|
||||
#endif
|
||||
|
||||
// a simple beer button
|
||||
|
12
README.md
12
README.md
@ -5,7 +5,8 @@ icons to your [Qt application](http://qt-project.org/).
|
||||
|
||||
## 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 Pro version](#installation-pro-version)
|
||||
- [Basic Usage](#basic-usage)
|
||||
@ -18,7 +19,14 @@ icons to your [Qt application](http://qt-project.org/).
|
||||
- [Contact](#contact)
|
||||
- [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.
|
||||
(There's also a Font Awesome 5 branch, but was never merged to the main/master branch.)
|
||||
|
@ -42,17 +42,37 @@ class Icons
|
||||
def build_maps(icons)
|
||||
icons.each do |key, data|
|
||||
if data['free'].length > 0
|
||||
if data['free'].first == 'brands'
|
||||
@icons_brands[key] = data['unicode']
|
||||
build_map_free(key, data)
|
||||
else
|
||||
@icons_regular_free[key] = data['unicode'] if data['free'].include?('regular')
|
||||
@icons_common[key] = data['unicode']
|
||||
build_map_pro(key, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if data['free'].length == 0
|
||||
@icons_pro[key] = data['unicode']
|
||||
def build_map_free(key, data)
|
||||
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
|
||||
@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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user