From be611c1c0592d4aaa9c58f227a9c33301acd544b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 19 Apr 2022 13:27:18 +0300 Subject: Implement Label3D node. Add "generate_mipmap" font import option. Add some missing features to the Sprite3D. Move BiDi override code from Control to TextServer. Add functions to access TextServer font cache textures. Add MSDF related flags and shader to the standard material. Change standard material cache to use HashMap instead of Vector. --- doc/classes/BaseMaterial3D.xml | 14 ++- doc/classes/Control.xml | 22 ----- doc/classes/FontData.xml | 3 + doc/classes/Label.xml | 2 +- doc/classes/Label3D.xml | 173 ++++++++++++++++++++++++++++++++++++ doc/classes/LineEdit.xml | 2 +- doc/classes/LinkButton.xml | 2 +- doc/classes/RichTextLabel.xml | 4 +- doc/classes/SpriteBase3D.xml | 17 +++- doc/classes/TextEdit.xml | 2 +- doc/classes/TextServer.xml | 68 ++++++++++++++ doc/classes/TextServerExtension.xml | 41 +++++++++ doc/classes/TreeItem.xml | 4 +- 13 files changed, 322 insertions(+), 32 deletions(-) create mode 100644 doc/classes/Label3D.xml (limited to 'doc') diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml index ae7b0afaa7..4b6f6eec67 100644 --- a/doc/classes/BaseMaterial3D.xml +++ b/doc/classes/BaseMaterial3D.xml @@ -63,6 +63,9 @@ Forces a conversion of the [member albedo_texture] from sRGB space to linear space. + + Enables multichannel signed distance field rendering shader. Use [member msdf_pixel_range] and [member msdf_outline_size] to configure MSDF paramenters. + Texture to multiply by [member albedo_color]. Used for basic texturing of objects. @@ -243,6 +246,12 @@ Specifies the channel of the [member metallic_texture] in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use. + + The width of the shape outine. + + + The width of the range around the shape between the minimum and maximum representable signed distance. + If [code]true[/code], depth testing is disabled and the object will be drawn in render order. @@ -647,7 +656,10 @@ - + + Enables multichannel signed distance field rendering shader. + + Represents the size of the [enum Flags] enum. diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 78150af9dd..7e1bceb888 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -1358,27 +1358,5 @@ Right-to-left text writing direction. - - Use default behavior. Same as [code]STRUCTURED_TEXT_NONE[/code] unless specified otherwise in the control description. - - - BiDi override for URI. - - - BiDi override for file path. - - - BiDi override for email. - - - BiDi override for lists. - Structured text options: list separator [code]String[/code]. - - - Use default Unicode BiDi algorithm. - - - User defined structured text BiDi override function. - diff --git a/doc/classes/FontData.xml b/doc/classes/FontData.xml index 313e3e31fc..a423d7a4e4 100644 --- a/doc/classes/FontData.xml +++ b/doc/classes/FontData.xml @@ -582,6 +582,9 @@ If set to [code]true[/code], auto-hinting is supported and preferred over font built-in hinting. Used by dynamic fonts only. + + If set to [code]true[/code], generate mipmaps for the font textures. + Font hinting mode. Used by dynamic fonts only. diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml index b1046dea6b..d5744bbc42 100644 --- a/doc/classes/Label.xml +++ b/doc/classes/Label.xml @@ -85,7 +85,7 @@ [b]Note:[/b] Setting this property updates [member visible_characters] based on current [method get_total_character_count]. - + Set BiDi algorithm override for the structured text. diff --git a/doc/classes/Label3D.xml b/doc/classes/Label3D.xml new file mode 100644 index 0000000000..c95b691bf3 --- /dev/null +++ b/doc/classes/Label3D.xml @@ -0,0 +1,173 @@ + + + + Displays plain text in a 3D world. + + + Label3D displays plain text in a 3D world. It gives you control over the horizontal and vertical alignment. + + + + + + + + Removes all OpenType features. + + + + + + Returns a [TriangleMesh] with the label's vertices following its current configuration (such as its [member pixel_size]). + + + + + + + Returns the value of the specified flag. + + + + + + + Returns OpenType feature [code]tag[/code]. + + + + + + + + If [code]true[/code], the specified flag will be enabled. See [enum Label3D.DrawFlags] for a list of flags. + + + + + + + + Returns OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + + + + + + The alpha cutting mode to use for the sprite. See [enum AlphaCutMode] for possible values. + + + Threshold at which the alpha scissor will discard values. + + + If set to something other than [constant AUTOWRAP_OFF], the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see [enum AutowrapMode]. + + + The billboard mode to use for the label. See [enum BaseMaterial3D.BillboardMode] for possible values. + + + If [code]true[/code], text can be seen from the back as well, if [code]false[/code], it is invisible when looking at it from behind. + + + If [code]true[/code], the label is rendered at the same size regardless of distance. + + + [Font] used for the [Label3D]'s text. + + + Font size of the [Label3D]'s text. + + + Controls the text's horizontal alignment. Supports left, center, right. Set it to one of the [enum HorizontalAlignment] constants. + + + Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + + + Vertical space between lines in multiline [Label3D]. + + + Text [Color] of the [Label3D]. + + + If [code]true[/code], depth testing is disabled and the object will be drawn in render order. + + + The tint of [Font]'s outline. + + + Text outline size. + + + The size of one pixel's width on the label to scale it in 3D. + + + If [code]true[/code], the [Light3D] in the [Environment] has effects on the label. + + + Set BiDi algorithm override for the structured text. + + + Set additional options for BiDi override. + + + The text to display on screen. + + + Base text writing direction. + + + Filter flags for the texture. See [enum BaseMaterial3D.TextureFilter] for options. + + + If [code]true[/code], all the text displays as UPPERCASE. + + + Controls the text's vertical alignment. Supports top, center, bottom. Set it to one of the [enum VerticalAlignment] constants. + + + Text width (in pixels), used for autowrap and fill alignment. + + + + + Autowrap is disabled. + + + Wraps the text inside the node's bounding rectangle by allowing to break lines at arbitrary positions, which is useful when very limited space is available. + + + Wraps the text inside the node's bounding rectangle by soft-breaking between words. + + + Behaves similarly to [constant AUTOWRAP_WORD], but force-breaks a word if that single word does not fit in one line. + + + If set, lights in the environment affect the label. + + + If set, text can be seen from the back as well. If not, the texture is invisible when looking at it from behind. + + + Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it. + + + Label is scaled by depth so that it always appears the same size on screen. + + + Represents the size of the [enum DrawFlags] enum. + + + This mode performs standard alpha blending. It can display translucent areas, but transparency sorting issues may be visible when multiple transparent materials are overlapping. + + + This mode only allows fully transparent or fully opaque pixels. Harsh edges will be visible unless some form of screen-space antialiasing is enabled (see [member ProjectSettings.rendering/anti_aliasing/quality/screen_space_aa]). This mode is also known as [i]alpha testing[/i] or [i]1-bit transparency[/i]. + [b]Note:[/b] This mode might have issues with anti-aliased fonts and outlines, try adjusting [member alpha_scissor_threshold] or using MSDF font. + [b]Note:[/b] When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline. + + + This mode draws fully opaque pixels in the depth prepass. This is slower than [constant ALPHA_CUT_DISABLED] or [constant ALPHA_CUT_DISCARD], but it allows displaying translucent areas and smooth edges while using proper sorting. + [b]Note:[/b] When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline. + + + diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index 136147b4b0..55e012ee0c 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -251,7 +251,7 @@ If [code]false[/code], using shortcuts will be disabled. - + Set BiDi algorithm override for the structured text. diff --git a/doc/classes/LinkButton.xml b/doc/classes/LinkButton.xml index 3b03d86644..ba80504caf 100644 --- a/doc/classes/LinkButton.xml +++ b/doc/classes/LinkButton.xml @@ -36,7 +36,7 @@ Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. - + Set BiDi algorithm override for the structured text. diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index 02b67a4a5b..828117a847 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -342,7 +342,7 @@ - + Adds a [code][p][/code] tag to the tag stack. @@ -488,7 +488,7 @@ If [code]true[/code], shortcut keys for context menu items are enabled, even if the context menu is disabled. - + Set BiDi algorithm override for the structured text. diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml index 405fff0ce8..9733fa3a26 100644 --- a/doc/classes/SpriteBase3D.xml +++ b/doc/classes/SpriteBase3D.xml @@ -53,6 +53,9 @@ If [code]true[/code], texture can be seen from the back as well, if [code]false[/code], it is invisible when looking at it from behind. + + If [code]true[/code], the label is rendered at the same size regardless of distance. + If [code]true[/code], texture is flipped horizontally. @@ -63,6 +66,9 @@ A color value used to [i]multiply[/i] the texture's colors. Can be used for mood-coloring or to simulate the color of light. [b]Note:[/b] If a [member GeometryInstance3D.material_override] is defined on the [SpriteBase3D], the material override must be configured to take vertex colors into account for albedo. Otherwise, the color defined in [member modulate] will be ignored. For a [BaseMaterial3D], [member BaseMaterial3D.vertex_color_use_as_albedo] must be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. + + If [code]true[/code], depth testing is disabled and the object will be drawn in render order. + The texture's drawing offset. @@ -72,6 +78,9 @@ If [code]true[/code], the [Light3D] in the [Environment] has effects on the sprite. + + Filter flags for the texture. See [enum BaseMaterial3D.TextureFilter] for options. + If [code]true[/code], the texture's transparency and the opacity are used to make those parts of the sprite invisible. @@ -86,7 +95,13 @@ If set, texture can be seen from the back as well. If not, the texture is invisible when looking at it from behind. - + + Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it. + + + Label is scaled by depth so that it always appears the same size on screen. + + Represents the size of the [enum DrawFlags] enum. diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index a4edaa79c7..58fdd2d058 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -1017,7 +1017,7 @@ If [code]true[/code], shortcut keys for context menu items are enabled, even if the context menu is disabled. - + Set BiDi algorithm override for the structured text. diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml index 9ef800d7e1..dba4bd24a5 100644 --- a/doc/classes/TextServer.xml +++ b/doc/classes/TextServer.xml @@ -80,6 +80,7 @@ Draws single glyph into a canvas item at the position, using [code]font_rid[/code] at the size [code]size[/code]. [b]Note:[/b] Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index]. + [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update. @@ -94,6 +95,7 @@ Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font_rid[/code] at the size [code]size[/code]. [b]Note:[/b] Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index]. + [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update. @@ -126,6 +128,13 @@ Returns bitmap font fixed size. + + + + + Returns [code]true[/code] if font texture mipmap generation is enabled. + + @@ -199,6 +208,26 @@ Returns index of the cache texture containing the glyph. + + + + + + + Returns resource id of the cache texture containing the glyph. + [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update. + + + + + + + + + Returns size of the cache texture containing the glyph. + [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update. + + @@ -580,6 +609,14 @@ If set to [code]true[/code] auto-hinting is preferred over font built-in hinting. + + + + + + If set to [code]true[/code] font texture mipmap generation is enabled. + + @@ -927,6 +964,15 @@ Converts a number from the numeral systems used in [code]language[/code] to Western Arabic (0..9). + + + + + + + Default implementation of the BiDi algorithm override function. See [enum StructuredTextParser] for more info. + + @@ -1630,5 +1676,27 @@ Font have fixed-width characters. + + Use default behavior. Same as [code]STRUCTURED_TEXT_NONE[/code] unless specified otherwise in the control description. + + + BiDi override for URI. + + + BiDi override for file path. + + + BiDi override for email. + + + BiDi override for lists. + Structured text options: list separator [code]String[/code]. + + + Use default Unicode BiDi algorithm. + + + User defined structured text BiDi override function. + diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml index e7c5edd266..ef522d08a7 100644 --- a/doc/classes/TextServerExtension.xml +++ b/doc/classes/TextServerExtension.xml @@ -121,6 +121,13 @@ Returns bitmap font fixed size. + + + + + Returns [code]true[/code] if font texture mipmap generation is enabled. + + @@ -193,6 +200,24 @@ Returns index of the cache texture containing the glyph. + + + + + + + Returns resource id of the cache texture containing the glyph. + + + + + + + + + Returns size of the cache texture containing the glyph. + + @@ -581,6 +606,14 @@ If set to [code]true[/code] auto-hinting is preferred over font built-in hinting. + + + + + + If set to [code]true[/code] font texture mipmap generation is enabled. + + @@ -927,6 +960,14 @@ Converts a number from the numeral systems used in [code]language[/code] to Western Arabic (0..9). + + + + + + + + diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index 396be2d9f8..d2e29bf3b1 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -284,7 +284,7 @@ - + @@ -620,7 +620,7 @@ - + -- cgit v1.2.3