Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 464666 - media-fonts/roboto uses black/bold variant for "Roboto" name
Summary: media-fonts/roboto uses black/bold variant for "Roboto" name
Status: IN_PROGRESS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Fonts Team
URL:
Whiteboard:
Keywords:
: 491186 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-05 03:52 UTC by Denilson Sá Maia
Modified: 2021-02-25 00:20 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denilson Sá Maia 2013-04-05 03:52:06 UTC
How to reproduce:
1. emerge -av media-fonts/roboto
(Happens on both 20111129 and 20120823 versions.)
2. google-chrome http://play.google.com/
(If needed, open the description page of any item from that site.)

What happens:
The text is all bold.

Why it happens?
The font files are incorrectly describing themselves. The full details including a workaround are explained here:
http://nileshgr.com/2013/02/24/configuring-roboto-font-in-linux
http://www.mail-archive.com/gentoo-user@lists.gentoo.org/msg135623.html

What should we do?
1. Deploy a fontconfig workaround in Gentoo's ebuild.
2. Contact upstream and ask them to fix it.
Comment 1 Ben de Groot (RETIRED) gentoo-dev 2013-04-05 05:20:32 UTC
This issue was already discussed in bug 423727, but in the meantime I can now confirm this. I don't think either of the solutions is completely satisfactory, and really this should be fixed upstream. Somebody needs to give these fonts their proper weight.

As it is I don't know which stop-gap solution is to be preferred: either not installing Medium and Black, or disabling them with a fontconfig file.
Comment 2 John Flatness 2013-10-22 21:11:42 UTC
This may have been quietly resolved by upstream, at least partially.

I'm one of the people who brought this up in bug 423727, and I was doing a little research to see if anything had changed recently.

The link from Google's typography design page has changed, it's now http://developer.android.com/downloads/design/roboto-1.100141.zip and the timestamps are July 31, 2013.

A cursory look at the Roboto Black and Black Italic from that zip correctly shows the OS/2 weight as Black (900).

I believe the erroneous selection of the Medium fonts by default is still the same, but they were always declaring the right weight, at least according to their names. The problem there seems to be more of a fontconfig situation, for deciding between Book and Medium as the "normal" weight.
Comment 3 John Flatness 2013-10-22 23:49:51 UTC
I experimented with the files from that new zip just now, and as I suspected, the issue with mis-selection of the Black weight is gone, but the issue with Medium being chosen by default remains.

I think I was also able to confirm that the Medium problem comes from fontconfig.

Running fc-pattern reveals that fontconfig defaults to a weight of 100 (medium weight), if no weight is specified in the pattern. (For comparison, "book" weight is 75, and both "regular" and "normal" are 80).

$ fc-pattern -d -c "" weight
Pattern has 1 elts (size 16)
        weight: 100(i)(s)

$ fc-pattern -d -c Roboto weight
Pattern has 1 elts (size 16)
        weight: 100(i)(s)

$ fc-pattern -d -c Roboto:regular weight
Pattern has 1 elts (size 16)
        weight: 80(i)(s)

The best way I can come up with, barring some change to fontconfig, which seems unlikely, is to modify patterns requesting Roboto:

    <match target="pattern">
        <test name="family" compare="eq"><string>Roboto</string></test>
        <edit name="weight" mode="append"><const>regular</const></edit>
    </match>

By just appending the "regular" weight, any weight specifically requested takes precedence, and it effectively just makes "regular" the fallback weight, as well as the default one when none is selected. In contrast to the previous linked workaround, this doesn't block off the Medium weight, it just effectively alters the default selection.

The effects seem pretty good. Various weights return as you'd expect:

$ fc-match Roboto
Roboto-Regular.ttf: "Roboto" "Regular"

$ fc-match Roboto:medium
Roboto-Medium.ttf: "Roboto" "Medium"

$ fc-match Roboto:black
Roboto-Black.ttf: "Roboto" "Black"

As do explicit styles:

$ fc-match Roboto:style=Regular
Roboto-Regular.ttf: "Roboto" "Regular"

$ fc-match Roboto:style=Medium
Roboto-Medium.ttf: "Roboto" "Medium"

$ fc-match Roboto:style=Black
Roboto-Black.ttf: "Roboto" "Black"

