Bug 6769 - Small caps not detected properly
Summary: Small caps not detected properly
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2_1
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Keith Packard
QA Contact:
Depends on:
Blocks: 8100
  Show dependency treegraph
Reported: 2006-04-28 04:06 UTC by Wouter Bolsterlee
Modified: 2006-09-03 09:17 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

gtk font chooser showing wrong Delicious (20.22 KB, image/png)
2006-04-28 17:31 UTC, Wouter Bolsterlee

Description Wouter Bolsterlee 2006-04-28 04:06:16 UTC
The SmallCaps variant of the Delicious font does not show up in the GTK+ Font
selection dialog (the regular version is shown), although
"Delicious-SmallCaps.otf" really contains the correct glyphs.

The font I'm talking about is available free of charge at:
Comment 1 Patrick Lam 2006-04-28 14:35:42 UTC
On my system, it shows up as 'Delicious SmallCaps' (a separate font).  Is that
what you get?
Comment 2 Wouter Bolsterlee 2006-04-28 17:22:51 UTC
Hmm, strange. I can't reproduce anymore. However, I'm pretty sure I saw this
happening yesterday (just after installing the fonts; I just copied them over to
~/.fonts/ and did not run fc-cache). I wouldn't have taken the time to file bug
if I wasn't absolutely sure ;-)

Leaving this open for a while. I'll comment if I see the problem again. Thanks
for looking into it.
Comment 3 Patrick Lam 2006-04-28 17:25:24 UTC
I didn't run fc-cache either.  If you see the bug again, try to see if it shows
up in fc-list.

Oh, I probably ran fc-list first, which will update the .fonts.cache-2 file in
my home directory.  Try removing cache files and seeing if you get the bug.
Comment 4 Wouter Bolsterlee 2006-04-28 17:30:32 UTC
Removing the font caches didn't have any effect.

This is is pretty strange though:
elin:~ > fc-match "Delicious"
Delicious-Heavy.otf: "Delicious" "Heavy"
elin:~ > fc-match "Delicious Regular"
MyriadWebPro.ttf: "Myriad Web Pro" "Regular"
elin:~ > fc-match "Delicious Roman"
MyriadWebPro.ttf: "Myriad Web Pro" "Regular"
Comment 5 Wouter Bolsterlee 2006-04-28 17:31:55 UTC
Created attachment 5514 [details]
gtk font chooser showing wrong Delicious

Look at this shot: 2 "Regular styles" show up and neither Roman nor Regular
show the correct font (while the fontilus preview of the .otf file does).
Comment 6 Wouter Bolsterlee 2006-04-28 17:33:29 UTC
fc-list |grep Delicious
Delicious SmallCaps,Delicious:style=Regular,SmallCaps
Delicious Heavy,Delicious:style=Regular,Heavy
Comment 7 Wouter Bolsterlee 2006-04-28 17:37:39 UTC
As requested on IRC:

fc-list : file family |grep -i Delicious
/home/uws/.fonts/Jos Buivenga/Delicious-Bold.otf: Delicious
/home/uws/.fonts/Jos Buivenga/Delicious-Roman.otf: Delicious
/home/uws/.fonts/Jos Buivenga/Delicious-Heavy.otf: Delicious Heavy,Delicious
/home/uws/.fonts/Jos Buivenga/Delicious-Italic.otf: Delicious
/home/uws/.fonts/Jos Buivenga/Delicious-BoldItalic.otf: Delicious
/home/uws/.fonts/Jos Buivenga/Delicious-SmallCaps.otf: Delicious SmallCaps,Delicious
Comment 8 Wouter Bolsterlee 2006-04-28 17:40:39 UTC
fc-list : file family style |grep -i Delicious
/home/uws/.fonts/Jos Buivenga/Delicious-Italic.otf: Delicious:style=Italic
/home/uws/.fonts/Jos Buivenga/Delicious-Heavy.otf: Delicious
/home/uws/.fonts/Jos Buivenga/Delicious-BoldItalic.otf: Delicious:style=BoldItalic
/home/uws/.fonts/Jos Buivenga/Delicious-Bold.otf: Delicious:style=Bold
/home/uws/.fonts/Jos Buivenga/Delicious-Roman.otf: Delicious:style=Roman
/home/uws/.fonts/Jos Buivenga/Delicious-SmallCaps.otf: Delicious
Comment 9 Keith Packard 2006-09-01 11:43:11 UTC
I see the SmallCaps and Heavy variants as separate fonts, but they both include
two family names and two style names. The first family name has the style
included (Delicious SmallCaps) while the first style name is Regular. The second
family name is generic (Delicious) while the second style name indicates the
variant (SmallCaps). I'm not sure how to resolve this; most fonts don't have an
implicit ordering dependency between the family and style names.
Comment 10 Wouter Bolsterlee 2006-09-02 12:11:07 UTC
Fwiw, my current fontconfig/gtk+ HEAD build shows me:

