8263140: Japanese chars garble in console window in HSDB

Reviewed-by: iklam, prr, cjplummer
This commit is contained in:
Yasumasa Suenaga 2021-03-09 23:43:07 +00:00
parent 70342e8513
commit d0c1aec202
5 changed files with 13 additions and 24 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -306,7 +306,7 @@ public class AnnotatedMemoryPanel extends JPanel {
});
if (font == null) {
font = GraphicsUtilities.lookupFont("Courier");
font = GraphicsUtilities.getMonospacedFont();
}
if (font == null) {
throw new RuntimeException("Error looking up monospace font Courier");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -60,7 +60,7 @@ public class CommandProcessorPanel extends JPanel {
editor = new JTextArea();
editor.setDocument(new EditableAtEndDocument());
editor.setFont(GraphicsUtilities.lookupFont("Courier"));
editor.setFont(GraphicsUtilities.getMonospacedFont());
JScrollPane scroller = new JScrollPane();
scroller.getViewport().add(editor);
add(scroller, BorderLayout.CENTER);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -58,7 +58,7 @@ public class DebuggerConsolePanel extends JPanel {
editor = new JTextArea();
editor.setDocument(new EditableAtEndDocument());
editor.setFont(GraphicsUtilities.lookupFont("Courier"));
editor.setFont(GraphicsUtilities.getMonospacedFont());
JScrollPane scroller = new JScrollPane();
scroller.getViewport().add(editor);
add(scroller, BorderLayout.CENTER);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,21 +34,10 @@ import javax.swing.border.*;
/** Useful utilities for drawing graphics */
public class GraphicsUtilities {
/** Returns a plain-styled 12-point version of the given font, or
null if the font could not be found */
public static Font lookupFont(String fontName) {
Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
Font font = null;
for (int i = 0; i < allFonts.length; i++) {
if (allFonts[i].getFontName().indexOf(fontName) != -1) {
font = allFonts[i];
break;
}
}
if (font == null) {
return null;
}
return font.deriveFont(Font.PLAIN, 12);
private static final int FONT_SIZE = 12;
public static Font getMonospacedFont() {
return new Font(Font.MONOSPACED, Font.PLAIN, FONT_SIZE);
}
/** Compute the width and height of given string given the current

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -130,7 +130,7 @@ public class MemoryPanel extends JPanel {
table.setCellSelectionEnabled(true);
table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
table.setDragEnabled(true);
Font font = GraphicsUtilities.lookupFont("Courier");
Font font = GraphicsUtilities.getMonospacedFont();
if (font == null) {
throw new RuntimeException("Error looking up monospace font Courier");
}