Skip to content

Commit

Permalink
Update to 6.7.1, Extra Duotone styles
Browse files Browse the repository at this point in the history
- Expand Duotone to support Solid, Regular, Light and Thin
- Add Sharp Duoto styles
- Deprecated Duotone (without style)
  • Loading branch information
gamecreature committed Nov 21, 2024
1 parent 83e0b07 commit 3fdfd5c
Show file tree
Hide file tree
Showing 12 changed files with 237 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*.pro.user
*.pro.user*
CMakeLists.txt.user
/*build*
*/build

# never include pro files
QtAwesome/fonts/pro/
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

- (2024-11-21) Update to 6.7.1, Extra Duotone styles
- Expand Duotone to support Solid, Regular, Light and Thin
- Add Sharp Duoto styles
- Deprecated Duotone (without style)
- (2024-04-23) Support for dark/light colorSchema mode, (contribution by @hanjianqiao(Lanchitour))
- (2023-12-07) Update to 6.5.1, Sharp Thin Pro font
- (2023-08-16) Update to 6.4.2, Fix issue missing pro icons in namedCodePoints
Expand Down
63 changes: 53 additions & 10 deletions QtAwesome/QtAwesome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,26 @@ class QtAwesomeIconPainterIconEngine : public QIconEngine

const QString QtAwesome::FA_BRANDS_FONT_FILENAME = "Font Awesome 6 Brands-Regular-400.otf";
#ifdef FONT_AWESOME_PRO
const QString QtAwesome::FA_DUOTONE_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Solid-900.otf";
const QString QtAwesome::FA_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Pro-Light-300.otf";
const QString QtAwesome::FA_DUOTONE_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Solid-900.otf"; // DEPRECATED, use FA_DUOTONE_SOLID_FONT_FILENAME
const QString QtAwesome::FA_DUOTONE_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Solid-900.otf";
const QString QtAwesome::FA_DUOTONE_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Regular-400.otf";
const QString QtAwesome::FA_DUOTONE_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Light-300.otf";
const QString QtAwesome::FA_DUOTONE_THIN_FONT_FILENAME = "pro/Font Awesome 6 Duotone-Thin-100.otf";

const QString QtAwesome::FA_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Pro-Solid-900.otf";
const QString QtAwesome::FA_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Pro-Regular-400.otf";
const QString QtAwesome::FA_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Pro-Light-300.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_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";
const QString QtAwesome::FA_SHARP_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Light-300.otf";
const QString QtAwesome::FA_SHARP_THIN_FONT_FILENAME = "pro/Font Awesome 6 Sharp-Thin-100.otf";

const QString QtAwesome::FA_SHARP_DUOTONE_SOLID_FONT_FILENAME = "pro/Font Awesome 6 Sharp Duotone-Solid-900.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_REGULAR_FONT_FILENAME = "pro/Font Awesome 6 Sharp Duotone-Regular-400.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_LIGHT_FONT_FILENAME = "pro/Font Awesome 6 Sharp Duotone-Light-300.otf";
const QString QtAwesome::FA_SHARP_DUOTONE_THIN_FONT_FILENAME = "pro/Font Awesome 6 Sharp Duotone-Thin-100.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";
Expand All @@ -238,17 +249,25 @@ QtAwesome::QtAwesome(QObject* parent)

_fontIconPainter = new QtAwesomeCharIconPainter();

_fontDetails.insert(fa::fa_brands, QtAwesomeFontData(FA_BRANDS_FONT_FILENAME, FA_BRANDS_FONT_WEIGHT));
_fontDetails.insert(fa::fa_solid, QtAwesomeFontData(FA_SOLID_FONT_FILENAME, FA_SOLID_FONT_WEIGHT));
_fontDetails.insert(fa::fa_regular, QtAwesomeFontData(FA_REGULAR_FONT_FILENAME, FA_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_brands, QtAwesomeFontData(FA_BRANDS_FONT_FILENAME, FA_BRANDS_FONT_WEIGHT));
#ifdef FONT_AWESOME_PRO
_fontDetails.insert(fa::fa_light, QtAwesomeFontData(FA_LIGHT_FONT_FILENAME, FA_LIGHT_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_duotone, QtAwesomeFontData(FA_DUOTONE_FONT_FILENAME, FA_DUOTONE_FONT_WEIGHT)); // DEPRECATED
_fontDetails.insert(fa::fa_duotone_solid, QtAwesomeFontData(FA_DUOTONE_SOLID_FONT_FILENAME, FA_DUOTONE_SOLID_FONT_WEIGHT));
_fontDetails.insert(fa::fa_duotone_regular, QtAwesomeFontData(FA_DUOTONE_REGULAR_FONT_FILENAME, FA_DUOTONE_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_duotone_light, QtAwesomeFontData(FA_DUOTONE_LIGHT_FONT_FILENAME, FA_DUOTONE_LIGHT_FONT_WEIGHT));
_fontDetails.insert(fa::fa_duotone_thin, QtAwesomeFontData(FA_DUOTONE_THIN_FONT_FILENAME, FA_DUOTONE_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));
_fontDetails.insert(fa::fa_sharp_light, QtAwesomeFontData(FA_SHARP_LIGHT_FONT_FILENAME, FA_SHARP_LIGHT_FONT_WEIGHT));
_fontDetails.insert(fa::fa_sharp_thin, QtAwesomeFontData(FA_SHARP_THIN_FONT_FILENAME, FA_SHARP_THIN_FONT_WEIGHT));
_fontDetails.insert(fa::fa_sharp_duotone_solid, QtAwesomeFontData(FA_SHARP_DUOTONE_SOLID_FONT_FILENAME, FA_SHARP_DUOTONE_SOLID_FONT_WEIGHT));
_fontDetails.insert(fa::fa_sharp_duotone_regular, QtAwesomeFontData(FA_SHARP_DUOTONE_REGULAR_FONT_FILENAME, FA_SHARP_DUOTONE_REGULAR_FONT_WEIGHT));
_fontDetails.insert(fa::fa_sharp_duotone_light, QtAwesomeFontData(FA_SHARP_DUOTONE_LIGHT_FONT_FILENAME, FA_SHARP_DUOTONE_LIGHT_FONT_WEIGHT));
_fontDetails.insert(fa::fa_sharp_duotone_thin, QtAwesomeFontData(FA_SHARP_DUOTONE_THIN_FONT_FILENAME, FA_SHARP_DUOTONE_THIN_FONT_WEIGHT));
#endif

#ifdef USE_COLOR_SCHEME
Expand Down Expand Up @@ -343,11 +362,19 @@ bool QtAwesome::initFontAwesome()
_namedCodepointsByStyle.insert(fa::fa_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_light, _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)); // DEPRECATED
_namedCodepointsByStyle.insert(fa::fa_duotone_solid, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_duotone_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_duotone_light, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_duotone_thin, _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));
_namedCodepointsByStyle.insert(fa::fa_sharp_light, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_thin, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_duotone_solid, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_duotone_regular, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_duotone_light, _namedCodepointsByStyle.value(fa::fa_solid));
_namedCodepointsByStyle.insert(fa::fa_sharp_duotone_thin, _namedCodepointsByStyle.value(fa::fa_solid));
#else
addToNamedCodePoints(fa::fa_regular, faRegularFreeIconArray, sizeof(faRegularFreeIconArray)/sizeof(QtAwesomeNamedIcon));
#endif
Expand Down Expand Up @@ -519,11 +546,19 @@ int QtAwesome::stringToStyleEnum(const QString style) const
#ifdef FONT_AWESOME_PRO
else if (style == "fa-light") return fa::fa_light;
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; // DEPRECATED
else if (style == "fa-duotone-solid") return fa::fa_duotone_solid;
else if (style == "fa-duotone-regular") return fa::fa_duotone_regular;
else if (style == "fa-duotone-light") return fa::fa_duotone_light;
else if (style == "fa-duotone-thin") return fa::fa_duotone_thin;
else if (style == "fa-sharp-solid") return fa::fa_sharp_solid;
else if (style == "fa-sharp-regular") return fa::fa_sharp_regular;
else if (style == "fa-sharp-light") return fa::fa_sharp_light;
else if (style == "fa-sharp-thin") return fa::fa_sharp_thin;
else if (style == "fa-sharp-duotone-solid") return fa::fa_sharp_duotone_solid;
else if (style == "fa-sharp-duotone-regular") return fa::fa_sharp_duotone_regular;
else if (style == "fa-sharp-duotone-light") return fa::fa_sharp_duotone_light;
else if (style == "fa-sharp-duotone-thin") return fa::fa_sharp_duotone_thin;
#endif
return fa::fa_solid;
}
Expand All @@ -536,15 +571,23 @@ const QString QtAwesome::styleEnumToString(int style) const
case fa::fa_brands: return "fa-brands";
#ifdef FONT_AWESOME_PRO
case fa::fa_light: return "fa-light";
case fa::fa_thin: return "fa=thin";
case fa::fa_duotone: return "fa-duotone";
case fa::fa_thin: return "fa-thin";
// case fa::fa_duotone: return "fa-duotone"; // DEPRECATED
case fa::fa_duotone_solid: return "fa-duotone-solid";
case fa::fa_duotone_regular: return "fa-duotone-regular";
case fa::fa_duotone_light: return "fa-duotone-light";
case fa::fa_duotone_thin: return "fa-duotone-thin";
case fa::fa_sharp_solid: return "fa-sharp-solid";
case fa::fa_sharp_regular: return "fa-sharp-regular";
case fa::fa_sharp_light: return "fa-sharp-light";
case fa::fa_sharp_thin: return "fa-sharp-thin";
case fa::fa_sharp_duotone_solid: return "fa-sharp-duotone-solid";
case fa::fa_sharp_duotone_regular: return "fa-sharp-duotone-regular";
case fa::fa_sharp_duotone_light: return "fa-sharp-duotone-light";
case fa::fa_sharp_duotone_thin: return "fa-sharp-duotone-thin";
#endif
}
return "fa_solid";
return "fa-solid";
}

