Browse Source

Fix font size not following DPI in the code editor

Stan Hebben 6 years ago
parent
commit
17338a30b3

+ 1
- 1
DrawableGui/src/main/java/org/openzen/drawablegui/swing/SwingDrawnRectangle.java View File

53
 	public void paint(Graphics2D g, DIRectangle clip) {
53
 	public void paint(Graphics2D g, DIRectangle clip) {
54
 		g.setColor(awtColor);
54
 		g.setColor(awtColor);
55
 		g.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
55
 		g.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
56
-		g.fillRect(clip.x, clip.y, 3, 3);
56
+		//g.fillRect(clip.x, clip.y, 3, 3);
57
 	}
57
 	}
58
 }
58
 }

+ 0
- 1
DrawableGui/src/main/java/org/openzen/drawablegui/tree/DTreeView.java View File

20
 import org.openzen.drawablegui.Destructible;
20
 import org.openzen.drawablegui.Destructible;
21
 import org.openzen.drawablegui.listeners.ListenerHandle;
21
 import org.openzen.drawablegui.listeners.ListenerHandle;
22
 import org.openzen.drawablegui.live.LiveBool;
22
 import org.openzen.drawablegui.live.LiveBool;
23
-import org.openzen.drawablegui.draw.DDrawSurface;
24
 import org.openzen.drawablegui.draw.DDrawnRectangle;
23
 import org.openzen.drawablegui.draw.DDrawnRectangle;
25
 import org.openzen.drawablegui.draw.DDrawnText;
24
 import org.openzen.drawablegui.draw.DDrawnText;
26
 import org.openzen.drawablegui.live.LiveList;
25
 import org.openzen.drawablegui.live.LiveList;

+ 2
- 1
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/editor/SourceEditor.java View File

52
  */
52
  */
53
 public class SourceEditor implements DComponent {
53
 public class SourceEditor implements DComponent {
54
 	private final DStyleClass styleClass;
54
 	private final DStyleClass styleClass;
55
-	private final DFont font = new DFont(DFontFamily.CODE, false, false, false, 24);
56
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
55
 	private final MutableLiveObject<DSizing> sizing = DSizing.create();
57
 	private final String tab = "    ";
56
 	private final String tab = "    ";
58
 	private final IDESourceFile sourceFile;
57
 	private final IDESourceFile sourceFile;
65
 	private SourceEditorStyle style;
64
 	private SourceEditorStyle style;
66
 	private DTimerHandle blinkTimer;
65
 	private DTimerHandle blinkTimer;
67
 	
66
 	
67
+	private DFont font;
68
 	private DFontMetrics fontMetrics;
68
 	private DFontMetrics fontMetrics;
69
 	private int textLineHeight;
69
 	private int textLineHeight;
70
 	private int fullLineHeight;
70
 	private int fullLineHeight;
140
 		
140
 		
141
 		context = parent.getChildContext("sourceeditor", styleClass);
141
 		context = parent.getChildContext("sourceeditor", styleClass);
142
 		style = context.getStyle(SourceEditorStyle::new);
142
 		style = context.getStyle(SourceEditorStyle::new);
143
+		font = new DFont(DFontFamily.CODE, false, false, false, (int)(context.getScale() * 13.7 + 0.5f));
143
 		
144
 		
144
 		fontMetrics = context.getFontMetrics(font);
145
 		fontMetrics = context.getFontMetrics(font);
145
 		textLineHeight = fontMetrics.getAscent() + fontMetrics.getDescent();
146
 		textLineHeight = fontMetrics.getAscent() + fontMetrics.getDescent();

Loading…
Cancel
Save