AvalonEdit text selection causes glyphs after selection to jiggle in Windows 10 per-monitor HDPI setups #198

Open
opened 2019-10-01 02:53:23 -05:00 by siegfriedpammer · 0 comments
siegfriedpammer commented 2019-10-01 02:53:23 -05:00 (Migrated from github.com)

Example GIF:

AvalonEdit_HDPI_Selection_Jiggle

Setup

OS: Windows 10 Pro Version 1903 Build 18362.356 / .NET 4.7.2

Two monitors one @100% the other @150%
Start the app on the first monitor and move it to the second, then start selecting text.

app.manifest

Enable per-monitor DPI awareness in app.manifest:

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
	<!-- Enable per-monitor DPI awareness: https://github.com/Microsoft/WPF-Samples/tree/master/PerMonitorDPI -->
	<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
	<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
    </windowsSettings>
  </application>

This does not occur in DPI unaware applications (tested with AvalonEdit.Sample)

According to https://github.com/Microsoft/WPF-Samples/tree/master/PerMonitorDPI#wpf-apps AvalonEdit will need some adjustments:

  • TextFormatting API calls – if your application uses any System.Windows.Media.-TextFormatting APIs, you’ll need to pass in your target DPI into new constructor overrides or properties. When DPI changes, you’ll need to force a re-render of your text – see PerMonitorDpi\TextFormatting and PerMonitorDpi\FormattedTextExample samples on github.com/WpfSamples

iirc, AvalonEdit uses FormattedText?

Example GIF: ![AvalonEdit_HDPI_Selection_Jiggle](https://user-images.githubusercontent.com/344204/65943260-54dee380-e42f-11e9-9d05-f4cefce13b41.gif) # Setup OS: Windows 10 Pro Version 1903 Build 18362.356 / .NET 4.7.2 Two monitors one `@100%` the other `@150%` Start the app on the first monitor and move it to the second, then start selecting text. ## app.manifest Enable per-monitor DPI awareness in app.manifest: ```xml <application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <!-- Enable per-monitor DPI awareness: https://github.com/Microsoft/WPF-Samples/tree/master/PerMonitorDPI --> <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware> </windowsSettings> </application> ``` This does not occur in DPI unaware applications (tested with AvalonEdit.Sample) According to https://github.com/Microsoft/WPF-Samples/tree/master/PerMonitorDPI#wpf-apps AvalonEdit will need some adjustments: > * **TextFormatting API calls** – if your application uses any System.Windows.Media.-TextFormatting APIs, you’ll need to pass in your target DPI into new constructor overrides or properties. When DPI changes, you’ll need to force a re-render of your text – see PerMonitorDpi\TextFormatting and PerMonitorDpi\FormattedTextExample samples on github.com/WpfSamples iirc, AvalonEdit uses FormattedText?
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-icsharpcode/AvalonEdit#198
No description provided.