From 29199579f780f4f66350e1962926c08b2ddcf65b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 10 Jan 2022 10:13:22 +0200 Subject: Add sub-pixel glyph positioning support. --- doc/classes/FontData.xml | 3 +++ doc/classes/ProjectSettings.xml | 9 +++++++++ doc/classes/TextServer.xml | 34 ++++++++++++++++++++++++++++++++-- doc/classes/TextServerExtension.xml | 15 +++++++++++++++ 4 files changed, 59 insertions(+), 2 deletions(-) (limited to 'doc/classes') diff --git a/doc/classes/FontData.xml b/doc/classes/FontData.xml index 658f7dd34d..e52142e86c 100644 --- a/doc/classes/FontData.xml +++ b/doc/classes/FontData.xml @@ -600,5 +600,8 @@ Font style name. + + Font glyph sub-pixel positioning mode. Subpixel positioning provides shaper text and better kerning for smaller font sizes, at the cost of memory usage and font rasterization speed. Use [constant TextServer.SUBPIXEL_POSITIONING_AUTO] to automatically enable it based on the font size. + diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 4b5f7b2091..5e2b19606d 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -564,6 +564,15 @@ Path to a custom [Font] resource to use as default for all GUI elements of the project. + + If set to [code]true[/code], default font uses 8-bit anitialiased glyph rendering. See [member FontData.antialiased]. + + + Default font hinting mode. See [member FontData.hinting]. + + + Default font glyph sub-pixel positioning mode. See [member FontData.subpixel_positioning]. + diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml index 9025e4ff2a..e4d426deeb 100644 --- a/doc/classes/TextServer.xml +++ b/doc/classes/TextServer.xml @@ -328,6 +328,13 @@ Returns font style name. + + + + + Returns font sub-pixel glyph positioning mode. + + @@ -613,7 +620,7 @@ - + Sets font hinting mode. Used by dynamic fonts only. @@ -727,7 +734,15 @@ - Set the font style name. + Sets the font style name. + + + + + + + + Sets font sub-pixel glyph positioning mode. @@ -1493,6 +1508,21 @@ Use the default font hinting mode (crisper but less smooth). + + Glyph horizontal position is rounded to the whole pixel size, each glyph is rasterized once. + + + Glyph horizontal position is rounded based on font size. + - To one quarter of the pixel size if font size is smaller or equal to [code]16[/code]. + - To one half of the pixel size if font size is smaller or equal to [code]20[/code]. + - To the whole pixel size for larger fonts. + + + Glyph horizontal position is rounded to one half of the pixel size, each glyph is rasterized up to two times. + + + Glyph horizontal position is rounded to one quarter of the pixel size, each glyph is rasterized up to four times. + TextServer supports bidirectional layouts. diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml index b212cec5f2..3b88728ef5 100644 --- a/doc/classes/TextServerExtension.xml +++ b/doc/classes/TextServerExtension.xml @@ -328,6 +328,13 @@ Returns font style name. + + + + + Returns font sub-pixel glyph positioning mode. + + @@ -738,6 +745,14 @@ Sets the font style name. + + + + + + Sets font sub-pixel glyph positioning mode. + + -- cgit v1.2.3