You are not logged in.

#1 2016-04-14 15:47:23

pbrenna
Member
Registered: 2015-11-14
Posts: 11

Lilypond misbehaves with updated pango and fontconfig

On an up-to-date Arch machine, lilypond font rendering is messy; in particular letters and numbers are far too big;
this seems to happen with any lilypond file, for example:

\version "2.18.0"
\header {
  title = "Title"
}
\relative c''{
	c
}

generates this output:
http://imgur.com/kPGcKEjl.png

Instead of the correct one:
http://imgur.com/AAUD0fQl.png

This behavior seems to be caused by recent updates to pango (current 1.40.1-1) or fontconfig (current 2.11.95-1);
downgrading to pango 1.39.0-1 and fontconfig 2.11.1-2 restores the correct behavior.
I am posting this partly to help anyone having the same problem, and partly to know if I am doing anything wrong

Last edited by pbrenna (2016-04-14 15:50:18)

Offline

#2 2016-04-15 14:28:08

creatid
Member
From: Netherlands
Registered: 2009-12-19
Posts: 75
Website

Re: Lilypond misbehaves with updated pango and fontconfig

I just updated my installation and I do not have those issues with LilyPond. When I compiled a decent size score and compared it to the PDF generated before the update, they look exactly the same.

That said, my fonts in Firefox do look different (larger) and zathura has black bars at the top and bottom of the viewport now which weren't there before.

Offline

#3 2016-05-13 15:04:46

ArchChem
Member
Registered: 2013-02-16
Posts: 23

Re: Lilypond misbehaves with updated pango and fontconfig

I have the same problem here. Downgrading fixes it but is there really no other solution?

Offline

#4 2016-06-19 21:59:15

trschell
Member
Registered: 2016-06-19
Posts: 2

Re: Lilypond misbehaves with updated pango and fontconfig

I think the problem lies with fontconfig, since everything is fine pango 1.39-0.1 and fontconfig 2.11.1-2 but fails when I upgrade fontconfig to 2.11.94-1 or later while keeping pango at the same version.

The problem persists with the latest fontconfig 2.12.0-1.

Offline

#5 2016-06-30 11:10:48

ArchChem
Member
Registered: 2013-02-16
Posts: 23

Re: Lilypond misbehaves with updated pango and fontconfig

Is there a possibility fixing that while using an other font?

Offline

#6 2016-10-30 03:44:59

trschell
Member
Registered: 2016-06-19
Posts: 2

Re: Lilypond misbehaves with updated pango and fontconfig

Whew, I have finally found a fix. It appears that somewhere in the interaction between pango and fontconfig, the font map resolution, which Lilypond sets to 1200 dpi gets reset to 96 dpi, which causes the font size value that is output to Postscript to be 1200/96 = 12.5 times too large. If I get the font description from the pango context instead, it seems to work fine again. Here's the patch:

--- 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));

To apply this, follow these steps:
1. Copy/paste the above patch into a file, for example

lilyfontsize.patch

2. Install lilypond-devel from the AUR:
2.1. Modify your PKGBUILD to insert the following line (with the appropriate path):

patch -Np1 < /path/to/patchfile/lilyfontsize.patch

It needs to be inserted right after the line with the other patch (no_fontforge-versioncheck.patch).

Let me know if it works for you!

Offline

#7 2016-11-05 11:34:24

ArchChem
Member
Registered: 2013-02-16
Posts: 23

Re: Lilypond misbehaves with updated pango and fontconfig

Hi and thank you very much for your patch for I haven't found a solution till now.
Unfortunately the patch does not work raising a build error.

==> Beginne prepare()...
patching file configure.ac
Hunk #1 succeeded at 182 (offset -4 lines).
patching file lily/pango-font.cc
patch: **** malformed patch at line 11: (context_)

All the other lilypond-Users do not have that problem?

Edit: I made a copy and paste mistake, the patch works now. I will suggest adding it to the default lillypond-Package.

Last edited by ArchChem (2016-11-05 12:07:18)

Offline

#8 2016-12-30 13:43:05

pbrenna
Member
Registered: 2015-11-14
Posts: 11

Re: Lilypond misbehaves with updated pango and fontconfig

Since this happened to me again, I wanted to share my solution.
Turns out that i had the file

~/.config/fontconfig/fonts.conf

which was apparently generated by lxqt-config-appearance; its content was

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- created by lxqt-config-appearance (DO NOT EDIT!) -->
<fontconfig>
  <include ignore_missing="yes">conf.d</include>
  <match target="font">
    <edit name="antialias" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
  <match target="font">
    <edit name="rgba" mode="assign">
      <const>rgb</const>
    </edit>
  </match>
  <match target="font">
    <edit name="lcdfilter" mode="assign">
      <const>lcddefault</const>
    </edit>
  </match>
  <match target="font">
    <edit name="hinting" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
  <match target="font">
    <edit name="hintstyle" mode="assign">
      <const>hintfull</const>
    </edit>
  </match>
  <match target="font">
    <edit name="autohint" mode="assign">
      <bool>false</bool>
    </edit>
  </match>
  <match target="pattern">
    <edit name="dpi" mode="assign">
      <double>96</double>
    </edit>
  </match>
</fontconfig>

Removing this file is a temporary solution for me (i only ever used lxqt once).

Offline

#9 2017-01-02 13:23:43

ArchChem
Member
Registered: 2013-02-16
Posts: 23

Re: Lilypond misbehaves with updated pango and fontconfig

This works for me, too. So the problem seems to be a conflict with the LXQT font configuration as I understand it right.

Offline

#10 2021-02-08 17:38:55

stefano
Member
Registered: 2011-04-09
Posts: 258

Re: Lilypond misbehaves with updated pango and fontconfig

I'm having exactly the same problem, with lilypond now at version 2.22.

I'm trying to use the patch pbrenna provided but I'm having no luck, most likely because I am not adding the patch instruction in the right place:

$ makepkg -si
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- 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
--------------------------
File to patch: 

Can someone tell me where in the PKGBUILD file for lilypond-git should the patch instruction be added? Here is the complete file:

# Contributor: Patrick McCarty <pnorcks at gmail dot com>
# Maintainer: Stefan Husmann <stefan-husmann@t-online.de>
# if you switch from freetype2 from [extra] to freetype2-infinality-ultimate,
# delete the $srcdir directory before building

pkgname=lilypond-git
pkgver=2.23b30044.1f4a63794d
pkgrel=1
pkgdesc="An automated music engraving system (Git snapshot)"
arch=('i686' 'x86_64')
url="http://lilypond.org/"
license=('GPL')
depends=('guile'
	 'pango'
	 'fontconfig'
	 'freetype2'
	 'python-lxml')
makedepends=('fontforge'
	     'git'
	     'gsfonts'
	     't1utils'
	     'dblatex'
	     'tex-gyre-fonts'
	     'texlive-langcyrillic'
	     'texi2html'
	     'netpbm')
optdepends=('extractpdfmark: for reducing the size of pdf output significantly'
	    'tidy: same for HTML files'
	    'tk: for the gui')
provides=('lilypond')
conflicts=('lilypond')
source=(git://git.savannah.gnu.org/lilypond.git)
md5sums=('SKIP')
options=('!makeflags')



pkgver() {
  cd lilypond/
  printf %s.%sb%s.%s $(grep MAJOR VERSION | cut -d= -f2) \
	 $(grep MINOR VERSION | cut -d= -f2) $(git rev-list --count HEAD) \
	 "$(git rev-parse --short HEAD)"
}


build() {
  cd lilypond/
  [[ -f config.hh ]] && rm config.hh
  ./autogen.sh --noconfigure
  [[ -d build ]] || mkdir build
  cd build
  ../configure --prefix=/usr \
      --disable-documentation
  make -j1 
}

package() {
  cd lilypond/build
  make DESTDIR="$pkgdir/" vimdir="/usr/share/vim/vimfiles" install
  rm -rf "$pkgdir"/usr/share/man
}

Last edited by stefano (2021-02-08 17:42:58)

Offline

#11 2021-02-08 18:24:08

pbrenna
Member
Registered: 2015-11-14
Posts: 11

Re: Lilypond misbehaves with updated pango and fontconfig

Hi stefano,

stefano wrote:

I'm having exactly the same problem, with lilypond now at version 2.22.

I'm trying to use the patch pbrenna provided but I'm having no luck, most likely because I am not adding the patch instruction in the right place:

the patch provided by trschell may need adjusting for 2.22; as a workaround have you tried editing/deleting your fontconfig settings, while using the lilypond package in the repos?
you could also try using lilypond from a new, empty user profile (ideally without a desktop manager) and see if the problem still happens.

Offline

#12 2021-02-08 19:04:03

stefano
Member
Registered: 2011-04-09
Posts: 258

Re: Lilypond misbehaves with updated pango and fontconfig

pbrenna wrote:

Hi stefano,

stefano wrote:

I'm having exactly the same problem, with lilypond now at version 2.22.

I'm trying to use the patch pbrenna provided but I'm having no luck, most likely because I am not adding the patch instruction in the right place:

the patch provided by trschell may need adjusting for 2.22; as a workaround have you tried editing/deleting your fontconfig settings, while using the lilypond package in the repos?
you could also try using lilypond from a new, empty user profile (ideally without a desktop manager) and see if the problem still happens.


Deleting (moving out, actually) the fontconfig settings file with the standard lilypond package was my first attempted solution, but it did not work. I'll try a new user profile next.

Offline

#13 2021-02-08 19:06:25

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: Lilypond misbehaves with updated pango and fontconfig

Instead of patching lilypond or completely removing the dpi settings from fontconfig, it should also be possible to fix the dpi issue by adding the following as /etc/fonts/local.conf

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="pattern">
                <test name="prgname" mode="eq">
                        <string>lilypond</string>
                </test>
		<edit name="dpi" mode="assign">
			<double>1200</double>
                </edit>
     </match>
</fontconfig>

Last edited by progandy (2021-02-08 19:07:52)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB