Subpixel-positioned text looks blurry, due to bilinear filtering of the
underlying texture. The basic idea here is to stretch the font glyphs
horizontally to increase the sharpness at subpixel positions. The
stretched images need to be smoothed to avoid aliasing artifacts; this
is done in FontFaceFreeType::BoxFilter().
Glyphs are always pixel-aligned vertically, so no vertical oversampling
is needed.
To make this feature comprehensible (I hope!) I've removed the
'subpixelGlyphPositions' flag and replaced it with a couple of values:
'fontSubpixelThreshold' sets the point at which subpixel positioning
kicks on, and 'fontOversampling' controls the amount of stretching.
The default values are 12pt text and 2x oversampling. These are fairly
conservative settings, which should improve small text without wasting
a lot of memory.
Note that when the font hint level is NORMAL (the default), subpixel
positioning and oversampling are both disabled. So, this feature doesn't
change any default behavior, and applies some hopefully sensible values
if the hint level is set to LIGHT or NONE.
When this option is enabled, text will be formatted with subpixel
(fractional) positions on the x-axis. Positions on the y-axis are
still pixel-aligned.
Note that this option has no effect if the hinting level is set
to FONT_HINT_LEVEL_NORMAL, as each glyph is rounded to an integral
pixel size by the hinter. It only makes a different if the hinting
mode is LIGHT (vertical hinting only) or NONE.
With subpixel positioning, the output will look blurrier due to
texture filtering. TODO: Add horizontal oversampling to improve
sharpness. That needs extra memory so it should be configurable.
This commit changes the 'pointSize' parameter in Font, Text
and Text3D from an int to a float, allowing e.g. 14.5pt text.
Note that when hinting is enabled, font metrics are snapped
to pixel boundaries, so the effect may be hard to see unless
you also set UI.FontHintLevel to LIGHT or NONE.
This is a change to the public API, but existing code (including
scripts) should compile and run as before.
There are three levels: NORMAL (the default), LIGHT and NONE.
The LIGHT level makes FreeType align font outlines to pixel
boundaries vertically, but not horizontally.
commit 06f4d6afab933e32eaf3428dd080766b11a87f82
Author: Lasse Öörni <loorni@gmail.com>
Date: Sun Dec 18 18:31:39 2016 +0200
Black variant of logo.
commit 8fa11f888de023fcc76f26908e2ea77ebfd3146b
Author: Lasse Öörni <loorni@gmail.com>
Date: Sun Dec 18 17:12:14 2016 +0200
New logo in Lua samples.
commit 1283e38db1164a1c1e5db7d1042feabf996031fb
Merge: 4062553 4f5a2ea
Author: Lasse Öörni <loorni@gmail.com>
Date: Sun Dec 18 16:51:04 2016 +0200
Merge remote-tracking branch 'Modanung/new-logo'
commit 4f5a2ea104feeac12b87d3fb89d116e1866c2513
Author: Modanung <frode@lindeijer.nl>
Date: Sun Dec 18 05:36:37 2016 +0100
Also replaced logo in angelscript samples
commit 7c6e5e90c4dc82705883806e46b0957a44fbc787
Author: Modanung <frode@lindeijer.nl>
Date: Sun Dec 18 03:34:31 2016 +0100
Changed logo in samples to fishbone logo