ttf

package
v0.0.0-...-24cf274 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PROP_FONT_CREATE_FILENAME_STRING            = "SDL_ttf.font.create.filename"
	PROP_FONT_CREATE_IOSTREAM_POINTER           = "SDL_ttf.font.create.iostream"
	PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER     = "SDL_ttf.font.create.iostream.offset"
	PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN = "SDL_ttf.font.create.iostream.autoclose"
	PROP_FONT_CREATE_SIZE_FLOAT                 = "SDL_ttf.font.create.size"
	PROP_FONT_CREATE_FACE_NUMBER                = "SDL_ttf.font.create.face"
	PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER      = "SDL_ttf.font.create.hdpi"
	PROP_FONT_CREATE_VERTICAL_DPI_NUMBER        = "SDL_ttf.font.create.vdpi"
	PROP_FONT_CREATE_EXISTING_FONT              = "SDL_ttf.font.create.existing_font"
)
View Source
const (
	PROP_RENDERER_TEXT_ENGINE_RENDERER           = "SDL_ttf.renderer_text_engine.create.renderer"
	PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE = "SDL_ttf.renderer_text_engine.create.atlas_texture_size"
)

Variables

This section is empty.

Functions

func CloseLibrary

func CloseLibrary() error

CloseLibrary releases resources associated with the library.

func GetGlyphScript

func GetGlyphScript(ch rune) (uint32, error)

TTF_GetGlyphScript - Get the script used by a 32-bit codepoint. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetGlyphScript)

func GetVersion

func GetVersion() sdl.Version

