From bcc3643989762a6814f1f0c5a4b63a0e66d6286c Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Fri, 12 Aug 2022 14:03:28 +0300 Subject: Add font LCD sub-pixel anti-aliasing support. --- doc/classes/CanvasItem.xml | 17 ++++++++++++++ doc/classes/EditorSettings.xml | 4 ++-- doc/classes/FontFile.xml | 4 ++-- doc/classes/ProjectSettings.xml | 7 ++++-- doc/classes/RenderingDevice.xml | 8 +++++++ doc/classes/RenderingServer.xml | 10 ++++++++ doc/classes/SystemFont.xml | 4 ++-- doc/classes/TextServer.xml | 46 +++++++++++++++++++++++++++++-------- doc/classes/TextServerExtension.xml | 20 ++++++++-------- 9 files changed, 92 insertions(+), 28 deletions(-) (limited to 'doc/classes') diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index fe1fe498d1..36f49a5a8e 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -107,6 +107,23 @@ After submitting all animations slices via [method draw_animation_slice], this function can be used to revert drawing to its default state (all subsequent drawing commands will be visible). If you don't care about this particular use case, usage of this function after submitting the slices is not required. + + + + + + + + Draws a textured rectangle region of the font texture with LCD sub-pixel anti-aliasing at a given position, optionally modulated by a color. + Texture is drawn using the following blend operation, blend mode of the [CanvasItemMaterial] is ignored: + [codeblock] + dst.r = texture.r * modulate.r * modulate.a + dst.r * (1.0 - texture.r * modulate.a); + dst.g = texture.g * modulate.g * modulate.a + dst.g * (1.0 - texture.g * modulate.a); + dst.b = texture.b * modulate.b * modulate.a + dst.b * (1.0 - texture.b * modulate.a); + dst.a = modulate.a + dst.a * (1.0 - modulate.a); + [/codeblock] + + diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 033f63c5ce..5c27a9c645 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -495,8 +495,8 @@ The language to use for the editor interface. Translations are provided by the community. If you spot a mistake, [url=https://docs.godotengine.org/en/latest/community/contributing/editor_and_docs_localization.html]contribute to editor translations on Weblate![/url] - - If [code]true[/code], enables FreeType's font antialiasing on the editor fonts. Most fonts are not designed to look good with antialiasing disabled, so it's recommended to leave this enabled unless you're using a pixel art font. + + FreeType's font anti-aliasing mode used to render the editor fonts. Most fonts are not designed to look good with anti-aliasing disabled, so it's recommended to leave this enabled unless you're using a pixel art font. The font hinting mode to use for the editor fonts. FreeType supports the following font hinting modes: diff --git a/doc/classes/FontFile.xml b/doc/classes/FontFile.xml index 0f229ea19a..4c82ead1de 100644 --- a/doc/classes/FontFile.xml +++ b/doc/classes/FontFile.xml @@ -543,8 +543,8 @@ - - If set to [code]true[/code], font 8-bit anitialiased glyph rendering is supported and enabled. + + Font anti-aliasing mode. Contents of the dynamic font source file. diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 0cee71b613..45b56622d2 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -651,8 +651,8 @@ 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 FontFile.antialiased]. + + Font anti-aliasing mode. See [member FontFile.antialiasing], If set to [code]true[/code], the default font will have mipmaps generated. This prevents text from looking grainy when a [Control] is scaled down, or when a [Label3D] is viewed from a long distance (if [member Label3D.texture_filter] is set to a mode that displays mipmaps). @@ -672,6 +672,9 @@ + + LCD sub-pixel layout used for font anti-aliasing. See [enum TextServer.FontLCDSubpixelLayout]. + Timer setting for incremental search in [Tree], [ItemList], etc. controls (in milliseconds). diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index 2f0b9dae72..718a161323 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -227,6 +227,14 @@ + + + + + + Sets blend constants for draw list, blend constants are used only if the graphics pipeline is created with [code]DYNAMIC_STATE_BLEND_CONSTANTS[/code] flag set. + + diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 62351ea9ec..855a55b4e2 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -176,6 +176,16 @@ + + + + + + + + + + diff --git a/doc/classes/SystemFont.xml b/doc/classes/SystemFont.xml index b7454cc7d2..c235843f3b 100644 --- a/doc/classes/SystemFont.xml +++ b/doc/classes/SystemFont.xml @@ -13,8 +13,8 @@ - - If set to [code]true[/code], font 8-bit anitialiased glyph rendering is supported and enabled. + + Font anti-aliasing mode. Array of fallback [Font]s. diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml index ee3c87b8e6..55d7e8ff2b 100644 --- a/doc/classes/TextServer.xml +++ b/doc/classes/TextServer.xml @@ -98,6 +98,13 @@ [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update. + + + + + Returns font anti-aliasing mode. + + @@ -447,13 +454,6 @@ Returns [code]true[/code] if a Unicode [param char] is available in the font. - - - - - Returns [code]true[/code] if font 8-bit anitialiased glyph rendering is supported and enabled. - - @@ -556,12 +556,12 @@ Renders the range of characters to the font cache texture. - + - + - If set to [code]true[/code], 8-bit antialiased glyph rendering is used, otherwise 1-bit rendering is used. Used by dynamic fonts only. + Sets font anti-aliasing mode. @@ -1539,6 +1539,32 @@ + + Font glyphs are rasterized as 1-bit bitmaps. + + + Font glyphs are rasterized as 8-bit grayscale anti-aliased bitmaps. + + + Font glyphs are rasterized for LCD screens. + LCD sub-pixel layout is determined by the value of [code]gui/theme/lcd_subpixel_layout[/code] project settings. + LCD sub-pixel anti-aliasing mode is suitable only for rendering horizontal, unscaled text in 2D. + + + Unknown or unsupported sub-pixel layout, LCD sub-pixel anti-aliasing is disabled. + + + Horizontal RGB sub-pixel layout. + + + Horizontal BGR sub-pixel layout. + + + Vertical RGB sub-pixel layout. + + + Vertical BGR sub-pixel layout. + Text direction is determined based on contents and current locale. diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml index 219052d3d5..cfac266ad2 100644 --- a/doc/classes/TextServerExtension.xml +++ b/doc/classes/TextServerExtension.xml @@ -91,6 +91,13 @@ Draws single glyph outline of size [param outline_size] into a canvas item at the position, using [param font_rid] at the size [param size]. + + + + + Returns font anti-aliasing mode. + + @@ -437,13 +444,6 @@ Returns [code]true[/code] if a Unicode [param char] is available in the font. - - - - - Returns [code]true[/code] if font 8-bit anitialiased glyph rendering is supported and enabled. - - @@ -544,12 +544,12 @@ Renders the range of characters to the font cache texture. - + - + - If set to [code]true[/code], 8-bit antialiased glyph rendering is used, otherwise 1-bit rendering is used. Used by dynamic fonts only. + Sets font anti-aliasing mode. -- cgit v1.2.3