* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 6:44 ` Tassilo Horn
@ 2024-09-23 8:34 ` Manuel Giraud via Emacs development discussions.
2024-09-23 8:45 ` Tassilo Horn
2024-09-23 11:56 ` Eli Zaretskii
2024-09-23 9:36 ` Visuwesh
2024-09-23 11:55 ` Eli Zaretskii
2 siblings, 2 replies; 33+ messages in thread
From: Manuel Giraud via Emacs development discussions. @ 2024-09-23 8:34 UTC (permalink / raw)
To: Tassilo Horn; +Cc: Morgan Willcock, emacs-devel, Eli Zaretskii, visuweshm
Tassilo Horn <tsdh@gnu.org> writes:
[...]
> That's what Visuwesh's advice of setting doc-view-svg-face's
> foreground/background to black and white would do. We could do that by
> default instead of inheriting from the default face (which is modified
> by the theme). That would probably give sensible results in most
> cases.
Hi,
When I introduced doc-view-svg-face to inherit from the default face, I
thought it was right for reading long papers to match the user's
preference. Now, for invoices or other more complex documents, it may
be better to default to "black on white".
But I think we should explain that one could inherit from the default
face to have its theme used into the doc-view-svg-face's docstring.
--
Manuel Giraud
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 8:34 ` Manuel Giraud via Emacs development discussions.
@ 2024-09-23 8:45 ` Tassilo Horn
2024-09-23 11:34 ` Manuel Giraud via Emacs development discussions.
2024-09-23 11:56 ` Eli Zaretskii
1 sibling, 1 reply; 33+ messages in thread
From: Tassilo Horn @ 2024-09-23 8:45 UTC (permalink / raw)
To: Manuel Giraud; +Cc: Morgan Willcock, emacs-devel, Eli Zaretskii, visuweshm
Manuel Giraud <manuel@ledu-giraud.fr> writes:
Hi Manuel,
> When I introduced doc-view-svg-face to inherit from the default face,
> I thought it was right for reading long papers to match the user's
> preference.
Did you read that when NOT inheriting from the default face and
therefore having all face properties nil also styles according to the
currently active theme? But yes, you replaced the old variables
doc-view-svg-background/foreground with the new face, and the old
variables where "white"/"black" by default.
> Now, for invoices or other more complex documents, it may be better to
> default to "black on white".
Seems so.
> But I think we should explain that one could inherit from the default
> face to have its theme used into the doc-view-svg-face's docstring.
Certainly. Would you like to do that?
Thanks,
Tassilo
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 8:45 ` Tassilo Horn
@ 2024-09-23 11:34 ` Manuel Giraud via Emacs development discussions.
0 siblings, 0 replies; 33+ messages in thread
From: Manuel Giraud via Emacs development discussions. @ 2024-09-23 11:34 UTC (permalink / raw)
To: Tassilo Horn; +Cc: Morgan Willcock, emacs-devel, Eli Zaretskii, visuweshm
Tassilo Horn <tsdh@gnu.org> writes:
> Manuel Giraud <manuel@ledu-giraud.fr> writes:
>
> Hi Manuel,
Hi Tassilo,
>> When I introduced doc-view-svg-face to inherit from the default face,
>> I thought it was right for reading long papers to match the user's
>> preference.
>
> Did you read that when NOT inheriting from the default face and
> therefore having all face properties nil also styles according to the
> currently active theme? But yes, you replaced the old variables
> doc-view-svg-background/foreground with the new face, and the old
> variables where "white"/"black" by default.
Yes. It seems that inherinting from default or having all properties to
nil does the same thing. FWIW, I think we should still use the former
which is more explicit.
>> Now, for invoices or other more complex documents, it may be better to
>> default to "black on white".
>
> Seems so.
>
>> But I think we should explain that one could inherit from the default
>> face to have its theme used into the doc-view-svg-face's docstring.
>
> Certainly. Would you like to do that?
Yes, I could file a bug report with both changes (face colors and
docstring) but I'd like to hear Eli inputs first.
--
Manuel Giraud
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 8:34 ` Manuel Giraud via Emacs development discussions.
2024-09-23 8:45 ` Tassilo Horn
@ 2024-09-23 11:56 ` Eli Zaretskii
2024-09-23 14:51 ` Tassilo Horn
1 sibling, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2024-09-23 11:56 UTC (permalink / raw)
To: Manuel Giraud; +Cc: tsdh, morgan, emacs-devel, visuweshm
> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: Morgan Willcock <morgan@ice9.digital>, emacs-devel@gnu.org, Eli
> Zaretskii <eliz@gnu.org>, visuweshm@gmail.com
> Date: Mon, 23 Sep 2024 10:34:57 +0200
>
> When I introduced doc-view-svg-face to inherit from the default face, I
> thought it was right for reading long papers to match the user's
> preference. Now, for invoices or other more complex documents, it may
> be better to default to "black on white".
>
> But I think we should explain that one could inherit from the default
> face to have its theme used into the doc-view-svg-face's docstring.
Should we perhaps define suitable settings for this face in the themes
that come with Emacs?
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 11:56 ` Eli Zaretskii
@ 2024-09-23 14:51 ` Tassilo Horn
2024-09-23 15:35 ` Eli Zaretskii
0 siblings, 1 reply; 33+ messages in thread
From: Tassilo Horn @ 2024-09-23 14:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Manuel Giraud, morgan, emacs-devel, visuweshm
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Manuel Giraud <manuel@ledu-giraud.fr>
>> Cc: Morgan Willcock <morgan@ice9.digital>, emacs-devel@gnu.org, Eli
>> Zaretskii <eliz@gnu.org>, visuweshm@gmail.com
>> Date: Mon, 23 Sep 2024 10:34:57 +0200
>>
>> When I introduced doc-view-svg-face to inherit from the default face, I
>> thought it was right for reading long papers to match the user's
>> preference. Now, for invoices or other more complex documents, it may
>> be better to default to "black on white".
>>
>> But I think we should explain that one could inherit from the default
>> face to have its theme used into the doc-view-svg-face's docstring.
>
> Should we perhaps define suitable settings for this face in the themes
> that come with Emacs?
I think the problem is much more likely when using a dark theme, so
those could define black foreground and white background for
doc-view-svg-face. But since there are so many popular dark themes
outside of emacs, I doubt that's a good idea.
In the end, if the theming of the PDF/SVG gives suitable results depends
on the PDF and we have no way to test if it does for the one at hand.
So I'd rather apply something like that to the emacs-30 branch:
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 15352630d25..667b0e12986 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -238,10 +238,21 @@ doc-view-imenu-flatten
:type 'boolean
:version "29.1")
-(defface doc-view-svg-face '((t :inherit default))
+(defface doc-view-svg-face '((t :inherit default
+ :background "white"
+ :foreground "black"))
"Face used for SVG images.
Only background and foreground colors are used.
-See `doc-view-mupdf-use-svg'."
+See `doc-view-mupdf-use-svg'.
+
+If foreground and background color are not specified explicitly and
+therefore inherit from the `default' face, the default
+foreground/background color values are passed to `create-image' when
+preparing the SVG for display in the doc-view buffer. The effect is
+that the current theme's foreground/background values are applied to the
+SVG display. Note that this doesn't work for documents which are not
+simply black-on-white where it can lead to unreadable documents due to
+foreground and background color being equal or similar."
:version "30.1")
(make-obsolete 'doc-view-svg-background 'doc-view-svg-face "30.1")
--8<---------------cut here---------------end--------------->8---
Plus a corresponding NEWS entry telling that unsetting the
foreground/background of doc-view-svg-face will try to apply the current
theme's fg/bg colors also for the display in doc-view (in case of
mupdf+svg).
Bye,
Tassilo
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 14:51 ` Tassilo Horn
@ 2024-09-23 15:35 ` Eli Zaretskii
2024-09-23 15:50 ` Morgan Willcock
2024-09-23 16:10 ` Tassilo Horn
0 siblings, 2 replies; 33+ messages in thread
From: Eli Zaretskii @ 2024-09-23 15:35 UTC (permalink / raw)
To: Tassilo Horn; +Cc: manuel, morgan, emacs-devel, visuweshm
> From: Tassilo Horn <tsdh@gnu.org>
> Cc: Manuel Giraud <manuel@ledu-giraud.fr>, morgan@ice9.digital,
> emacs-devel@gnu.org, visuweshm@gmail.com
> Date: Mon, 23 Sep 2024 16:51:28 +0200
>
> > Should we perhaps define suitable settings for this face in the themes
> > that come with Emacs?
>
> I think the problem is much more likely when using a dark theme, so
> those could define black foreground and white background for
> doc-view-svg-face. But since there are so many popular dark themes
> outside of emacs, I doubt that's a good idea.
OK.
> In the end, if the theming of the PDF/SVG gives suitable results depends
> on the PDF and we have no way to test if it does for the one at hand.
> So I'd rather apply something like that to the emacs-30 branch:
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/lisp/doc-view.el b/lisp/doc-view.el
> index 15352630d25..667b0e12986 100644
> --- a/lisp/doc-view.el
> +++ b/lisp/doc-view.el
> @@ -238,10 +238,21 @@ doc-view-imenu-flatten
> :type 'boolean
> :version "29.1")
>
> -(defface doc-view-svg-face '((t :inherit default))
> +(defface doc-view-svg-face '((t :inherit default
> + :background "white"
> + :foreground "black"))
> "Face used for SVG images.
This part is okay.
> Only background and foreground colors are used.
> -See `doc-view-mupdf-use-svg'."
> +See `doc-view-mupdf-use-svg'.
> +
> +If foreground and background color are not specified explicitly and
> +therefore inherit from the `default' face, the default
> +foreground/background color values are passed to `create-image' when
> +preparing the SVG for display in the doc-view buffer. The effect is
> +that the current theme's foreground/background values are applied to the
> +SVG display. Note that this doesn't work for documents which are not
> +simply black-on-white where it can lead to unreadable documents due to
> +foreground and background color being equal or similar."
> :version "30.1")
I think this is too technical, and describes what the face definitions
do. I think we only need to say there that if the face's colors cause
color SVG images display with low contrast between foreground and
background, the user should customize the face to produce a better
contrast.
Also, I thought we agreed to also have some text in NEWS to delineate
this issue.
Thanks.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 15:35 ` Eli Zaretskii
@ 2024-09-23 15:50 ` Morgan Willcock
2024-09-23 16:10 ` Tassilo Horn
1 sibling, 0 replies; 33+ messages in thread
From: Morgan Willcock @ 2024-09-23 15:50 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Tassilo Horn, manuel, emacs-devel, visuweshm
Eli Zaretskii <eliz@gnu.org> writes:
>> +If foreground and background color are not specified explicitly and
>> +therefore inherit from the `default' face, the default
>> +foreground/background color values are passed to `create-image' when
>> +preparing the SVG for display in the doc-view buffer. The effect is
>> +that the current theme's foreground/background values are applied to the
>> +SVG display. Note that this doesn't work for documents which are not
>> +simply black-on-white where it can lead to unreadable documents due to
>> +foreground and background color being equal or similar."
>> :version "30.1")
>
> I think this is too technical, and describes what the face definitions
> do. I think we only need to say there that if the face's colors cause
> color SVG images display with low contrast between foreground and
> background, the user should customize the face to produce a better
> contrast.
Unless you know what the document looks like ahead of time, it isn't
obvious that what you are looking at is actually a background and a
foreground. Perhaps it is best to also mention that elements of the
image may appear to be missing entirely.
--
Morgan Willcock
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 15:35 ` Eli Zaretskii
2024-09-23 15:50 ` Morgan Willcock
@ 2024-09-23 16:10 ` Tassilo Horn
2024-09-23 16:27 ` Eli Zaretskii
2024-09-23 17:56 ` Manuel Giraud via Emacs development discussions.
1 sibling, 2 replies; 33+ messages in thread
From: Tassilo Horn @ 2024-09-23 16:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: manuel, morgan, emacs-devel, visuweshm
Eli Zaretskii <eliz@gnu.org> writes:
>> Only background and foreground colors are used.
>> -See `doc-view-mupdf-use-svg'."
>> +See `doc-view-mupdf-use-svg'.
>> +
>> +If foreground and background color are not specified explicitly and
>> +therefore inherit from the `default' face, the default
>> +foreground/background color values are passed to `create-image' when
>> +preparing the SVG for display in the doc-view buffer. The effect is
>> +that the current theme's foreground/background values are applied to the
>> +SVG display. Note that this doesn't work for documents which are not
>> +simply black-on-white where it can lead to unreadable documents due to
>> +foreground and background color being equal or similar."
>> :version "30.1")
>
> I think this is too technical, and describes what the face definitions
> do. I think we only need to say there that if the face's colors cause
> color SVG images display with low contrast between foreground and
> background, the user should customize the face to produce a better
> contrast.
Indeed.
> Also, I thought we agreed to also have some text in NEWS to delineate
> this issue.
Right. So next try, including a change of the NEWS entry for the face:
--8<---------------cut here---------------start------------->8---
diff --git a/etc/NEWS b/etc/NEWS
index 8ed16cfeeff..c72a87787f3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1544,10 +1544,12 @@ default is non-nil if your system supports display of SVG images.
---
*** New face 'doc-view-svg-face'.
This replaces 'doc-view-svg-foreground' and 'doc-view-svg-background'.
-If you don't like the colors produced by the default definition of
-this new face when DocView displays documents, customize this face to
-restore the colors you were used to, or to get colors more to your
-liking.
+By default, this face has black foreground on white background and
+inherits from the default face. When unsetting the foreground and
+background values, the display in DocView is styled according to the
+current theme. However, this, or any non-standard values, can result in
+poor contrast for documents which aren't simply black text on white
+background.
---
*** DocView buffers now display a new tool bar.
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 15352630d25..1ed0c71febe 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -238,10 +238,15 @@ doc-view-imenu-flatten
:type 'boolean
:version "29.1")
-(defface doc-view-svg-face '((t :inherit default))
+(defface doc-view-svg-face '((t :inherit default
+ :background "white"
+ :foreground "black"))
"Face used for SVG images.
-Only background and foreground colors are used.
-See `doc-view-mupdf-use-svg'."
+See `doc-view-mupdf-use-svg'.
+
+Only background and foreground colors are used as the SVG image's
+descriptors, see (info \"(elisp) SVG Images\"). Non-standard values may
+cause low-contrast issues with certain documents."
:version "30.1")
(make-obsolete 'doc-view-svg-background 'doc-view-svg-face "30.1")
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 16:10 ` Tassilo Horn
@ 2024-09-23 16:27 ` Eli Zaretskii
2024-09-23 16:54 ` Tassilo Horn
2024-09-23 17:56 ` Manuel Giraud via Emacs development discussions.
1 sibling, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2024-09-23 16:27 UTC (permalink / raw)
To: Tassilo Horn; +Cc: manuel, morgan, emacs-devel, visuweshm
> From: Tassilo Horn <tsdh@gnu.org>
> Cc: manuel@ledu-giraud.fr, morgan@ice9.digital, emacs-devel@gnu.org,
> visuweshm@gmail.com
> Date: Mon, 23 Sep 2024 18:10:34 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > I think this is too technical, and describes what the face definitions
> > do. I think we only need to say there that if the face's colors cause
> > color SVG images display with low contrast between foreground and
> > background, the user should customize the face to produce a better
> > contrast.
>
> Indeed.
>
> > Also, I thought we agreed to also have some text in NEWS to delineate
> > this issue.
>
> Right. So next try, including a change of the NEWS entry for the face:
LGTM, thanks.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 16:27 ` Eli Zaretskii
@ 2024-09-23 16:54 ` Tassilo Horn
2024-09-24 11:17 ` Eli Zaretskii
0 siblings, 1 reply; 33+ messages in thread
From: Tassilo Horn @ 2024-09-23 16:54 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: manuel, morgan, emacs-devel, visuweshm
Eli Zaretskii <eliz@gnu.org> writes:
>> > Also, I thought we agreed to also have some text in NEWS to
>> > delineate this issue.
>>
>> Right. So next try, including a change of the NEWS entry for the face:
>
> LGTM, thanks.
Perfect, pushed to the emacs-30 branch.
Thanks Morgan for making us aware of the issue before the release. :-)
Bye,
Tassilo
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 16:54 ` Tassilo Horn
@ 2024-09-24 11:17 ` Eli Zaretskii
2024-09-24 11:22 ` Tassilo Horn
0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2024-09-24 11:17 UTC (permalink / raw)
To: Tassilo Horn; +Cc: manuel, morgan, emacs-devel, visuweshm
> From: Tassilo Horn <tsdh@gnu.org>
> Cc: manuel@ledu-giraud.fr, morgan@ice9.digital, emacs-devel@gnu.org,
> visuweshm@gmail.com
> Date: Mon, 23 Sep 2024 18:54:16 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> > Also, I thought we agreed to also have some text in NEWS to
> >> > delineate this issue.
> >>
> >> Right. So next try, including a change of the NEWS entry for the face:
> >
> > LGTM, thanks.
>
> Perfect, pushed to the emacs-30 branch.
Did you forget to push? Because I don't think I see this change on
the branch.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 16:10 ` Tassilo Horn
2024-09-23 16:27 ` Eli Zaretskii
@ 2024-09-23 17:56 ` Manuel Giraud via Emacs development discussions.
2024-09-23 18:35 ` Tassilo Horn
1 sibling, 1 reply; 33+ messages in thread
From: Manuel Giraud via Emacs development discussions. @ 2024-09-23 17:56 UTC (permalink / raw)
To: Tassilo Horn; +Cc: Eli Zaretskii, morgan, emacs-devel, visuweshm
Tassilo Horn <tsdh@gnu.org> writes:
[...]
>
> -(defface doc-view-svg-face '((t :inherit default))
> +(defface doc-view-svg-face '((t :inherit default
> + :background "white"
> + :foreground "black"))
Since this face is used only for its foreground and background colors, I
think you could leave the :inherit.
--
Manuel Giraud
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 17:56 ` Manuel Giraud via Emacs development discussions.
@ 2024-09-23 18:35 ` Tassilo Horn
2024-09-23 19:06 ` Manuel Giraud via Emacs development discussions.
0 siblings, 1 reply; 33+ messages in thread
From: Tassilo Horn @ 2024-09-23 18:35 UTC (permalink / raw)
To: Manuel Giraud via Emacs development discussions.
Cc: Manuel Giraud, Eli Zaretskii, morgan, visuweshm
Manuel Giraud via "Emacs development discussions." <emacs-devel@gnu.org> writes:
Hi Manuel,
>> -(defface doc-view-svg-face '((t :inherit default))
>> +(defface doc-view-svg-face '((t :inherit default
>> + :background "white"
>> + :foreground "black"))
>
> Since this face is used only for its foreground and background colors,
> I think you could leave the :inherit.
I know. But that makes it slightly easier to turn on styling by theme.
Or, well, having both nil without inheriting has the same effect, but as
you have said, explicit is better. I agree with that, so I kept it on
purpose.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 18:35 ` Tassilo Horn
@ 2024-09-23 19:06 ` Manuel Giraud via Emacs development discussions.
0 siblings, 0 replies; 33+ messages in thread
From: Manuel Giraud via Emacs development discussions. @ 2024-09-23 19:06 UTC (permalink / raw)
To: Tassilo Horn
Cc: Manuel Giraud via Emacs development discussions., Eli Zaretskii,
morgan, visuweshm
Tassilo Horn <tsdh@gnu.org> writes:
> Manuel Giraud via "Emacs development discussions." <emacs-devel@gnu.org> writes:
>
> Hi Manuel,
>
>>> -(defface doc-view-svg-face '((t :inherit default))
>>> +(defface doc-view-svg-face '((t :inherit default
>>> + :background "white"
>>> + :foreground "black"))
>>
>> Since this face is used only for its foreground and background colors,
>> I think you could leave the :inherit.
>
> I know. But that makes it slightly easier to turn on styling by theme.
> Or, well, having both nil without inheriting has the same effect, but as
> you have said, explicit is better. I agree with that, so I kept it on
> purpose.
Ah ok. You're right it is easier to configure via custom. Thanks.
--
Manuel Giraud
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 6:44 ` Tassilo Horn
2024-09-23 8:34 ` Manuel Giraud via Emacs development discussions.
@ 2024-09-23 9:36 ` Visuwesh
2024-09-23 11:55 ` Eli Zaretskii
2 siblings, 0 replies; 33+ messages in thread
From: Visuwesh @ 2024-09-23 9:36 UTC (permalink / raw)
To: Tassilo Horn; +Cc: Morgan Willcock, emacs-devel, Eli Zaretskii
[திங்கள் செப்டம்பர் 23, 2024] Tassilo Horn wrote:
> Morgan Willcock <morgan@ice9.digital> writes:
>
>> When looking at the SVG files in the location browsed by
>> doc-view-dired-cache I can see that the Azure invoice has:
>>
>> - A transparent background with black and grey text on it.
>> - A dark grey border with white text on it.
>> - A white border with black text on it.
>>
>> The transparent background is shown as white or black, depending on
>> whether the light or dark theme is loaded, but the text is always
>> readable because the text colour complements the background.
>>
>> The problem is the text that is not on the transparent area of the
>> document, presumably because a coloured border cannot be identified as
>> being part of the background and so the border colours will never
>> follow the theme.
>>
>> Based on my usage, setting doc-view-mupdf-use-svg to t seems to make
>> reading PDF documents significantly more difficult.
>>
>> Perhaps there should be an option to just assume a white background
>> and render using the original colours, and turn that on by default.
>
> That's what Visuwesh's advice of setting doc-view-svg-face's
> foreground/background to black and white would do. We could do that by
> default instead of inheriting from the default face (which is modified
> by the theme). That would probably give sensible results in most cases.
>
> I've also tried un-inheriting doc-view-svg-face from the default face so
> that it is the empty face, i.e., all its attributes are nil. In that
> case, it looks exactly as if it inherited from the default face, i.e.,
> the document is styled according to the theme with the same problems for
> certain files as you see.
>
> I've also created a PDF with blue background and different text colors.
> In that case, doc-view-svg-face set to "black on wide" doesn't seem to
> have any effect. The foreground/background colors of the document
> appear exactly as I've specified them in the original LaTeX document and
> as the Evince or mupdf PDF viewer show them, too.
>
> Eli, what do you think?
>
>> Would that be what a regular PDF viewer does?
>
> It seems so.
AFAIU, the "dark-mode" PDF viewers offer has a lot that goes into it
especially wrt making images actually viewable. Since we don't do any
such complex handling (nor do we instruct mutool to do it), we present
an unreadable document in this case. I believe it would be best to
default the face to be black-on-white, and let the user customise the
face to match whatever colour they want at their own risk.
> Bye,
> Tassilo
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 6:44 ` Tassilo Horn
2024-09-23 8:34 ` Manuel Giraud via Emacs development discussions.
2024-09-23 9:36 ` Visuwesh
@ 2024-09-23 11:55 ` Eli Zaretskii
2024-09-23 12:05 ` Tassilo Horn
2 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2024-09-23 11:55 UTC (permalink / raw)
To: Tassilo Horn; +Cc: morgan, emacs-devel, visuweshm
> From: Tassilo Horn <tsdh@gnu.org>
> Cc: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>, visuweshm@gmail.com
> Date: Mon, 23 Sep 2024 08:44:35 +0200
>
> Morgan Willcock <morgan@ice9.digital> writes:
>
> > When looking at the SVG files in the location browsed by
> > doc-view-dired-cache I can see that the Azure invoice has:
> >
> > - A transparent background with black and grey text on it.
> > - A dark grey border with white text on it.
> > - A white border with black text on it.
> >
> > The transparent background is shown as white or black, depending on
> > whether the light or dark theme is loaded, but the text is always
> > readable because the text colour complements the background.
> >
> > The problem is the text that is not on the transparent area of the
> > document, presumably because a coloured border cannot be identified as
> > being part of the background and so the border colours will never
> > follow the theme.
> >
> > Based on my usage, setting doc-view-mupdf-use-svg to t seems to make
> > reading PDF documents significantly more difficult.
> >
> > Perhaps there should be an option to just assume a white background
> > and render using the original colours, and turn that on by default.
>
> That's what Visuwesh's advice of setting doc-view-svg-face's
> foreground/background to black and white would do. We could do that by
> default instead of inheriting from the default face (which is modified
> by the theme). That would probably give sensible results in most cases.
>
> I've also tried un-inheriting doc-view-svg-face from the default face so
> that it is the empty face, i.e., all its attributes are nil. In that
> case, it looks exactly as if it inherited from the default face, i.e.,
> the document is styled according to the theme with the same problems for
> certain files as you see.
>
> I've also created a PDF with blue background and different text colors.
> In that case, doc-view-svg-face set to "black on wide" doesn't seem to
> have any effect. The foreground/background colors of the document
> appear exactly as I've specified them in the original LaTeX document and
> as the Evince or mupdf PDF viewer show them, too.
>
> Eli, what do you think?
Sorry, I don't understand what you are asking me about. Please
elaborate
It sounds like PDF documents with colors have inherent problems with
doc-view-mupdf-use-svg and/or themes, so maybe we should warn about
this in NEWS and in the doc string, and suggest that people either
customize the doc-view-svg-face, or disable doc-view-mupdf-use-svg.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 11:55 ` Eli Zaretskii
@ 2024-09-23 12:05 ` Tassilo Horn
2024-09-23 15:32 ` Eli Zaretskii
0 siblings, 1 reply; 33+ messages in thread
From: Tassilo Horn @ 2024-09-23 12:05 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: morgan, emacs-devel, visuweshm, Manuel Giraud
Eli Zaretskii <eliz@gnu.org> writes:
>> Eli, what do you think?
>
> Sorry, I don't understand what you are asking me about. Please
> elaborate
>
> It sounds like PDF documents with colors have inherent problems with
> doc-view-mupdf-use-svg and/or themes, so maybe we should warn about
> this in NEWS and in the doc string, and suggest that people either
> customize the doc-view-svg-face, or disable doc-view-mupdf-use-svg.
Yes, exactly. There can be foreground-similar-to-background color
issues when mupdf + doc-view-mupdf-use-svg is used for certain, not
uncommon documents.
We can either document that issue in NEWS and docstrings, or we can
simply set "black on white" as default value of doc-view-svg-face which
would eliminate those problems (and match what we had in emacs 29 before
the face was introduced by Manuel Giraud) but would stop trying to apply
our emacs theme to the document, too.
I'd rather be conservative, use "black on white" as doc-view-svg-face
default value and document in NEWS and doc-view-svg-face's docstring
that one can style documents according to the emacs theme by inheriting
from the default face and not explicitly setting foreground and
background colors.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: No NEWS entry for doc-view-mupdf-use-svg (Emacs 30.0.91 feedback)
2024-09-23 12:05 ` Tassilo Horn
@ 2024-09-23 15:32 ` Eli Zaretskii
0 siblings, 0 replies; 33+ messages in thread
From: Eli Zaretskii @ 2024-09-23 15:32 UTC (permalink / raw)
To: Tassilo Horn; +Cc: morgan, emacs-devel, visuweshm, manuel
> From: Tassilo Horn <tsdh@gnu.org>
> Cc: morgan@ice9.digital, emacs-devel@gnu.org, visuweshm@gmail.com, Manuel
> Giraud <manuel@ledu-giraud.fr>
> Date: Mon, 23 Sep 2024 14:05:30 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> Eli, what do you think?
> >
> > Sorry, I don't understand what you are asking me about. Please
> > elaborate
> >
> > It sounds like PDF documents with colors have inherent problems with
> > doc-view-mupdf-use-svg and/or themes, so maybe we should warn about
> > this in NEWS and in the doc string, and suggest that people either
> > customize the doc-view-svg-face, or disable doc-view-mupdf-use-svg.
>
> Yes, exactly. There can be foreground-similar-to-background color
> issues when mupdf + doc-view-mupdf-use-svg is used for certain, not
> uncommon documents.
>
> We can either document that issue in NEWS and docstrings, or we can
> simply set "black on white" as default value of doc-view-svg-face which
> would eliminate those problems (and match what we had in emacs 29 before
> the face was introduced by Manuel Giraud) but would stop trying to apply
> our emacs theme to the document, too.
>
> I'd rather be conservative, use "black on white" as doc-view-svg-face
> default value and document in NEWS and doc-view-svg-face's docstring
> that one can style documents according to the emacs theme by inheriting
> from the default face and not explicitly setting foreground and
> background colors.
Agreed.
^ permalink raw reply [flat|nested] 33+ messages in thread