TTF_Version - This function gets the version of the dynamically linked SDL_ttf library. (https://wiki.libsdl.org/SDL3_ttf/TTF_Version)

func Init

func Init() error

TTF_Init - Initialize SDL_ttf. (https://wiki.libsdl.org/SDL3_ttf/TTF_Init)

func LoadLibrary

func LoadLibrary(path string) error

LoadLibrary loads SDL_ttf library and initializes all functions.

func Path

func Path() string

Path returns the library installation path based on the operating system

func Quit

func Quit()

TTF_Quit - Deinitialize SDL_ttf. (https://wiki.libsdl.org/SDL3_ttf/TTF_Quit)

func StringToTag

func StringToTag(str string) uint32

TTF_StringToTag - Convert from a 4 character string to a 32-bit tag. (https://wiki.libsdl.org/SDL3_ttf/TTF_StringToTag)

func TagToString

func TagToString(tag uint32, size uintptr) string

TTF_TagToString - Convert from a 32-bit tag to a 4 character string. (https://wiki.libsdl.org/SDL3_ttf/TTF_TagToString)

func WasInit

func WasInit() int32

TTF_WasInit - Check if SDL_ttf is initialized. (https://wiki.libsdl.org/SDL3_ttf/TTF_WasInit)

Types

type CopyOperation

type CopyOperation struct {
	Cmd        DrawCommand
	TextOffset int32
	GlyphFont  *Font
	GlyphIndex uint32
	Src        sdl.Rect
	Dst        sdl.Rect
	// contains filtered or unexported fields
}

type Direction

type Direction uint32

TTF_Direction - Direction flags (https://wiki.libsdl.org/SDL3_ttf/TTF_Direction)

const (
	DIRECTION_INVALID Direction = 0
	DIRECTION_LTR     Direction = 4 // Left to Right
	DIRECTION_RTL     Direction = 5 // Right to Left
	DIRECTION_TTB     Direction = 6 // Top to Bottom
	DIRECTION_BTT     Direction = 7 // Bottom to Top
)

type DrawCommand

type DrawCommand uint32
const (
	DRAW_COMMAND_NOOP DrawCommand = 0
	DRAW_COMMAND_FILL DrawCommand = 1
	DRAW_COMMAND_COPY DrawCommand = 2
)

type DrawOperation

type DrawOperation struct {
	Cmd DrawCommand
	// contains filtered or unexported fields
}

union type

func (*DrawOperation) CopyOperation

func (d *DrawOperation) CopyOperation() *CopyOperation

func (*DrawOperation) FillOperation

func (d *DrawOperation) FillOperation() *FillOperation

type FillOperation

type FillOperation struct {
	Cmd  DrawCommand
	Rect sdl.Rect
}

type Font

type Font struct{}

TTF_Font - The internal structure containing font information. (https://wiki.libsdl.org/SDL3_ttf/TTF_Font)

func OpenFont

func OpenFont(file string, ptSize float32) (*Font, error)

TTF_OpenFont - Create a font from a file, using a specified point size. (https://wiki.libsdl.org/SDL3_ttf/TTF_OpenFont)

func OpenFontIO

func OpenFontIO(src *sdl.IOStream, closeio bool, ptSize float32) (*Font, error)

TTF_OpenFontIO - Create a font from an SDL_IOStream, using a specified point size. (https://wiki.libsdl.org/SDL3_ttf/TTF_OpenFontIO)

func OpenFontWithProperties

func OpenFontWithProperties(props sdl.PropertiesID) (*Font, error)

TTF_OpenFontWithProperties - Create a font with the specified properties. (https://wiki.libsdl.org/SDL3_ttf/TTF_OpenFontWithProperties)

func (*Font) AddFallback

func (font *Font) AddFallback(fallback *Font) error

TTF_AddFallbackFont - Add a fallback font. (https://wiki.libsdl.org/SDL3_ttf/TTF_AddFallbackFont)

func (*Font) Ascent

func (font *Font) Ascent() int32

TTF_GetFontAscent - Query the offset from the baseline to the top of a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontAscent)

func (*Font) ClearFallbacks

func (font *Font) ClearFallbacks()

TTF_ClearFallbackFonts - Remove all fallback fonts. (https://wiki.libsdl.org/SDL3_ttf/TTF_ClearFallbackFonts)

func (*Font) Close

func (font *Font) Close()

TTF_CloseFont - Dispose of a previously-created font. (https://wiki.libsdl.org/SDL3_ttf/TTF_CloseFont)

func (*Font) Copy

func (font *Font) Copy() (*Font, error)

TTF_CopyFont - Create a copy of an existing font. (https://wiki.libsdl.org/SDL3_ttf/TTF_CopyFont)

func (*Font) DPI

func (font *Font) DPI() (int32, int32, error)

TTF_GetFontDPI - Get font target resolutions, in dots per inch. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontDPI)

func (*Font) Descent

func (font *Font) Descent() int32

TTF_GetFontDescent - Query the offset from the baseline to the bottom of a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontDescent)

func (*Font) Direction

func (font *Font) Direction() Direction

TTF_GetFontDirection - Get the direction to be used for text shaping by a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontDirection)

func (*Font) FamilyName

func (font *Font) FamilyName() string

TTF_GetFontFamilyName - Query a font's family name. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontFamilyName)

func (*Font) Generation

func (font *Font) Generation() uint32

TTF_GetFontGeneration - Get the font generation. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontGeneration)

func (*Font) GlyphImage

func (font *Font) GlyphImage(ch uint32) (*sdl.Surface, ImageType, error)

TTF_GetGlyphImage - Get the pixel image for a UNICODE codepoint. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetGlyphImage)

func (*Font) GlyphImageForIndex

func (font *Font) GlyphImageForIndex(glyphIndex uint32) (*sdl.Surface, ImageType, error)

TTF_GetGlyphImageForIndex - Get the pixel image for a character index. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetGlyphImageForIndex)

func (*Font) GlyphKerning

func (font *Font) GlyphKerning(previousCh, ch rune) (int32, error)

TTF_GetGlyphKerning - Query the kerning size between the glyphs of two UNICODE codepoints. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetGlyphKerning)

func (*Font) GlyphMetrics

func (font *Font) GlyphMetrics(ch uint32) (*GlyphMetrics, error)

TTF_GetGlyphMetrics - Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetGlyphMetrics)

func (*Font) HasGlyph

func (font *Font) HasGlyph(ch uint32) bool

TTF_FontHasGlyph - Check whether a glyph is provided by the font for a UNICODE codepoint. (https://wiki.libsdl.org/SDL3_ttf/TTF_FontHasGlyph)

func (*Font) Height

func (font *Font) Height() int32

TTF_GetFontHeight - Query the total height of a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontHeight)

func (*Font) Hinting

func (font *Font) Hinting() HintingFlags

TTF_GetFontHinting - Query a font's current FreeType hinter setting. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontHinting)

func (*Font) IsFixedWidth

func (font *Font) IsFixedWidth() bool

TTF_FontIsFixedWidth - Query whether a font is fixed-width. (https://wiki.libsdl.org/SDL3_ttf/TTF_FontIsFixedWidth)

func (*Font) IsScalable

func (font *Font) IsScalable() bool

TTF_FontIsScalable - Query whether a font is scalable or not. (https://wiki.libsdl.org/SDL3_ttf/TTF_FontIsScalable)

func (*Font) Kerning

func (font *Font) Kerning() bool

TTF_GetFontKerning - Query whether or not kerning is enabled for a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontKerning)

func (*Font) LineSkip

func (font *Font) LineSkip() int32

TTF_GetFontLineSkip - Query the spacing between lines of text for a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontLineSkip)

func (*Font) MeasureString

func (font *Font) MeasureString(text string, maxWidth int32) (int32, uintptr, error)

TTF_MeasureString - Calculate how much of a UTF-8 string will fit in a given width. Returns the measured_width, measured_length (https://wiki.libsdl.org/SDL3_ttf/TTF_MeasureString)

func (*Font) NumFaces

func (font *Font) NumFaces() int32

TTF_GetNumFontFaces - Query the number of faces of a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetNumFontFaces)

func (*Font) Outline

func (font *Font) Outline() int32

TTF_GetFontOutline - Query a font's current outline. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontOutline)

func (*Font) Properties

func (font *Font) Properties() sdl.PropertiesID

TTF_GetFontProperties - Get the properties associated with a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontProperties)

func (*Font) RemoveFallback

func (font *Font) RemoveFallback(fallback *Font)

TTF_RemoveFallbackFont - Remove a fallback font. (https://wiki.libsdl.org/SDL3_ttf/TTF_RemoveFallbackFont)

func (*Font) RenderGlyphBlended

func (font *Font) RenderGlyphBlended(glyph rune, fg sdl.Color) (*sdl.Surface, error)

TTF_RenderGlyph_Blended - Render a single UNICODE codepoint at high quality to a new ARGB surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderGlyph_Blended)

func (*Font) RenderGlyphLCD

func (font *Font) RenderGlyphLCD(glyph rune, fg, bg sdl.Color) (*sdl.Surface, error)

TTF_RenderGlyph_LCD - Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderGlyph_LCD)

func (*Font) RenderGlyphShaded

func (font *Font) RenderGlyphShaded(glyph rune, fg, bg sdl.Color) (*sdl.Surface, error)

TTF_RenderGlyph_Shaded - Render a single UNICODE codepoint at high quality to a new 8-bit surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderGlyph_Shaded)

func (*Font) RenderGlyphSolid

func (font *Font) RenderGlyphSolid(glyph rune, fg sdl.Color) (*sdl.Surface, error)

TTF_RenderGlyph_Solid - Render a single 32-bit glyph at fast quality to a new 8-bit surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderGlyph_Solid)

func (*Font) RenderTextBlended

func (font *Font) RenderTextBlended(text string, fg sdl.Color) (*sdl.Surface, error)

TTF_RenderText_Blended - Render UTF-8 text at high quality to a new ARGB surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderText_Blended)

func (*Font) RenderTextBlendedWrapped

func (font *Font) RenderTextBlendedWrapped(text string, fg sdl.Color, wrapWidth int32) (*sdl.Surface, error)

TTF_RenderText_Blended_Wrapped - Render word-wrapped UTF-8 text at high quality to a new ARGB surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderText_Blended_Wrapped)

