Correct font size calculation for Terminal in multi-monitor setups#2472
Merged
HeikoKlare merged 2 commits intoeclipse-platform:masterfrom Mar 5, 2026
Merged
Conversation
29078ca to
0d681b9
Compare
Contributor
c8e8cba to
668821a
Compare
668821a to
78a0d0c
Compare
Contributor
|
This pull request changes some projects for the first time in this development cycle. Warning 🚧 This PR cannot be modified by maintainers because edits are disabled or it is created from an organization repository. To obtain the required changes apply the git patch manually as an additional commit. Git patchFurther information are available in Common Build Issues - Missing version increments. |
1785a90 to
e152379
Compare
The StyleMap of the Terminal implementation uses a GC to calculate the extents of strings to be rendered. This GC is created on the current Display instance, which does not incorporate the zoom of the current usage context (i.e., the monitor on which the Terminal is displayed). But the monitor zoom has an effect on the effective font size, as font sizes in pixels are always integers such that the logical SWT point value can be rounded differently depending on the zoom. An effect of this are cut-off texts on secondary monitors on Windows, because without taking the zoom of the usage context into account the terminal font is erroneously not identified as a monospace font. This change adapts the implementation of StyleMap and its callers to create a GC for text extent calculations for the actual usage context. It makes the Terminal font being properly identified as a monospace font, such that individual characters are rendered and texts are not cut off. Contributes to eclipse-platform#2295 # Conflicts: # terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/StyleMap.java
e152379 to
f9644cc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The StyleMap of the Terminal implementation uses a GC to calculate the extents of strings to be rendered. This GC is created on the current Display instance, which does not incorporate the zoom of the current usage context (i.e., the monitor on which the Terminal is displayed). But the monitor zoom has an effect on the effective font size, as font sizes in pixels are always integers such that the logical SWT point value can be rounded differently depending on the zoom. An effect of this are cut-off texts on secondary monitors on Windows, because without taking the zoom of the usage context into account the terminal font is erroneously not identified as a monospace font.
This change adapts the implementation of StyleMap and its callers to create a GC for text extent calculations for the actual usage context. It makes the Terminal font being properly identified as a monospace font, such that individual characters are rendered and texts are not cut off.
Contributes to #2295
Additional information
This change further improves and is thus only benefical in combination with:
To test this change, you should have two monitors on a Windows system with different zooms. Open a terminal on the secondary monitor. For example, the following screenshots are taken on the secondary monitor of a setup with 100% primary monitor zoom and 125% secondary monitor zoom.
With current

masterstate:With #2463:

With #2463 and this:
