[Bug 285941] net-im/telegram-desktop: CMake bool was used incorrectly inverting the meaning
Date: Tue, 08 Jul 2025 08:20:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285941
--- Comment #3 from Volodymyr Kostyrko <arcade@b1t.name> ---
Ok, let me describe it in details (because patch was actually wrong, I messed
it up).
Telegram bundles fonts into the binary, making it bigger. The idea was to
disable bundling in fonts so that system fonts can be used instead.
According to ./cmake/variables.cmake:
```
option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of
bundled patched ones." OFF)
```
Option DESKTOP_APP_USE_PACKAGED_FONTS is defined defaulting to OFF, when option
is on system (preinstalled) fonts are used.
What actually happened here is either option was OFF by default, or we were
setting it to OFF through option.
According to ./Telegram/lib_ui/CMakeLists.txt:
```
if (DESKTOP_APP_USE_PACKAGED_FONTS)
target_compile_definitions(lib_ui PRIVATE LIB_UI_USE_PACKAGED_FONTS)
remove_target_sources(lib_ui ${src_loc} fonts/fonts.qrc)
endif()
```
So we can see hen that CMake option is on font sources are removed from the
build. So we need to set that option to ON when we want to use system fonts.
Actually my patch was incorrect, I tried reading through porters handbook and
tried changing CMAKE_BOOL_OFF to CMAKE_BOOL_ON (doh) to invert how the option
works. It looks like porters handbook doesn't document correctly how CMAKE_BOOL
works, because CMAKE_BOOL_ON is not described there, but still works inverting
the logic. Retested it now and here's my build matrix:
old patch (CMAKE_BOOL_ON)
SYSTEM_FONTS on: 212267184
SYSTEM_FONTS off: 211299760
without patch (CMAKE_BOOL_OFF):
SYSTEM_FONTS on: 212267184
SYSTEM_FONTS off: 212267184
with new proposed change (CMAKE_BOOL):
SYSTEM_FONTS on: 211299760
SYSTEM_FONTS off: 212267184
Proposed change is to use:
SYSTEM_FONTS_CMAKE_BOOL= DESKTOP_APP_USE_PACKAGED_FONTS
--
You are receiving this mail because:
You are the assignee for the bug.