func (*Font) RenderTextLCD

func (font *Font) RenderTextLCD(text string, fg, bg sdl.Color) (*sdl.Surface, error)

TTF_RenderText_LCD - Render UTF-8 text at LCD subpixel quality to a new ARGB surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderText_LCD)

func (*Font) RenderTextLCDWrapped

func (font *Font) RenderTextLCDWrapped(text string, fg, bg sdl.Color, wrapWidth int32) (*sdl.Surface, error)

TTF_RenderText_LCD_Wrapped - Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderText_LCD_Wrapped)

func (*Font) RenderTextShaded

func (font *Font) RenderTextShaded(text string, fg, bg sdl.Color) (*sdl.Surface, error)

TTF_RenderText_Shaded - Render UTF-8 text at high quality to a new 8-bit surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderText_Shaded)

func (*Font) RenderTextShadedWrapped

func (font *Font) RenderTextShadedWrapped(text string, fg, bg sdl.Color, wrapWidth int32) (*sdl.Surface, error)

TTF_RenderText_Shaded_Wrapped - Render word-wrapped UTF-8 text at high quality to a new 8-bit surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderText_Shaded_Wrapped)

func (*Font) RenderTextSolid

func (font *Font) RenderTextSolid(text string, fg sdl.Color) (*sdl.Surface, error)

