From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Evgeny Zajcev Newsgroups: gmane.emacs.bugs Subject: bug#59075: 29.0.50; Image transforms not applied to svg images Date: Sat, 12 Nov 2022 12:48:40 +0300 Message-ID: References: <83o7tk1h3m.fsf@gnu.org> <83leoo1cv9.fsf@gnu.org> <87o7tk5j8h.fsf@gmx.net> <877d0858oz.fsf@gmx.net> <87v8nr8v9g.fsf@yahoo.com> <877d077y1m.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000077e6b05ed42ea1a" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="918"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59075@debbugs.gnu.org, Eli Zaretskii , Stephen Berman To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 12 10:50:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1otn9U-000Aay-7E for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Nov 2022 10:50:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otn9I-0002yj-ME; Sat, 12 Nov 2022 04:50:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otn9G-0002yT-S0 for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 04:50:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otn9F-0008LQ-SS for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 04:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1otn9F-000462-P9 for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 04:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Evgeny Zajcev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Nov 2022 09:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59075 X-GNU-PR-Package: emacs Original-Received: via spool by 59075-submit@debbugs.gnu.org id=B59075.166824654315679 (code B ref 59075); Sat, 12 Nov 2022 09:50:01 +0000 Original-Received: (at 59075) by debbugs.gnu.org; 12 Nov 2022 09:49:03 +0000 Original-Received: from localhost ([127.0.0.1]:47347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otn8J-00044p-AI for submit@debbugs.gnu.org; Sat, 12 Nov 2022 04:49:03 -0500 Original-Received: from mail-lf1-f49.google.com ([209.85.167.49]:45051) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otn8G-00044J-L9 for 59075@debbugs.gnu.org; Sat, 12 Nov 2022 04:49:01 -0500 Original-Received: by mail-lf1-f49.google.com with SMTP id p8so11699758lfu.11 for <59075@debbugs.gnu.org>; Sat, 12 Nov 2022 01:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0M2bERpkTq0TXSBifpNx4evVlPxo5fLA1J8edQtExzY=; b=hC3T0L527BMPtyyDmriWh1xA1e5UKeCLxpqgkq5Ivr9oBMx0/UJ0vvp0v8mK9PUQ1B y5OLBEAJGMg6NvqRs3LfAfNbB6qWgkIDFOB9Ras6mQPl9ud+FF3Srisr4xO64WfIDX8I CpzrLWU8VZKFbBptgMLwMcvZwPzbwpQpijMN+ygMfZNI95ms83pUVJNPLH5OaH6YciyH VAcxxEG5AdHyY+RmZ7JuBK/So5gn+MEhlPcogMQv/jhlRQyCGtcnFlocSPH2mOzKOwxZ u7+h9Zm9AtKLcEmwSoFJKgu6jVcP6uMBn+bz15IucixMpXftDl4CTRpXQLQsrw0eFtdy hsPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0M2bERpkTq0TXSBifpNx4evVlPxo5fLA1J8edQtExzY=; b=if0JujUhCpIZ7Ewso17gCEBKxv6Jjs61d5EMGoPgyYutX8I7RUAo74O6cp442dKPRF nzxXE7NpNIPle9bw0g0Cq6OEpfvmu4YHveBRqnxaNrFnlkzdMV74tKYOe/FgutN3zrQZ VfEV8MPhK2JFiA3lpQcuSAQ2tsLfBWmzTCxfGKx26Sj3yPa23TScUcVtA0obEeH0KVaT /GB6W7uROlkA+dcFtQW2L51FobwDY0XH6/GBERNtsS/4XEbroedWuFRdmxHNsyE8vtYj jFdfbhcjBMEECQ8XKoc50I/Y0zSjwoQrqQ0m/bkNuYwZ1S1V6v5DOPSm48ZpNI8qt4e3 E6nw== X-Gm-Message-State: ANoB5pnjKBE7lsRzpjVNcE2LEdKdQYDcuSdNJVg6JcuFVkf8e5NGOgF2 zEfgvLV0msjIiGMkSO0XEXvPORuBFZu5IGwbgOs= X-Google-Smtp-Source: AA0mqf5i2QR1kbrfEuRSq9TQ0aAPNPlkeOj1pppYlcKMjjh7DGUn74FFQ2cRHAZiERYNCCRtaLLpy/9f+XfKNxVvPTA= X-Received: by 2002:a05:6512:23a9:b0:4a7:229f:2dd0 with SMTP id c41-20020a05651223a900b004a7229f2dd0mr2115016lfv.598.1668246533536; Sat, 12 Nov 2022 01:48:53 -0800 (PST) In-Reply-To: <877d077y1m.fsf@yahoo.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247644 Archived-At: --000000000000077e6b05ed42ea1a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D0=BF=D0=BD, 7 =D0=BD=D0=BE=D1=8F=D0=B1. 2022 =D0=B3. =D0=B2 15:24, Po Lu = : > Evgeny Zajcev writes: > > > =D0=BF=D0=BD, 7 =D0=BD=D0=BE=D1=8F=D0=B1. 2022 =D0=B3. =D0=B2 03:26, Po= Lu : > > > > My suspicion is that librsvg is not being used to display SVGs at all, > > on Mac OS 13. What happens if you build without native image APIs? > > > > Works perfectly without native image API! Resulting svg image gets > correct size after applying `:height', > > and if I change image type to png, image is not displayed at all as > expected. > > Scratch what I said earlier. Does this fix the problem? > > diff --git a/src/nsimage.m b/src/nsimage.m > index 9cb5090dd0..dd8768664a 100644 > --- a/src/nsimage.m > +++ b/src/nsimage.m > @@ -74,8 +74,10 @@ Updated by Christian Limpach (chris@nice.ch) > imageType =3D @"com.compuserve.gif"; > else if (EQ (type, Qtiff)) > imageType =3D @"public.tiff"; > +#ifndef HAVE_RSVG > else if (EQ (type, Qsvg)) > imageType =3D @"public.svg-image"; > +#endif > else if (EQ (type, Qheic)) > imageType =3D @"public.heic"; > > > Adding this code fixes the problem! However, if I specify `png' image type instead of `svg' when svg image is in use, no error is triggered in contrast with Emacs without native images. If this code does not break anything on older MacOS I think it should be added to Emacs. If rsvg is present, there is no point in using native image APIs, as > they do not scale SVG images nearly as well. And this part of > image_set_transform gets in the way: > > #ifdef HAVE_RSVG > /* SVGs are pre-scaled to the correct size. */ > if (EQ (image_spec_value (img->spec, QCtype, NULL), Qsvg)) > { > width =3D img->width / FRAME_SCALE_FACTOR (f); > height =3D img->height / FRAME_SCALE_FACTOR (f); > } > else > #endif > --=20 lg --000000000000077e6b05ed42ea1a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
=D0=BF=D0=BD, 7 =D0=BD=D0=BE=D1=8F=D0= =B1. 2022 =D0=B3. =D0=B2 15:24, Po Lu <luangruo@yahoo.com>:
Evgeny Zajcev <lg.zevlg@gmail.com> writes:

> =D0=BF=D0=BD, 7 =D0=BD=D0=BE=D1=8F=D0=B1. 2022 =D0=B3. =D0=B2 03:26, P= o Lu <luangruo@y= ahoo.com>:
>
>=C2=A0 My suspicion is that librsvg is not being used to display SVGs a= t all,
>=C2=A0 on Mac OS 13.=C2=A0 What happens if you build without native ima= ge APIs?
>
> Works perfectly without native image API!=C2=A0 Resulting svg image ge= ts correct size after applying `:height',
> and if I change image type to png, image is not displayed at all as ex= pected.

Scratch what I said earlier.=C2=A0 Does this fix the problem?

diff --git a/src/nsimage.m b/src/nsimage.m
index 9cb5090dd0..dd8768664a 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -74,8 +74,10 @@ Updated by Christian Limpach (chris@nice.ch)
=C2=A0 =C2=A0 =C2=A0imageType =3D @"com.compuserve.gif";
=C2=A0 =C2=A0else if (EQ (type, Qtiff))
=C2=A0 =C2=A0 =C2=A0imageType =3D @"public.tiff";
+#ifndef HAVE_RSVG
=C2=A0 =C2=A0else if (EQ (type, Qsvg))
=C2=A0 =C2=A0 =C2=A0imageType =3D @"public.svg-image";
+#endif
=C2=A0 =C2=A0else if (EQ (type, Qheic))
=C2=A0 =C2=A0 =C2=A0imageType =3D @"public.heic";



Adding this code fixes the problem!=C2= =A0 However, if I specify `png' image type instead of `svg' when sv= g image is in use, no error is triggered in contrast with Emacs without nat= ive images.

If this code does not break anything o= n older MacOS I think it should be added to Emacs.

If rsvg is present, there is no point in using native image APIs, as
they do not scale SVG images nearly as well.=C2=A0 And this part of
image_set_transform gets in the way:

#ifdef HAVE_RSVG
=C2=A0 /* SVGs are pre-scaled to the correct size.=C2=A0 */
=C2=A0 if (EQ (image_spec_value (img->spec, QCtype, NULL), Qsvg))
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 width =3D img->width / FRAME_SCALE_FACTOR (f);
=C2=A0 =C2=A0 =C2=A0 height =3D img->height / FRAME_SCALE_FACTOR (f); =C2=A0 =C2=A0 }
=C2=A0 else
#endif


--
lg
--000000000000077e6b05ed42ea1a--