Skip to content

Commit 9b6e8f8

Browse files
akoch-yattaHeikoKlare
authored andcommitted
USe SWTFontProvider in win32 GC fonts
This commit adapts how to fetch fonts in GC in the win32 implementation. Now it always uses the internal SWTFontProvider to fetch system and non-system fonts in the correct scaling. Contributes to #62 and #131
1 parent fc0098c commit 9b6e8f8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4423,7 +4423,7 @@ public void setFillRule(int rule) {
44234423
public void setFont (Font font) {
44244424
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
44254425
if (font != null && font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
4426-
data.font = font != null ? Font.win32_new(font, data.nativeZoom) : data.device.systemFont;
4426+
data.font = font != null ? SWTFontProvider.getFont(device, font.getFontData()[0], data.nativeZoom) : SWTFontProvider.getSystemFont(device, data.nativeZoom);
44274427
data.state &= ~FONT;
44284428
}
44294429

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public Font getSystemFont(int zoom) {
5151
if (hFont == 0) hFont = OS.GetStockObject (OS.SYSTEM_FONT);
5252
Font font = Font.win32_new(device, hFont);
5353
registerFont(KEY_SYSTEM_FONTS, font);
54+
registerFont(font.getFontData()[0], font);
5455
return font;
5556
}
5657

0 commit comments

Comments
 (0)