- Delicious
  - Roman   *
  - Regular *
  - Regular *
  - Italic
  - Bold
- Delicious Heavy
  - Regular *
- Delicious SmallCaps
  - Regular

The font names marked with a * all show the exact same preview, which is the
"Delicious Heavy Regular" font (which is slightly bolder than the "Delicious
Bold" variant). It's impossible to select the 'normal' Delicious font.
Comment 11 Keith Packard 2006-09-02 13:41:18 UTC
Ok, I think I understand the problem. These fonts have names for three
'platforms' (in TrueType speak):

 1: Apple 'unicode' names
 2: Apple legacy names
 3: Microsoft names

For each platform, they contain family, style and fullname entries. For both
Apple platforms, they use sensible names (e.g.):

  family: Delicious
  style: Heavy
  fullname: Delicious-Heavy

The names on the Microsoft platform are broken:

  family: Delicious Heavy
  style: Regular
  fullname: Delicious-Heavy

I think we want to leave the Microsoft names out of the configuration and use
only the Apple names -- it's the Microsoft style name that's breaking things here.
Comment 12 Keith Packard 2006-09-02 16:54:20 UTC
Further investigation uncovers the fact that Delicious Heavy registers itself as
a 'normal weight' font in the os2 table. So, we're left with a font which:

Says it's family is 'Delicious' (or 'Delicious Heavy')
Says it's style is 'Regular' (or 'Heavy')
Says it's weight is Medium

I'm not sure how I'm supposed to detect that this font isn't a good match for a
request asking for a regular font in the Delicous family, other than having a
special case for this particular font (which is clearly broken, as it registers
the wrong weight).

I'd prefer not to go the Microsoft route and stick all style variants in the
font menu; that seems wrong.

I suspect the right plan here is to allow us to add rules to edit the
constructed pattern for each font so that we can fix things like this in an
extensible fashion.
Comment 13 Keith Packard 2006-09-02 17:54:38 UTC
Well, that was certainly easier than I had feared. I've added a new match target
(scan) which affects fonts as they're scanned into the database. A new
configuration file 60-delicious.conf was added that takes the heavy variant and
adjusts the weight from medium to heavy, causing it to be correctly matched as a
heavy font.

I also added a match predicate for 'decorative' fonts so that 'normal' fonts are
preferred unless the decorative style name is supplied. This fixes false matches
on the Decorative SmallCaps face.
Comment 14 Wouter Bolsterlee 2006-09-03 04:01:15 UTC
Keith, thanks for looking into this issue. Is your patch in CVS yet? I don't
know which fontconfig branch I should use (I'm using fc-2_4_branch right now) to
track "head" development...
Comment 15 Keith Packard 2006-09-03 09:17:29 UTC
Yes, the patch is in the GIT repository (fontconfig moved last weekend) and is
available on the fc-2_4-keithp branch. I'll be merging that to master this week
if I can get a few more people to give it a try.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.