Page MenuHomePhabricator

Bold and big not highlighted correctly in the 2017WTE
Open, LowestPublic

Description

User:Wei4green reports at https://www.mediawiki.org/wiki/Topic:Udwa2nil46r6hmsm that bold text and big text is not displaying correctly in the syntax highlighter, in the 2017 WTE:

Screenshot of the expected results in the 2010(?) wikitext editor:

expected.png (66×1 px, 10 KB)

and the actual results in the new wikitext mode:

actual.png (70×1 px, 10 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

For <big> (and headlines) this is not possible, as the text itself always has the same size, and the syntaxhighlight layer must be exactly in the same place, so must use the same fixed size as well.

But I can (at least for my fonts) confirm that using bold does not cause any problems, i.e. when I disable the rule
font-weight: normal !important; for .ve-init-mw-desktopArticleTarget .CodeMirror-code, .ve-init-mw-desktopArticleTarget .CodeMirror-code *, .ve-init-mw-desktopArticleTarget .ve-ui-mwWikitextSurface .ve-ce-paragraphNode, text and highlight still are in sync, and it looks nice.

We disabled the bold/italic rules as in some browsers (probably IE) they were causing sub-pixel width differences.

We disabled the bold/italic rules as in some browsers (probably IE) they were causing sub-pixel width differences.

Italic isn't disabled.

Is it possible to measure the width of a monospaced text once with bold and once without, and if they are equal assume it's okay to dynamically remove the rule that disables bold?

Section headings get a larger font in the 2010 WTE:

Screen Shot 2018-07-26 at 11.06.40 AM.png (379×514 px, 60 KB)

so presumably text is not required to have the same size throughout the document. However, I've not seen any indication that multiple sizes are possible on the same line.

@Whatamidoing-WMF The 2010 editor uses a single CodeMirror edit surface for display and editing. As a result this triggers a range of issues with IMEs and bidi text, which CodeMirror are unlikely to ever fix. To avoid these in the 2017 editor we use an invisible VE edit surface (which doesn't have the IME/bidi issues), and a duplicate CodeMirror surface underneath. The downside is that in order for the two surfaces to line up perfectly we can't use any styling that changes the text size.

We disabled the bold/italic rules as in some browsers (probably IE) they were causing sub-pixel width differences.

Italic isn't disabled.

Is it possible to measure the width of a monospaced text once with bold and once without, and if they are equal assume it's okay to dynamically remove the rule that disables bold?

As much as I don't trust the engines to render the fonts, I don't trust them to correctly measure the sub-pixel width values. It could be possible, but I don't think it's worth the effort.

I just found the reason why bold is disabled: T184467 (according to the title not only IE). So it seems that neither bold nor big is possible (at least not until font rendering in browsers improves a lot, which would make bold possible again). Is it worth keeping this task open until then?

TheDJ changed the task status from Open to Stalled.Mar 20 2019, 10:18 AM
TheDJ moved this task from Backlog to Improvement on the MediaWiki-extensions-CodeMirror board.
Aklapper changed the task status from Stalled to Open.Jun 20 2022, 12:25 AM