Created attachment 234251 [details] add NO_FONTS option Hello. Idea was found in arch repo - just truncate fonts and don't use DemiBold.
(In reply to Volodymyr Kostyrko from comment #0) Please, don't name option with "NO" prefix. I'd suggest EMBEDDED_FONTS or BUNDLED_FONTS as an alternative.
Created attachment 234409 [details] rename option, clarify description
Hi, net-im/telegram-desktop has been updated to version 4.2.4. I've just taken a look on patch, so I couldn't find how to apply the patch. Could you please review and update the patch. Thank you.
(In reply to Sergey A. Osokin from comment #3) Just checked and it applied cleanly for me: cd /usr/ports/net-im/telegram-desktop fetch -o - 'https://bz-attachments.freebsd.org/attachment.cgi?id=234409' | patch -p3
(In reply to Volodymyr Kostyrko from comment #4) Thanks for the update. net-im/telegram-desktop has been updated to version 4.5.0. Could you please update the patch as well, thank you.
Created attachment 239360 [details] patch to skip embedding fonts, fix for latest version Fixed regarding WEBKIT removal.
(In reply to Volodymyr Kostyrko from comment #6) I've forgotten to add that this new option can be optional and disabled by default, hope it's ok.
It should not be disabled by default, default preference is to follow official build. By disabling this option you can prevent build from bundling fonts in to use your own preferred ones. This was done differently in first patch, but changed according to comment #1.
(In reply to Volodymyr Kostyrko from comment #8) Hi Volodymyr, thanks for the update. I've contacted the Telegram Desktop Development team for the patch review. It's been recommended to keep default behavior as is, otherwise it may cause an issue with default fonts for the program. Please raise a corresponding issue on the project page in GitHub, hope your patch will be accepted there. Thank you.
I believe this patch can be added: it does not change default behavior of the package, it's not intrusive, and it allows users to use system fonts in telegram for better visual integration with their desktop.
(In reply to Max Brazhnikov from comment #10) I'm definitely ready to add the feature as an optional, but Volodymyr wants to see that be default, and the vendor is disagree with that.
I'd rather work with upstream to get the patch there or abandon the patch. IMHO, the ports system shouldn't turn into a fork of upstream software.
Created attachment 240694 [details] Option for system fonts Turns out upstream already provides build option for using system fonts and I set it unconditionally in [1] because default fonts looked ugly on my monitor. I've missed when it was reverted, apparently Telegram ships better fonts now. Let's make it optional. Volodymyr, could you test the attached patch? [1] https://svnweb.freebsd.org/ports?view=revision&revision=552150
Reopen for new patch.
(In reply to Max Brazhnikov from comment #13) Well, that option never worked for me before. And right now your patch also doesn't change anything for me, I still see Telegram using embedded fonts after enabling it. > pkg info -l telegram-desktop-qt6 telegram-desktop-qt6-4.5.0: /usr/local/bin/telegram-desktop /usr/local/share/applications/org.telegram.desktop.desktop /usr/local/share/icons/hicolor/128x128/apps/telegram.png /usr/local/share/icons/hicolor/16x16/apps/telegram.png /usr/local/share/icons/hicolor/256x256/apps/telegram.png /usr/local/share/icons/hicolor/32x32/apps/telegram.png /usr/local/share/icons/hicolor/48x48/apps/telegram.png /usr/local/share/icons/hicolor/512x512/apps/telegram.png /usr/local/share/icons/hicolor/64x64/apps/telegram.png /usr/local/share/licenses/telegram-desktop-qt6-4.5.0/GPLv3 /usr/local/share/licenses/telegram-desktop-qt6-4.5.0/LICENSE /usr/local/share/licenses/telegram-desktop-qt6-4.5.0/catalog.mk /usr/local/share/metainfo/org.telegram.desktop.metainfo.xml ^^^ Here fonts are not available as separate files, they are embedded into the binary with all other resources. # original build .rwxr-xr-x 89M root 20 Mar 13:28 /usr/local/bin/telegram-desktop # SYSTEM_FONTS .rwxr-xr-x 89M root 20 Mar 22:35 /usr/local/bin/telegram-desktop # EMBEDDED_FOINTS .rwxr-xr-x 88M root 27 Feb 10:48 /usr/local/bin/telegram-desktop All those are same Telegram version, built against same static libraries. (In reply to Sergey A. Osokin from comment #11) I guess you got me wrong. Enabled EMDEDDED_FONTS option doesn't alter the build at all, keeping it the same as intended by developer. Disabling this option results in embedded fonts being truncated prior to build, so they are still "embedded" to the binary, but being "incorrect" they are simply ignored and system preferences are kicking in. In fact, I highly doubt Telegram Developers will ever consider allowing other fonts on their build. The reason for that is state of font rendering in QT, which is... flawed. Telegram Developers choose to stick to one font and make sure this font is properly positioned/used everywhere in the program. On the other hand OpenSans is a poorly hinted font, and on higher resolutions or with better hinting it looks worse then other fonts available. Other reason to switch out from it is bold text, which might be rendered indistinguishable from normal text. Turning off OpenSans also has it's own deficiencies. Some fonts are too high, and engine is not fitting them correctly into interface, resulting in underlines being pushed out of the text box, so you can't see which text is underlined in the interface. Others are calculated too low, so they are rendered higher then optimal text position, resulting in unread numbers being rendered not at the center of the circle. Probably I got suggestion wrong from the start, initial version just added another option that stripped embedded fonts when enabled, and I named it NO_FONTS. Probably I just need to rename it to SYSTEM_FONTS as suggested by Max and invert the logic? (i.e. disabled by default and removes fonts when enabled) Thanks in advance!
(In reply to Volodymyr Kostyrko from comment #15) That makes sense. I'm still ready to add a disabled by default option, so that makes possible to build the program with a desired behavior. Also, I'd like to ask you to raise a request on GH, so the Telegram Desktop development team can get all details on this feature and provide their comments on this feature request. Thank you.
Created attachment 241052 [details] fixed SYSTEM_FONTS patch After some digging on GitHub I got out with idea Max approach should actually work. So I think I fixed his patch and now it works properly. Or maybe I just missed his idea on the first approach... Anyway, attached patch adds SYSTEM_FONTS option and removes one extra setting that was shadowing configurable set by option.
Ah, regarding default build. DESKTOP_APP_USE_PACKAGED_FONTS defaults to off by design, so line I removed was actually noop until someone attempted to actually enable it.
(In reply to Volodymyr Kostyrko from comment #17) Right, I forgot to remove that line.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=f7596f833caa1b18c84714e4648008a3fc78bbb2 commit f7596f833caa1b18c84714e4648008a3fc78bbb2 Author: Sergey A. Osokin <osa@FreeBSD.org> AuthorDate: 2023-04-23 02:50:34 +0000 Commit: Sergey A. Osokin <osa@FreeBSD.org> CommitDate: 2023-04-23 02:50:34 +0000 net-im/t*: update Telegram Desktop to 4.8.0 Also, add option to use system fonts. (*) PR: 264274 (*) net-im/telegram-desktop/Makefile | 9 +++++---- net-im/telegram-desktop/distinfo | 6 +++--- net-im/tg_owt/Makefile | 4 ++-- net-im/tg_owt/distinfo | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-)
Committed, thanks!