Skip to content

Commit

Permalink
Merge pull request godotengine#64422 from bruvzg/make_fonts_unbearabl…
Browse files Browse the repository at this point in the history
…y_ugly_2.0
  • Loading branch information
akien-mga authored Aug 26, 2022
2 parents 354123a + bcc3643 commit 7013c68
Show file tree
Hide file tree
Showing 49 changed files with 931 additions and 301 deletions.
17 changes: 17 additions & 0 deletions doc/classes/CanvasItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/EditorSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/FontFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@
<member name="gui/theme/custom_font" type="String" setter="" getter="" default="&quot;&quot;">
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).
Expand All @@ -669,6 +669,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>
Expand Down
8 changes: 8 additions & 0 deletions doc/classes/RenderingDevice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
10 changes: 10 additions & 0 deletions doc/classes/RenderingServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/SystemFont.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
46 changes: 36 additions & 10 deletions doc/classes/TextServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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" />
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
20 changes: 10 additions & 10 deletions doc/classes/TextServerExtension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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" />
Expand Down Expand Up @@ -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">
Expand Down
Loading

0 comments on commit 7013c68

Please sign in to comment.