TTF_RenderText_Solid - Render UTF-8 text at fast quality to a new 8-bit surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderText_Solid)

func (*Font) RenderTextSolidWrapped

func (font *Font) RenderTextSolidWrapped(text string, fg sdl.Color, wrapLength int32) (*sdl.Surface, error)

TTF_RenderText_Solid_Wrapped - Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_RenderText_Solid_Wrapped)

func (*Font) SDF

func (font *Font) SDF() bool

TTF_GetFontSDF - Query whether Signed Distance Field rendering is enabled for a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontSDF)

func (*Font) Script

func (font *Font) Script() uint32

TTF_GetFontScript - Get the script used for text shaping a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontScript)

func (*Font) SetDirection

func (font *Font) SetDirection(direction Direction) error

TTF_SetFontDirection - Set the direction to be used for text shaping by a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontDirection)

func (*Font) SetHinting

func (font *Font) SetHinting(hinting HintingFlags)

TTF_SetFontHinting - Set a font's current hinter setting. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontHinting)

func (*Font) SetKerning

func (font *Font) SetKerning(enabled bool)

TTF_SetFontKerning - Set if kerning is enabled for a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontKerning)

func (*Font) SetLanguage

func (font *Font) SetLanguage(languageBCP47 string) error

TTF_SetFontLanguage - Set language to be used for text shaping by a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontLanguage)

func (*Font) SetLineSkip

func (font *Font) SetLineSkip(lineskip int32)

TTF_SetFontLineSkip - Set the spacing between lines of text for a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontLineSkip)

func (*Font) SetOutline

func (font *Font) SetOutline(outline int32) error

TTF_SetFontOutline - Set a font's current outline. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontOutline)

func (*Font) SetSDF

func (font *Font) SetSDF(enabled bool) error

TTF_SetFontSDF - Enable Signed Distance Field rendering for a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontSDF)

func (*Font) SetScript

func (font *Font) SetScript(script uint32) error

TTF_SetFontScript - Set the script to be used for text shaping by a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontScript)

func (*Font) SetSize

func (font *Font) SetSize(ptsize float32) error

TTF_SetFontSize - Set a font's size dynamically. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontSize)

func (*Font) SetSizeDPI

func (font *Font) SetSizeDPI(ptsize float32, hdpi, vdpi int32) error

TTF_SetFontSizeDPI - Set font size dynamically with target resolutions, in dots per inch. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontSizeDPI)

func (*Font) SetStyle

func (font *Font) SetStyle(style FontStyleFlags)

TTF_SetFontStyle - Set a font's current style. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontStyle)

func (*Font) SetWrapAlignment

func (font *Font) SetWrapAlignment(align HorizontalAlignment)

TTF_SetFontWrapAlignment - Set a font's current wrap alignment option. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetFontWrapAlignment)

func (*Font) Size

func (font *Font) Size() (float32, error)

TTF_GetFontSize - Get the size of a font. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontSize)

func (*Font) StringSize

func (font *Font) StringSize(text string) (int32, int32, error)

TTF_GetStringSize - Calculate the dimensions of a rendered string of UTF-8 text. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetStringSize)

func (*Font) StringSizeWrapped

func (font *Font) StringSizeWrapped(text string, wrapWidth int32) (int32, int32, error)

TTF_GetStringSizeWrapped - Calculate the dimensions of a rendered string of UTF-8 text. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetStringSizeWrapped)

func (*Font) Style

func (font *Font) Style() FontStyleFlags

TTF_GetFontStyle - Query a font's current style. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontStyle)

func (*Font) StyleName

func (font *Font) StyleName() string

TTF_GetFontStyleName - Query a font's style name. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontStyleName)

func (*Font) WrapAlignment

func (font *Font) WrapAlignment() HorizontalAlignment

TTF_GetFontWrapAlignment - Query a font's current wrap alignment option. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFontWrapAlignment)

type FontStyleFlags

type FontStyleFlags uint32

TTF_FontStyleFlags - Font style flags for [TTF_Font](TTF_Font) (https://wiki.libsdl.org/SDL3_ttf/TTF_FontStyleFlags)

type GPUAtlasDrawSequence

type GPUAtlasDrawSequence struct {
	AtlasTexture *sdl.GPUTexture       // Texture atlas that stores the glyphs
	Xy           *sdl.FPoint           // An array of vertex positions
	Uv           *sdl.FPoint           // An array of normalized texture coordinates for each vertex
	NumVertices  int32                 // Number of vertices
	Indices      *int32                // An array of indices into the 'vertices' arrays
	NumIndices   int32                 // Number of indices
	ImageType    ImageType             // The image type of this draw sequence
	Next         *GPUAtlasDrawSequence // The next sequence (will be NULL in case of the last sequence)
}

TTF_GPUAtlasDrawSequence - Draw sequence returned by [TTF_GetGPUTextDrawData](TTF_GetGPUTextDrawData) (https://wiki.libsdl.org/SDL3_ttf/TTF_GPUAtlasDrawSequence)

type GPUTextEngineWinding

type GPUTextEngineWinding uint32

TTF_GPUTextEngineWinding - The winding order of the vertices returned by [TTF_GetGPUTextDrawData](TTF_GetGPUTextDrawData) (https://wiki.libsdl.org/SDL3_ttf/TTF_GPUTextEngineWinding)

const (
	GPU_TEXTENGINE_WINDING_INVALID           GPUTextEngineWinding = 4294967295
	GPU_TEXTENGINE_WINDING_CLOCKWISE         GPUTextEngineWinding = 0
	GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE GPUTextEngineWinding = 1
)

type GlyphMetrics

type GlyphMetrics struct {
	MinX    int32
	MaxX    int32
	MinY    int32
	MaxY    int32
	Advance int32
}

type HintingFlags

type HintingFlags uint32

TTF_HintingFlags - Hinting flags for TTF (TrueType Fonts) (https://wiki.libsdl.org/SDL3_ttf/TTF_HintingFlags)

const (
	HINTING_INVALID        HintingFlags = 4294967295
	HINTING_NORMAL         HintingFlags = 0 // Normal hinting applies standard grid-fitting.
	HINTING_LIGHT          HintingFlags = 1 // Light hinting applies subtle adjustments to improve rendering.
	HINTING_MONO           HintingFlags = 2 // Monochrome hinting adjusts the font for better rendering at lower resolutions.
	HINTING_NONE           HintingFlags = 3 // No hinting, the font is rendered without any grid-fitting.
	HINTING_LIGHT_SUBPIXEL HintingFlags = 4 // Light hinting with subpixel rendering for more precise font edges.
)

type HorizontalAlignment

type HorizontalAlignment uint32

TTF_HorizontalAlignment - The horizontal alignment used when rendering wrapped text. (https://wiki.libsdl.org/SDL3_ttf/TTF_HorizontalAlignment)

const (
	HORIZONTAL_ALIGN_INVALID HorizontalAlignment = 4294967295
	HORIZONTAL_ALIGN_LEFT    HorizontalAlignment = 0
	HORIZONTAL_ALIGN_CENTER  HorizontalAlignment = 1
	HORIZONTAL_ALIGN_RIGHT   HorizontalAlignment = 2
)

type ImageType

type ImageType uint32

TTF_ImageType - The type of data in a glyph image (https://wiki.libsdl.org/SDL3_ttf/TTF_ImageType)

const (
	IMAGE_INVALID ImageType = 0
	IMAGE_ALPHA   ImageType = 1 // The color channels are white
	IMAGE_COLOR   ImageType = 2 // The color channels have image data
	IMAGE_SDF     ImageType = 3 // The alpha channel has signed distance field information
)

type LibraryVersion

type LibraryVersion struct {
	Minor int32
	Major int32
	Patch int32
}

func FreeTypeVersion

func FreeTypeVersion() LibraryVersion

TTF_GetFreeTypeVersion - Query the version of the FreeType library in use. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetFreeTypeVersion)

func HarfBuzzVersion

func HarfBuzzVersion() LibraryVersion

TTF_GetHarfBuzzVersion - Query the version of the HarfBuzz library in use. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetHarfBuzzVersion)

type Pointer

type Pointer = internal.Pointer

type SubString

type SubString struct {
	Flags        SubStringFlags // The flags for this substring
	Offset       int32          // The byte offset from the beginning of the text
	Length       int32          // The byte length starting at the offset
	LineIndex    int32          // The index of the line that contains this substring
	ClusterIndex int32          // The internal cluster index, used for quickly iterating
	Rect         sdl.Rect       // The rectangle, relative to the top left of the text, containing the substring
}

TTF_SubString - The representation of a substring within text. (https://wiki.libsdl.org/SDL3_ttf/TTF_SubString)

type SubStringFlags

type SubStringFlags uint32

TTF_SubStringFlags - Flags for [TTF_SubString](TTF_SubString) (https://wiki.libsdl.org/SDL3_ttf/TTF_SubStringFlags)

type Text

type Text struct {
	Text     string    // A copy of the UTF-8 string that this text object represents, useful for layout, debugging and retrieving substring text. This is updated when the text object is modified and will be freed automatically when the object is destroyed.
	NumLines int32     // The number of lines in the text, 0 if it's empty
	Refcount int32     // Application reference count, used when freeing surface
	Internal *TextData // Private
}

TTF_Text - Text created with [TTF_CreateText](TTF_CreateText)() (https://wiki.libsdl.org/SDL3_ttf/TTF_Text)

func (*Text) AppendString

func (text *Text) AppendString(str string) error

TTF_AppendTextString - Append UTF-8 text to a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_AppendTextString)

func (*Text) Color

func (text *Text) Color() (sdl.Color, error)

TTF_GetTextColor - Get the color of a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextColor)

func (*Text) ColorFloat

func (text *Text) ColorFloat() (sdl.FColor, error)

TTF_GetTextColorFloat - Get the color of a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextColorFloat)

func (*Text) DeleteString

func (text *Text) DeleteString(offset int32, length int32) error

TTF_DeleteTextString - Delete UTF-8 text from a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_DeleteTextString)

func (*Text) Destroy

func (text *Text) Destroy()

TTF_DestroyText - Destroy a text object created by a text engine. (https://wiki.libsdl.org/SDL3_ttf/TTF_DestroyText)

func (*Text) Direction

func (text *Text) Direction() Direction

TTF_GetTextDirection - Get the direction to be used for text shaping a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextDirection)

func (*Text) DrawRenderer

func (text *Text) DrawRenderer(x, y float32) error

TTF_DrawRendererText - Draw text to an SDL renderer. (https://wiki.libsdl.org/SDL3_ttf/TTF_DrawRendererText)

func (*Text) DrawSurface

func (text *Text) DrawSurface(x, y int32, surface *sdl.Surface) error

TTF_DrawSurfaceText - Draw text to an SDL surface. (https://wiki.libsdl.org/SDL3_ttf/TTF_DrawSurfaceText)

func (*Text) Engine

func (text *Text) Engine() (*TextEngine, error)

TTF_GetTextEngine - Get the text engine used by a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextEngine)

func (*Text) Font

func (text *Text) Font() (*Font, error)

TTF_GetTextFont - Get the font used by a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextFont)

func (*Text) GPUDrawData

func (text *Text) GPUDrawData() (*GPUAtlasDrawSequence, error)

TTF_GetGPUTextDrawData - Get the geometry data needed for drawing the text. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetGPUTextDrawData)

func (*Text) InsertString

func (text *Text) InsertString(offset int32, str string) error

TTF_InsertTextString - Insert UTF-8 text into a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_InsertTextString)

func (*Text) NextSubString

func (text *Text) NextSubString(substring *SubString) (*SubString, error)

TTF_GetNextTextSubString - Get the previous substring in a text object (https://wiki.libsdl.org/SDL3_ttf/TTF_GetNextTextSubString)

func (*Text) Position

func (text *Text) Position() (int32, int32)

TTF_GetTextPosition - Get the position of a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextPosition)

func (*Text) PreviousSubString

func (text *Text) PreviousSubString(substring *SubString) (*SubString, error)

TTF_GetPreviousTextSubString - Get the previous substring in a text object (https://wiki.libsdl.org/SDL3_ttf/TTF_GetPreviousTextSubString)

func (*Text) Properties

func (text *Text) Properties() sdl.PropertiesID

TTF_GetTextProperties - Get the properties associated with a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextProperties)

func (*Text) Script

func (text *Text) Script() uint32

TTF_GetTextScript - Get the script used for text shaping a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextScript)

func (*Text) SetColor

func (text *Text) SetColor(r, g, b, a uint8) error

TTF_SetTextColor - Set the color of a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextColor)

func (*Text) SetColorFloat

func (text *Text) SetColorFloat(r, g, b, a float32) error

TTF_SetTextColorFloat - Set the color of a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextColorFloat)

func (*Text) SetDirection

func (text *Text) SetDirection(direction Direction) error

TTF_SetTextDirection - Set the direction to be used for text shaping a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextDirection)

func (*Text) SetEngine

func (text *Text) SetEngine(engine *TextEngine) error

TTF_SetTextEngine - Set the text engine used by a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextEngine)

func (*Text) SetFont

func (text *Text) SetFont(font *Font) error

TTF_SetTextFont - Set the font used by a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextFont)

func (*Text) SetPosition

func (text *Text) SetPosition(x, y int32)

TTF_SetTextPosition - Set the position of a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextPosition)

func (*Text) SetScript

func (text *Text) SetScript(script uint32) error

TTF_SetTextScript - Set the script to be used for text shaping a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextScript)

func (*Text) SetString

func (text *Text) SetString(str string) error

TTF_SetTextString - Set the UTF-8 text used by a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextString)

func (*Text) SetWrapWhitespaceVisible

func (text *Text) SetWrapWhitespaceVisible(visible bool) error

