Skip to content

Commit

Permalink
Fill in descriptions for import options in the class reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Calinou committed Jul 13, 2023
1 parent 60f3b79 commit 66f9c60
Show file tree
Hide file tree
Showing 17 changed files with 276 additions and 11 deletions.
13 changes: 8 additions & 5 deletions doc/classes/ProjectSettings.xml
Expand Up @@ -935,23 +935,26 @@
Path to a custom [Font] resource to use as default for all GUI elements of the project.
</member>
<member name="gui/theme/default_font_antialiasing" type="int" setter="" getter="" default="1">
Font anti-aliasing mode. See [member FontFile.antialiasing].
Font anti-aliasing mode for the default project font. See [member FontFile.antialiasing].
[b]Note:[/b] This setting does not affect custom [Font]s used within the project. Use the [b]Import[/b] dock for that instead (see [member ResourceImporterDynamicFont.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).
Enabling [member gui/theme/default_font_generate_mipmaps] increases font generation time and memory usage. Only enable this setting if you actually need it.
[b]Note:[/b] This setting does not affect custom [Font]s used within the project.
[b]Note:[/b] This setting does not affect custom [Font]s used within the project. Use the [b]Import[/b] dock for that instead (see [member ResourceImporterDynamicFont.generate_mipmaps]).
</member>
<member name="gui/theme/default_font_hinting" type="int" setter="" getter="" default="1">
Default font hinting mode. See [member FontFile.hinting].
Font hinting mode for the default project font. See [member FontFile.hinting].
[b]Note:[/b] This setting does not affect custom [Font]s used within the project. Use the [b]Import[/b] dock for that instead (see [member ResourceImporterDynamicFont.hinting]).
</member>
<member name="gui/theme/default_font_multichannel_signed_distance_field" type="bool" setter="" getter="" default="false">
If set to [code]true[/code], the default font will use multichannel signed distance field (MSDF) for crisp rendering at any size. Since this approach does not rely on rasterizing the font every time its size changes, this allows for resizing the font in real-time without any performance penalty. Text will also not look grainy for [Control]s that are scaled down (or for [Label3D]s viewed from a long distance).
MSDF font rendering can be combined with [member gui/theme/default_font_generate_mipmaps] to further improve font rendering quality when scaled down.
[b]Note:[/b] This setting does not affect custom [Font]s used within the project.
[b]Note:[/b] This setting does not affect custom [Font]s used within the project. Use the [b]Import[/b] dock for that instead (see [member ResourceImporterDynamicFont.multichannel_signed_distance_field]).
</member>
<member name="gui/theme/default_font_subpixel_positioning" type="int" setter="" getter="" default="1">
Default font glyph subpixel positioning mode. See [member FontFile.subpixel_positioning].
Font glyph subpixel positioning mode for the default project font. See [member FontFile.subpixel_positioning].
[b]Note:[/b] This setting does not affect custom [Font]s used within the project. Use the [b]Import[/b] dock for that instead (see [member ResourceImporterDynamicFont.subpixel_positioning]).
</member>
<member name="gui/theme/default_theme_scale" type="float" setter="" getter="" default="1.0">
The default scale factor for [Control]s, when not overridden by a [Theme].
Expand Down
7 changes: 7 additions & 0 deletions doc/classes/ResourceImporterBMFont.xml
@@ -1,15 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceImporterBMFont" inherits="ResourceImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Imports a bitmap font in the BMFont ([code].fnt[/code]) format.
</brief_description>
<description>
The BMFont format is a format created by the [url=https://www.angelcode.com/products/bmfont/]BMFont[/url] program. Many BMFont-compatible programs also exist, like [url=https://www.bmglyph.com/]BMGlyph[/url].
Compared to [ResourceImporterImageFont], [ResourceImporterBMFont] supports bitmap fonts with varying glyph widths/heights.
See also [ResourceImporterDynamicFont].
</description>
<tutorials>
<link title="Bitmap fonts - Using fonts">$DOCS_URL/tutorials/ui/gui_using_fonts.html#bitmap-fonts</link>
</tutorials>
<members>
<member name="compress" type="bool" setter="" getter="" default="true">
If [code]true[/code], uses lossless compression for the resulting font.
</member>
<member name="fallbacks" type="Array" setter="" getter="" default="[]">
List of font fallbacks to use if a glyph isn't found in this bitmap font. Fonts are the beginning of the array are attempted first.
</member>
</members>
</class>
7 changes: 7 additions & 0 deletions doc/classes/ResourceImporterBitMap.xml
@@ -1,15 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceImporterBitMap" inherits="ResourceImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Imports a [BitMap] resource (2D array of boolean values).
</brief_description>
<description>
[BitMap] resources are typically used as click masks in [TextureButton] and [TouchScreenButton].
</description>
<tutorials>
<link title="Importing images">$DOCS_URL/tutorials/assets_pipeline/importing_images.html</link>
</tutorials>
<members>
<member name="create_from" type="int" setter="" getter="" default="0">
The data source to use for generating the bitmap.
[b]Black &amp; White:[/b] Pixels whose HSV value is greater than the [member threshold] will be considered as "enabled" (bit is [code]true[/code]). If the pixel is lower than or equal to the threshold, it will be considered as "disabled" (bit is [code]false[/code]).
[b]Alpha:[/b] Pixels whose alpha value is greater than the [member threshold] will be considered as "enabled" (bit is [code]true[/code]). If the pixel is lower than or equal to the threshold, it will be considered as "disabled" (bit is [code]false[/code]).
</member>
<member name="threshold" type="float" setter="" getter="" default="0.5">
The threshold to use to determine which bits should be considered enabled or disabled. See also [member create_from].
</member>
</members>
</class>
13 changes: 13 additions & 0 deletions doc/classes/ResourceImporterCSVTranslation.xml
@@ -1,15 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceImporterCSVTranslation" inherits="ResourceImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Imports comma-separated values
</brief_description>
<description>
Comma-separated values are a plain text table storage format. The format's simplicity makes it easy to edit in any text editor or spreadsheet software. This makes it a common choice for game localization.
[b]Example CSV file:[/b]
[codeblock]
keys,en,es,ja
GREET,"Hello, friend!","Hola, amigo!",こんにちは
ASK,How are you?,Cómo está?,元気ですか
BYE,Goodbye,Adiós,さようなら
QUOTE,"""Hello"" said the man.","""Hola"" dijo el hombre.",「こんにちは」男は言いました
[/codeblock]
</description>
<tutorials>
<link title="Importing translations">https://docs.godotengine.org/en/latest/tutorials/assets_pipeline/importing_translations.html</link>
</tutorials>
<members>
<member name="compress" type="bool" setter="" getter="" default="true">
If [code]true[/code], creates an [OptimizedTranslation] instead of a [Translation]. This makes the resulting file smaller at the cost of a small CPU overhead.
</member>
<member name="delimiter" type="int" setter="" getter="" default="0">
The delimiter to use in the CSV file. The default value matches the common CSV convention. Tab-separated values are sometimes called TSV files.
</member>
</members>
</class>
34 changes: 34 additions & 0 deletions doc/classes/ResourceImporterDynamicFont.xml
@@ -1,43 +1,77 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceImporterDynamicFont" inherits="ResourceImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Imports a TTF, OTF, WOFF or WOFF2 font file for font rendering that adapts to any size.
</brief_description>
<description>
Unlike bitmap fonts, dynamic fonts can be resized to any size and still look crisp. Dynamic fonts also optionally support MSDF font rendering, which allows for run-time scale changes with no re-rasterization cost.
While WOFF and especially WOFF2 tend to result in smaller file sizes, there is no universally "better" font format. In most situations, it's recommended to use the font format that was shipped on the font developer's website.
See also [ResourceImporterBMFont] and [ResourceImporterImageFont].
</description>
<tutorials>
<link title="Dynamic fonts - Using fonts">$DOCS_URL/tutorials/ui/gui_using_fonts.html#dynamic-fonts</link>
</tutorials>
<members>
<member name="allow_system_fallback" type="bool" setter="" getter="" default="true">
If [code]true[/code], automatically use system fonts as a fallback if a glyph isn't found in this dynamic font. This makes supporting CJK characters or emoji more straightforward, as you don't need to include a CJK/emoji font in your project. See also [member fallbacks].
[b]Note:[/b] The appearance of system fonts varies across platforms. Loading system fonts is only supported on Windows, macOS, Linux, Android and iOS.
</member>
<member name="antialiasing" type="int" setter="" getter="" default="1">
The font antialiasing method to use.
[b]Disabled:[/b] Most suited for pixel art fonts, although you do not [i]have[/i] to change the antialiasing from the default [b]Grayscale[/b] if the font file was well-created and the font is used at an integer multiple of its intended size. If pixel art fonts have a bad appearance at their intended size, try setting [member subpixel_positioning] to [b]Disabled[/b] instead.
[b]Grayscale:[/b] Use grayscale antialiasing. This is the approach used by the operating system on macOS, Android and iOS.
[b]LCD Subpixel:[/b] Use antialiasing with subpixel patterns to make fonts sharper on LCD displays. This is the approach used by the operating system on Windows and most Linux distributions. The downside is that this can introduce "fringing" on edges, especially on display technologies that don't use standard RGB subpixels (such as OLED displays). The LCD subpixel layout is globally controlled by [member ProjectSettings.gui/theme/lcd_subpixel_layout], which also allows falling back to grayscale antialiasing.
</member>
<member name="compress" type="bool" setter="" getter="" default="true">
If [code]true[/code], uses lossless compression for the resulting font.
</member>
<member name="fallbacks" type="Array" setter="" getter="" default="[]">
List of font fallbacks to use if a glyph isn't found in this dynamic font. Fonts are the beginning of the array are attempted first. See also [member allow_system_fallback].
</member>
<member name="force_autohinter" type="bool" setter="" getter="" default="false">
If [code]true[/code], forces generation of hinting data for the font using [url=https://freetype.org/]FreeType[/url]'s autohinter. This will make [member hinting] effective with fonts that don't include hinting data.
</member>
<member name="generate_mipmaps" type="bool" setter="" getter="" default="false">
If [code]true[/code], this 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).
Enabling [member generate_mipmaps] increases font generation time and memory usage. Only enable this setting if you actually need it.
</member>
<member name="hinting" type="int" setter="" getter="" default="1">
The hinting mode to use. This controls how aggressively glyph edges should be snapped to pixels when rasterizing the font. Depending on personal preference, you may prefer using one hinting mode over the other. Hinting modes other than [b]None[/b] are only effective if the font contains hinting data (see [member force_autohinter]).
[b]None:[/b] Smoothest appearance, which can make the font look blurry at small sizes.
[b]Light:[/b] Sharp result by snapping glyph edges to pixels on the Y axis only.
[b]Full:[/b] Sharpest by snapping glyph edges to pixels on both X and Y axes.
</member>
<member name="language_support" type="Dictionary" setter="" getter="" default="{}">
The list of languages supported by this font. See also [member script_support].
</member>
<member name="msdf_pixel_range" type="int" setter="" getter="" default="8">
The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, [member msdf_pixel_range] must be set to at least [i]twice[/i] the size of the largest font outline. The default [member msdf_pixel_range] value of [code]8[/code] allows outline sizes up to [code]4[/code] to look correct.
</member>
<member name="msdf_size" type="int" setter="" getter="" default="48">
Source font size used to generate MSDF textures. Higher values allow for more precision, but are slower to render and require more memory. Only increase this value if you notice a visible lack of precision in glyph rendering. Only effective if [member multichannel_signed_distance_field] is [code]true[/code].
</member>
<member name="multichannel_signed_distance_field" type="bool" setter="" getter="" default="false">
If set to [code]true[/code], the default font will use multichannel signed distance field (MSDF) for crisp rendering at any size. Since this approach does not rely on rasterizing the font every time its size changes, this allows for resizing the font in real-time without any performance penalty. Text will also not look grainy for [Control]s that are scaled down (or for [Label3D]s viewed from a long distance).
MSDF font rendering can be combined with [member generate_mipmaps] to further improve font rendering quality when scaled down.
</member>
<member name="opentype_features" type="Dictionary" setter="" getter="" default="{}">
The OpenType features to enable for this font. This can be used to enable optional features provided by the font, such as ligatures or alternative glyphs. The list of supported OpenType features varies on a per-font basis.
</member>
<member name="oversampling" type="float" setter="" getter="" default="0.0">
If set to a value greater than [code]0.0[/code], overrides the oversampling factor for the font. This can be used to render the font at a higher or lower resolution than intended without affecting its physical size. In most cases, this should be left at [code]0.0[/code].
</member>
<member name="preload" type="Array" setter="" getter="" default="[]">
The glyph ranges to prerender. This can avoid stuttering during gameplay when new characters need to be rendered, especially if [member subpixel_positioning] is enabled. The downside of using preloading is that initial project load times will increase, as well as memory usage.
</member>
<member name="script_support" type="Dictionary" setter="" getter="" default="{}">
The list of language scripts supported by this font. See also [member language_support].
</member>
<member name="subpixel_positioning" type="int" setter="" getter="" default="1">
Subpixel positioning improves font rendering appearance, especially at smaller font sizes. The downside is that it takes more time to initially render the font, which can cause stuttering during gameplay, especially if used with large font sizes. This should be set to [b]Disabled[/b] for fonts with a pixel art appearance.
[b]Disabled:[/b] No subpixel positioning. Lowest quality, fastest rendering.
[b]Auto:[/b] Use subpixel positioning at small font sizes (the chosen quality varies depending on font size). Large fonts will not use subpixel positioning. This is a good tradeoff between performance and quality.
[b]One Half of a Pixel:[/b] Always perform intermediate subpixel positioning regardless of font size. High quality, slow rendering.
[b]One Quarter of a Pixel:[/b] Always perform precise subpixel positioning regardless of font size. Highest quality, slowest rendering.
</member>
</members>
</class>
3 changes: 3 additions & 0 deletions doc/classes/ResourceImporterImage.xml
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceImporterImage" inherits="ResourceImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Imports a image for use in scripting, with no rendering capabilities.
</brief_description>
<description>
This importer imports [Image] resources, as opposed to [CompressedTexture2D]. If you need to render the image in 2D or 3D, use [ResourceImporterTexture] instead.
</description>
<tutorials>
<link title="Importing images">$DOCS_URL/tutorials/assets_pipeline/importing_images.html</link>
</tutorials>
</class>
13 changes: 13 additions & 0 deletions doc/classes/ResourceImporterImageFont.xml
@@ -1,25 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceImporterImageFont" inherits="ResourceImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Imports a fixed-width bitmap font where all glyphs have the same width and height.
</brief_description>
<description>
This image-based workflow can be easier to use than [ResourceImporterBMFont], but it requires all glyphs to have the same width and height. This makes [ResourceImporterImageFont] most suited to fixed-width fonts.
See also [ResourceImporterDynamicFont].
</description>
<tutorials>
<link title="Bitmap fonts - Using fonts">$DOCS_URL/tutorials/ui/gui_using_fonts.html#bitmap-fonts</link>
</tutorials>
<members>
<member name="character_margin" type="Rect2i" setter="" getter="" default="Rect2i(0, 0, 0, 0)">
Margin applied around every imported glyph. If your font image contains guides (in the form of lines between glyphs) or if spacing between characters appears incorrect, try adjusting [member character_margin].
</member>
<member name="character_ranges" type="PackedStringArray" setter="" getter="" default="PackedStringArray()">
The character ranges to import from the font image. This is an array that maps each position on the image (in tile coordinates, not pixels). The font atlas is traversed from left to right and top to bottom. Characters can be specified with decimal numbers (127), hexadecimal numbers ([code]0x007f[/code]) or between single quotes ([code]'~'[/code]). Ranges can be specified with a hyphen between characters.
For instance, [code]0-127[/code] (or [code]0x0000-0x007f[/code]) denotes the full ASCII range. As another example, [code]' '-'~'[/code] is equivalent to [code]32-127[/code] and denotes the range of printable (visible) ASCII characters.
Make sure [member character_ranges] doesn't exceed the number of [member columns] * [member rows] defined. Otherwise, the font will fail to import.
</member>
<member name="columns" type="int" setter="" getter="" default="1">
Number of columns in the font image. See also [member rows].
</member>
<member name="compress" type="bool" setter="" getter="" default="true">
If [code]true[/code], uses lossless compression for the resulting font.
</member>
<member name="fallbacks" type="Array" setter="" getter="" default="[]">
List of font fallbacks to use if a glyph isn't found in this bitmap font. Fonts are the beginning of the array are attempted first.
</member>
<member name="image_margin" type="Rect2i" setter="" getter="" default="Rect2i(0, 0, 0, 0)">
Margin to cut on the sides of the entire image. This can be used to cut parts of the image that contain attribution information or similar.
</member>
<member name="rows" type="int" setter="" getter="" default="1">
Number of rows in the font image. See also [member columns].
</member>
</members>
</class>

0 comments on commit 66f9c60

Please sign in to comment.