Ugly/Non Anti-Aliased fonts in Java-Swing Applications











up vote
9
down vote

favorite
1












I've recently switched to Ubuntu and I've installed Oracle's Java JDK 8u45 (32 bit) using the webupd8team/java repository.



Everything seems to be working fine except that the Java-Swing applications are having broken and ugly fonts with no anti-aliasing. Changing the font doesn't work. Native applications like Gedit though having the same font are not affected (nor are non-Swing Java-applications like Eclipse); its only affecting Swing-based applications.



Screenshots:
(jEdit v5.1)



Screenshot of jEdit



I'm running Ubuntu 15.04 (which is the latest version as of 2015-06-15). My Java version is 1.8.0_45 and 'java -version' gives the following output:



java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)


I've tried the fixes given in similar questions (here and on other stackexchange sites) but they do not work. I've also added the following lines in the /etc/environment (as given here: https://wiki.archlinux.org/index.php/Java_Runtime_Environment_Fonts) but they are not giving me any apparent results.



JAVA_FONTS=/usr/share/fonts/truetype
_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'


I'm sure there must be a fix for this. The same Java-Applications are working as they should on Windows-7.










share|improve this question




























    up vote
    9
    down vote

    favorite
    1












    I've recently switched to Ubuntu and I've installed Oracle's Java JDK 8u45 (32 bit) using the webupd8team/java repository.



    Everything seems to be working fine except that the Java-Swing applications are having broken and ugly fonts with no anti-aliasing. Changing the font doesn't work. Native applications like Gedit though having the same font are not affected (nor are non-Swing Java-applications like Eclipse); its only affecting Swing-based applications.



    Screenshots:
    (jEdit v5.1)



    Screenshot of jEdit



    I'm running Ubuntu 15.04 (which is the latest version as of 2015-06-15). My Java version is 1.8.0_45 and 'java -version' gives the following output:



    java version "1.8.0_45"
    Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
    Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)


    I've tried the fixes given in similar questions (here and on other stackexchange sites) but they do not work. I've also added the following lines in the /etc/environment (as given here: https://wiki.archlinux.org/index.php/Java_Runtime_Environment_Fonts) but they are not giving me any apparent results.



    JAVA_FONTS=/usr/share/fonts/truetype
    _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'


    I'm sure there must be a fix for this. The same Java-Applications are working as they should on Windows-7.










    share|improve this question


























      up vote
      9
      down vote

      favorite
      1









      up vote
      9
      down vote

      favorite
      1






      1





      I've recently switched to Ubuntu and I've installed Oracle's Java JDK 8u45 (32 bit) using the webupd8team/java repository.



      Everything seems to be working fine except that the Java-Swing applications are having broken and ugly fonts with no anti-aliasing. Changing the font doesn't work. Native applications like Gedit though having the same font are not affected (nor are non-Swing Java-applications like Eclipse); its only affecting Swing-based applications.



      Screenshots:
      (jEdit v5.1)



      Screenshot of jEdit



      I'm running Ubuntu 15.04 (which is the latest version as of 2015-06-15). My Java version is 1.8.0_45 and 'java -version' gives the following output:



      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)


      I've tried the fixes given in similar questions (here and on other stackexchange sites) but they do not work. I've also added the following lines in the /etc/environment (as given here: https://wiki.archlinux.org/index.php/Java_Runtime_Environment_Fonts) but they are not giving me any apparent results.



      JAVA_FONTS=/usr/share/fonts/truetype
      _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'


      I'm sure there must be a fix for this. The same Java-Applications are working as they should on Windows-7.










      share|improve this question















      I've recently switched to Ubuntu and I've installed Oracle's Java JDK 8u45 (32 bit) using the webupd8team/java repository.



      Everything seems to be working fine except that the Java-Swing applications are having broken and ugly fonts with no anti-aliasing. Changing the font doesn't work. Native applications like Gedit though having the same font are not affected (nor are non-Swing Java-applications like Eclipse); its only affecting Swing-based applications.



      Screenshots:
      (jEdit v5.1)



      Screenshot of jEdit



      I'm running Ubuntu 15.04 (which is the latest version as of 2015-06-15). My Java version is 1.8.0_45 and 'java -version' gives the following output:



      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)


      I've tried the fixes given in similar questions (here and on other stackexchange sites) but they do not work. I've also added the following lines in the /etc/environment (as given here: https://wiki.archlinux.org/index.php/Java_Runtime_Environment_Fonts) but they are not giving me any apparent results.



      JAVA_FONTS=/usr/share/fonts/truetype
      _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'


      I'm sure there must be a fix for this. The same Java-Applications are working as they should on Windows-7.







      java fonts jdk






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 3 at 6:24

























      asked Jun 15 '15 at 11:03









      hexman

      456316




      456316






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          8
          down vote



          accepted










          This problem has long been fixed so I decided I should post the solution. Note that the problem is still there by default but it can be fixed by a parameter.



          Adding this line:



          _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'


          to /etc/environment fixes the issue.



          This fix works as of Ubuntu 16.04 and OpenJDK 8u151 (haven't checked with Oracle JDK or Java 9).



          Working example:
          enter image description here



          Note: Some fonts and AA settings complicate the problem. In jEdit, I use the default Java fonts ("Dialog" as it's called) for everything. You can probably use a different font for the Text-Area but Dialog is the best for buttons, etc. The best Text-Area AA setting I've found is standard but your mileage may vary.






          share|improve this answer

















          • 1




            Your solution works great!
            – Nadav B
            Apr 18 at 14:39










          • Again needed as of Ubuntu 18.10 and OpenJDK 11. And still working! :)
            – tanius
            Nov 30 at 1:51











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f636666%2fugly-non-anti-aliased-fonts-in-java-swing-applications%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          8
          down vote



          accepted










          This problem has long been fixed so I decided I should post the solution. Note that the problem is still there by default but it can be fixed by a parameter.



          Adding this line:



          _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'


          to /etc/environment fixes the issue.



          This fix works as of Ubuntu 16.04 and OpenJDK 8u151 (haven't checked with Oracle JDK or Java 9).



          Working example:
          enter image description here



          Note: Some fonts and AA settings complicate the problem. In jEdit, I use the default Java fonts ("Dialog" as it's called) for everything. You can probably use a different font for the Text-Area but Dialog is the best for buttons, etc. The best Text-Area AA setting I've found is standard but your mileage may vary.






          share|improve this answer

















          • 1




            Your solution works great!
            – Nadav B
            Apr 18 at 14:39










          • Again needed as of Ubuntu 18.10 and OpenJDK 11. And still working! :)
            – tanius
            Nov 30 at 1:51















          up vote
          8
          down vote



          accepted










          This problem has long been fixed so I decided I should post the solution. Note that the problem is still there by default but it can be fixed by a parameter.



          Adding this line:



          _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'


          to /etc/environment fixes the issue.



          This fix works as of Ubuntu 16.04 and OpenJDK 8u151 (haven't checked with Oracle JDK or Java 9).



          Working example:
          enter image description here



          Note: Some fonts and AA settings complicate the problem. In jEdit, I use the default Java fonts ("Dialog" as it's called) for everything. You can probably use a different font for the Text-Area but Dialog is the best for buttons, etc. The best Text-Area AA setting I've found is standard but your mileage may vary.






          share|improve this answer

















          • 1




            Your solution works great!
            – Nadav B
            Apr 18 at 14:39










          • Again needed as of Ubuntu 18.10 and OpenJDK 11. And still working! :)
            – tanius
            Nov 30 at 1:51













          up vote
          8
          down vote



          accepted







          up vote
          8
          down vote



          accepted






          This problem has long been fixed so I decided I should post the solution. Note that the problem is still there by default but it can be fixed by a parameter.



          Adding this line:



          _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'


          to /etc/environment fixes the issue.



          This fix works as of Ubuntu 16.04 and OpenJDK 8u151 (haven't checked with Oracle JDK or Java 9).



          Working example:
          enter image description here



          Note: Some fonts and AA settings complicate the problem. In jEdit, I use the default Java fonts ("Dialog" as it's called) for everything. You can probably use a different font for the Text-Area but Dialog is the best for buttons, etc. The best Text-Area AA setting I've found is standard but your mileage may vary.






          share|improve this answer












          This problem has long been fixed so I decided I should post the solution. Note that the problem is still there by default but it can be fixed by a parameter.



          Adding this line:



          _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'


          to /etc/environment fixes the issue.



          This fix works as of Ubuntu 16.04 and OpenJDK 8u151 (haven't checked with Oracle JDK or Java 9).



          Working example:
          enter image description here



          Note: Some fonts and AA settings complicate the problem. In jEdit, I use the default Java fonts ("Dialog" as it's called) for everything. You can probably use a different font for the Text-Area but Dialog is the best for buttons, etc. The best Text-Area AA setting I've found is standard but your mileage may vary.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 24 '17 at 16:20









          hexman

          456316




          456316








          • 1




            Your solution works great!
            – Nadav B
            Apr 18 at 14:39










          • Again needed as of Ubuntu 18.10 and OpenJDK 11. And still working! :)
            – tanius
            Nov 30 at 1:51














          • 1




            Your solution works great!
            – Nadav B
            Apr 18 at 14:39










          • Again needed as of Ubuntu 18.10 and OpenJDK 11. And still working! :)
            – tanius
            Nov 30 at 1:51








          1




          1




          Your solution works great!
          – Nadav B
          Apr 18 at 14:39




          Your solution works great!
          – Nadav B
          Apr 18 at 14:39












          Again needed as of Ubuntu 18.10 and OpenJDK 11. And still working! :)
          – tanius
          Nov 30 at 1:51




          Again needed as of Ubuntu 18.10 and OpenJDK 11. And still working! :)
          – tanius
          Nov 30 at 1:51


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f636666%2fugly-non-anti-aliased-fonts-in-java-swing-applications%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How did Captain America manage to do this?

          迪纳利

          南乌拉尔铁路局