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-Medium.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>
</RCC>

View file

@ -91,9 +91,6 @@ reader::reader(QWidget *parent) :
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Italic.ttf");
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
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
// Font
@ -104,29 +101,13 @@ reader::reader(QWidget *parent) :
}
else {
if(checkconfig_str_val == "Crimson Pro") {
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Regular.ttf");
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
QFont crimson(family);
ui->text->setFont(crimson);
ui->fontChooser->setCurrentText(checkconfig_str_val);
setCrimsonProFont();
}
else if(checkconfig_str_val == "Bitter") {
QString family;
{
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Medium.ttf");
family = QFontDatabase::applicationFontFamilies(id).at(0);
setBitterFont();
}
{
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 if(checkconfig_str_val == "Ibarra Real Nova") {
setIbarraFont();
}
else {
QFont config_font(checkconfig_str_val);
@ -1033,17 +1014,17 @@ void reader::on_fontChooser_currentIndexChanged(const QString &arg1)
}
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.
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Regular.ttf");
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
QFont crimson(family);
ui->text->setFont(crimson);
setCrimsonProFont();
string_writeconfig(".config/04-book/font", "Crimson Pro");
}
if(arg1 == "Bitter") {
QFont bitter("Bitter");
ui->text->setFont(bitter);
setBitterFont();
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()
@ -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() {
this->repaint();
}

View file

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

View file

@ -393,6 +393,11 @@
<string>Libertinus Serif</string>
</property>
</item>
<item>
<property name="text">
<string>Ibarra Real Nova</string>
</property>
</item>
<item>
<property name="text">
<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.