Linux Ubuntu 上 Java 应用程序中的丑陋字体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17510099/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 23:24:07  来源:igfitidea点击:

Ugly fonts in Java applications on Ubuntu

javalinuxubuntunetbeanspycharm

提问by Dmitry

Help me, please. It's screen of my Netbeans:enter image description herePyCharm: enter image description hereHow can I fix it? I use Oracle Java 7. java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

请帮帮我。这是我的 Netbeans 的屏幕:在此处输入图片说明PyCharm:在此处输入图片说明我该如何修复它?我使用 Oracle Java 7. java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM(build 23.25-b01,混合模式)

PS: For comparison my Sublime Text:enter image description here

PS:为了比较我的崇高文字:在此处输入图片说明

采纳答案by Dmitry

So... Seems my problem is solved.

所以......似乎我的问题解决了。

Step 1, Install and configure Infinality for better font rendering in Linux

第 1 步,安装和配置 Infinality 以在 Linux 中更好地呈现字体

sudo add-apt-repository ppa:no1wantdthisname/ppa
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fontconfig-infinality

Step 2., Install OpenJDK7 with font fixes in Ubuntu

第 2 步,在 Ubuntu 中安装带有字体修复的 OpenJDK7

sudo add-apt-repository ppa:no1wantdthisname/openjdk-fontfix
sudo apt-get update
sudo apt-get upgrade

NetBeans: screenshot with improved fonts

网豆: 带有改进字体的屏幕截图

Step 3: Applies nice font style linux

第 3 步:应用漂亮的字体样式 linux

sudo /etc/fonts/infinality/infctl.sh setstyle linux

回答by Peter Lawrey

I suggest changing the choice of font in the program's settings. You can also install the windows fontson Ubuntu if you prefer these.

我建议更改程序设置中的字体选择。如果你喜欢这些,你也可以在 Ubuntu 上安装 Windows 字体

In both cases you should be able to chose File -> Settings and search for font and change it to whatever you like.

在这两种情况下,您都应该能够选择 File -> Settings 并搜索字体并将其更改为您喜欢的任何内容。

I use a proportional font in IntelliJ CE and it looks fine to me in Ubuntu.

我在 IntelliJ CE 中使用了比例字体,在 Ubuntu 中看起来不错。

回答by Afaria

Old topic but for future visits, here is a solution that works:

旧主题,但对于将来的访问,这是一个有效的解决方案:

# Install both infinality and fontfix'ed JDK.
sudo add-apt-repository ppa:no1wantdthisname/ppa
sudo add-apt-repository ppa:no1wantdthisname/openjdk-fontfix
sudo apt-get update
sudo apt-get install fontconfig-infinality openjdk-7-jdk
# Apply a font style that looks good.
sudo /etc/fonts/infinality/infctl.sh setstyle linux
# And reboot the system.
sudo reboot

source : Demian Ferreiro in solution

来源 : Demian Ferreiro 在解决方案中

回答by MarcB

Try adding

尝试添加

export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp'

to your ~/.bashrc

到你的 ~/.bashrc

A more detailed discussion can be found here.

更详细的讨论可以在这里找到。

回答by Ian Wong

After hours of searching and experimenting, I finally found a working solution!!! No need to mess up with fontforge, no need to patch your jdk, which is not allowed on a corporate workstation.

经过数小时的搜索和试验,我终于找到了一个可行的解决方案!!!无需搞乱 fontforge,无需修补 jdk,这在企业工作站上是不允许的。

  1. REQUIREDRemove openjdk and install oracle jdk.
  2. Download deb from http://ppa.launchpad.net/no1wantdthisname/ubuntu/pool/main/f/fontconfig-infinality/
  3. Install it: sudo dpkg -i *.deb
  4. Enable osx font smoothing: sudo /etc/fonts/infinality/infctl.sh setstyle
  5. Reboot your system sudo reboot lightgdm
  1. 必需删除 openjdk 并安装 oracle jdk。
  2. http://ppa.launchpad.net/no1wantdthisname/ubuntu/pool/main/f/fontconfig-infinality/下载 deb
  3. 安装它: sudo dpkg -i *.deb
  4. 启用 osx 字体平滑: sudo /etc/fonts/infinality/infctl.sh setstyle
  5. 重新启动系统 sudo reboot lightgdm

If you are an Android Studio (Intellij) user, try add the following lines to your studio(64).vmoptions:

如果您是 Android Studio (Intellij) 用户,请尝试将以下几行添加到您的 studio(64).vmoptions:

-Dawt.useSystemAAFontSettings=on
-Dswing.aatext=true
-Dsun.java2d.xrender=true

回答by Scott P.

As of version release 2016.1, JetBrains is including / bundling a JRE that has the font rendering corrected.

从 2016.1 版开始,JetBrains 包含/捆绑了一个已更正字体渲染的 JRE。

:)

:)

Scott

斯科特