Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8263140: Japanese chars garble in console window in HSDB
Reviewed-by: iklam, prr, cjplummer
  • Loading branch information
YaSuenag committed Mar 9, 2021
1 parent 70342e8 commit d0c1aec2023cbaba48548cc22094c417c051595f
@@ -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 void ancestorResized(HierarchyEvent e) {
});

if (font == null) {
font = GraphicsUtilities.lookupFont("Courier");
font = GraphicsUtilities.getMonospacedFont();
}
if (font == null) {
throw new RuntimeException("Error looking up monospace font Courier");
@@ -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 CommandProcessorPanel(CommandProcessor cp) {

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);
@@ -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 DebuggerConsolePanel(Debugger debugger) {

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);
@@ -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 @@
/** 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
@@ -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 boolean isCellEditable(int row, int col) {
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");
}

0 comments on commit d0c1aec

Please sign in to comment.