Replace global oversampling with overrideable per-viewport oversampling.

This commit is contained in:
Pāvels Nadtočajevs
2025-03-30 14:20:25 +03:00
parent 215acd52e8
commit 4afeca3bcf
38 changed files with 1235 additions and 557 deletions

View File

@@ -78,6 +78,13 @@
Removes all font sizes from the cache entry.
</description>
</method>
<method name="_font_clear_system_fallback_cache" qualifiers="virtual">
<return type="void" />
<description>
[b]Optional.[/b]
Frees all automatically loaded system fonts.
</description>
</method>
<method name="_font_clear_textures" qualifiers="virtual">
<return type="void" />
<param index="0" name="font_rid" type="RID" />
@@ -95,9 +102,10 @@
<param index="3" name="pos" type="Vector2" />
<param index="4" name="index" type="int" />
<param index="5" name="color" type="Color" />
<param index="6" name="oversampling" type="float" />
<description>
[b]Required.[/b]
Draws single glyph into a canvas item at the position, using [param font_rid] at the size [param size].
Draws single glyph into a canvas item at the position, using [param font_rid] at the size [param size]. If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.
</description>
</method>
<method name="_font_draw_glyph_outline" qualifiers="virtual const">
@@ -109,9 +117,10 @@
<param index="4" name="pos" type="Vector2" />
<param index="5" name="index" type="int" />
<param index="6" name="color" type="Color" />
<param index="7" name="oversampling" type="float" />
<description>
[b]Required.[/b]
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].
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]. If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.
</description>
</method>
<method name="_font_get_antialiasing" qualifiers="virtual const">
@@ -447,6 +456,14 @@
Returns list of script support overrides.
</description>
</method>
<method name="_font_get_size_cache_info" qualifiers="virtual const">
<return type="Dictionary[]" />
<param index="0" name="font_rid" type="RID" />
<description>
[b]Optional.[/b]
Returns font cache information, each entry contains the following fields: [code]Vector2i size_px[/code] - font size in pixels, [code]float viewport_oversampling[/code] - viewport oversampling factor, [code]int glyphs[/code] - number of rendered glyphs, [code]int textures[/code] - number of used textures, [code]int textures_size[/code] - size of texture data in bytes.
</description>
</method>
<method name="_font_get_size_cache_list" qualifiers="virtual const">
<return type="Vector2i[]" />
<param index="0" name="font_rid" type="RID" />
@@ -1315,6 +1332,14 @@
Returns percent sign used in the [param language].
</description>
</method>
<method name="_reference_oversampling_level" qualifiers="virtual">
<return type="void" />
<param index="0" name="oversampling" type="float" />
<description>
[b]Required.[/b]
Increases the reference count of the specified oversampling level. This method is called by [Viewport], and should not be used directly.
</description>
</method>
<method name="_save_support_data" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="filename" type="String" />
@@ -1510,9 +1535,10 @@
<param index="3" name="clip_l" type="float" />
<param index="4" name="clip_r" type="float" />
<param index="5" name="color" type="Color" />
<param index="6" name="oversampling" type="float" />
<description>
[b]Optional.[/b]
Draw shaped text into a canvas item at a given position, with [param color]. [param pos] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout).
Draw shaped text into a canvas item at a given position, with [param color]. [param pos] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.
</description>
</method>
<method name="_shaped_text_draw_outline" qualifiers="virtual const">
@@ -1524,9 +1550,10 @@
<param index="4" name="clip_r" type="float" />
<param index="5" name="outline_size" type="int" />
<param index="6" name="color" type="Color" />
<param index="7" name="oversampling" type="float" />
<description>
[b]Optional.[/b]
Draw the outline of the shaped text into a canvas item at a given position, with [param color]. [param pos] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout).
Draw the outline of the shaped text into a canvas item at a given position, with [param color]. [param pos] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.
</description>
</method>
<method name="_shaped_text_fit_to_width" qualifiers="virtual">
@@ -2109,5 +2136,13 @@
Converts OpenType tag to readable feature, variation, script, or language name.
</description>
</method>
<method name="_unreference_oversampling_level" qualifiers="virtual">
<return type="void" />
<param index="0" name="oversampling" type="float" />
<description>
[b]Required.[/b]
Decreases the reference count of the specified oversampling level, and frees the font cache for oversampling level when the reference count reaches zero. This method is called by [Viewport], and should not be used directly.
</description>
</method>
</methods>
</class>