Closed Bug 637157 Opened 13 years ago Closed 13 years ago

@font-face family names should hide system fonts

Categories

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

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(1 file)

According to CSS3 Fonts draft, the family-name defined by @font-face should hide any installed system font of the same name.

The Mac and Windows implementations behave in this way (except when all sources fail to load, see bug 623711), but the Pango backend explicitly matches against both @font-face *and* system font names. This corresponds to earlier drafts of @font-face spec, but is now incorrect.

(See comments at http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxPangoFonts.cpp#1768.)
Assignee: nobody → jfkthame
Attachment #515475 - Flags: review?(jdaggett)
Attachment #515475 - Flags: review?(jdaggett) → review+
http://hg.mozilla.org/mozilla-central/rev/8faf4e6c62f7
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-cedar]
Target Milestone: --- → mozilla2.2
This bug fix seems to have broken Indian websites that specify their own fonts and use @font-face to load a font for IE and make a font for other browsers available for download, but fail to specify a local font that Firefox can use.

Regression range:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=e11c2f95f781&tochange=bf68a4a3ef6a

I've seen some reports about this issue.
https://support.mozilla.com/en-US/questions/842928
https://support.mozilla.com/en-US/questions/839623

This site still works because Firefox doesn't get a @font-face.
http://www.manoramaonline.com
http://www.manoramaonline.com/mmfont/Manorama.ttf

It breaks a site like this in Firefox 5 that works with Firefox 4:
http://www.lankadeepa.lk/
http://www.lankadeepa.lk/sinhala_font/Sinhala_Fonts.htm

view-source:http://www.lankadeepa.lk/2006/ex1.prf
  @font-face {
    font-family: Wijeya;
    font-style:  normal;
    font-weight: 700;
    src: url(../02\WIJEYA1.prf);
  }
  
  @font-face {
    font-family: Wijeya;
    font-style:  normal;
    font-weight: normal;
    src: url(../02\WIJEYA0.prf);
  }

It works if I disable downloadlable fonts (gfx.downloadable_fonts.enabled -> false) or add a local(Wijeya) rule.

  @font-face {
    font-family: Wijeya;
    font-style:  normal;
    font-weight: 700;
    src: url(../02\WIJEYA1.prf),local(Wijeya);
  }
  
  @font-face {
    font-family: Wijeya;
    font-style:  normal;
    font-weight: normal;
    src: url(../02\WIJEYA0.prf),local(Wijeya);
  }
If I'm understanding this correctly, such sites are coded incorrectly and should not be expected to work. Given a rule such as:

  @font-face {
    font-family: Wijeya;
    font-style:  normal;
    font-weight: normal;
    src: url(../02\WIJEYA1.prf);
  }

this defines the family "Wijeya" as a downloadable font with the given source. Firefox presumably won't actually succeed in loading the .prf file (unless it's a TrueType/OpenType font in disguise!), so this font family is unusable and will be skipped, so we'll use the next font in the CSS font-family list instead, or fall back to a default (most likely "serif") if nothing else was specified.

What we will not do (any longer, as per CSS spec) is to use a locally-installed font called "Wijeya", because this rule redefines that family name as referring to the downloaded font instead.

(As an aside, such websites really, REALLY should be updated to use Unicode instead of non-standard 8-bit encodings and custom fonts. That would serve users better by making them more interoperable with other software and the rest of the online world, as well as removing the necessity to mess with custom fonts in order to read the text.)
Thanks.

Is there any reason why you can't define a font via @font-face in userContent.css?
@font-face only seems to work if applied directly to the page source via a stylesheet, so probably only a Greasemonkey script works to fix this.
@font-face works fine in userContent.css, as far as I can tell.

However, if you're trying to use it to define the "Wijeya" family (for example) in order to work around the problem on the lankadeepa.lk site, I expect that probably fails because the page's own @font-face rule supersedes the one you put in userContent.css.
Thanks.

I will do some experimenting to see how it works.

Probably the only solution that I can offer now is to disable downloadable font to people with this issue.  That wouldn't be not really my first choice as it breaks all other websites that use @font-face.

Lets leave it with this.
Thanks once again for your comments.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: