zevlg / telega.el

GNU Emacs telegram client (unofficial)
https://zevlg.github.io/telega.el/
GNU General Public License v3.0
1.09k stars 85 forks source link

Non-generated avatars are not displayed #424

Closed SqrtMinusOne closed 1 year ago

SqrtMinusOne commented 1 year ago

Non-generated avatars are no longer displayed on my machine. Autogenerated letters in circles work fine.

image

Telega Setup

OS: Guix System Emacs: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0) Features: svg ffmpeg Telega: telega v0.8.151 (TDLib v1.8.15-GITDIR-) (telega-server v0.8.2)

Current Behavior

The value of the display property on avatars seems to be correct (running C-u C-x = on the avatar at "Saved Messages"):

There are text properties here:
  :action              telega-chat-button-action
  :inserter            telega-ins--chat-full
  :telega-retain-props (:inserter :action)
  :value               [Show]
  button               (t)
  category             telega-chat-button
  display              [Show]
  rear-nonsticky       (display)
((slice 0 nil 1.0 nil)
 (image :type svg :data "<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"20\" height=\"19\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"> <defs> <clipPath id=\"clip\"> <circle cx=\"10\" cy=\"9\" r=\"8.8\"></circle></clipPath></defs> <image xlink:href=\"profile_photos/5217817268556251362.jpg\" clip-path=\"url(#clip)\" height=\"17.6\" width=\"17.6\" y=\"1.1\" x=\"1.1999999999999993\"></image></svg>" :scale 1.0 :width 20 :height 19 :ascent center :mask heuristic :base-uri "/home/pavel/.telega/dummy" :telega-text
        (#("(S)" 1 2
           (face
            (bold
             (telega-msg-self-title)))))))

There's an image at ~/.telega/profile_photos/5217817268556251362.jpg, which is the correct image. Tracing shows that telega-avatar--create-image outputs the same image form as above.

Steps to Reproduce

What I've done in attempt to fix the issue:

Config ```lisp (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (eval-when-compile (require 'use-package)) (use-package evil :straight t :init (setq evil-want-integration t) (setq evil-want-C-u-scroll t) (setq evil-want-keybinding nil) (setq evil-search-module 'evil-search) (setq evil-split-window-below t) (setq evil-vsplit-window-right t) (unless (display-graphic-p) (setq evil-want-C-i-jump nil)) :config (evil-mode 1) ;; (setq evil-respect-visual-line-mode t) (evil-set-undo-system 'undo-tree)) (use-package evil-collection :straight t :after evil :config (evil-collection-init '(telega))) (use-package telega :straight t) ```

So far couldn't figure out what goes wrong. Sounds like an issue with SVG rendering, but I have no clue where to dig further. I'll probably modify telega-avatar--create-image to always draw letters in circles to make it usable for now...

Any ideas?

zevlg commented 1 year ago

Try running with telega-use-svg-base-uri explicitly set to nil before loading telega. I've heard about systems with librsvg disallowing images embedding

zevlg commented 1 year ago

Ah, you've already tried this. Make sure image file is accessible by telega

But looks like this is some deep issue, not related to telega directly

SqrtMinusOne commented 1 year ago

Well, I've nuked and re-created the straight folder and the Emacs profile. This helped.

Strange.

SqrtMinusOne commented 1 year ago

So, the issue seems to be librsvg. Now multi-character emojis are displayed like that:

image

The version that gobbles telega avatars displays these emojis correctly, and this is the only thing that changed in the emacs definition: https://github.com/guix-mirror/guix/commit/5834953573a00793fbee8918d9d53897e25fa363.

emacs-next renders both emojis and avatars correctly, but it has other font issues on my setup, namely that something seems to reset the fonts after initialization, and set-frame-font resolves the italic version of my main font instead of the normal one... And it's still 29.0.92 and not 29.1 on Guix, maybe this has something do with it.

I'll wait for the proper 29.1 definition, I guess.