fontconfig dpi issue

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

fontconfig dpi issue

trschell
Hi everyone,

I ran into an issue with font rendering in Lilypond where text characters
are far too large. This issue also affected several other users and is
described here <https://bbs.archlinux.org/viewtopic.php?id=211350>.

It turns out that if the dpi setting is manually set in the fontconfig
fonts.conf file, Lilypond will adopt that dpi setting (rather than the
standard setting used in Lilypond, which is 1200) and render all text too
large.

The desktop environment LXQT sets this to 96 dpi automatically, which is
what triggered the bug for me. This may not a good idea on their part, but
I imagine some users may want to or need to adjust this setting and it
doesn't seem right that this should affect rendering in Lilypond.

To reproduce this bug, edit the following file (or create the file, if it
doesn't exist):
$XDG_CONFIG_HOME/fontconfig/fonts.conf

Paste this as the contents of the file (or just add the <match> block with
the dpi setting):
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <edit name="dpi" mode="assign">
      <double>96</double>
    </edit>
  </match>
</fontconfig>

Next, compile any .ly file that includes text, for example:
\version "2.19.49"
\header {
  title = "Title"
}
\relative c''{
c
}

I also have a proposed patch that fixes the problem described, although I
don't know if this is the proper way to fix it:
--- lilypond-2.19.49.orig/lily/pango-font.cc 2016-10-16 07:16:18.000000000
-0400
+++ lilypond-2.19.49.new/lily/pango-font.cc 2016-10-29 22:39:02.921622080
-0400
@@ -317,7 +317,7 @@
   pango_fc_font_unlock_face (fcfont);
   pango_glyph_string_free (pgs);
   pgs = 0;
-  PangoFontDescription *descr = pango_font_describe (pa->font);
+  PangoFontDescription *descr = pango_context_get_font_description
(context_);
   Real size = pango_font_description_get_size (descr)
               / (Real (PANGO_SCALE));


I also created a minimal Pango example that reproduces the bug here
<http://stackoverflow.com/questions/40325159/why-is-the-font-map-resolution-reset-when-using-fontconfig-2-11-94>.
Thanks!

Tim Schellenberg
_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fontconfig dpi issue

Federico Bruni-2
Hey Tim

It seems that nobody replied to you.
I hope that some font guru (Werner?) can step in and give some feedback.

I'm interested in this problem, because LilyDev recently switched to
LXQT.
In which version of LXQT they changed this setting?
I cannot find it on current debian testing:

root@lilydev:~# grep -i dpi /etc/fonts/fonts.conf
root@lilydev:~#


Il giorno mer 25 gen 2017 alle 23:43, Tim Schellenberg
<[hidden email]> ha scritto:

> Hi everyone,
>
> I ran into an issue with font rendering in Lilypond where text
> characters
> are far too large. This issue also affected several other users and is
> described here <https://bbs.archlinux.org/viewtopic.php?id=211350>.
>
> It turns out that if the dpi setting is manually set in the fontconfig
> fonts.conf file, Lilypond will adopt that dpi setting (rather than the
> standard setting used in Lilypond, which is 1200) and render all text
> too
> large.
>
> The desktop environment LXQT sets this to 96 dpi automatically, which
> is
> what triggered the bug for me. This may not a good idea on their
> part, but
> I imagine some users may want to or need to adjust this setting and it
> doesn't seem right that this should affect rendering in Lilypond.
>
> To reproduce this bug, edit the following file (or create the file,
> if it
> doesn't exist):
> $XDG_CONFIG_HOME/fontconfig/fonts.conf
>
> Paste this as the contents of the file (or just add the <match> block
> with
> the dpi setting):
> <?xml version="1.0"?>
> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
> <fontconfig>
>   <match target="pattern">
>     <edit name="dpi" mode="assign">
>       <double>96</double>
>     </edit>
>   </match>
> </fontconfig>
>
> Next, compile any .ly file that includes text, for example:
> \version "2.19.49"
> \header {
>   title = "Title"
> }
> \relative c''{
> c
> }
>

Yep, if I paste that content in ~/.config/fontconfig/fonts.conf I can
reproduce the problem on my Fedora 25 system.

Before I create an issue on the tracker, some developer should say if
LilyPond or LXQT must be fixed.
I have no idea about it.


> I also have a proposed patch that fixes the problem described,
> although I
> don't know if this is the proper way to fix it:
> --- lilypond-2.19.49.orig/lily/pango-font.cc 2016-10-16
> 07:16:18.000000000
> -0400
> +++ lilypond-2.19.49.new/lily/pango-font.cc 2016-10-29
> 22:39:02.921622080
> -0400
> @@ -317,7 +317,7 @@
>    pango_fc_font_unlock_face (fcfont);
>    pango_glyph_string_free (pgs);
>    pgs = 0;
> -  PangoFontDescription *descr = pango_font_describe (pa->font);
> +  PangoFontDescription *descr = pango_context_get_font_description
> (context_);
>    Real size = pango_font_description_get_size (descr)
>                / (Real (PANGO_SCALE));
>
>
> I also created a minimal Pango example that reproduces the bug here
> <http://stackoverflow.com/questions/40325159/why-is-the-font-map-resolution-reset-when-using-fontconfig-2-11-94>.
> Thanks!
>
> Tim Schellenberg
> _______________________________________________
> bug-lilypond mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/bug-lilypond


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fontconfig dpi issue

Werner LEMBERG

> I hope that some font guru (Werner?) can step in and give some
> feedback.

I've seen this a few days ago but no time to reply, sorry.

>> I ran into an issue with font rendering in Lilypond where text
>> characters are far too large. This issue also affected several
>> other users and is described here
>> <https://bbs.archlinux.org/viewtopic.php?id=211350>.  It turns out
>> that if the dpi setting is manually set in the fontconfig
>> fonts.conf file, Lilypond will adopt that dpi setting (rather than
>> the standard setting used in Lilypond, which is 1200) and render
>> all text too large.
>
> Before I create an issue on the tracker, some developer should say
> if LilyPond or LXQT must be fixed.  I have no idea about it.

I think it's a lilypond bug, since setting a DPI value is for stuff
that goes to the screen and/or a selected printer, but lilypond should
produce stuff that does not depend on the DPI.

>> I also have a proposed patch that fixes the problem described,
>> although I don't know if this is the proper way to fix it: [...]

Me neither, unfortunately, since I have never worked with Pango.
However, your patch looks reasonable.

>> I also created a minimal Pango example that reproduces the bug here
>> <http://stackoverflow.com/questions/40325159/why-is-the-font-map-resolution-reset-when-using-fontconfig-2-11-94>.

Have you already reported the problem to the fontconfig people?  Maybe
they can give more advice.


    Werner

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: fontconfig dpi issue

Federico Bruni-2
Eventually I've added an issue to the tracker:
https://sourceforge.net/p/testlilyissues/issues/5136/


Il giorno gio 23 feb 2017 alle 7:11, Werner LEMBERG <[hidden email]> ha
scritto:

>
>>  I hope that some font guru (Werner?) can step in and give some
>>  feedback.
>
> I've seen this a few days ago but no time to reply, sorry.
>
>>>  I ran into an issue with font rendering in Lilypond where text
>>>  characters are far too large. This issue also affected several
>>>  other users and is described here
>>>  <https://bbs.archlinux.org/viewtopic.php?id=211350>.  It turns out
>>>  that if the dpi setting is manually set in the fontconfig
>>>  fonts.conf file, Lilypond will adopt that dpi setting (rather than
>>>  the standard setting used in Lilypond, which is 1200) and render
>>>  all text too large.
>>
>>  Before I create an issue on the tracker, some developer should say
>>  if LilyPond or LXQT must be fixed.  I have no idea about it.
>
> I think it's a lilypond bug, since setting a DPI value is for stuff
> that goes to the screen and/or a selected printer, but lilypond should
> produce stuff that does not depend on the DPI.
>
>>>  I also have a proposed patch that fixes the problem described,
>>>  although I don't know if this is the proper way to fix it: [...]
>
> Me neither, unfortunately, since I have never worked with Pango.
> However, your patch looks reasonable.
>
>>>  I also created a minimal Pango example that reproduces the bug here
>>>  
>>> <http://stackoverflow.com/questions/40325159/why-is-the-font-map-resolution-reset-when-using-fontconfig-2-11-94>.
>
> Have you already reported the problem to the fontconfig people?  Maybe
> they can give more advice.
>
>
>     Werner


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Loading...