TTF_SetTextWrapWhitespaceVisible - Set whether whitespace should be visible when wrapping a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextWrapWhitespaceVisible)

func (*Text) SetWrapWidth

func (text *Text) SetWrapWidth(wrapWidth int32) error

TTF_SetTextWrapWidth - Set whether wrapping is enabled on a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetTextWrapWidth)

func (*Text) Size

func (text *Text) Size() (int32, int32, error)

TTF_GetTextSize - Get the size of a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextSize)

func (*Text) SubString

func (text *Text) SubString(offset int32) (*SubString, error)

TTF_GetTextSubString - Get the substring of a text object that surrounds a text offset. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextSubString)

func (*Text) SubStringForLine

func (text *Text) SubStringForLine(line int32) (*SubString, error)

TTF_GetTextSubStringForLine - Get the substring of a text object that contains the given line. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextSubStringForLine)

func (*Text) SubStringForPoint

func (text *Text) SubStringForPoint(x, y int32) (*SubString, error)

TTF_GetTextSubStringForPoint - Get the portion of a text string that is closest to a point. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextSubStringForPoint)

func (*Text) SubStringsForRange

func (text *Text) SubStringsForRange(offset int32, length int32) ([]*SubString, error)

TTF_GetTextSubStringsForRange - Get the substrings of a text object that contain a range of text. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextSubStringsForRange)

func (*Text) Update

func (text *Text) Update() error

TTF_UpdateText - Update the layout of a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_UpdateText)

func (*Text) WrapWhitespaceVisible

func (text *Text) WrapWhitespaceVisible() bool

TTF_TextWrapWhitespaceVisible - Return whether whitespace is shown when wrapping a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_TextWrapWhitespaceVisible)

func (*Text) WrapWidth

func (text *Text) WrapWidth() (int32, error)

