Page MenuHomePhabricator

Monospace text still much smaller in Vector for certain extensions
Closed, ResolvedPublic

Description

Author: gsm100

Description:
This report is related to bugreport number 20706. It occurs using Firefox 3.6.3, the vector skin and extensions SyntaxHighLight_GesHi and HeaderTabs. I use mw16beta3 plus the latest (from the nightly build) vector skin date (may 30).

The small font issue seems to persist in combination with certain extensions.

HeaderTabs: With version 0.7 of this extension the effect was that the font in the edit screen wasn't courier anymore. Setting it to monospace (user preference) showed a very small courier font. Adding tag "textarea" to the already proposed tt, code and pre fix solved this problem. (see this extensions talk page).

tt, code, pre, textarea {

font-family: monospace, sans-serif;

}

SyntaxHighLight_GesHi: With the latest version of this extension all the preformatted text shows in colour but again in very small font. I have not been able to repair it with any temporary solution in Mediawiki:Vector.css


Version: 1.16.x
Severity: normal

Details

Reference
bz23708

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:01 PM
bzimport set Reference to bz23708.

gsm100 wrote:

Screenshot of small font issue

Attached:

SCRS01.png (133×195 px, 3 KB)

gsm100 wrote:

I found a temporary work-a-round for SyntaxHighLight_GesHi:

  1. Update to the latest php files of the extension
  2. Do not use the new Geshi files but use the older geshi version: 1.0.7.22

Then the small font issue doesn't occur in the vector skin (using Firefox).


Probable cause:
There is a difference in the generated html that geshi.php produces:

Version 1.0.7.22 (still ok):

var $overall_style = '';
var $code_style = 'font-family: \'Courier New\', Courier, monospace; font-weight: normal; font-style: normal;';

Version 1.0.8.7 (nok):
var $overall_style = 'font-family:monospace;';
var $code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;';

Maybe this helps narrowing down the search for the problem.

This is essentially the same as bug 23951. See explanations there.

The culprit is the SyntaxHighlight GeSHi extension adding style="font-family: monospace;" everywhere. As http://www.brunildo.org/test/monospace_fsize.html shows, this is the most harmful thing to do because "font-family: monospace;" is the only thing that triggers the tiny fonts in *all* browsers that have the problem. In some browsers it can be worked around by adding something else at any position of the list (even if that "something" is actually a monospaced font), in others it can be worked around by adding a generic family at the end.

By adding style="font-family: monospace;" as inline style attribute, the SyntaxHighlight GeSHi extension invalidates the workaround that has been added to the Vector skin to fix bug 20706. It can be overridded with something like

pre.css.source-css, /* MediaWiki:*.css, User:*.css */
pre.javascript.source-javascript, /* MediaWiki:*.js, User:*.js */
div.mw-geshi pre, /* source enclose="pre" */
div.mw-geshi div, /* source enclose="div" */
span.mw-geshi /* source enclose="none" */ {
font-family: monospace, sans-serif !important;
}

The place to fix it is the SyntaxHighlight GeSHi extension itself. It should stop adding "font-family: monospace;" all over the place and rely on HTML elements that imply it and leave it up to browsers and skins to deal with them. It could wrap everything that it doesn't wrap into a pre element into a tt element. Or, more semantic, wrap everything into a code element and then even further into a pre, div or nothing (yes, wrapping a code element into a pre element makes sense).

Wrapping GeSHi's output into <code> elements is also suggested in bug 17147. For other reasons, though, and that alone won't suffice: It would also have to drop all instances of "font-family: monospace;".

gsm100 wrote:

Thanks for your extensive comment and helpful links. I have added a MediaWiki:Geshi.css page to my wiki with the suggested code:

pre.css.source-css, /* MediaWiki:*.css, User:*.css */
pre.javascript.source-javascript, /* MediaWiki:*.js, User:*.js */
div.mw-geshi pre, /* source enclose="pre" */
div.mw-geshi div, /* source enclose="div" */
span.mw-geshi /* source enclose="none" */ {

font-family: monospace, sans-serif !important;

}

Now sourcecode shows properly in a page with Firefox and the newest version of Geshi.

This solves the issue reported in the bug. I think this bugreport can be closed.

(In reply to comment #5)

This solves the issue reported in the bug. I think this bugreport can be
closed.

Resolving as FIXED per reporter.

This is not "fixed" as it still needs rather ugly local adaptions to avoid the tiny fonts. Duping to bug 17147 because the underlying issue is that Geshi cannot easily be styled like <code> although it *is* code.

  • This bug has been marked as a duplicate of bug 17147 ***

Reopening because of bug 17147 comment 2.

Reclosing as duplicate. Generic monospace bug has been fixed long ago in bug 20706. GeSHi issue still open in bug 26204.

  • This bug has been marked as a duplicate of bug 26204 ***