//---------------------------------------------------------------------------------------
Expand Down
48 changes: 41 additions & 7 deletions QtAwesome/QtAwesome.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,22 @@ enum fa_styles {
#ifdef FONT_AWESOME_PRO
fa_light = 3,
fa_thin = 4,
fa_duotone = 5,
fa_sharp_solid = 6,
fa_sharp_regular = 7,
fa_sharp_light = 8,
fa_sharp_thin = 9,

fa_duotone = 5, // DEPRECATED, use fa_duotone_solid
fa_duotone_solid = 5,
fa_duotone_regular = 6,
fa_duotone_light = 7,
fa_duotone_thin = 8,

fa_sharp_solid = 9,
fa_sharp_regular = 10,
fa_sharp_light = 11,
fa_sharp_thin = 12,

fa_sharp_duotone_solid = 13,
fa_sharp_duotone_regular = 14,
fa_sharp_duotone_light = 15,
fa_sharp_duotone_thin = 16,
#endif
fa_brands = 2
};
Expand Down Expand Up @@ -87,20 +98,43 @@ Q_OBJECT

#ifdef FONT_AWESOME_PRO
static const QString FA_LIGHT_FONT_FILENAME; // fa-light
static const QString FA_DUOTONE_FONT_FILENAME; // fa-duotone
static const QString FA_THIN_FONT_FILENAME; // fa-thin

static const QString FA_DUOTONE_FONT_FILENAME; // fa-duotone / DEPRECATED
static const QString FA_DUOTONE_SOLID_FONT_FILENAME; // fa-duotone fa-solid
static const QString FA_DUOTONE_REGULAR_FONT_FILENAME; // fa-duotone fa-regular
static const QString FA_DUOTONE_LIGHT_FONT_FILENAME; // fa-duotone fa-light
static const QString FA_DUOTONE_THIN_FONT_FILENAME; // fa-duotone 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 QString FA_SHARP_LIGHT_FONT_FILENAME; // fa-sharp fa-light
static const QString FA_SHARP_THIN_FONT_FILENAME; // fa-sharp fa-thin

static const QString FA_SHARP_DUOTONE_SOLID_FONT_FILENAME; // fa-sharp-duotone fa-solid
static const QString FA_SHARP_DUOTONE_REGULAR_FONT_FILENAME; // fa-sharp-duotone fa-regular
static const QString FA_SHARP_DUOTONE_LIGHT_FONT_FILENAME; // fa-sharp-duotone fa-light
static const QString FA_SHARP_DUOTONE_THIN_FONT_FILENAME; // fa-sharp-duotone fa-thin

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_DUOTONE_FONT_WEIGHT = QFont::Black; // DEPRECATED: use FA_DUOTONE_FONT_SOLID_WEIGHT
static const QFont::Weight FA_DUOTONE_SOLID_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_DUOTONE_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_DUOTONE_LIGHT_FONT_WEIGHT = QFont::Light;
static const QFont::Weight FA_DUOTONE_THIN_FONT_WEIGHT = QFont::ExtraLight;

static const QFont::Weight FA_SHARP_SOLID_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_SHARP_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_SHARP_LIGHT_FONT_WEIGHT = QFont::Light;
static const QFont::Weight FA_SHARP_THIN_FONT_WEIGHT = QFont::ExtraLight;

static const QFont::Weight FA_SHARP_DUOTONE_SOLID_FONT_WEIGHT = QFont::Black;
static const QFont::Weight FA_SHARP_DUOTONE_REGULAR_FONT_WEIGHT = QFont::Normal;
static const QFont::Weight FA_SHARP_DUOTONE_LIGHT_FONT_WEIGHT = QFont::Light;
static const QFont::Weight FA_SHARP_DUOTONE_THIN_FONT_WEIGHT = QFont::ExtraLight;
#endif

public:
Expand Down
Loading

0 comments on commit 3fdfd5c

Please sign in to comment.