Add macro for disabling fonts bundling
This commit is contained in:
parent
f401e8c085
commit
35176fd02a
2 changed files with 12 additions and 1 deletions
|
|
@ -33,7 +33,6 @@ PRIVATE
|
||||||
ui/colors.palette
|
ui/colors.palette
|
||||||
emoji_suggestions/emoji_autocomplete.json
|
emoji_suggestions/emoji_autocomplete.json
|
||||||
|
|
||||||
fonts/fonts.qrc
|
|
||||||
qt_conf/mac.qrc
|
qt_conf/mac.qrc
|
||||||
qt_conf/win.qrc
|
qt_conf/win.qrc
|
||||||
|
|
||||||
|
|
@ -189,6 +188,10 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
|
||||||
nice_target_sources(lib_ui ${src_loc} PRIVATE qt_conf/linux.qrc)
|
nice_target_sources(lib_ui ${src_loc} PRIVATE qt_conf/linux.qrc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (NOT DESKTOP_APP_USE_PACKAGED_FONTS)
|
||||||
|
nice_target_sources(lib_ui ${src_loc} PRIVATE fonts/fonts.qrc)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(lib_ui
|
target_include_directories(lib_ui
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${src_loc}
|
${src_loc}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@
|
||||||
#include <QtGui/QFontDatabase>
|
#include <QtGui/QFontDatabase>
|
||||||
|
|
||||||
void style_InitFontsResource() {
|
void style_InitFontsResource() {
|
||||||
|
#ifndef DESKTOP_APP_USE_PACKAGED_FONTS
|
||||||
Q_INIT_RESOURCE(fonts);
|
Q_INIT_RESOURCE(fonts);
|
||||||
|
#endif // !DESKTOP_APP_USE_PACKAGED_FONTS
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
Q_INIT_RESOURCE(win);
|
Q_INIT_RESOURCE(win);
|
||||||
#elif defined Q_OS_MAC // Q_OS_WIN
|
#elif defined Q_OS_MAC // Q_OS_WIN
|
||||||
|
|
@ -93,6 +95,7 @@ enum {
|
||||||
|
|
||||||
FontTypesCount,
|
FontTypesCount,
|
||||||
};
|
};
|
||||||
|
#ifndef DESKTOP_APP_USE_PACKAGED_FONTS
|
||||||
QString FontTypeNames[FontTypesCount] = {
|
QString FontTypeNames[FontTypesCount] = {
|
||||||
"DAOpenSansRegular",
|
"DAOpenSansRegular",
|
||||||
"DAOpenSansRegularItalic",
|
"DAOpenSansRegularItalic",
|
||||||
|
|
@ -101,6 +104,7 @@ QString FontTypeNames[FontTypesCount] = {
|
||||||
"DAOpenSansSemibold",
|
"DAOpenSansSemibold",
|
||||||
"DAOpenSansSemiboldItalic",
|
"DAOpenSansSemiboldItalic",
|
||||||
};
|
};
|
||||||
|
#endif // !DESKTOP_APP_USE_PACKAGED_FONTS
|
||||||
int32 FontTypeFlags[FontTypesCount] = {
|
int32 FontTypeFlags[FontTypesCount] = {
|
||||||
0,
|
0,
|
||||||
FontItalic,
|
FontItalic,
|
||||||
|
|
@ -109,6 +113,7 @@ int32 FontTypeFlags[FontTypesCount] = {
|
||||||
0,
|
0,
|
||||||
FontItalic,
|
FontItalic,
|
||||||
};
|
};
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
QString FontTypeWindowsFallback[FontTypesCount] = {
|
QString FontTypeWindowsFallback[FontTypesCount] = {
|
||||||
"Segoe UI",
|
"Segoe UI",
|
||||||
"Segoe UI",
|
"Segoe UI",
|
||||||
|
|
@ -117,6 +122,7 @@ QString FontTypeWindowsFallback[FontTypesCount] = {
|
||||||
"Segoe UI Semibold",
|
"Segoe UI Semibold",
|
||||||
"Segoe UI Semibold",
|
"Segoe UI Semibold",
|
||||||
};
|
};
|
||||||
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
bool Started = false;
|
bool Started = false;
|
||||||
QString Overrides[FontTypesCount];
|
QString Overrides[FontTypesCount];
|
||||||
|
|
@ -131,6 +137,7 @@ void StartFonts() {
|
||||||
|
|
||||||
style_InitFontsResource();
|
style_InitFontsResource();
|
||||||
|
|
||||||
|
#ifndef DESKTOP_APP_USE_PACKAGED_FONTS
|
||||||
bool areGood[FontTypesCount] = { false };
|
bool areGood[FontTypesCount] = { false };
|
||||||
for (auto i = 0; i != FontTypesCount; ++i) {
|
for (auto i = 0; i != FontTypesCount; ++i) {
|
||||||
const auto name = FontTypeNames[i];
|
const auto name = FontTypeNames[i];
|
||||||
|
|
@ -155,6 +162,7 @@ void StartFonts() {
|
||||||
//QFont::insertSubstitution(name, fallback);
|
//QFont::insertSubstitution(name, fallback);
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
}
|
}
|
||||||
|
#endif // !DESKTOP_APP_USE_PACKAGED_FONTS
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
auto list = QStringList();
|
auto list = QStringList();
|
||||||
list.append(".SF NS Text");
|
list.append(".SF NS Text");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue