tonsky / tonsky/FiraCode

Hyphen based ligatures don't work in WPF

Open
#259 16 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
82k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

This is related to the issues people have reported with Visual Studio where ligatures that contain a hyphen, such as -> or <!-- don't work in Visual Studio.

It actually looks like this might be a generic WPF issue, rather than just Visual Studio.

I created a dummy WPF application that simply included a TextBlock, Label and FlowDocumentReader. The TextBlock and Label will display ligatures correctly, apart from those containing hyphens (e.g. ->). Strangely, the FlowDocumentReader works as expected.

screen shot 2016-08-29 at 10 51 33 am

I tried to debug the Visual Studio editor, and as best as I could follow, it's not the editor that's doing the work to display ligatures - it comes automagically from WPF and Windows. It looks like the editor is using Windows' native "Line Services" and for some reason, this component is treating the hyphen as a separate character, rather than as part of a run - and so it gets rendered separately, and not converted into a ligature. Hyphenation appears to be disabled in the Visual Studio editor code, and it's definitely disabled in the TextBlock and Label in my dummy application.

I've no idea now what's going wrong, and I strongly suspect this is a WPF/Windows issue and not something that could be fixed in the font, but I'm hoping that we get a nice friendly WPF expert wandering past who can help out.

Could it be something stupid like Windows doesn't recognise "hyphen" in the ligatures?

Anyone got any ideas?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the dummy WPF application with a TextBlock, Label, and FlowDocumentReader, comparing ligatures such as -> and <!--. Then investigate the contrast between those controls and the Windows Line Services behavior described; done would require identifying a concrete, project-relevant cause or fix rather than only confirming the WPF issue.

Written by the indexing model from the issue text.

Assessment

Domain
desktop
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.