Bug#299697: fontconfig: Still unresolved

2006-05-03 Thread Ian Jackson
Ian Jackson writes (Re: Bug#299697: fontconfig: Still unresolved):
 But yes, if you don't use pango for everything then you have to find
 the places in Mozilla where it uses fontconfig and change those too,
 to pass the new flag.  I haven't done that at this stage because it
 wasn't relevant to the configuration in Ubuntu.

It has so turned out that we (Ubuntu) have just changed our firefox
setup to sometimes not use pango, so we have had to make those changes
to firefox.

We've also discovered that the usual way to call fontconfig when you
want to present to the user a list of fonts is to supply a fairly
minimal pattern and call FcFontList or the like; which doesn't work
with anymetrics=1 because the pattern never matches.

Personally I think this is a design error in the FC API:
configuration-directing attributes like anymetrics should be removed
during canonicalisation which ought to completely solve that, but this
wouldn't work at present because applications generally don't do
canonicalisation between pattern creation and font enumeration.

Indeed, I found a couple of places in pango where a pattern was
constructed and FcFontMatch was called without invoking the
canonicalisation and configuration processing.

It seems to me that the canonicalisation and config processing, which
are supposed to be performed by all fontconfig-using programs, should
be done automatically the first time a pattern is used, whether for
enumeration or finding a particular font.  This would eliminate
mistakes of this kind (and make application code smaller and more
straightforward).  fontconfig would have to maintain a copy of the
original pattern in case the application modified it or had other
unusual flows (or at least, it would have to mark the pattern as
`canonicalised' and refuse to further edit it).

So, currently the correct behaviour for a non-metrics-sensitive
program is to set anymetrics=1 iff it is looking for a particular
font, and not to set it iff the pattern is to be used for
enumeration.  This is not quite correct and might lead to misbehaviour
in the future, but the behaviour is correct in the current
configuration.

The revised patch to pango, and the patch to firefox that I mentioned
earlier, are attached.

Thanks,
Ian.

diff -u pango1.0-1.12.1/debian/control pango1.0-1.12.1/debian/control
--- pango1.0-1.12.1/debian/control
+++ pango1.0-1.12.1/debian/control
@@ -2,7 +2,7 @@
 Section: libs
 Priority: optional
 Maintainer: Sebastien Bacher [EMAIL PROTECTED]
-Uploaders: Debian GNOME Maintainers [EMAIL PROTECTED], Akira TAGOH [EMAIL 
PROTECTED], Andreas Rottmann [EMAIL PROTECTED], Andrew Lau [EMAIL 
PROTECTED], Carlos Perelló Marín [EMAIL PROTECTED], Clément Stenac 
[EMAIL PROTECTED], Ed Boraas [EMAIL PROTECTED], Edd Dumbill [EMAIL 
PROTECTED], Emil Soleyman-Zomalan [EMAIL PROTECTED], Guilherme de S. Pastore 
[EMAIL PROTECTED], Gustavo Noronha Silva [EMAIL PROTECTED], J.H.M. Dassen 
(Ray) [EMAIL PROTECTED], Joe Drew [EMAIL PROTECTED], Johannes Rohr [EMAIL 
PROTECTED], Jordi Mallach [EMAIL PROTECTED], Jose Carlos Garcia Sogo [EMAIL 
PROTECTED], Josselin Mouette [EMAIL PROTECTED], Loic Minier [EMAIL 
PROTECTED], Marc HE Brockschmidt [EMAIL PROTECTED], Ondřej Surý [EMAIL 
PROTECTED], Rob Bradford [EMAIL PROTECTED], Robert McQueen [EMAIL 
PROTECTED], Ross Burton [EMAIL PROTECTED], Sjoerd Simons [EMAIL 
PROTECTED], Takuo KITAME [EMAIL PROTECTED]
+Uploaders: Debian GNOME Maintainers [EMAIL PROTECTED], Akira TAGOH [EMAIL 
PROTECTED], Andreas Rottmann [EMAIL PROTECTED], Andrew Lau [EMAIL 
PROTECTED], Carlos Perelló Marín [EMAIL PROTECTED], Ed Boraas [EMAIL 
PROTECTED], Edd Dumbill [EMAIL PROTECTED], Emil Soleyman-Zomalan [EMAIL 
PROTECTED], Gustavo Noronha Silva [EMAIL PROTECTED], J.H.M. Dassen (Ray) 
[EMAIL PROTECTED], Joe Drew [EMAIL PROTECTED], Johannes Rohr [EMAIL 
PROTECTED], Jordi Mallach [EMAIL PROTECTED], Jose Carlos Garcia Sogo [EMAIL 
PROTECTED], Josselin Mouette [EMAIL PROTECTED], Marc HE Brockschmidt [EMAIL 
PROTECTED], Ondřej Surý [EMAIL PROTECTED], Rob Bradford [EMAIL 
PROTECTED], Robert McQueen [EMAIL PROTECTED], Ross Burton [EMAIL 
PROTECTED], Sjoerd Simons [EMAIL PROTECTED], Takuo KITAME [EMAIL PROTECTED]
 Build-Depends: debhelper (= 4.9.12), libfreetype6-dev (= 2.1.7), libx11-dev, 
libxrender-dev, libxt-dev, libglib2.0-dev (= 2.10.0), pkg-config, defoma (= 
0.11.1), libxft-dev, libfontconfig1-dev (= 2.1.91), autotools-dev, po-debconf, 
gnome-pkg-tools, libcairo2-dev (= 1.0.0)
 Standards-Version: 3.6.2
 
diff -u pango1.0-1.12.1/debian/changelog pango1.0-1.12.1/debian/changelog
--- pango1.0-1.12.1/debian/changelog
+++ pango1.0-1.12.1/debian/changelog
@@ -1,3 +1,27 @@
+pango1.0 (1.12.1-1ubuntu4) dapper; urgency=low
+
+  * Do not use FC_ANY_METRICS while listing, because that's a property
+that is never matched exactly and so only valid when matching.
+
+ -- Ian Jackson [EMAIL PROTECTED]  Tue, 25 Apr 2006 19:01:59 +0100
+
+pango1.0 (1.12.1-1ubuntu3) dapper; urgency=low
+
+  * Correct

Bug#299697: fontconfig: Still unresolved

2006-04-24 Thread Ian Jackson
Indeed, as Steve Pomeroy says, the problem is that websites specifying
`Times' (say) get Nimbus rather than DejaVu (or whatever the default
is in Debian).

Fixing this is complicated because, as Keith Packard says, Nimbus is
needed for (for example) PDF viewing, because DejaVu has different
metrics.  The real problem is that the fontconfig configuration can't
tell whether we're (i) a web browser, which doesn't really care much
about the metrics but definitely wants a font that looks good on
screen or (ii) a PDF handling program (or similar), which must use
fonts with exactly the metrics of the requested font.

Without a way to distinguish these cases, it is impossible to (as
Keith says) `work out [the] rules for when each family should be used
and try to make that happen'.

After staring at the various packages involved, I concluded that the
right answer was: a new font template property `anymetrics' which
would be set by applications which would not mind fonts with different
metrics to that specified in the pattern.  Doing it that way round
means that the stricter behaviour is the default, so that we will err
on the side of ugliness rather than brokenness.

In Ubuntu we configure firefox to use pango for all of its text
rendering (for i18n charset reasons).  And as it turns out, I think
applications that use pango (such as firefox) always leave the
specific text sizing and placement to pango, and pango uses the actual
metrics from the actual font.  So the correct place to set the
anymetrics fontconfig flag is in pango, and firefox does not need to
be changed.

I could be wrong about pango clients but it seems likely that this is
true for the majority at least.  If it's not true for all - if, for
example, pango even provides an interface that could be used by a
program which needs to use specific fonts and do its own text
placement - then an option could be added to pango's font selection
machinery to turn anymetrics off.  It seems to me from what little I
know abouit this situation that this is the right way round for the
default at this layer.

Finally, this provides us with the tools to selectively disable the
font alias... directives for the relatively ugly Nimbus fonts when
we know that we don't care about the metrics so that DejaVu fallback
is good.  Sadly alias... can only be made conditional by turning
it into match... which is much more verbose.  An if... construct
would have been very useful.

Attached:

* Patch to fontconfig (against 2.3.2-1.1ubuntu9) to
  - provide a new FC_ANY_METRICS (aka `anymetrics') boolean property.
  - only use Nimbus for Times et al if anymetrics is not set.

* Patch to pango (against pango1.0 1.12.1-1ubuntu1) to set
  FC_ANY_METRICS (aka `anymetrics') to FcTrue everywhere a fontconfig
  font pattern is constructed.  Note that the versioned
  build-dependency on libfontconfig1-dev may need adjusting for Debian.

Regards,
Ian.

diff -ruN --exclude '*~' orig/fontconfig-2.3.2/debian/changelog 
fontconfig-2.3.2/debian/changelog
--- orig/fontconfig-2.3.2/debian/changelog  2006-04-19 14:31:45.0 
+0100
+++ fontconfig-2.3.2/debian/changelog   2006-04-19 14:37:51.0 +0100
@@ -1,3 +1,15 @@
+fontconfig (2.3.2-1.1ubuntu10) dapper; urgency=low
+
+  * Correctly fix the (eg) firefox vs. (eg) evince font metrics
+problem:
+- New FC_ANY_METRICS property, boolean.
+- Revert change from 2.3.2-1.1ubuntu9 and instead:
+- Change URW Nimbus font aliases in fonts.conf.in into equivalent
+  match directives so that we can add an additional test which
+  disables them when the anymetrics property is true.
+
+ -- Ian Jackson [EMAIL PROTECTED]  Wed, 19 Apr 2006 12:51:29 +0100
+
 fontconfig (2.3.2-1.1ubuntu9) dapper; urgency=low
 
   * Until firefox and thunderbird can be tought to use it's own
diff -ruN --exclude '*~' 
orig/fontconfig-2.3.2/debian/patches/05_no_nimbus_fallback.patch 
fontconfig-2.3.2/debian/patches/05_no_nimbus_fallback.patch
--- orig/fontconfig-2.3.2/debian/patches/05_no_nimbus_fallback.patch
2006-04-19 14:31:45.0 +0100
+++ fontconfig-2.3.2/debian/patches/05_no_nimbus_fallback.patch 1970-01-01 
01:00:00.0 +0100
@@ -1,23 +0,0 @@
 fonts.conf.in~ 2006-04-18 16:06:59.203112376 +
-+++ fonts.conf.in  2006-04-18 16:11:52.197570448 +
-@@ -147,6 +147,12 @@
- !--
-   URW provides metric and shape compatible fonts for these 3 Adobe families.
-   --
-+!--
-+  Disable the usage of metric and shape compatible fonts for the
-+  3 Adobe families. evince cannot display documents correctly
-+  with these replacements not beeing available, but web browsers not
-+  using these fonts look definitely nicer.
-+
- alias
- familyTimes/family
- acceptfamilyNimbus Roman No9 L/family/accept
-@@ -159,6 +165,7 @@
- familyCourier/family
- acceptfamilyNimbus Mono L/family/accept
-   /alias
-+  --
- 
- !--
-  AMT provides metric and shape compatible fonts for these three web font
diff 

Bug#299697: fontconfig: Still unresolved

2006-04-24 Thread Ian Jackson
Josselin Mouette writes (Re: Bug#299697: fontconfig: Still unresolved):
 Le lundi 24 avril 2006 à 12:35 +0100, Ian Jackson a écrit :
  Indeed, as Steve Pomeroy says, the problem is that websites specifying
  `Times' (say) get Nimbus rather than DejaVu (or whatever the default
  is in Debian).
 
 Again, this is caused by a rewrite of sans into Helvetica and
 sans-serif into Times in Mozilla. This bug has been fixed in
 xulrunner and can easily be fixed in firefox as well.

This may be true and will cause the problem to manifest on most
websites rather than just on ones that ask for `Times' or `Helvetica'
explicity.  However, even if we fix Mozilla then we'll still have
problems with those latter sites.

  In Ubuntu we configure firefox to use pango for all of its text
  rendering (for i18n charset reasons).  And as it turns out, I think
  applications that use pango (such as firefox) always leave the
  specific text sizing and placement to pango, and pango uses the actual
  metrics from the actual font.  So the correct place to set the
  anymetrics fontconfig flag is in pango, and firefox does not need to
  be changed.
 
 Epiphany disables pango, apart for some languages for which it is
 necessary to use it. So this method wouldn't be enough for epiphany;
 that would mean dealing with Mozilla's internals to add the same hack.

This is not a hack, and I resent you describing it that way.

It's the correct solution; we add the missing piece of information to
the interface.  Or do you disagree with some part of my rationale ?
If so, please come out and explain !

But yes, if you don't use pango for everything then you have to find
the places in Mozilla where it uses fontconfig and change those too,
to pass the new flag.  I haven't done that at this stage because it
wasn't relevant to the configuration in Ubuntu.

Alternatively you might say that the default is wrong, and that
instead we should edit the programs that have (or whose documents
have) a specific idea of what the metrics are going to be.

Thanks,
Ian.



Bug#299697: fontconfig: Still unresolved

2006-04-24 Thread Josselin Mouette
Le lundi 24 avril 2006 à 12:35 +0100, Ian Jackson a écrit :
 Indeed, as Steve Pomeroy says, the problem is that websites specifying
 `Times' (say) get Nimbus rather than DejaVu (or whatever the default
 is in Debian).

Again, this is caused by a rewrite of sans into Helvetica and
sans-serif into Times in Mozilla. This bug has been fixed in
xulrunner and can easily be fixed in firefox as well.

 In Ubuntu we configure firefox to use pango for all of its text
 rendering (for i18n charset reasons).  And as it turns out, I think
 applications that use pango (such as firefox) always leave the
 specific text sizing and placement to pango, and pango uses the actual
 metrics from the actual font.  So the correct place to set the
 anymetrics fontconfig flag is in pango, and firefox does not need to
 be changed.

Epiphany disables pango, apart for some languages for which it is
necessary to use it. So this method wouldn't be enough for epiphany;
that would mean dealing with Mozilla's internals to add the same hack.
-- 
 .''`.   Josselin Mouette/\./\
: :' :   [EMAIL PROTECTED]
`. `'[EMAIL PROTECTED]
   `-  Debian GNU/Linux -- The power of freedom




Bug#299697: fontconfig: Still unresolved

2006-04-21 Thread Josselin Mouette
Le jeudi 20 avril 2006 à 19:41 -0400, Steve Pomeroy a écrit :
 Package: fontconfig
 Version: 2.3.2-5.1
 Followup-For: Bug #299697
 
 
 fontconfig just updated my /etc/fonts/font.conf file, reminding
 me that this bug is still unresolved.
 
 Does anyone have any further info on this issue? 

There are lots of things in this bug report, so I'd like to make them
clear.

Most contributors to this thread noticed that the URW fonts had replaced
the Bitstream fonts in Firefox/epiphany. This is caused by the Mozilla
suite replacing the sans-serif and serif aliases by Helvetica and
Times. We will not include a broken patch from Ubuntu for fontconfig
when the bug is in Mozilla; it has been fixed in xulrunner 1.8.0.1-3. I
don't know whether it has been fixed in firefox as well, but it is only
a matter of porting the same patch.

I'd like to know whether the original bug report (ugly fonts at small
sizes) is the same. You can check the latest epiphany package, in which
I'm sure the DejaVu fonts are correctly used by default. You can also
try with removing the gsfonts-x11 package.

Regards,
-- 
 .''`.   Josselin Mouette/\./\
: :' :   [EMAIL PROTECTED]
`. `'[EMAIL PROTECTED]
   `-  Debian GNU/Linux -- The power of freedom




Bug#299697: fontconfig: Still unresolved

2006-04-21 Thread Steve Pomeroy
On Fri, Apr 21, 2006 at 09:24:50AM +0200, Josselin Mouette wrote:
 Le jeudi 20 avril 2006 à 19:41 -0400, Steve Pomeroy a écrit :
  Package: fontconfig
  Version: 2.3.2-5.1
  Followup-For: Bug #299697
  
  
  fontconfig just updated my /etc/fonts/font.conf file, reminding
  me that this bug is still unresolved.
  
  Does anyone have any further info on this issue? 
 
 There are lots of things in this bug report, so I'd like to make them
 clear.
 
 Most contributors to this thread noticed that the URW fonts had replaced
 the Bitstream fonts in Firefox/epiphany. This is caused by the Mozilla
 suite replacing the sans-serif and serif aliases by Helvetica and
 Times. We will not include a broken patch from Ubuntu for fontconfig
 when the bug is in Mozilla; it has been fixed in xulrunner 1.8.0.1-3. I
 don't know whether it has been fixed in firefox as well, but it is only
 a matter of porting the same patch.

Perhaps I'm mistaken, but the problem wasn't the default font for
Firefox, etc. but that websites would specify Helvetica and Times in
their CSS, which would then use the Nimbus fonts. That's certainly the
case for myself, anyhow. (My Firefox default has always been the 
generic 'sans', etc.)

Keith: I think your suggestions are much more sane than the current
default. I've been simply putting a ban on the Nimbus family, but I
imagine others are not so keen on that ;-)

Perhaps this is really a bug report for the Nimbus fonts themselves? I
mean, I can understand why a metric and shape compatible font is such
a good thing, but why does it have to render poorly in certain contexts?
In fact, what contexts *do* the render well?

 I'd like to know whether the original bug report (ugly fonts at small
 sizes) is the same. You can check the latest epiphany package, in which
 I'm sure the DejaVu fonts are correctly used by default. You can also
 try with removing the gsfonts-x11 package.

DejaVu has been recently rendering poorly as well, so I don't think that
helps much. But that's for another bug report ;-)

 Regards,
 -- 
  .''`.   Josselin Mouette/\./\
 : :' :   [EMAIL PROTECTED]
 `. `'[EMAIL PROTECTED]
`-  Debian GNU/Linux -- The power of freedom
 
 

-- 
Steve Pomeroy
http://staticfree.info/



Bug#299697: fontconfig: Still unresolved

2006-04-20 Thread Steve Pomeroy
Package: fontconfig
Version: 2.3.2-5.1
Followup-For: Bug #299697


fontconfig just updated my /etc/fonts/font.conf file, reminding
me that this bug is still unresolved.

Does anyone have any further info on this issue? 

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (700, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages fontconfig depends on:
ii  defoma0.11.8-0.1 Debian Font Manager -- automatic f
ii  fontconfig-config 2.3.2-5.1  generic font configuration library
ii  libc6 2.3.6-7GNU C Library: Shared libraries
ii  libfontconfig12.3.2-5.1  generic font configuration library

fontconfig recommends no packages.

-- debconf information:
  fontconfig/subpixel_rendering: Automatic
  fontconfig/enable_bitmaps: false
  fontconfig/hinting_type: Native


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]