Intellij Idea 的字体应该如何设置?

软件和网站开发以及相关技术探讨
回复
wzhe
帖子: 1
注册时间: 2006-07-27 19:12

Intellij Idea 的字体应该如何设置?

#1

帖子 wzhe » 2006-07-27 19:20

小弟刚刚开始用ubuntu,感觉很好
尤其是这里的论坛和wiki很有帮助

不过有个问题始终没有找到好的解决办法,需要请教:

idea没有办法改字体
每次 config-->fonts and colors 进去以后,点击选择字体的按钮,idea就会自动关掉

郁闷
azure
帖子: 10
注册时间: 2006-06-07 22:59

#2

帖子 azure » 2006-09-05 22:24

事实是crash了,我的方法是把windows版color目录下(在你的Documents and Settings\{User's name}\.IntelliJIdea50)的文件copy到linux的相应目录(/home/{user's name}/.intelliJ5.0/config/color)下
头像
nmvr2600
帖子: 215
注册时间: 2005-11-01 18:23

#3

帖子 nmvr2600 » 2006-09-06 23:55

我记得是Ubuntu下几个字体会让Swing程序在字体索引时当掉,有个简单的检查程序,能够帮你找到引发问题的字体,把这几个字体删掉,然后刷新字体缓存,就好了。
google一下,比较久的事情了,忘了以前的东西都扔到哪了。 8)
We are both God and devil.
----------------------------------
Oracle 11G SG PPT下载
头像
nmvr2600
帖子: 215
注册时间: 2005-11-01 18:23

#4

帖子 nmvr2600 » 2006-09-07 0:10

呵呵,忘了以前写在blog上了,贴给你用。应该是/usr/share/fonts/truetype/ttf-gujarati-fonts这个下面的Rekha.ttf和akar-medium.ttf这两个字体的问题。可以删删看,把它们剪切到别的目录下就是。想知道详细从链接上到我blog上看吧,懒得再输一遍了。

ps:这论坛显示的是什么鸟时间?现在是0:11,不是上午12:11,晕倒!!

代码: 全选

import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

public class FontTest {
  public static void main(String[] args) {
    final JFrame frame = new JFrame("Font test window");
    frame.setSize(800, 600);
    frame.getContentPane().setLayout(new BorderLayout());
    final JLabel label = new JLabel("The quick brown fox jumped over the lazy dog's back!" +
                                    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +
                                    "@#$%^&*()_+-=,./<>?'\";:[{]}\\|`~");
    label.setFont(label.getFont().deriveFont(16.0f));
    frame.getContentPane().add(label, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
    try {
        final Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
        for (int i = 0; i < fonts.length; i++) {
          final int idx = i;
          SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
              final Font font = fonts[idx];
              final String name = font.getName();

              System.out.println("Checking Font: " + name);

              final boolean t1 = testChars(font, 'a', 'z');
              final boolean t2 = testChars(font, 'A', 'Z');
              final boolean t3 = testChars(font, '0', '9');
              System.out.println("Executing canDisplayUpTo...");
              final boolean t4 = font.canDisplayUpTo("The quick brown fox jumped over the lazy dog's back!@#$%^&*()_+-=,./<>?'\";:[{]}\\|`~") == -1;
              System.out.println("Executing printTest...");
              printTest(frame, label, font);

              if (t1 && t2 && t3 && t4) {
                System.out.println(" OK.");
              } else {
                System.out.println();
              }
            }
          });
        }
        System.out.println("Finished");
        System.exit(0);
    } catch(Exception e) {
      throw new RuntimeException(e);
    }
  }

  private static boolean testChars(final Font font, final int start, final int end)
  {
    System.out.println("testChars('" + (char)start + "', '" + (char)end + "')");
    boolean ret = true;

    for(int i = start;i <= end;i++) {
      if(!font.canDisplay((char)i)) {
        ret = false;
      }
    }

    return ret;
  }

  private static void printTest(final JFrame frame, final JLabel label, final Font font)
  {
    System.out.println("Entering printTest.");
    final Font derived = font.deriveFont(16.0f);
    System.out.println("Derived font");
    label.setFont(derived);
    System.out.println("Set font");
    frame.repaint();
    System.out.println("Repainted and leaving printTest.");
  }
}
We are both God and devil.
----------------------------------
Oracle 11G SG PPT下载
回复