Documentation
¶
Overview ¶
Package FontFile provides methods for working with FontFile object instances.
Index ¶
- type Advanced
- type Any
- type Instance
- func (self Instance) AllowSystemFallback() bool
- func (self Instance) Antialiasing() gdclass.TextServerFontAntialiasing
- 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() gdclass.TextServerFixedSizeScaleMode
- 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 gdclass.TextServerSpacingType) 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) [1]gdclass.Image
- 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() gdclass.TextServerHinting
- func (self Instance) LoadBitmapFont(path string) error
- func (self Instance) LoadDynamicFont(path string) error
- 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 gdclass.TextServerFontAntialiasing)
- 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 gdclass.TextServerSpacingType, value int)
- func (self Instance) SetFaceIndex(cache_index int, face_index int)
- func (self Instance) SetFixedSize(value int)
- func (self Instance) SetFixedSizeScaleMode(value gdclass.TextServerFixedSizeScaleMode)
- func (self Instance) SetFontName(value string)
- func (self Instance) SetFontStretch(value int)
- func (self Instance) SetFontStyle(value gdclass.TextServerFontStyle)
- 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 gdclass.TextServerHinting)
- 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) SetMsdfPixelRange(value int)
- func (self Instance) SetMsdfSize(value int)
- func (self Instance) SetMultichannelSignedDistanceField(value 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 gdclass.TextServerSubpixelPositioning)
- func (self Instance) SetTextureImage(cache_index int, size Vector2i.XY, texture_index int, image [1]gdclass.Image)
- 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() gdclass.TextServerSubpixelPositioning
- func (self *Instance) UnsafePointer() unsafe.Pointer
- 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 Instance ¶
[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 [Font]s 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. [b]Note:[/b] A character is a symbol that represents an item (letter, digit etc.) in an abstract way. [b]Note:[/b] 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. [b]Note:[/b] 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. [codeblocks] [gdscript] var f = load("res://BarlowCondensed-Bold.ttf") $Label.add_theme_font_override("font", f) $Label.add_theme_font_size_override("font_size", 64) [/gdscript] [csharp] var f = ResourceLoader.Load<FontFile>("res://BarlowCondensed-Bold.ttf"); GetNode("Label").AddThemeFontOverride("font", f); GetNode("Label").AddThemeFontSizeOverride("font_size", 64); [/csharp] [/codeblocks]
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AllowSystemFallback ¶
func (Instance) Antialiasing ¶
func (self Instance) Antialiasing() gdclass.TextServerFontAntialiasing
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. [b]Note:[/b] This function will not remove textures associated with the glyphs, use [method remove_texture] 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. [b]Note:[/b] This function will not remove glyphs associated with the texture, use [method remove_glyph] to remove them manually.
func (Instance) DisableEmbeddedBitmaps ¶
func (Instance) FixedSizeScaleMode ¶
func (self Instance) FixedSizeScaleMode() gdclass.TextServerFixedSizeScaleMode
func (Instance) ForceAutohinter ¶
func (Instance) GenerateMipmaps ¶
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 [param glyph_index], or [code]0[/code] if [param glyph_index] is invalid. See [method get_glyph_index].
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 gdclass.TextServerSpacingType) int
Returns spacing for [param spacing] (see [enum TextServer.SpacingType]) 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). [b]Note:[/b] 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 [param char], optionally modified by the [param 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 [code]true[/code] if support override is enabled for the [param language].
func (Instance) GetLanguageSupportOverrides ¶
Returns list of language support overrides.
func (Instance) GetScriptSupportOverride ¶
Returns [code]true[/code] if support override is enabled for the [param 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] 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) [1]gdclass.Image
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 [method Font.get_supported_variation_list] for more info.
func (Instance) Hinting ¶
func (self Instance) Hinting() gdclass.TextServerHinting
func (Instance) LoadBitmapFont ¶
Loads an AngelCode BMFont (.fnt, .font) bitmap font from file [param path]. [b]Warning:[/b] 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 [code]user://[/code] directory.
func (Instance) LoadDynamicFont ¶
Loads a TrueType (.ttf), OpenType (.otf), WOFF (.woff), WOFF2 (.woff2) or Type 1 (.pfb, .pfm) dynamic font from file [param path]. [b]Warning:[/b] 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 [code]user://[/code] directory.
func (Instance) MsdfPixelRange ¶
func (Instance) MultichannelSignedDistanceField ¶
func (Instance) OpentypeFeatureOverrides ¶
func (Instance) Oversampling ¶
func (Instance) RemoveCache ¶
Removes specified font cache entry.
func (Instance) RemoveGlyph ¶
Removes specified rendered glyph information from the cache entry. [b]Note:[/b] This function will not remove textures associated with the glyphs, use [method remove_texture] 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. [b]Note:[/b] This function will not remove glyphs associated with the texture. Remove them manually using [method remove_glyph].
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 ¶
func (Instance) SetAntialiasing ¶
func (self Instance) SetAntialiasing(value gdclass.TextServerFontAntialiasing)
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 ¶
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 gdclass.TextServerSpacingType, value int)
Sets the spacing for [param spacing] (see [enum TextServer.SpacingType]) to [param 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 ¶
func (Instance) SetFixedSizeScaleMode ¶
func (self Instance) SetFixedSizeScaleMode(value gdclass.TextServerFixedSizeScaleMode)
func (Instance) SetFontName ¶
func (Instance) SetFontStretch ¶
func (Instance) SetFontStyle ¶
func (self Instance) SetFontStyle(value gdclass.TextServerFontStyle)
func (Instance) SetFontWeight ¶
func (Instance) SetForceAutohinter ¶
func (Instance) SetGenerateMipmaps ¶
func (Instance) SetGlyphAdvance ¶
Sets glyph advance (offset of the next glyph). [b]Note:[/b] 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 gdclass.TextServerHinting)
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 [method Font.is_language_supported].
func (Instance) SetMsdfPixelRange ¶
func (Instance) SetMsdfSize ¶
func (Instance) SetMultichannelSignedDistanceField ¶
func (Instance) SetOpentypeFeatureOverrides ¶
func (Instance) SetOversampling ¶
func (Instance) SetScriptSupportOverride ¶
Adds override for [method Font.is_script_supported].
func (Instance) SetStyleName ¶
func (Instance) SetSubpixelPositioning ¶
func (self Instance) SetSubpixelPositioning(value gdclass.TextServerSubpixelPositioning)
func (Instance) SetTextureImage ¶
func (self Instance) SetTextureImage(cache_index int, size Vector2i.XY, texture_index int, image [1]gdclass.Image)
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 [method Font.get_supported_variation_list] for more info.
func (Instance) SubpixelPositioning ¶
func (self Instance) SubpixelPositioning() gdclass.TextServerSubpixelPositioning