unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: ichernyshovvv@gmail.com, 66941@debbugs.gnu.org
Subject: bug#66941: 29.1; Emacs on Windows can't display CJK characters correctly in svg images
Date: Mon, 6 Nov 2023 12:57:04 +0000	[thread overview]
Message-ID: <ZUjioFRrVPJ3lByB@idiocy.org> (raw)
In-Reply-To: <83ttpz2htm.fsf@gnu.org>

On Mon, Nov 06, 2023 at 02:21:25PM +0200, Eli Zaretskii wrote:
> > Date: Sun, 5 Nov 2023 23:27:23 +0000
> > From: Alan Third <alan@idiocy.org>
> > Cc: ichernyshovvv@gmail.com, 66941@debbugs.gnu.org
> > 
> > On Sun, Nov 05, 2023 at 08:54:27AM +0200, Eli Zaretskii wrote:
> > > Could be a problem with the font used by librsvg to show text?  Maybe
> > > the font doesn't have any non-ASCII characters.
> > 
> > This seems plausible. It should be possible to check by over-riding
> > the CSS with a font you know should work:
> > 
> > (progn
> >   (require 'svg)
> >   (switch-to-buffer "*svg-test*")
> >   (let ((svg-image (svg-create 200 200))
> >         (inhibit-read-only t))
> >     (erase-buffer)
> >     (svg-text svg-image "我喜欢自由软件" :y 100 :x 50)
> >     (insert-image (svg-image svg-image :css "svg{font-family:\"Noto Sans Mono CJK HK\";}"))))
> > 
> > Choose a font you know can show the text you're testing. I've a vague
> > memory that the Noto CJK fonts behave slightly oddly on Windows, so
> > maybe something else is a better choice.
> > 
> > I think setting the :css attribute to an empty string should reset
> > librsvg so it will use its default font settings and that would let
> > us see if it works right without our customisation.
> 
> Thanks.  I tried the above, and it didn't work, at least with (old)
> librsvg 2.40.1 I have here.  Moreover, if I use a plain ASCII string,
> which does display, the font used for display is identical whether or
> not I specify font-family in the :css attribute, so I think somehow
> this attribute doesn't have any effect.

Ah, OK. CSS only works on librsvg 2.48 and above.

This means that, at least for you, Emacs has no effect on the font
used by librsvg, it will be using its default. I've no idea what that
is and a quick look through the librsvg code hasn't helped.

It should be possible to over-ride it in the svg file itself, but
that's really up to the user.

I don't know how librsvg handles fallbacks for glyphs the font doesn't
support or if there's any way for us to over-ride its behaviour.

> Is it possible to specify a font rather than font-family?  Font
> families are treated poorly on MS-Windows, so I'd prefer to specify a
> particular font, to be sure.

This is how CSS works even in web browsers, I don't think there's a
separate "font" option.
-- 
Alan Third





      reply	other threads:[~2023-11-06 12:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04 19:00 bug#66941: 29.1; Emacs on Windows can't display CJK characters correctly in svg images Ilya Chernyshov
2023-11-05  6:47 ` Eli Zaretskii
2023-11-05  6:54   ` Eli Zaretskii
2023-11-05 23:27     ` Alan Third
2023-11-06 12:21       ` Eli Zaretskii
2023-11-06 12:57         ` Alan Third [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZUjioFRrVPJ3lByB@idiocy.org \
    --to=alan@idiocy.org \
    --cc=66941@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=ichernyshovvv@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).