Documentation
¶
Overview ¶
FontFile contains a set of glyphs to represent Unicode characters imported from a font file, as well as a cache of rasterized glyphs, and a set of fallback Fonts to use.
Use FontVariation to access specific OpenType variation of the font, create simulated bold / slanted version, and draw lines of text.
For more complex text processing, use FontVariation in conjunction with TextLine or TextParagraph.
Supported font formats:
- Dynamic font importer: TrueType (.ttf), TrueType collection (.ttc), OpenType (.otf), OpenType collection (.otc), WOFF (.woff), WOFF2 (.woff2), Type 1 (.pfb, .pfm).
- Bitmap font importer: AngelCode BMFont (.fnt, .font), text and binary (version 3) format variants.
- Monospace image font importer: All supported image formats.
Note: A character is a symbol that represents an item (letter, digit etc.) in an abstract way.
Note: A glyph is a bitmap or a shape used to draw one or more characters in a context-dependent manner. Glyph indices are bound to the specific font data source.
Note: If none of the font data sources contain glyphs for a character used in a string, the character in question will be replaced with a box displaying its hexadecimal code.
package main import ( "graphics.gd/classdb/FontFile" "graphics.gd/classdb/Label" "graphics.gd/classdb/Resource" ) func ExampleFontFile(label Label.Instance) { var f = Resource.Load[FontFile.Instance]("res://BarlowCondensed-Bold.ttf") label.AsControl().AddThemeFontOverride("font", f.AsFont()) label.AsControl().AddThemeFontSizeOverride("font_size", 64) }
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AllowSystemFallback() bool
- func (self Instance) Antialiasing() TextServer.FontAntialiasing
- func (self Instance) AsFont() Font.Instance
- func (self Instance) AsFontFile() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) ClearCache()
- func (self Instance) ClearGlyphs(cache_index int, size Vector2i.XY)
- func (self Instance) ClearKerningMap(cache_index int, size int)
- func (self Instance) ClearSizeCache(cache_index int)
- func (self Instance) ClearTextures(cache_index int, size Vector2i.XY)
- func (self Instance) Data() []byte
- func (self Instance) DisableEmbeddedBitmaps() bool
- func (self Instance) FixedSize() int
- func (self Instance) FixedSizeScaleMode() TextServer.FixedSizeScaleMode
- func (self Instance) ForceAutohinter() bool
- func (self Instance) GenerateMipmaps() bool
- func (self Instance) GetCacheAscent(cache_index int, size int) Float.X
- func (self Instance) GetCacheCount() int
- func (self Instance) GetCacheDescent(cache_index int, size int) Float.X
- func (self Instance) GetCacheScale(cache_index int, size int) Float.X
- func (self Instance) GetCacheUnderlinePosition(cache_index int, size int) Float.X
- func (self Instance) GetCacheUnderlineThickness(cache_index int, size int) Float.X
- func (self Instance) GetCharFromGlyphIndex(size int, glyph_index int) int
- func (self Instance) GetEmbolden(cache_index int) Float.X
- func (self Instance) GetExtraBaselineOffset(cache_index int) Float.X
- func (self Instance) GetExtraSpacing(cache_index int, spacing TextServer.SpacingType) int
- func (self Instance) GetFaceIndex(cache_index int) int
- func (self Instance) GetGlyphAdvance(cache_index int, size int, glyph int) Vector2.XY
- func (self Instance) GetGlyphIndex(size int, char int, variation_selector int) int
- func (self Instance) GetGlyphList(cache_index int, size Vector2i.XY) []int32
- func (self Instance) GetGlyphOffset(cache_index int, size Vector2i.XY, glyph int) Vector2.XY
- func (self Instance) GetGlyphSize(cache_index int, size Vector2i.XY, glyph int) Vector2.XY
- func (self Instance) GetGlyphTextureIdx(cache_index int, size Vector2i.XY, glyph int) int
- func (self Instance) GetGlyphUvRect(cache_index int, size Vector2i.XY, glyph int) Rect2.PositionSize
- func (self Instance) GetKerning(cache_index int, size int, glyph_pair Vector2i.XY) Vector2.XY
- func (self Instance) GetKerningList(cache_index int, size int) []Vector2i.XY
- func (self Instance) GetLanguageSupportOverride(language string) bool
- func (self Instance) GetLanguageSupportOverrides() []string
- func (self Instance) GetScriptSupportOverride(script string) bool
- func (self Instance) GetScriptSupportOverrides() []string
- func (self Instance) GetSizeCacheList(cache_index int) []Vector2i.XY
- func (self Instance) GetTextureCount(cache_index int, size Vector2i.XY) int
- func (self Instance) GetTextureImage(cache_index int, size Vector2i.XY, texture_index int) Image.Instance
- func (self Instance) GetTextureOffsets(cache_index int, size Vector2i.XY, texture_index int) []int32
- func (self Instance) GetTransform(cache_index int) Transform2D.OriginXY
- func (self Instance) GetVariationCoordinates(cache_index int) map[string]float32
- func (self Instance) Hinting() TextServer.Hinting
- func (self Instance) ID() ID
- func (self Instance) KeepRoundingRemainders() bool
- func (self Instance) LoadBitmapFont(path string) error
- func (self Instance) LoadDynamicFont(path string) error
- func (self Instance) ModulateColorGlyphs() bool
- func (self Instance) MsdfPixelRange() int
- func (self Instance) MsdfSize() int
- func (self Instance) MultichannelSignedDistanceField() bool
- func (self Instance) OpentypeFeatureOverrides() map[any]any
- func (self Instance) Oversampling() Float.X
- func (self Instance) RemoveCache(cache_index int)
- func (self Instance) RemoveGlyph(cache_index int, size Vector2i.XY, glyph int)
- func (self Instance) RemoveKerning(cache_index int, size int, glyph_pair Vector2i.XY)
- func (self Instance) RemoveLanguageSupportOverride(language string)
- func (self Instance) RemoveScriptSupportOverride(script string)
- func (self Instance) RemoveSizeCache(cache_index int, size Vector2i.XY)
- func (self Instance) RemoveTexture(cache_index int, size Vector2i.XY, texture_index int)
- func (self Instance) RenderGlyph(cache_index int, size Vector2i.XY, index int)
- func (self Instance) RenderRange(cache_index int, size Vector2i.XY, start int, end int)
- func (self Instance) SetAllowSystemFallback(value bool)
- func (self Instance) SetAntialiasing(value TextServer.FontAntialiasing)
- func (self Instance) SetCacheAscent(cache_index int, size int, ascent Float.X)
- func (self Instance) SetCacheDescent(cache_index int, size int, descent Float.X)
- func (self Instance) SetCacheScale(cache_index int, size int, scale Float.X)
- func (self Instance) SetCacheUnderlinePosition(cache_index int, size int, underline_position Float.X)
- func (self Instance) SetCacheUnderlineThickness(cache_index int, size int, underline_thickness Float.X)
- func (self Instance) SetData(value []byte)
- func (self Instance) SetDisableEmbeddedBitmaps(value bool)
- func (self Instance) SetEmbolden(cache_index int, strength Float.X)
- func (self Instance) SetExtraBaselineOffset(cache_index int, baseline_offset Float.X)
- func (self Instance) SetExtraSpacing(cache_index int, spacing TextServer.SpacingType, value int)
- func (self Instance) SetFaceIndex(cache_index int, face_index int)
- func (self Instance) SetFixedSize(value int)
- func (self Instance) SetFixedSizeScaleMode(value TextServer.FixedSizeScaleMode)
- func (self Instance) SetFontName(value string)
- func (self Instance) SetFontStretch(value int)
- func (self Instance) SetFontStyle(value TextServer.FontStyle)
- func (self Instance) SetFontWeight(value int)
- func (self Instance) SetForceAutohinter(value bool)
- func (self Instance) SetGenerateMipmaps(value bool)
- func (self Instance) SetGlyphAdvance(cache_index int, size int, glyph int, advance Vector2.XY)
- func (self Instance) SetGlyphOffset(cache_index int, size Vector2i.XY, glyph int, offset Vector2.XY)
- func (self Instance) SetGlyphSize(cache_index int, size Vector2i.XY, glyph int, gl_size Vector2.XY)
- func (self Instance) SetGlyphTextureIdx(cache_index int, size Vector2i.XY, glyph int, texture_idx int)
- func (self Instance) SetGlyphUvRect(cache_index int, size Vector2i.XY, glyph int, uv_rect Rect2.PositionSize)
- func (self Instance) SetHinting(value TextServer.Hinting)
- func (self Instance) SetKeepRoundingRemainders(value bool)
- func (self Instance) SetKerning(cache_index int, size int, glyph_pair Vector2i.XY, kerning Vector2.XY)
- func (self Instance) SetLanguageSupportOverride(language string, supported bool)
- func (self Instance) SetModulateColorGlyphs(value bool)
- func (self Instance) SetMsdfPixelRange(value int)
- func (self Instance) SetMsdfSize(value int)
- func (self Instance) SetMultichannelSignedDistanceField(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOpentypeFeatureOverrides(value map[any]any)
- func (self Instance) SetOversampling(value Float.X)
- func (self Instance) SetScriptSupportOverride(script string, supported bool)
- func (self Instance) SetStyleName(value string)
- func (self Instance) SetSubpixelPositioning(value TextServer.SubpixelPositioning)
- func (self Instance) SetTextureImage(cache_index int, size Vector2i.XY, texture_index int, image Image.Instance)
- func (self Instance) SetTextureOffsets(cache_index int, size Vector2i.XY, texture_index int, offset []int32)
- func (self Instance) SetTransform(cache_index int, transform Transform2D.OriginXY)
- func (self Instance) SetVariationCoordinates(cache_index int, variation_coordinates map[string]float32)
- func (self Instance) SubpixelPositioning() TextServer.SubpixelPositioning
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsFontFile ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AllowSystemFallback ¶
If set to true, system fonts can be automatically used as fallbacks.
func (Instance) Antialiasing ¶
func (self Instance) Antialiasing() TextServer.FontAntialiasing
Font anti-aliasing mode.
func (Instance) AsFontFile ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) ClearGlyphs ¶
Removes all rendered glyph information from the cache entry.
Note: This function will not remove textures associated with the glyphs, use RemoveTexture to remove them manually.
func (Instance) ClearKerningMap ¶
Removes all kerning overrides.
func (Instance) ClearSizeCache ¶
Removes all font sizes from the cache entry.
func (Instance) ClearTextures ¶
Removes all textures from font cache entry.
Note: This function will not remove glyphs associated with the texture, use RemoveGlyph to remove them manually.
func (Instance) DisableEmbeddedBitmaps ¶
If set to true, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).
func (Instance) FixedSizeScaleMode ¶
func (self Instance) FixedSizeScaleMode() TextServer.FixedSizeScaleMode
Scaling mode, used only for the bitmap fonts with FixedSize greater than zero.
func (Instance) ForceAutohinter ¶
If set to true, auto-hinting is supported and preferred over font built-in hinting. Used by dynamic fonts only (MSDF fonts don't support hinting).
func (Instance) GenerateMipmaps ¶
If set to true, generate mipmaps for the font textures.
func (Instance) GetCacheAscent ¶
Returns the font ascent (number of pixels above the baseline).
func (Instance) GetCacheCount ¶
Returns number of the font cache entries.
func (Instance) GetCacheDescent ¶
Returns the font descent (number of pixels below the baseline).
func (Instance) GetCacheScale ¶
Returns scaling factor of the color bitmap font.
func (Instance) GetCacheUnderlinePosition ¶
Returns pixel offset of the underline below the baseline.
func (Instance) GetCacheUnderlineThickness ¶
Returns thickness of the underline in pixels.
func (Instance) GetCharFromGlyphIndex ¶
Returns character code associated with 'glyph_index', or 0 if 'glyph_index' is invalid. See GetGlyphIndex.
func (Instance) GetEmbolden ¶
Returns embolden strength, if is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness.
func (Instance) GetExtraBaselineOffset ¶
Returns extra baseline offset (as a fraction of font height).
func (Instance) GetExtraSpacing ¶
func (self Instance) GetExtraSpacing(cache_index int, spacing TextServer.SpacingType) int
Returns spacing for 'spacing' in pixels (not relative to the font size).
func (Instance) GetFaceIndex ¶
Returns an active face index in the TrueType / OpenType collection.
func (Instance) GetGlyphAdvance ¶
Returns glyph advance (offset of the next glyph).
Note: Advance for glyphs outlines is the same as the base glyph advance and is not saved.
func (Instance) GetGlyphIndex ¶
Returns the glyph index of a 'char', optionally modified by the 'variation_selector'.
func (Instance) GetGlyphList ¶
Returns list of rendered glyphs in the cache entry.
func (Instance) GetGlyphOffset ¶
Returns glyph offset from the baseline.
func (Instance) GetGlyphSize ¶
Returns glyph size.
func (Instance) GetGlyphTextureIdx ¶
Returns index of the cache texture containing the glyph.
func (Instance) GetGlyphUvRect ¶
func (self Instance) GetGlyphUvRect(cache_index int, size Vector2i.XY, glyph int) Rect2.PositionSize
Returns rectangle in the cache texture containing the glyph.
func (Instance) GetKerning ¶
Returns kerning for the pair of glyphs.
func (Instance) GetKerningList ¶
Returns list of the kerning overrides.
func (Instance) GetLanguageSupportOverride ¶
Returns true if support override is enabled for the 'language'.
func (Instance) GetLanguageSupportOverrides ¶
Returns list of language support overrides.
func (Instance) GetScriptSupportOverride ¶
Returns true if support override is enabled for the 'script'.
func (Instance) GetScriptSupportOverrides ¶
Returns list of script support overrides.
func (Instance) GetSizeCacheList ¶
Returns list of the font sizes in the cache. Each size is Vector2i.XY with font size and outline size.
func (Instance) GetTextureCount ¶
Returns number of textures used by font cache entry.
func (Instance) GetTextureImage ¶
func (self Instance) GetTextureImage(cache_index int, size Vector2i.XY, texture_index int) Image.Instance
Returns a copy of the font cache texture image.
func (Instance) GetTextureOffsets ¶
func (self Instance) GetTextureOffsets(cache_index int, size Vector2i.XY, texture_index int) []int32
Returns a copy of the array containing glyph packing data.
func (Instance) GetTransform ¶
func (self Instance) GetTransform(cache_index int) Transform2D.OriginXY
Returns 2D transform, applied to the font outlines, can be used for slanting, flipping and rotating glyphs.
func (Instance) GetVariationCoordinates ¶
Returns variation coordinates for the specified font cache entry. See Font.GetSupportedVariationList for more info.
func (Instance) Hinting ¶
func (self Instance) Hinting() TextServer.Hinting
Font hinting mode. Used by dynamic fonts only.
func (Instance) KeepRoundingRemainders ¶
If set to true, when aligning glyphs to the pixel boundaries rounding remainders are accumulated to ensure more uniform glyph distribution. This setting has no effect if subpixel positioning is enabled.
func (Instance) LoadBitmapFont ¶
Loads an AngelCode BMFont (.fnt, .font) bitmap font from file 'path'.
Warning: This method should only be used in the editor or in cases when you need to load external fonts at run-time, such as fonts located at the user:// directory.
func (Instance) LoadDynamicFont ¶
Loads a TrueType (.ttf), OpenType (.otf), WOFF (.woff), WOFF2 (.woff2) or Type 1 (.pfb, .pfm) dynamic font from file 'path'.
Warning: This method should only be used in the editor or in cases when you need to load external fonts at run-time, such as fonts located at the user:// directory.
func (Instance) ModulateColorGlyphs ¶
If set to true, color modulation is applied when drawing colored glyphs, otherwise it's applied to the monochrome glyphs only.
func (Instance) MsdfPixelRange ¶
The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, MsdfPixelRange must be set to at least twice the size of the largest font outline. The default MsdfPixelRange value of 16 allows outline sizes up to 8 to look correct.
func (Instance) MsdfSize ¶
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.
func (Instance) MultichannelSignedDistanceField ¶
If set to true, glyphs of all sizes are rendered using single multichannel signed distance field (MSDF) generated from the dynamic font vector data. 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 Controls that are scaled down (or for Label3Ds viewed from a long distance). As a downside, font hinting is not available with MSDF. The lack of font hinting may result in less crisp and less readable fonts at small sizes.
Note: If using font outlines, MsdfPixelRange must be set to at least twice the size of the largest font outline.
Note: MSDF font rendering does not render glyphs with overlapping shapes correctly. Overlapping shapes are not valid per the OpenType standard, but are still commonly found in many font files, especially those converted by Google Fonts. To avoid issues with overlapping glyphs, consider downloading the font file directly from the type foundry instead of relying on Google Fonts.
func (Instance) OpentypeFeatureOverrides ¶
Font OpenType feature set override.
func (Instance) Oversampling ¶
If set to a positive value, overrides the oversampling factor of the viewport this font is used in. See Viewport.Oversampling. This value doesn't override the oversampling parameter of draw_* methods.
func (Instance) RemoveCache ¶
Removes specified font cache entry.
func (Instance) RemoveGlyph ¶
Removes specified rendered glyph information from the cache entry.
Note: This function will not remove textures associated with the glyphs, use RemoveTexture to remove them manually.
func (Instance) RemoveKerning ¶
Removes kerning override for the pair of glyphs.
func (Instance) RemoveLanguageSupportOverride ¶
Remove language support override.
func (Instance) RemoveScriptSupportOverride ¶
Removes script support override.
func (Instance) RemoveSizeCache ¶
Removes specified font size from the cache entry.
func (Instance) RemoveTexture ¶
Removes specified texture from the cache entry.
Note: This function will not remove glyphs associated with the texture. Remove them manually using RemoveGlyph.
func (Instance) RenderGlyph ¶
Renders specified glyph to the font cache texture.
func (Instance) RenderRange ¶
Renders the range of characters to the font cache texture.
func (Instance) SetAllowSystemFallback ¶
SetAllowSystemFallback sets the property returned by [IsAllowSystemFallback].
func (Instance) SetAntialiasing ¶
func (self Instance) SetAntialiasing(value TextServer.FontAntialiasing)
SetAntialiasing sets the property returned by [GetAntialiasing].
func (Instance) SetCacheAscent ¶
Sets the font ascent (number of pixels above the baseline).
func (Instance) SetCacheDescent ¶
Sets the font descent (number of pixels below the baseline).
func (Instance) SetCacheScale ¶
Sets scaling factor of the color bitmap font.
func (Instance) SetCacheUnderlinePosition ¶
func (self Instance) SetCacheUnderlinePosition(cache_index int, size int, underline_position Float.X)
Sets pixel offset of the underline below the baseline.
func (Instance) SetCacheUnderlineThickness ¶
func (self Instance) SetCacheUnderlineThickness(cache_index int, size int, underline_thickness Float.X)
Sets thickness of the underline in pixels.
func (Instance) SetDisableEmbeddedBitmaps ¶
SetDisableEmbeddedBitmaps sets the property returned by [GetDisableEmbeddedBitmaps].
func (Instance) SetEmbolden ¶
Sets embolden strength, if is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness.
func (Instance) SetExtraBaselineOffset ¶
Sets extra baseline offset (as a fraction of font height).
func (Instance) SetExtraSpacing ¶
func (self Instance) SetExtraSpacing(cache_index int, spacing TextServer.SpacingType, value int)
Sets the spacing for 'spacing' to 'value' in pixels (not relative to the font size).
func (Instance) SetFaceIndex ¶
Sets an active face index in the TrueType / OpenType collection.
func (Instance) SetFixedSize ¶
SetFixedSize sets the property returned by [GetFixedSize].
func (Instance) SetFixedSizeScaleMode ¶
func (self Instance) SetFixedSizeScaleMode(value TextServer.FixedSizeScaleMode)
SetFixedSizeScaleMode sets the property returned by [GetFixedSizeScaleMode].
func (Instance) SetFontStretch ¶
Font stretch amount, compared to a normal width. A percentage value between 50% and 200%.
func (Instance) SetFontStyle ¶
func (self Instance) SetFontStyle(value TextServer.FontStyle)
Font style flags.
func (Instance) SetFontWeight ¶
Weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700.
func (Instance) SetForceAutohinter ¶
SetForceAutohinter sets the property returned by [IsForceAutohinter].
func (Instance) SetGenerateMipmaps ¶
SetGenerateMipmaps sets the property returned by [GetGenerateMipmaps].
func (Instance) SetGlyphAdvance ¶
Sets glyph advance (offset of the next glyph).
Note: Advance for glyphs outlines is the same as the base glyph advance and is not saved.
func (Instance) SetGlyphOffset ¶
func (self Instance) SetGlyphOffset(cache_index int, size Vector2i.XY, glyph int, offset Vector2.XY)
Sets glyph offset from the baseline.
func (Instance) SetGlyphSize ¶
Sets glyph size.
func (Instance) SetGlyphTextureIdx ¶
func (self Instance) SetGlyphTextureIdx(cache_index int, size Vector2i.XY, glyph int, texture_idx int)
Sets index of the cache texture containing the glyph.
func (Instance) SetGlyphUvRect ¶
func (self Instance) SetGlyphUvRect(cache_index int, size Vector2i.XY, glyph int, uv_rect Rect2.PositionSize)
Sets rectangle in the cache texture containing the glyph.
func (Instance) SetHinting ¶
func (self Instance) SetHinting(value TextServer.Hinting)
SetHinting sets the property returned by [GetHinting].
func (Instance) SetKeepRoundingRemainders ¶
SetKeepRoundingRemainders sets the property returned by [GetKeepRoundingRemainders].
func (Instance) SetKerning ¶
func (self Instance) SetKerning(cache_index int, size int, glyph_pair Vector2i.XY, kerning Vector2.XY)
Sets kerning for the pair of glyphs.
func (Instance) SetLanguageSupportOverride ¶
Adds override for Font.IsLanguageSupported.
func (Instance) SetModulateColorGlyphs ¶
SetModulateColorGlyphs sets the property returned by [IsModulateColorGlyphs].
func (Instance) SetMsdfPixelRange ¶
SetMsdfPixelRange sets the property returned by [GetMsdfPixelRange].
func (Instance) SetMsdfSize ¶
SetMsdfSize sets the property returned by [GetMsdfSize].
func (Instance) SetMultichannelSignedDistanceField ¶
SetMultichannelSignedDistanceField sets the property returned by [IsMultichannelSignedDistanceField].
func (Instance) SetOpentypeFeatureOverrides ¶
SetOpentypeFeatureOverrides sets the property returned by [GetOpentypeFeatureOverrides].
func (Instance) SetOversampling ¶
SetOversampling sets the property returned by [GetOversampling].
func (Instance) SetScriptSupportOverride ¶
Adds override for Font.IsScriptSupported.
func (Instance) SetSubpixelPositioning ¶
func (self Instance) SetSubpixelPositioning(value TextServer.SubpixelPositioning)
SetSubpixelPositioning sets the property returned by [GetSubpixelPositioning].
func (Instance) SetTextureImage ¶
func (self Instance) SetTextureImage(cache_index int, size Vector2i.XY, texture_index int, image Image.Instance)
Sets font cache texture image.
func (Instance) SetTextureOffsets ¶
func (self Instance) SetTextureOffsets(cache_index int, size Vector2i.XY, texture_index int, offset []int32)
Sets array containing glyph packing data.
func (Instance) SetTransform ¶
func (self Instance) SetTransform(cache_index int, transform Transform2D.OriginXY)
Sets 2D transform, applied to the font outlines, can be used for slanting, flipping, and rotating glyphs.
func (Instance) SetVariationCoordinates ¶
func (self Instance) SetVariationCoordinates(cache_index int, variation_coordinates map[string]float32)
Sets variation coordinates for the specified font cache entry. See Font.GetSupportedVariationList for more info.
func (Instance) SubpixelPositioning ¶
func (self Instance) SubpixelPositioning() TextServer.SubpixelPositioning
Font glyph subpixel positioning mode. Subpixel positioning provides shaper text and better kerning for smaller font sizes, at the cost of higher memory usage and lower font rasterization speed. Use [Textserver.SubpixelPositioningAuto] to automatically enable it based on the font size.