More fixes; new fonts

This commit is contained in:
Nicolas Mailloux 2021-07-11 22:11:13 -04:00
parent dd8921c859
commit d61a663479
10 changed files with 94 additions and 30 deletions

View file

@ -51,5 +51,11 @@
<file>resources/fonts/Bitter-MediumItalic.ttf</file> <file>resources/fonts/Bitter-MediumItalic.ttf</file>
<file>resources/fonts/Bitter-Medium.ttf</file> <file>resources/fonts/Bitter-Medium.ttf</file>
<file>resources/fonts/Bitter-Bold.ttf</file> <file>resources/fonts/Bitter-Bold.ttf</file>
<file>resources/fonts/Bitter-BoldItalic.ttf</file>
<file>resources/fonts/CrimsonPro-BoldItalic.ttf</file>
<file>resources/fonts/IbarraRealNova-MediumItalic.ttf</file>
<file>resources/fonts/IbarraRealNova-Medium.ttf</file>
<file>resources/fonts/IbarraRealNova-BoldItalic.ttf</file>
<file>resources/fonts/IbarraRealNova-Bold.ttf</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -91,9 +91,6 @@ reader::reader(QWidget *parent) :
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Italic.ttf"); int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Italic.ttf");
QString family = QFontDatabase::applicationFontFamilies(id).at(0); QString family = QFontDatabase::applicationFontFamilies(id).at(0);
QFont crimson(family); QFont crimson(family);
int id_1 = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Bold.ttf");
QString family_1 = QFontDatabase::applicationFontFamilies(id).at(0);
QFont crimson_1(family_1);
// Custom settings // Custom settings
// Font // Font
@ -104,29 +101,13 @@ reader::reader(QWidget *parent) :
} }
else { else {
if(checkconfig_str_val == "Crimson Pro") { if(checkconfig_str_val == "Crimson Pro") {
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Regular.ttf"); setCrimsonProFont();
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
QFont crimson(family);
ui->text->setFont(crimson);
ui->fontChooser->setCurrentText(checkconfig_str_val);
} }
else if(checkconfig_str_val == "Bitter") { else if(checkconfig_str_val == "Bitter") {
QString family; setBitterFont();
{ }
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Medium.ttf"); else if(checkconfig_str_val == "Ibarra Real Nova") {
family = QFontDatabase::applicationFontFamilies(id).at(0); setIbarraFont();
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-MediumItalic.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Bold.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
QFont bitter(family);
ui->text->setFont(bitter);
ui->fontChooser->setCurrentText(checkconfig_str_val);
} }
else { else {
QFont config_font(checkconfig_str_val); QFont config_font(checkconfig_str_val);
@ -1033,17 +1014,17 @@ void reader::on_fontChooser_currentIndexChanged(const QString &arg1)
} }
if(arg1 == "Crimson Pro") { if(arg1 == "Crimson Pro") {
// As adding Crimson Pro to the default fonts bundled along with the Qt libs breaks the general Inter homogeneity, it is incorporated on-demand here. // As adding Crimson Pro to the default fonts bundled along with the Qt libs breaks the general Inter homogeneity, it is incorporated on-demand here.
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Regular.ttf"); setCrimsonProFont();
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
QFont crimson(family);
ui->text->setFont(crimson);
string_writeconfig(".config/04-book/font", "Crimson Pro"); string_writeconfig(".config/04-book/font", "Crimson Pro");
} }
if(arg1 == "Bitter") { if(arg1 == "Bitter") {
QFont bitter("Bitter"); setBitterFont();
ui->text->setFont(bitter);
string_writeconfig(".config/04-book/font", "Bitter"); string_writeconfig(".config/04-book/font", "Bitter");
} }
if(arg1 == "Ibarra Real Nova") {
setIbarraFont();
string_writeconfig(".config/04-book/font", "Ibarra Real Nova");
}
} }
void reader::on_alignLeftBtn_clicked() void reader::on_alignLeftBtn_clicked()
@ -1633,6 +1614,75 @@ void reader::setupSearchDialog() {
} }
} }
void reader::setBitterFont() {
QString family;
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Medium.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-MediumItalic.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Bold.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-BoldItalic.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
QFont bitter(family);
ui->text->setFont(bitter);
ui->fontChooser->setCurrentText("Bitter");
}
void reader::setCrimsonProFont() {
QString family;
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Regular.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Italic.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Bold.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-BoldItalic.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
QFont crimson(family);
ui->text->setFont(crimson);
ui->fontChooser->setCurrentText("Crimson Pro");
}
void reader::setIbarraFont() {
QString family;
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/IbarraRealNova-Medium.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/IbarraRealNova-MediumItalic.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/IbarraRealNova-Bold.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/IbarraRealNova-BoldItalic.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
QFont ibarra(family);
ui->text->setFont(ibarra);
ui->fontChooser->setCurrentText("Ibarra Real Nova");
}
void reader::searchRefreshScreen() { void reader::searchRefreshScreen() {
this->repaint(); this->repaint();
} }

View file

@ -98,6 +98,9 @@ public:
QString setPageNumberLabelContent(); QString setPageNumberLabelContent();
void setupPageWidget(); void setupPageWidget();
void getTotalEpubPagesNumber(); void getTotalEpubPagesNumber();
void setBitterFont();
void setCrimsonProFont();
void setIbarraFont();
private slots: private slots:
void on_nextBtn_clicked(); void on_nextBtn_clicked();

View file

@ -393,6 +393,11 @@
<string>Libertinus Serif</string> <string>Libertinus Serif</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Ibarra Real Nova</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>Noto Mono</string> <string>Noto Mono</string>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.