Page MenuHomePhabricator

Bold and big not highlighted correctly in the 2017WTE
Open, Stalled, 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:

and the actual results in the new wikitext mode:

Event Timeline

Restricted Application added projects: VisualEditor, Community-Tech. · View Herald TranscriptJul 16 2018, 7:09 PM
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.

MusikAnimal updated the task description. (Show Details)Jul 17 2018, 3:22 PM

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:

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.

Esanders triaged this task as Lowest priority.Aug 6 2018, 2:24 PM
Deskana moved this task from To Triage to Freezer on the VisualEditor board.Aug 30 2018, 2:03 PM

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?

Izno added a subscriber: Izno.Jan 9 2019, 3:42 PM
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.