Skip to content

Commit b1a42ff

Browse files
authored
use a default AWT monospaced font, fixes #6733 (#6793)
1 parent 88f3363 commit b1a42ff

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

ui/src/main/java/org/apache/hop/ui/hopgui/terminal/JediTerminalWidget.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,13 @@
3838
import org.apache.hop.core.Const;
3939
import org.apache.hop.core.logging.LogChannel;
4040
import org.apache.hop.ui.core.PropsUi;
41-
import org.apache.hop.ui.core.gui.GuiResource;
4241
import org.eclipse.swt.SWT;
4342
import org.eclipse.swt.awt.SWT_AWT;
4443
import org.eclipse.swt.custom.StyledText;
4544
import org.eclipse.swt.events.KeyAdapter;
4645
import org.eclipse.swt.events.KeyEvent;
4746
import org.eclipse.swt.events.TraverseEvent;
4847
import org.eclipse.swt.events.TraverseListener;
49-
import org.eclipse.swt.graphics.Font;
50-
import org.eclipse.swt.graphics.FontData;
5148
import org.eclipse.swt.graphics.Rectangle;
5249
import org.eclipse.swt.layout.FormAttachment;
5350
import org.eclipse.swt.layout.FormData;
@@ -218,12 +215,8 @@ private void sendTabToShell() {
218215
*/
219216
private DefaultSettingsProvider createHopSettingsProvider(
220217
final boolean isDarkMode, final Display display) {
221-
// Hop's fixed-width font (name, style, base size from preferences)
222-
Font swtFixedFont = GuiResource.getInstance().getFontFixed();
223-
FontData[] fixedFontData = swtFixedFont.getFontData();
224-
final String fontName = fixedFontData.length > 0 ? fixedFontData[0].getName() : "Monospaced";
225-
final int baseFontHeight = fixedFontData.length > 0 ? fixedFontData[0].getHeight() : 12;
226-
int swtStyle = fixedFontData.length > 0 ? fixedFontData[0].getStyle() : SWT.NORMAL;
218+
final String fontName = java.awt.Font.MONOSPACED;
219+
final int baseFontHeight = 13;
227220

228221
float fontScale = 1.0f;
229222
String manualScale = System.getProperty("JediTerm.fontScale");
@@ -237,18 +230,11 @@ private DefaultSettingsProvider createHopSettingsProvider(
237230
}
238231
final float systemPropScale = fontScale;
239232

240-
int awtStyle = java.awt.Font.PLAIN;
241-
if ((swtStyle & SWT.BOLD) != 0) awtStyle |= java.awt.Font.BOLD;
242-
if ((swtStyle & SWT.ITALIC) != 0) awtStyle |= java.awt.Font.ITALIC;
243-
final int finalAwtStyle = awtStyle;
233+
final int finalAwtStyle = java.awt.Font.PLAIN;
244234

245235
return new DefaultSettingsProvider() {
246236
private int computeFontSize() {
247-
// baseFontHeight already includes Hop's globalZoomFactor (applied in GuiResource).
248-
// Both SWT and AWT interpret point sizes the same way and apply screen DPI
249-
// internally, so no additional nativeZoomFactor or DPI correction is needed.
250-
int percent = fontScalePercent.get();
251-
return Math.max(6, Math.round(baseFontHeight * (percent / 100f) * systemPropScale));
237+
return Math.round(baseFontHeight * (fontScalePercent.get() / 100f) * systemPropScale);
252238
}
253239

254240
@Override

0 commit comments

Comments
 (0)