לאתר זה תהיה פונקציונליות מוגבלת בזמן שאנו מתחזקים אותו לשיפור החוויה שלך. אם מאמר מסויים לא פותר את הבעיה שלך וברצונך לשאול שאלה, קהילת התמיכה שלנו מחכה לעזור לך ב־Twitter תחת ‎@FirefoxSupport וב־Reddit תחת ‎/r/firefox.

חיפוש בתמיכה

יש להימנע מהונאות תמיכה. לעולם לא נבקש ממך להתקשר או לשלוח הודעת טקסט למספר טלפון או לשתף מידע אישי. נא לדווח על כל פעילות חשודה באמצעות באפשרות ״דיווח על שימוש לרעה״.

מידע נוסף

Plain text files are rendered in proportional font. How can I change this?

  • 6 תגובות
  • 5 have this problem
  • 6 views
  • תגובה אחרונה מאת the-edmeister

more options

When I access plain text files, like `file:///home/username/.profile`, or remote files with mime-type text/plain, they are rendered in Quirks mode. Unfortunately, this has changed to use a proportional-width font on my system, which is rather annoying since it breaks some nice properties for source code.

Using <right-click>-"inspect element" gives a body with one

-element.  Its CSS properties (browser styles) show

    xmp, pre, plaintext {
      display: block;
      font-family: -moz-fixed;
      white-space: pre;
      margin: 1em 0;
    }

Originating from some 'html.css' which I have not found anywhere on my
system.


How can I get plain text being displayed in a monospaced font again?

Thanks!
When I access plain text files, like `file:///home/username/.profile`, or remote files with mime-type text/plain, they are rendered in Quirks mode. Unfortunately, this has changed to use a proportional-width font on my system, which is rather annoying since it breaks some nice properties for source code. Using <right-click>-"inspect element" gives a body with one <pre>-element. Its CSS properties (browser styles) show xmp, pre, plaintext { display: block; font-family: -moz-fixed; white-space: pre; margin: 1em 0; } Originating from some 'html.css' which I have not found anywhere on my system. How can I get plain text being displayed in a monospaced font again? Thanks!

כל התגובות (6)

more options

I'm not sure what OS and Firefox version you have, so apologies if this doesn't exactly track.

Check the Options (or Preferences) dialog to see what font you have listed for monospaced text.

  • "3-bar" menu button > Options/Preferences > Content

Click the "Advanced" button and check that your Monospace font selection is actually the font you want. Before closing the dialog, check the language selector at the top of the dialog. If you made the change for Western (or another specific character set), change the selector to Other Languages to view fonts used on Unicode pages and update that if needed. (And vice versa...)

Any luck?

more options

Sorry, no.

For your question: Firefox 32.0 on Arch Linux.

I've tried your advice about font settings before, to no avail. And I have played around with these settings a bit more intensively now, with surprising (but unsatisfying) results:

 * With my current setting I do see monospaced font on some web
   pages.  For example the second half of my incorrectly rendered
   question above, or Wikipedia examples on programming languages.
 * Setting Fonts for "Other Languages" has no effect on the rendering
   of the plain text file, but the setting for "Western" has,
   although the Page Info (after hitting C-i) shows
       Type: text/plain
       Render Mode: Quirks mode
       Encoding: UTF-8
   And the file contains german umlauts, rendered as such.  Here [1]
   it is, so you can have a look.
 * In the Fonts dialog (after klicking "Advanced") setting
   "Monospace" has no effect, but setting "Sans-serif" changes the
   font used for the plain text file.  Note, that "Proportional" is
   set to "Sans-serif".
 * If I "Allow pages to choose their own fonts, instead of my
   selection above" in the advanced Fonts dialog, then the plain text
   file is rendered in the font selected for "Monospace".  But I'd
   have to bear all the badly chosen fonts out there on the web...

My conclusion is, that Quirks mode wrongly choses the "Proportional" font setting, instead of the "Monospace" font setting, when Firefox is set not to use websites own fonts. That would be a bug then.

What do you think?

____________________ [1] https://svn.uni-konstanz.de/dbis/inf2_s14/pub/pk2-13.lhs

more options

I cannot reproduce the problem on Firefox 31 on Windows 7 ("Courier New" as monospace font) with any combination of Quirks mode and text/plain (or text/html) and allow pages to choose their own fonts or not choose them. I've got too many tabs going to upgrade this particular system to Firefox 32 right now, but will test again when I can.

Meanwhile, though, I think some Linux users need to take a look.

more options

You could override that with code in userContent.css, either for all websites or for specific websites.

 pre{font-family:monospace!important}

@-moz-document domain(svn.uni-konstanz.de){
 pre{font-family:monospace!important}
}
more options

This does solve the symptom — Thank you!

However, with the findings in my previous post I still suspect a bug. After all, this solution is a rather rugged one, depriving all sites from choosing alternative styles (although I cannot imagine a sensible use case).

Where/how can I file a bug report?

more options