You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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?
Reacted by Leonid Tsarev, Maximilian Haru Raditya, Alexander Johnston, Peter Bright, Marshall Bowers, Ryan Lundy, Sevenate, Kristian Thy, Vladimir Shein, SupinePandora43 and 6 more
This isn't Windows, it's WPF. If you try in a UWP app, it renders correctly. I asked folks at VS to look into it and here's what they found so far:
Looks line LineServices (a low-level component that WPF uses to help format text) treats ‘-‘ specially, presumably for the line-breaking algorithm. With the result that it’s never placed in the same glyph run as normal characters like ‘>’. So by the time DWrite sees the text, it looks like GlyphRun(“--") GlyphRun(“> >= ==> 3/4"), and DWrite doesn’t recognize the ligature that changes ‘-->’ into the right-arrow glyph.
Reacted by Stuart Lang, Friedrich von Never, Nate Radebaugh, Saul Rennison, Crystal Durham, Botond Balázs, James Harris, wyz, Ewan Yang, Arne Kiesewetter and 19 more
@onovotny are you able to use your influence to bring this up with them another time. I think there's about a month before VS2017 changes are frozen, it would be sweet if they can get this sorted in time, sounds like they are onto the root cause.
Reacted by Botond Balázs, George Pollard, Jonathan Ferguson, Escape0707 and bl-ue
I overlooked this when scanning the history of this issue so I thought I would post an explicit comment. The issue is now tracked in the WPF team's GitHub issues: dotnet/wpf#109
Reacted by astrionic, lifeforce-dev, bl-ue and Sevenate
dotnet/wpf#109 (comment) Looks like it's been resolved in .NET 9; visual studio still uses an older version but perhaps the issue will be resolved in VS2025?
Activity
clairernovotny commentedon Aug 30, 2016
This isn't Windows, it's WPF. If you try in a UWP app, it renders correctly. I asked folks at VS to look into it and here's what they found so far:
citizenmatt commentedon Aug 30, 2016
Nice one - very useful info! Is there any indication of a fix being worked on?
saul commentedon Nov 6, 2016
@onovotny have you received any word from the guys at VS that this is being worked on?
slang25 commentedon Dec 19, 2016
@onovotny are you able to use your influence to bring this up with them another time. I think there's about a month before VS2017 changes are frozen, it would be sweet if they can get this sorted in time, sounds like they are onto the root cause.
Porges commentedon Jan 6, 2017
Here's a relevant UserVoice suggestion to get this fixed: https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/12983895-fix-ligatures
anjelo commentedon Apr 18, 2017
Update from the Visual Studio dev community: https://developercommunity.visualstudio.com/content/problem/44061/some-programming-ligatures-do-not-work.html
saul commentedon Apr 18, 2017
That's a real shame :(
jogibear9988 commentedon May 4, 2017
I've also added a connect issue: https://connect.microsoft.com/VisualStudio/feedback/details/3133502/ligatures-dont-work-correctly-in-wpf
sgrottel commentedon Jan 18, 2019
Btw, it's also the same with VS 2019 preview.
slang25 commentedon Jan 19, 2019
I've just got the notification that the issue is a "wont fix" :(
clairernovotny commentedon Jan 19, 2019
@slang25 I would wait until WPF for .NET Core 3 is fully open sourced.
slang25 commentedon Jan 19, 2019
That's a very good point!
limbusdev commentedon Apr 10, 2019
Persists in Visual Studio 2019.1
lifeforce-dev commentedon Feb 18, 2020
Bummer :( maybe one day it will come out of Won't Fix.
HolisticDeveloper commentedon Jun 12, 2020
I overlooked this when scanning the history of this issue so I thought I would post an explicit comment. The issue is now tracked in the WPF team's GitHub issues: dotnet/wpf#109
Vresod commentedon Dec 12, 2024
dotnet/wpf#109 (comment) Looks like it's been resolved in .NET 9; visual studio still uses an older version but perhaps the issue will be resolved in VS2025?