Closed Bug 1287089 Opened 3 years ago Closed 3 years ago

[CSS] @font-face src: local() doesn't work properly

Categories

(Core :: Layout: Text and Fonts, defect)

45 Branch
defect
Not set

Tracking

()

RESOLVED INVALID

People

(Reporter: carlo.stemberger, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160607223741

Steps to reproduce:

On a Debian Stretch (testing) system:
1. apt-get install ttf-sjfonts
2. run the following file:
-----
<html>
	<head>
<style>
@font-face {
	font-family: 'Steve';
	src: local('Steve');
}

body {
	font-family: Steve;
}
</style>
	</head>
	<body>
		<p>This is a test.</p>
	</body>
</html>
-----


Actual results:

Firefox ignores the @font-face rule.


Expected results:

Firefox should use the Steve font:

$ fc-list |grep -i steve
/usr/share/fonts/truetype/sjfonts/SteveHand.ttf: Steve:style=Hand

Please note 2 things:
1) the following file works well:
-----
<html>
	<head>
<style>
body {
	font-family: Steve;
}
</style>
	</head>
	<body>
		<p>This is a test.</p>
	</body>
</html>
-----

2) the following file works well too, but I think it's a bug:
-----
<html>
	<head>
<style>
@font-face {
	font-family: 'Steve';
	src: local('SteveHand');
}

body {
	font-family: Steve;
}
</style>
	</head>
	<body>
		<p>This is a test.</p>
	</body>
</html>
-----

See also: https://bugs.chromium.org/p/chromium/issues/detail?id=627143
Component: Untriaged → Layout: Text
No, Firefox is correct here AFAICS. The src:local() descriptor takes an individual font *face* name, which may be either the "full name" or the "postscript name", according to the CSS Fonts spec.[1]

In this case, the font's fullname and psname are both "SteveHand", and therefore that is the correct name to use in src:local(). The name "Steve" is the *family* name (which could potentially identify a whole family of "Steve" faces with different weights, widths, italicness, etc), and this is *not* valid for use in the src:local() descriptor.

From a quick look at the Chromium issue mentioned, it sounds like Chromium may be accepting the font *family* name in src:local(). If so, that's a bug (and a violation of the spec).

[1] https://www.w3.org/TR/css-fonts-3/#src-desc
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.