Skip to content

Commit

Permalink
set app font from resources and put licence file for font
Browse files Browse the repository at this point in the history
  • Loading branch information
khumnath committed Nov 6, 2024
1 parent 20dc30d commit 2e94b17
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
15 changes: 9 additions & 6 deletions calendarwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ CalendarWindow::CalendarWindow(QWidget *parent) :
blockSignals(false)
{
ui->setupUi(this);

// Apply the custom font
int fontId = QFontDatabase::addApplicationFont(":/resources/Laila-Medium.ttf");
if (fontId != -1) {
QString fontFamily = QFontDatabase::applicationFontFamilies(fontId).at(0);
QFont appFont(fontFamily);
qApp->setFont(appFont);
}

this->setWindowTitle("नेपाली पात्रो तथा मिति परिवर्तक");
connect(ui->aboutbutton, &QPushButton::clicked, this, &CalendarWindow::showMenu);
// Center the window on the screen
centerOnScreen();
installEventFilter(this);

Expand All @@ -33,11 +41,6 @@ CalendarWindow::CalendarWindow(QWidget *parent) :
file.close();
}

int fontId = QFontDatabase::addApplicationFont(":/resources/Laila-Medium.ttf");
QString fontFamily = QFontDatabase::applicationFontFamilies(fontId).at(0);
QFont appFont(fontFamily);
CalendarWindow::setFont(appFont);

// Initialize current date to today's date
QDate currentDate = QDate::currentDate();
// Populate AD combo boxes
Expand Down
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<file>resources/VERSION.txt</file>
<file>resources/Laila-Medium.ttf</file>
<file>resources/flag.png</file>
<file>resources/Laila-Font-LICENSE</file>
</qresource>
</RCC>
35 changes: 35 additions & 0 deletions resources/Laila-Font-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Laila
Designed by Indian Type Foundry

License
Copyright (c) 2014, Indian Type Foundry ([email protected]).
This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is included below and is also available with a FAQ at: https://openfontlicense.org

SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.

The OFL allows the licensed fonts to be used, studied, modified, and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed, and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.

DEFINITIONS

"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such.
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, or substituting any of the components of the Original Version, by changing formats, or by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer, or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:

The Font Software, or any of its components, in Original or Modified Versions, may not be sold by itself.
Copies of the Font Software may be bundled, redistributed, and/or sold with any software, provided that each copy includes the copyright notice and this license.
No Modified Version of the Font Software may use the Reserved Font Name(s) without explicit permission.
The names of the Copyright Holder(s) or Author(s) may not be used to promote or endorse any Modified Version without explicit permission.
The Font Software, modified or unmodified, must remain under this license.
TERMINATION
This license becomes null and void if any of the above conditions are not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT.

0 comments on commit 2e94b17

Please sign in to comment.