{"id":2280,"date":"2010-11-30T23:38:49","date_gmt":"2010-11-30T23:38:49","guid":{"rendered":"http:\/\/t.motd.kr\/articles\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font"},"modified":"2022-12-28T01:44:48","modified_gmt":"2022-12-27T16:44:48","slug":"how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font","status":"publish","type":"post","link":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/","title":{"rendered":"How to disable font hinting in Swing (or how to strip hints from a font)"},"content":{"rendered":"\n

In my GNOME<\/span> desktop, I disable hinting<\/a> or set hinting level to \u2018slight\u2019. The hinting level beyond \u2018slight\u2019 (i.e. \u2018moderate\u2019 or \u2018full\u2019) makes glyph look too thin to read easily. Moreover, especially when screen DPI<\/span> is high, unhinted or slightly hinted glyphs look much more beautiful than fully hinted ones:<\/p>\n\n\n\n

\"\"\/<\/figure>\n\n\n\n

If you think fully hinted one looks better or you are using Mac OS X, you are so lucky that you can skip this article. My font preference is often a problem to Java Swing based applications such as IntelliJ IDEA<\/span><\/a> (and that was always why I go back to SWT<\/span>-based Eclipse<\/a>). Although Swing uses Freetype<\/a> to render glyphs, which is the same library that GTK<\/span> uses to render glyphs, it doesn\u2019t seem to respect my font appearance settings:<\/p>\n\n\n\n

\"\"\/<\/figure>\n\n\n\n

This issue was raised a couple times in the community, but the latest OpenJDK 7 snapshot still doesn\u2019t seem to fix this issue unfortunately. Therefore, there\u2019s no way currently to disable font hinting in Sun\/Oracle JDK<\/span> or OpenJDK on Linux. What\u2019s possible is working around the problem by stripping the hinting information out from your font files so that Swing does not apply any hinting because of the missing information.<\/p>\n\n\n\n

To strip the hinting information from a TrueType font, you can use FontForge<\/a>:<\/p>\n\n\n\n

    \n
  1. Open your TTF<\/span> file with FontForge.<\/li>\n\n\n\n
  2. Press CTRL<\/span>+A to select all glyphs.<\/li>\n\n\n\n
  3. Choose Hints -> Clear Hints menu item (and wait for a while)<\/li>\n\n\n\n
  4. Choose Hints -> Clear Instructions menu item (and wait for a while)<\/li>\n\n\n\n
  5. Choose File -> Generate Fonts menu iteam and replace the existing font with the unhinted one.<\/li>\n<\/ol>\n\n\n\n

    If you don\u2019t want to replace the existing font, press CTRL<\/span>+SHIFT+F to update the metadata before the last step. A \u2018Font Information\u2019 dialog will show up and you can edit font names there.<\/p>\n\n\n\n

    Once the new fonts are generated, you can update your ~\/.fonts.conf<\/tt> to make the unhinted fonts your default desktop:<\/p>\n\n\n\n

    <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n<fontconfig>\n  <!-- Note that I actually appended 'U' to all unhinted font names -->\n  <match target=\"pattern\">\n    <test qual=\"any\" name=\"family\">\n      <string>sans-serif<\/string>\n    <\/test>\n    <edit name=\"family\" mode=\"prepend\" binding=\"strong\">\n      <string>Liberation Sans U<\/string>\n      <string>WenQuanYi Zen Hei U<\/string>\n    <\/edit>\n  <\/match>\n  <match target=\"pattern\">\n    <test qual=\"any\" name=\"family\">\n      <string>sans-serif<\/string>\n    <\/test>\n    <edit name=\"family\" mode=\"prepend\" binding=\"strong\">\n      <string>Liberation Serif U<\/string>\n      <string>WenQuanYi Zen Hei U<\/string>\n    <\/edit>\n  <\/match>\n  <match target=\"pattern\">\n    <test qual=\"any\" name=\"family\">\n      <string>monospace<\/string>\n    <\/test>\n    <edit name=\"family\" mode=\"prepend\" binding=\"strong\">\n      <string>Liberation Mono U<\/string>\n      <string>WenQuanYi Zen Hei U<\/string>\n    <\/edit>\n  <\/match>\n<\/fontconfig><\/code><\/pre>\n\n\n\n

    If configured properly, hinting will be automatically disabled for all desktop applications soon no matter what hinting option you specified because there\u2019s no hinting information in the new fonts.<\/p>\n\n\n\n

    Now open or restart your favorite Swing application and choose GTK<\/span> Look & Feel. If you have to specify the font name explicitly, choose the unhinted one (e.g. Liberation Mono U). The result is your new-born Swing application with its ever-pleasing look:<\/p>\n\n\n\n

    \"\"\/<\/figure>\n\n\n\n

    Actually, the italicized bold glyphs doesn\u2019t look perfect, but I can live with it. It would be really nice if OpenJDK delivers a proper fix in the near future, though.<\/p>\n","protected":false},"excerpt":{"rendered":"

    In my GNOME desktop, I disable hinting or set hinting level to \u2018slight\u2019. The hinting level beyond \u2018slight\u2019 (i.e. \u2018moderate\u2019 or \u2018full\u2019) makes glyph look too thin to read easily. Moreover, especially when screen DPI is high, unhinted or slightly hinted glyphs look much more beautiful than fully hinted ones: If you think fully hinted… Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"yoast_head":"How to disable font hinting in Swing (or how to strip hints from a font) — T's message of the day<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to disable font hinting in Swing (or how to strip hints from a font) — T's message of the day\" \/>\n<meta property=\"og:description\" content=\"In my GNOME desktop, I disable hinting or set hinting level to \u2018slight\u2019. The hinting level beyond \u2018slight\u2019 (i.e. \u2018moderate\u2019 or \u2018full\u2019) makes glyph look too thin to read easily. Moreover, especially when screen DPI is high, unhinted or slightly hinted glyphs look much more beautiful than fully hinted ones: If you think fully hinted... Continue reading →\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/\" \/>\n<meta property=\"og:site_name\" content=\"T's message of the day\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/trustin\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/trustin\" \/>\n<meta property=\"article:published_time\" content=\"2010-11-30T23:38:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-27T16:44:48+00:00\" \/>\n<meta name=\"author\" content=\"Trustin Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/trustin\" \/>\n<meta name=\"twitter:site\" content=\"@trustin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Trustin Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/\"},\"author\":{\"name\":\"Trustin Lee\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"headline\":\"How to disable font hinting in Swing (or how to strip hints from a font)\",\"datePublished\":\"2010-11-30T23:38:49+00:00\",\"dateModified\":\"2022-12-27T16:44:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/\"},\"wordCount\":448,\"publisher\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/\",\"name\":\"How to disable font hinting in Swing (or how to strip hints from a font) — T's message of the day\",\"isPartOf\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#website\"},\"datePublished\":\"2010-11-30T23:38:49+00:00\",\"dateModified\":\"2022-12-27T16:44:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vault.motd.kr\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to disable font hinting in Swing (or how to strip hints from a font)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#website\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/\",\"name\":\"T's message of the day\",\"description\":\"the best is yet to come\",\"publisher\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vault.motd.kr\/wordpress\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\",\"name\":\"Trustin Lee\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png\",\"contentUrl\":\"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png\",\"width\":966,\"height\":966,\"caption\":\"Trustin Lee\"},\"logo\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/t.motd.kr\/\",\"https:\/\/www.facebook.com\/trustin\",\"https:\/\/www.instagram.com\/trustinlee\/\",\"https:\/\/www.linkedin.com\/in\/trustin\",\"https:\/\/twitter.com\/https:\/\/www.twitter.com\/trustin\",\"https:\/\/www.youtube.com\/@trustinlee\"]}]}<\/script>","yoast_head_json":{"title":"How to disable font hinting in Swing (or how to strip hints from a font) — T's message of the day","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/","og_locale":"en_US","og_type":"article","og_title":"How to disable font hinting in Swing (or how to strip hints from a font) — T's message of the day","og_description":"In my GNOME desktop, I disable hinting or set hinting level to \u2018slight\u2019. The hinting level beyond \u2018slight\u2019 (i.e. \u2018moderate\u2019 or \u2018full\u2019) makes glyph look too thin to read easily. Moreover, especially when screen DPI is high, unhinted or slightly hinted glyphs look much more beautiful than fully hinted ones: If you think fully hinted... Continue reading →","og_url":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/","og_site_name":"T's message of the day","article_publisher":"https:\/\/www.facebook.com\/trustin","article_author":"https:\/\/www.facebook.com\/trustin","article_published_time":"2010-11-30T23:38:49+00:00","article_modified_time":"2022-12-27T16:44:48+00:00","author":"Trustin Lee","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/trustin","twitter_site":"@trustin","twitter_misc":{"Written by":"Trustin Lee","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/#article","isPartOf":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/"},"author":{"name":"Trustin Lee","@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"headline":"How to disable font hinting in Swing (or how to strip hints from a font)","datePublished":"2010-11-30T23:38:49+00:00","dateModified":"2022-12-27T16:44:48+00:00","mainEntityOfPage":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/"},"wordCount":448,"publisher":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/","url":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/","name":"How to disable font hinting in Swing (or how to strip hints from a font) — T's message of the day","isPartOf":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#website"},"datePublished":"2010-11-30T23:38:49+00:00","dateModified":"2022-12-27T16:44:48+00:00","breadcrumb":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2280\/how-to-disable-font-hinting-in-swing-or-how-to-strip-hints-from-a-font\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vault.motd.kr\/wordpress\/"},{"@type":"ListItem","position":2,"name":"How to disable font hinting in Swing (or how to strip hints from a font)"}]},{"@type":"WebSite","@id":"https:\/\/vault.motd.kr\/wordpress\/#website","url":"https:\/\/vault.motd.kr\/wordpress\/","name":"T's message of the day","description":"the best is yet to come","publisher":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vault.motd.kr\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d","name":"Trustin Lee","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png","contentUrl":"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png","width":966,"height":966,"caption":"Trustin Lee"},"logo":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/t.motd.kr\/","https:\/\/www.facebook.com\/trustin","https:\/\/www.instagram.com\/trustinlee\/","https:\/\/www.linkedin.com\/in\/trustin","https:\/\/twitter.com\/https:\/\/www.twitter.com\/trustin","https:\/\/www.youtube.com\/@trustinlee"]}]}},"_links":{"self":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2280"}],"collection":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/comments?post=2280"}],"version-history":[{"count":3,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2280\/revisions"}],"predecessor-version":[{"id":5928,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2280\/revisions\/5928"}],"wp:attachment":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/media?parent=2280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/categories?post=2280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/tags?post=2280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}