As far as I can tell, this just restores the default selection that "should" be happening, and doesn't block out selection of any of the styles (though I've just tested it with fontconfig's direct tools so far).
Comment 4 Ben de Groot (RETIRED) gentoo-dev 2013-10-23 02:07:14 UTC
Thanks for that! I'm sorry I've left this issue open for so long. I hope to have time in a couple of days to finally address this.
Comment 5 Ben de Groot (RETIRED) gentoo-dev 2013-10-25 17:12:26 UTC
This should be fixed in the new version now.
Comment 6 Ben de Groot (RETIRED) gentoo-dev 2013-11-14 13:05:43 UTC
*** Bug 491186 has been marked as a duplicate of this bug. ***
Comment 7 John Flatness 2013-11-20 00:56:06 UTC
I'm temporarily working around the renewed Black problem in the latest version by just manually editing the weight class with Fontforge and replacing the Black font with the edited version. Alternatively, it should be possible to add another rule to the fontconfig file that's currently shipping with the package to override the weight data as read by fontconfig.

Of course, just having a correct font to start with would be best. Strangely, the font in the googlefontdirectory hg repo seems to have the right weight data. As far as I can tell, they just dump the ttfs in there and make subsets from them; there's no source files for Roboto in that repo.
Comment 8 Eugene Shalygin 2014-12-19 16:36:27 UTC
As another workaround, Roboto from dev-texlive/texlive-fontsextra-2014 works fine
Comment 9 Ben de Groot (RETIRED) gentoo-dev 2015-03-07 12:52:45 UTC
(In reply to John Flatness from comment #7)
> Of course, just having a correct font to start with would be best.
> Strangely, the font in the googlefontdirectory hg repo seems to have the
> right weight data. As far as I can tell, they just dump the ttfs in there
> and make subsets from them; there's no source files for Roboto in that repo.

I have just repackaged the roboto fonts as they are currently found in the hg repo. Let me know if this issue is fixed in the new version, or if there still are problems.
Comment 10 BT 2015-03-08 01:02:45 UTC
(In reply to Ben de Groot from comment #9)
> I have just repackaged the roboto fonts as they are currently found in the
> hg repo. Let me know if this issue is fixed in the new version, or if there
> still are problems.

Selecting Roboto regular still forces Roboto medium. The KDE font selection dialog makes no distinction between regular and medium, and medium is always selected in the font settings.

The fonts from the hg repo appear to be the same Roboto fonts listed on the Material design page[1]. You might want to use the provided archive (no versioning) instead of packaging it yourself. The ebuild homepage url should probably be updated as well.

[1] http://www.google.com/design/spec/style/typography.html
Comment 11 John Flatness 2015-03-09 19:01:57 UTC
media-fonts/roboto-2015.03 appears to resolve this problem (the part with the Black weights, anyway).

The Black and BlackItalic variants both correctly have weights of 900, so fontconfig doesn't mistakenly select them.

As for issues with the Medium weight, fontconfig 2.11.1 incorporated the fix I mentioned in a previous comment: https://bugs.gentoo.org/show_bug.cgi?id=491186#c1

On Gnome3/GTK, the font selection works fine with these and all weights are selectable, including Regular, Medium, and Black, and Regular is correctly the "normal" weight.

fc-match also behaves correctly: Roboto, Roboto:medium, and Roboto:black queries each select the right font.
Comment 12 Andreas Klauer 2015-03-27 16:12:41 UTC
For some reason the Roboto Condensed was not condensed at all, in the roboto 2015.03 package, so I had to mask it.
Comment 13 MW 2021-02-24 11:43:22 UTC
Should this bug still be open? No surprises/issues for me with =media-fonts/roboto-2.138. In particular, selecting Roboto with XeLaTeX+fontspec sets Roboto-Regular.
Comment 14 John Flatness 2021-02-25 00:08:58 UTC
My distant recollection here is that this was 2 issues: 1 in fontconfig that would prefer "Medium" over "Regular", and 1 in Roboto itself where the weights were specified wrong in the font files.

I believe both are long since fixed, but I don't currently have a graphical Gentoo environment at the moment to check for sure.
Comment 15 Eugene Shalygin 2021-02-25 00:20:39 UTC
fc-match "Roboto" prints out now
Roboto-Regular.otf: "Roboto" "Regular"