TTF_GetTextWrapWidth - Get whether wrapping is enabled on a text object. (https://wiki.libsdl.org/SDL3_ttf/TTF_GetTextWrapWidth)

type TextData

type TextData struct {
	Font              *Font
	Color             sdl.FColor
	NeedsLayoutUpdate bool
	Layout            *TextLayout
	X                 int32
	Y                 int32
	W                 int32
	H                 int32
	NumOps            int32
	Ops               *DrawOperation
	NumClusters       int32
	Clusters          *SubString
	Props             sdl.PropertiesID
	NeedsEngineUpdate bool
	Engine            *TextEngine
	EngineText        Pointer
}

TTF_TextData - Internal data for [TTF_Text](TTF_Text) (https://wiki.libsdl.org/SDL3_ttf/TTF_TextData)

type TextEngine

type TextEngine struct {
	Version         uint32
	Userdata        Pointer
	CreateTextFunc  Pointer
	DestroyTextFunc Pointer
}

TTF_TextEngine - A text engine used to create text objects. (https://wiki.libsdl.org/SDL3_ttf/TTF_TextEngine)

func CreateGPUTextEngine

func CreateGPUTextEngine(device *sdl.GPUDevice) (*TextEngine, error)

TTF_CreateGPUTextEngine - Create a text engine for drawing text with the SDL GPU API. (https://wiki.libsdl.org/SDL3_ttf/TTF_CreateGPUTextEngine)

func CreateGPUTextEngineWithProperties

func CreateGPUTextEngineWithProperties(props sdl.PropertiesID) (*TextEngine, error)

TTF_CreateGPUTextEngineWithProperties - Create a text engine for drawing text with the SDL GPU API, with the specified properties. (https://wiki.libsdl.org/SDL3_ttf/TTF_CreateGPUTextEngineWithProperties)

func CreateRendererTextEngine

func CreateRendererTextEngine(renderer *sdl.Renderer) (*TextEngine, error)

TTF_CreateRendererTextEngine - Create a text engine for drawing text on an SDL renderer. (https://wiki.libsdl.org/SDL3_ttf/TTF_CreateRendererTextEngine)

func CreateRendererTextEngineWithProperties

func CreateRendererTextEngineWithProperties(props sdl.PropertiesID) (*TextEngine, error)

TTF_CreateRendererTextEngineWithProperties - Create a text engine for drawing text on an SDL renderer, with the specified properties. (https://wiki.libsdl.org/SDL3_ttf/TTF_CreateRendererTextEngineWithProperties)

func CreateSurfaceTextEngine

func CreateSurfaceTextEngine() (*TextEngine, error)

TTF_CreateSurfaceTextEngine - Create a text engine for drawing text on SDL surfaces. (https://wiki.libsdl.org/SDL3_ttf/TTF_CreateSurfaceTextEngine)

func (*TextEngine) CreateText

func (engine *TextEngine) CreateText(font *Font, text string) (*Text, error)

TTF_CreateText - Create a text object from UTF-8 text and a text engine. (https://wiki.libsdl.org/SDL3_ttf/TTF_CreateText)

func (*TextEngine) DestroyGPU

func (engine *TextEngine) DestroyGPU()

TTF_DestroyGPUTextEngine - Destroy a text engine created for drawing text with the SDL GPU API. (https://wiki.libsdl.org/SDL3_ttf/TTF_DestroyGPUTextEngine)

func (*TextEngine) DestroyRenderer

func (engine *TextEngine) DestroyRenderer()

TTF_DestroyRendererTextEngine - Destroy a text engine created for drawing text on an SDL renderer. (https://wiki.libsdl.org/SDL3_ttf/TTF_DestroyRendererTextEngine)

func (*TextEngine) DestroySurface

func (engine *TextEngine) DestroySurface()

TTF_DestroySurfaceTextEngine - Destroy a text engine created for drawing text on SDL surfaces. (https://wiki.libsdl.org/SDL3_ttf/TTF_DestroySurfaceTextEngine)

func (*TextEngine) GPUWinding

func (engine *TextEngine) GPUWinding() GPUTextEngineWinding

TTF_GetGPUTextEngineWinding - Get the winding order of the vertices returned by TTF_GetGPUTextDrawData for a particular GPU text engine (https://wiki.libsdl.org/SDL3_ttf/TTF_GetGPUTextEngineWinding)

func (*TextEngine) SetGPUWinding

func (engine *TextEngine) SetGPUWinding(winding GPUTextEngineWinding)

TTF_SetGPUTextEngineWinding - Sets the winding order of the vertices returned by TTF_GetGPUTextDrawData for a particular GPU text engine. (https://wiki.libsdl.org/SDL3_ttf/TTF_SetGPUTextEngineWinding)

type TextLayout

type TextLayout struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL