Font Consolas in Pycharm is being rendered in a weird way

后端 未结 2 905
一整个雨季
一整个雨季 2021-02-09 02:45

On the picture below Consolas 10pt in Font Manager and in Pycharm 2.7.2 In Pycharm it became small and bold-ish Is there a way to render it similar to Windows style?

相关标签:
2条回答
  • 2021-02-09 03:43

    I replaced OpenJDK with tuxJDK which works for me perfectly.

    Here's a screenshot,

    To install,

    1. Download the JDK with wget or any httpclient.

      wget https://googledrive.com/host/0B68yuEpDuq6waUl5UjNTUWRlYTQ/jdk-8u5-tuxjdk-b08.tar.xz
      
    2. Extract downloaded JDK

      tar -xvf jdk-8u5-tuxjdk-b08.tar.xz
      
    3. Move extracted files to /usr/lib/jvm

      sudo mv jdk-8u5-tuxjdk-b08 /usr/lib/jvm
      
    4. set priorities to tuxjdk as 1

      sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-8u5-tuxjdk-b08/bin/java" 1
      
      sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-8u5-tuxjdk-b08/bin/javac" 1
      
    5. Correct permissions and ownership

      sudo chmod a+x /usr/bin/java
      sudo chmod a+x /usr/bin/javac
      sudo chown -R root:root /usr/lib/jvm/jdk-8u5-tuxjdk-b08/
      
    6. Now setup the defaults,

      sudo update-alternatives --config java
      

      if the terminal shows "There is nothing to configure" quit this step.
      it will prompt a selection window as shown below,

      There are 2 choices for the alternative java (providing /usr/bin/java).
      
        Selection    Path                                            Priority   Status
      ------------------------------------------------------------
        0            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      auto mode
        1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
      * 2            /usr/lib/jvm/jdk-8u5-tuxjdk-b08/bin/java         1         manual mode
      
      Press <enter> to keep the current choice[*], or type selection number: 
      

      enter the selection number adjacent to tuxjdk (here 2).
      do the same for javac and select tuxjdk if it exists.

      sudo update-alternatives --config javac
      
    0 讨论(0)
  • 2021-02-09 03:46

    It's a problem with OpenJDK's font rendering. So all you need is to swap OpenJDK to Sun JDK and fonts will look normal.

    Here's how you do it:

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
    

    After the installation finishes, if you wish to see if it was successful, you can run the following command:

    java -version
    

    It should return something like this:

    java version "1.7.0_10"
    Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
    Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
    

    To automatically set up the Java 7 environment variables, you can install the following package:

    sudo apt-get install oracle-java7-set-default
    

    How to install Oracle JDK in Ubuntu

    UPD

    I forgot the main thing. In your .profile, enter this:

    export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=lcd_hrgb -Dswing.aatext=true -Dsun.java2d.xrender=true'
    

    Alternatively, if you want to set font settings to specific applications, in this case, pycharm - instead of modifying .profile, you can edit pycharm/bin/pycharm64.vmoptions file and add this:

    -Dawt.useSystemAAFontSettings=lcd_hrgb
    -Dswing.aatext=true
    -Dsun.java2d.xrender=true
    
    0 讨论(0)
提交回复
热议问题