Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent anti-aliasing (or sub-pixel rendering) of a TrueType font

This is how the .ttf font is rendered:

How the font is rendered

I have created this vector-only TrueType font using FontForge. I want to use this font on applications which require vector-based glyphs, and do not support loading .ttf embedded bitmaps (which do not seem to have this problem).

On certain color-schemes this sub-pixel rendering that Windows does makes the font completely unreadable. This effect is present in most ttf fonts, but is much stronger on fonts with pixel-perfect edges like mine.

Does anybody know any programmable hinting tricks or font-settings that will allow the font to render pixel-perfectly instead of with this red/blue halo? I would like the font to work properly without OS modifications to disable ClearType or similar.

To clarify, this is a question about leveraging the TrueType Instruction Set, or changing a TrueType font-setting (not a System/Application setting) that I have may have neglected to set properly, to make the font render legibly (if possible).

like image 485
Nowayz Avatar asked May 16 '17 11:05

Nowayz


Video Answer


1 Answers

Working Solution

Credit goes to Brian Nixon for posting the solution URL, and to Erik Olofsson for researching and posting the solution on his blog.

Erik Olofsson provides a solution that forces Windows font API to prioritize .ttf embedded bitmaps to be used with priority over glyphs when rendering.

The solution can be found in detail at http://www.electronicdissonance.com/2010/01/raster-fonts-in-visual-studio-2010.html


Solution Summary

  1. Add 'Traditional Chinese' code page to the OS/2 Panpose table.
  2. Use the 'ISO 106046-1' (Unicode, UCS-2) encoding.
  3. Include glyphs for the following seemingly random Hiragana characters:
    • い - U+3044
    • う - U+3046
    • か - U+304B
    • ひ - U+3057
    • の - U+306E
    • ん - U+3093

This list is not a joke

like image 182
2 revs Avatar answered Apr 24 '23 17:04

2 revs