Commit 765d73f
committed
[win32] Cache font height to prevent inconsistency
This commit adapts a limitation of handling fonts in the win32
implementation. When a font is initialized with FontData the height in
points of it and the desired target zoom will be used to calculate the
font height in pixels. When the FontData of an existing font is retrieved
the Logfont data from the OS together with the font zoom are used to
recalculate the original font height. As the conversion to pixels
involved rounding, the reversed calculation will result in a different
value than was used on creation time. With monitor-specific scaling
a font for a different zoom will be calculated on the basis of the
FontData of an existing base font. This can lead to font heights in
pixels that differ from the "correct" value. To solve this limitation
each font handle and its original font height in points are cached in a
static Map to recreate the original value when Font::getFontData is called.1 parent b85d9d2 commit 765d73f
File tree
2 files changed
+16
-17
lines changed- bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt
- graphics
- internal
2 files changed
+16
-17
lines changedLines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
176 | 181 | | |
177 | 182 | | |
178 | 183 | | |
| 184 | + | |
179 | 185 | | |
180 | 186 | | |
181 | 187 | | |
| |||
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
216 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
217 | 229 | | |
218 | 230 | | |
219 | 231 | | |
| |||
240 | 252 | | |
241 | 253 | | |
242 | 254 | | |
| 255 | + | |
243 | 256 | | |
244 | 257 | | |
245 | 258 | | |
| |||
Lines changed: 2 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | 56 | | |
59 | 57 | | |
60 | 58 | | |
| |||
134 | 132 | | |
135 | 133 | | |
136 | 134 | | |
137 | | - | |
138 | | - | |
139 | | - | |
| 135 | + | |
| 136 | + | |
140 | 137 | | |
141 | 138 | | |
142 | 139 | | |
| |||
167 | 164 | | |
168 | 165 | | |
169 | 166 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | 167 | | |
0 commit comments