diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-08-12 14:03:28 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-08-23 08:47:21 +0300 |
commit | bcc3643989762a6814f1f0c5a4b63a0e66d6286c (patch) | |
tree | 186cddd06e0dcadddc04214954fe8e19f6f3f2ba /doc/classes | |
parent | 230225d360ee152e9ed6120b62af915e9a844d04 (diff) |
Add font LCD sub-pixel anti-aliasing support.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/CanvasItem.xml | 17 | ||||
-rw-r--r-- | doc/classes/EditorSettings.xml | 4 | ||||
-rw-r--r-- | doc/classes/FontFile.xml | 4 | ||||
-rw-r--r-- | doc/classes/ProjectSettings.xml | 7 | ||||
-rw-r--r-- | doc/classes/RenderingDevice.xml | 8 | ||||
-rw-r--r-- | doc/classes/RenderingServer.xml | 10 | ||||
-rw-r--r-- | doc/classes/SystemFont.xml | 4 | ||||
-rw-r--r-- | doc/classes/TextServer.xml | 46 | ||||
-rw-r--r-- | doc/classes/TextServerExtension.xml | 20 |
9 files changed, 92 insertions, 28 deletions
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. </description> </method> + <method name="draw_lcd_texture_rect_region"> + <return type="void" /> + <param index="0" name="texture" type="Texture2D" /> + <param index="1" name="rect" type="Rect2" /> + <param index="2" name="src_rect" type="Rect2" /> + <param index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" /> + <description> + 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] + </description> + </method> <method name="draw_line"> <return type="void" /> <param index="0" name="from" type="Vector2" /> 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] </member> - <member name="interface/editor/font_antialiased" type="bool" setter="" getter=""> - 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. + <member name="interface/editor/font_antialiasing" type="int" setter="" getter=""> + 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. </member> <member name="interface/editor/font_hinting" type="int" setter="" getter=""> 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 @@ </method> </methods> <members> - <member name="antialiased" type="bool" setter="set_antialiased" getter="is_antialiased" default="true"> - If set to [code]true[/code], font 8-bit anitialiased glyph rendering is supported and enabled. + <member name="antialiasing" type="int" setter="set_antialiasing" getter="get_antialiasing" enum="TextServer.FontAntialiasing" default="1"> + Font anti-aliasing mode. </member> <member name="data" type="PackedByteArray" setter="set_data" getter="get_data" default="PackedByteArray()"> 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 @@ <member name="gui/theme/custom_font" type="String" setter="" getter="" default=""""> Path to a custom [Font] resource to use as default for all GUI elements of the project. </member> - <member name="gui/theme/default_font_antialiased" type="bool" setter="" getter="" default="true"> - If set to [code]true[/code], default font uses 8-bit anitialiased glyph rendering. See [member FontFile.antialiased]. + <member name="gui/theme/default_font_antialiasing" type="int" setter="" getter="" default="1"> + Font anti-aliasing mode. See [member FontFile.antialiasing], </member> <member name="gui/theme/default_font_generate_mipmaps" type="bool" setter="" getter="" default="false"> 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 @@ </member> <member name="gui/theme/default_theme_scale" type="float" setter="" getter="" default="1.0"> </member> + <member name="gui/theme/lcd_subpixel_layout" type="int" setter="" getter="" default="1"> + LCD sub-pixel layout used for font anti-aliasing. See [enum TextServer.FontLCDSubpixelLayout]. + </member> <member name="gui/timers/incremental_search_max_interval_msec" type="int" setter="" getter="" default="2000"> Timer setting for incremental search in [Tree], [ItemList], etc. controls (in milliseconds). </member> 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 @@ <description> </description> </method> + <method name="draw_list_set_blend_constants"> + <return type="void" /> + <param index="0" name="draw_list" type="int" /> + <param index="1" name="color" type="Color" /> + <description> + 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. + </description> + </method> <method name="draw_list_set_push_constant"> <return type="void" /> <param index="0" name="draw_list" type="int" /> 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 @@ <description> </description> </method> + <method name="canvas_item_add_lcd_texture_rect_region"> + <return type="void" /> + <param index="0" name="item" type="RID" /> + <param index="1" name="rect" type="Rect2" /> + <param index="2" name="texture" type="RID" /> + <param index="3" name="src_rect" type="Rect2" /> + <param index="4" name="modulate" type="Color" /> + <description> + </description> + </method> <method name="canvas_item_add_line"> <return type="void" /> <param index="0" name="item" type="RID" /> 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 @@ <tutorials> </tutorials> <members> - <member name="antialiased" type="bool" setter="set_antialiased" getter="is_antialiased" default="true"> - If set to [code]true[/code], font 8-bit anitialiased glyph rendering is supported and enabled. + <member name="antialiasing" type="int" setter="set_antialiasing" getter="get_antialiasing" enum="TextServer.FontAntialiasing" default="1"> + Font anti-aliasing mode. </member> <member name="fallbacks" type="Font[]" setter="set_fallbacks" getter="get_fallbacks" default="[]"> 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. </description> </method> + <method name="font_get_antialiasing" qualifiers="const"> + <return type="int" enum="TextServer.FontAntialiasing" /> + <param index="0" name="font_rid" type="RID" /> + <description> + Returns font anti-aliasing mode. + </description> + </method> <method name="font_get_ascent" qualifiers="const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> @@ -447,13 +454,6 @@ Returns [code]true[/code] if a Unicode [param char] is available in the font. </description> </method> - <method name="font_is_antialiased" qualifiers="const"> - <return type="bool" /> - <param index="0" name="font_rid" type="RID" /> - <description> - Returns [code]true[/code] if font 8-bit anitialiased glyph rendering is supported and enabled. - </description> - </method> <method name="font_is_force_autohinter" qualifiers="const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> @@ -556,12 +556,12 @@ Renders the range of characters to the font cache texture. </description> </method> - <method name="font_set_antialiased"> + <method name="font_set_antialiasing"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> - <param index="1" name="antialiased" type="bool" /> + <param index="1" name="antialiasing" type="int" enum="TextServer.FontAntialiasing" /> <description> - 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. </description> </method> <method name="font_set_ascent"> @@ -1539,6 +1539,32 @@ </method> </methods> <constants> + <constant name="FONT_ANTIALIASING_NONE" value="0" enum="FontAntialiasing"> + Font glyphs are rasterized as 1-bit bitmaps. + </constant> + <constant name="FONT_ANTIALIASING_GRAY" value="1" enum="FontAntialiasing"> + Font glyphs are rasterized as 8-bit grayscale anti-aliased bitmaps. + </constant> + <constant name="FONT_ANTIALIASING_LCD" value="2" enum="FontAntialiasing"> + 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. + </constant> + <constant name="FONT_LCD_SUBPIXEL_LAYOUT_NONE" value="0" enum="FontLCDSubpixelLayout"> + Unknown or unsupported sub-pixel layout, LCD sub-pixel anti-aliasing is disabled. + </constant> + <constant name="FONT_LCD_SUBPIXEL_LAYOUT_HRGB" value="1" enum="FontLCDSubpixelLayout"> + Horizontal RGB sub-pixel layout. + </constant> + <constant name="FONT_LCD_SUBPIXEL_LAYOUT_HBGR" value="2" enum="FontLCDSubpixelLayout"> + Horizontal BGR sub-pixel layout. + </constant> + <constant name="FONT_LCD_SUBPIXEL_LAYOUT_VRGB" value="3" enum="FontLCDSubpixelLayout"> + Vertical RGB sub-pixel layout. + </constant> + <constant name="FONT_LCD_SUBPIXEL_LAYOUT_VBGR" value="4" enum="FontLCDSubpixelLayout"> + Vertical BGR sub-pixel layout. + </constant> <constant name="DIRECTION_AUTO" value="0" enum="Direction"> Text direction is determined based on contents and current locale. </constant> 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]. </description> </method> + <method name="font_get_antialiasing" qualifiers="virtual const"> + <return type="int" enum="TextServer.FontAntialiasing" /> + <param index="0" name="font_rid" type="RID" /> + <description> + Returns font anti-aliasing mode. + </description> + </method> <method name="font_get_ascent" qualifiers="virtual const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> @@ -437,13 +444,6 @@ Returns [code]true[/code] if a Unicode [param char] is available in the font. </description> </method> - <method name="font_is_antialiased" qualifiers="virtual const"> - <return type="bool" /> - <param index="0" name="font_rid" type="RID" /> - <description> - Returns [code]true[/code] if font 8-bit anitialiased glyph rendering is supported and enabled. - </description> - </method> <method name="font_is_force_autohinter" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> @@ -544,12 +544,12 @@ Renders the range of characters to the font cache texture. </description> </method> - <method name="font_set_antialiased" qualifiers="virtual"> + <method name="font_set_antialiasing" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> - <param index="1" name="antialiased" type="bool" /> + <param index="1" name="antialiasing" type="int" enum="TextServer.FontAntialiasing" /> <description> - 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. </description> </method> <method name="font_set_ascent" qualifiers="virtual"> |