Skip to content

Commit 3728cc6

Browse files
committed
Fix Amharic (Ethiopic) font rendering on Windows
- Bundle Abyssinica SIL font in Telegram/Resources/fonts/ - Load font and add substitutions in application.cpp (Windows only) - Fixes #30184, #30230 - README: Add Abyssinica SIL attribution (SIL OFL 1.1) - Location picker: Escape maps token before eval (security) Made-with: Cursor
1 parent 234e0b2 commit 3728cc6

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Version **1.8.15** was the last that supports older systems
5959
* Range-v3 ([Boost License](https://github.com/ericniebler/range-v3/blob/master/LICENSE.txt))
6060
* Open Sans font ([Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html))
6161
* Vazirmatn font ([SIL Open Font License 1.1](https://github.com/rastikerdar/vazirmatn/blob/master/OFL.txt))
62+
* Abyssinica SIL font ([SIL Open Font License 1.1](https://software.sil.org/abyssinica/)) — Ethiopic/Amharic support
6263
* Emoji alpha codes ([MIT License](https://github.com/emojione/emojione/blob/master/extras/alpha-codes/LICENSE.md))
6364
* xxHash ([BSD License](https://github.com/Cyan4973/xxHash/blob/dev/LICENSE))
6465
* QR Code generator ([MIT License](https://github.com/nayuki/QR-Code-generator#license))
262 KB
Binary file not shown.

‎Telegram/Resources/qrc/telegram/telegram.qrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<file alias="dice/dice4.svg">../../art/dice/dice4.svg</file>
4444
<file alias="dice/dice5.svg">../../art/dice/dice5.svg</file>
4545
<file alias="dice/dice6.svg">../../art/dice/dice6.svg</file>
46+
<file alias="fonts/AbyssinicaSIL-Regular.ttf">../../fonts/AbyssinicaSIL-Regular.ttf</file>
4647
</qresource>
4748
<qresource prefix="/icons">
4849
<file alias="calls/hands.lottie">../../icons/calls/hands.lottie</file>

‎Telegram/SourceFiles/core/application.cpp‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ For license and copyright information please follow this link:
9393

9494
#include <QtCore/QStandardPaths>
9595
#include <QtCore/QMimeDatabase>
96+
#include <QtGui/QFontDatabase>
9697
#include <QtGui/QGuiApplication>
9798
#include <QtGui/QScreen>
9899
#include <QtGui/QWindow>
@@ -262,9 +263,25 @@ void Application::run() {
262263

263264
startLocalStorage();
264265

265-
style::SetCustomFont(settings().customFontFamily());
266+
auto fontFamily = settings().customFontFamily();
267+
style::SetCustomFont(fontFamily);
266268
style::internal::StartFonts();
267269

270+
// Add Ethiopic (Amharic) font fallback on Windows. Open Sans doesn't support
271+
// Ethiopic; bundled Abyssinica SIL does. Fixes #30184, #30230.
272+
#ifdef Q_OS_WIN
273+
if (const auto id = QFontDatabase::addApplicationFont(
274+
u":/gui/fonts/AbyssinicaSIL-Regular.ttf"_q);
275+
id >= 0) {
276+
QFont::insertSubstitutions(u"Open Sans"_q, QStringList{
277+
u"Vazirmatn UI NL"_q,
278+
u"Abyssinica SIL"_q,
279+
u"Segoe UI"_q,
280+
u"Arial"_q,
281+
});
282+
}
283+
#endif
284+
268285
ValidateScale();
269286

270287
refreshGlobalProxy(); // Depends on app settings being read.

‎Telegram/SourceFiles/ui/controls/location_picker.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ void LocationPicker::mapReady() {
10951095

10961096
delete base::take(_mapLoading);
10971097

1098-
const auto token = _config.mapsToken.toUtf8();
1098+
const auto token = EscapeForScriptString(_config.mapsToken.toUtf8());
10991099
const auto center = DefaultCenter(_initialProvided);
11001100
const auto bounds = DefaultBounds();
11011101
const auto params = "token: '" + token + "'"

0 commit comments

Comments
 (0)