freetype

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: MIT Imports: 6 Imported by: 0

README

freetype

PkgGoDev golangci-lint

This is a cgo-free library that implements the much of the FreeType C API. It is a relatively thin wrapper around the excellent libfreetype, providing a slightly more Go friendly API.

A degree of familiarity with FreeType's API will be required. The Freetype Tutorial is a good starting point.

API

The API attempts to balance Go conventions with FreeType conventions. And while it violates both from time to time, hopefully it doesn't stray too far from either.

functions

For the most part there is a one-to-one mapping between C API function and Go functions.

structs

Non-private struct fields are exported, with a few exceptions.

  • Where there are a pair of fields with a count and a pointer to an array, they will not be exported. Instead a method that returns a slice is exported.
  • Fields that are a pointer to a zero-terminated string are not exported. Instead there will be an exported method with the same name, and it will return a Go string.
types

Most C types defined by FreeType have a corresponding Go type.

C macros

Most FreeType C macros do not need to be exposed. One exception is the Font Testing Macros. They are exposed as functions, such as HasHorizontal.

Examples

Simple examples can be found in the example directory.

Completeness

Most types and functions in the Core API are implemented. That should suffice for many glyph rasterization needs.

Alternatives

While this library has its benefits there are alternatives that should be considered.

  • modernc.org/libfreetype - This is the library that this library wraps. It is the result of using ccgo to compile the FreeType C source code to Go. The main challenge with using it is that its API is a little tricky to use. Pointers are represented with uintptr. An instance of libc.TLS must be used, and passed to all functions. It does not export many constants that are needed.
  • github.com/golang/freetype - This is a Go port of the C FreeType library. It has some limitations, a number of open bugs, and has not been updated in 8 years. However it's a good library, and will likely suffice for many use cases.
  • FreeType - It's perfectly possible to use cgo to use the FreeType library itself. This requires the library to be installed, for building apps the headers available, and a knowledge of C and cgo.

Development

source files

Many source files are named after one of the sections in the FreeType API Reference. The types and functions in those files are maintained in the same order as they appear in their section's documentation.

pre-commit hook

There are configuration files for linting and other checks. To use a git pre-commit hook for the checks

Documentation

Index

Constants

View Source
const (
	PIXEL_MODE_NONE  = PixelMode(0)
	PIXEL_MODE_MONO  = PixelMode(1)
	PIXEL_MODE_GRAY  = PixelMode(2)
	PIXEL_MODE_GRAY2 = PixelMode(3)
	PIXEL_MODE_GRAY4 = PixelMode(4)
	PIXEL_MODE_LCD   = PixelMode(5)
	PIXEL_MODE_LCD_V = PixelMode(6)
	PIXEL_MODE_BGRA  = PixelMode(7)
)
View Source
const (
	Err_Ok                    = FTError(0x00)
	Err_Cannot_Open_Resource  = FTError(0x01)
	Err_Unknown_File_Format   = FTError(0x02)
	Err_Invalid_File_Format   = FTError(0x03)
	Err_Invalid_Version       = FTError(0x04)
	Err_Lower_Module_Version  = FTError(0x05)
	Err_Invalid_Argument      = FTError(0x06)
	Err_Unimplemented_Feature = FTError(0x07)
	Err_Invalid_Table         = FTError(0x08)
	Err_Invalid_Offset        = FTError(0x09)
	Err_Array_Too_Large       = FTError(0x0A)
	Err_Missing_Module        = FTError(0x0B)
	Err_Missing_Property      = FTError(0x0C)

	Err_Invalid_Glyph_Index    = FTError(0x10)
	Err_Invalid_Character_Code = FTError(0x11)
	Err_Invalid_Glyph_Format   = FTError(0x12)
	Err_Cannot_Render_Glyph    = FTError(0x13)
	Err_Invalid_Outline        = FTError(0x14)
	Err_Invalid_Composite      = FTError(0x15)
	Err_Too_Many_Hints         = FTError(0x16)
	Err_Invalid_Pixel_Size     = FTError(0x17)
	Err_Invalid_SVG_Document   = FTError(0x18)

	Err_Invalid_Handle         = FTError(0x20)
	Err_Invalid_Library_Handle = FTError(0x21)
	Err_Invalid_Driver_Handle  = FTError(0x22)
	Err_Invalid_Face_Handle    = FTError(0x23)
	Err_Invalid_Size_Handle    = FTError(0x24)
	Err_Invalid_Slot_Handle    = FTError(0x25)
	Err_Invalid_CharMap_Handle = FTError(0x26)
	Err_Invalid_Cache_Handle   = FTError(0x27)
	Err_Invalid_Stream_Handle  = FTError(0x28)

	Err_Too_Many_Drivers    = FTError(0x30)
	Err_Too_Many_Extensions = FTError(0x31)

	Err_Out_Of_Memory   = FTError(0x40)
	Err_Unlisted_Object = FTError(0x41)

	Err_Cannot_Open_Stream       = FTError(0x51)
	Err_Invalid_Stream_Seek      = FTError(0x52)
	Err_Invalid_Stream_Skip      = FTError(0x53)
	Err_Invalid_Stream_Read      = FTError(0x54)
	Err_Invalid_Stream_Operation = FTError(0x55)
	Err_Invalid_Frame_Operation  = FTError(0x56)
	Err_Nested_Frame_Access      = FTError(0x57)
	Err_Invalid_Frame_Read       = FTError(0x58)

	Err_Raster_Uninitialized   = FTError(0x60)
	Err_Raster_Corrupted       = FTError(0x61)
	Err_Raster_Overflow        = FTError(0x62)
	Err_Raster_Negative_Height = FTError(0x63)

	Err_Too_Many_Caches = FTError(0x70)

	Err_Invalid_Opcode            = FTError(0x80)
	Err_Too_Few_Arguments         = FTError(0x81)
	Err_Stack_Overflow            = FTError(0x82)
	Err_Code_Overflow             = FTError(0x83)
	Err_Bad_Argument              = FTError(0x84)
	Err_Divide_By_Zero            = FTError(0x85)
	Err_Invalid_Reference         = FTError(0x86)
	Err_Debug_OpCode              = FTError(0x87)
	Err_ENDF_In_Exec_Stream       = FTError(0x88)
	Err_Nested_DEFS               = FTError(0x89)
	Err_Invalid_CodeRange         = FTError(0x8A)
	Err_Execution_Too_Long        = FTError(0x8B)
	Err_Too_Many_Function_Defs    = FTError(0x8C)
	Err_Too_Many_Instruction_Defs = FTError(0x8D)
	Err_Table_Missing             = FTError(0x8E)
	Err_Horiz_Header_Missing      = FTError(0x8F)
	Err_Locations_Missing         = FTError(0x90)
	Err_Name_Table_Missing        = FTError(0x91)
	Err_CMap_Table_Missing        = FTError(0x92)
	Err_Hmtx_Table_Missing        = FTError(0x93)
	Err_Post_Table_Missing        = FTError(0x94)
	Err_Invalid_Horiz_Metrics     = FTError(0x95)
	Err_Invalid_CharMap_Format    = FTError(0x96)
	Err_Invalid_PPem              = FTError(0x97)
	Err_Invalid_Vert_Metrics      = FTError(0x98)
	Err_Could_Not_Find_Context    = FTError(0x99)
	Err_Invalid_Post_Table_Format = FTError(0x9A)
	Err_Invalid_Post_Table        = FTError(0x9B)
	Err_DEF_In_Glyf_Bytecode      = FTError(0x9C)
	Err_Missing_Bitmap            = FTError(0x9D)
	Err_Missing_SVG_Hooks         = FTError(0x9E)

	Err_Syntax_Error          = FTError(0xA0)
	Err_Stack_Underflow       = FTError(0xA1)
	Err_Ignore                = FTError(0xA2)
	Err_No_Unicode_Glyph_Name = FTError(0xA3)
	Err_Glyph_Too_Big         = FTError(0xA4)

	Err_Missing_Startfont_Field       = FTError(0xB0)
	Err_Missing_Font_Field            = FTError(0xB1)
	Err_Missing_Size_Field            = FTError(0xB2)
	Err_Missing_Fontboundingbox_Field = FTError(0xB3)
	Err_Missing_Chars_Field           = FTError(0xB4)
	Err_Missing_Startchar_Field       = FTError(0xB5)
	Err_Missing_Encoding_Field        = FTError(0xB6)
	Err_Missing_Bbx_Field             = FTError(0xB7)
	Err_Bbx_Too_Big                   = FTError(0xB8)
	Err_Corrupted_Font_Header         = FTError(0xB9)
	Err_Corrupted_Font_Glyphs         = FTError(0xBA)
)
View Source
const (
	FACE_FLAG_SCALABLE         = FACE_FLAG(1 << 0)
	FACE_FLAG_FIXED_SIZES      = FACE_FLAG(1 << 1)
	FACE_FLAG_FIXED_WIDTH      = FACE_FLAG(1 << 2)
	FACE_FLAG_SFNT             = FACE_FLAG(1 << 3)
	FACE_FLAG_HORIZONTAL       = FACE_FLAG(1 << 4)
	FACE_FLAG_VERTICAL         = FACE_FLAG(1 << 5)
	FACE_FLAG_KERNING          = FACE_FLAG(1 << 6)
	FACE_FLAG_FAST_GLYPHS      = FACE_FLAG(1 << 7)
	FACE_FLAG_MULTIPLE_MASTERS = FACE_FLAG(1 << 8)
	FACE_FLAG_GLYPH_NAMES      = FACE_FLAG(1 << 9)
	FACE_FLAG_EXTERNAL_STREAM  = FACE_FLAG(1 << 10)
	FACE_FLAG_HINTER           = FACE_FLAG(1 << 11)
	FACE_FLAG_CID_KEYED        = FACE_FLAG(1 << 12)
	FACE_FLAG_TRICKY           = FACE_FLAG(1 << 13)
	FACE_FLAG_COLOR            = FACE_FLAG(1 << 14)
	FACE_FLAG_VARIATION        = FACE_FLAG(1 << 15)
	FACE_FLAG_SVG              = FACE_FLAG(1 << 16)
	FACE_FLAG_SBIX             = FACE_FLAG(1 << 17)
	FACE_FLAG_SBIX_OVERLAY     = FACE_FLAG(1 << 18)
)
View Source
const (
	STYLE_FLAG_ITALIC = STYLE_FLAG(1 << 0)
	STYLE_FLAG_BOLD   = STYLE_FLAG(1 << 1)
)
View Source
const (
	LOAD_DEFAULT                     = LoadFlag(0x0)
	LOAD_NO_SCALE                    = LoadFlag(1 << 1)
	LOAD_NO_HINTING                  = LoadFlag(1 << 2)
	LOAD_RENDER                      = LoadFlag(1 << 3)
	LOAD_NO_BITMAP                   = LoadFlag(1 << 4)
	LOAD_VERTICAL_LAYOUT             = LoadFlag(1 << 5)
	LOAD_FORCE_AUTOHINT              = LoadFlag(1 << 6)
	LOAD_CROP_BITMAP                 = LoadFlag(1 << 7)
	LOAD_PEDANTIC                    = LoadFlag(1 << 8)
	LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH = LoadFlag(1 << 9)
	LOAD_NO_RECURSE                  = LoadFlag(1 << 10)
	LOAD_IGNORE_TRANSFORM            = LoadFlag(1 << 11)
	LOAD_MONOCHROME                  = LoadFlag(1 << 12)
	LOAD_LINEAR_DESIGN               = LoadFlag(1 << 13)
	LOAD_SBITS_ONLY                  = LoadFlag(1 << 14)
	LOAD_NO_AUTOHINT                 = LoadFlag(1 << 15)

	/* Bits 16-19 are used by `FT_LOAD_TARGET_` */
	LOAD_COLOR               = LoadFlag(1 << 20)
	LOAD_COMPUTE_METRICS     = LoadFlag(1 << 21)
	LOAD_BITMAP_METRICS_ONLY = LoadFlag(1 << 22)
	LOAD_NO_SVG              = LoadFlag(1 << 24)
)
View Source
const (
	LOAD_TARGET_NORMAL = LoadTarget(RENDER_MODE_NORMAL)
	LOAD_TARGET_LIGHT  = LoadTarget(RENDER_MODE_LIGHT)
	LOAD_TARGET_MONO   = LoadTarget(RENDER_MODE_MONO)
	LOAD_TARGET_LCD    = LoadTarget(RENDER_MODE_LCD)
	LOAD_TARGET_LCD_V  = LoadTarget(RENDER_MODE_LCD_V)
)
View Source
const (
	RENDER_MODE_NORMAL = RenderMode(0)
	RENDER_MODE_LIGHT  = RenderMode(1)
	RENDER_MODE_MONO   = RenderMode(2)
	RENDER_MODE_LCD    = RenderMode(3)
	RENDER_MODE_LCD_V  = RenderMode(4)
	RENDER_MODE_SDF    = RenderMode(5)
)
View Source
const (
	KERNING_DEFAULT  = KerningMode(0)
	KERNING_UNFITTED = KerningMode(1)
	KERNING_UNSCALED = KerningMode(2)
)
View Source
const (
	FSTYPE_INSTALLABLE_EMBEDDING        = FSType(0x0000)
	FSTYPE_RESTRICTED_LICENSE_EMBEDDING = FSType(0x0002)
	FSTYPE_PREVIEW_AND_PRINT_EMBEDDING  = FSType(0x0004)
	FSTYPE_EDITABLE_EMBEDDING           = FSType(0x0008)
	FSTYPE_NO_SUBSETTING                = FSType(0x0100)
	FSTYPE_BITMAP_EMBEDDING_ONLY        = FSType(0x0200)
)
View Source
const (
	SUBGLYPH_FLAG_ARGS_ARE_WORDS     = SubglyphFlag(1)
	SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES = SubglyphFlag(2)
	SUBGLYPH_FLAG_ROUND_XY_TO_GRID   = SubglyphFlag(4)
	SUBGLYPH_FLAG_SCALE              = SubglyphFlag(8)
	SUBGLYPH_FLAG_XY_SCALE           = SubglyphFlag(0x40)
	SUBGLYPH_FLAG_2X2                = SubglyphFlag(0x80)
	SUBGLYPH_FLAG_USE_MY_METRICS     = SubglyphFlag(0x200)
)
View Source
const (
	// The maximum number of Multiple Masters axes.
	T1_MAX_MM_AXIS = 4
	// The maximum number of Multiple Masters designs.
	T1_MAX_MM_DESIGNS = 16
	// The maximum number of elements in a design map.
	T1_MAX_MM_MAP_POINTS = 20
)
View Source
const (
	SIZE_REQUEST_TYPE_NOMINAL  = SizeRequestType(0)
	SIZE_REQUEST_TYPE_REAL_DIM = SizeRequestType(1)
	SIZE_REQUEST_TYPE_BBOX     = SizeRequestType(2)
	SIZE_REQUEST_TYPE_CELL     = SizeRequestType(3)
	SIZE_REQUEST_TYPE_SCALES   = SizeRequestType(4)
)
View Source
const (
	SFNT_HEAD = SfntTag(0)
	SFNT_MAXP = SfntTag(1)
	SFNT_OS2  = SfntTag(2)
	SFNT_HHEA = SfntTag(3)
	SFNT_VHEA = SfntTag(4)
	SFNT_POST = SfntTag(5)
	SFNT_PCLT = SfntTag(6)
	SFNT_MAX  = SfntTag(7)
)
View Source
const (
	PLATFORM_APPLE_UNICODE = TT_Platform(0)
	PLATFORM_MACINTOSH     = TT_Platform(1)
	PLATFORM_ISO           = TT_Platform(2) /* deprecated */
	PLATFORM_MICROSOFT     = TT_Platform(3)
	PLATFORM_CUSTOM        = TT_Platform(4)
	PLATFORM_ADOBE         = TT_Platform(7) /* artificial */
)
View Source
const (
	APPLE_ID_DEFAULT          = TT_AppleID(0) /* Unicode 1.0                   */
	APPLE_ID_UNICODE_1_1      = TT_AppleID(1) /* specify Hangul at U+34xx      */
	APPLE_ID_ISO_10646        = TT_AppleID(2) /* deprecated                    */
	APPLE_ID_UNICODE_2_0      = TT_AppleID(3) /* or later                      */
	APPLE_ID_UNICODE_32       = TT_AppleID(4) /* 2.0 or later, full repertoire */
	APPLE_ID_VARIANT_SELECTOR = TT_AppleID(5) /* variation selector data       */
	APPLE_ID_FULL_UNICODE     = TT_AppleID(6) /* used with type 13 cmaps       */
)
View Source
const (
	NAME_ID_COPYRIGHT      = TT_NameID(0)
	NAME_ID_FONT_FAMILY    = TT_NameID(1)
	NAME_ID_FONT_SUBFAMILY = TT_NameID(2)
	NAME_ID_UNIQUE_ID      = TT_NameID(3)
	NAME_ID_FULL_NAME      = TT_NameID(4)
	NAME_ID_VERSION_STRING = TT_NameID(5)
	NAME_ID_PS_NAME        = TT_NameID(6)
	NAME_ID_TRADEMARK      = TT_NameID(7)

	/* the following values are from the OpenType spec */
	NAME_ID_MANUFACTURER = TT_NameID(8)
	NAME_ID_DESIGNER     = TT_NameID(9)
	NAME_ID_DESCRIPTION  = TT_NameID(10)
	NAME_ID_VENDOR_URL   = TT_NameID(11)
	NAME_ID_DESIGNER_URL = TT_NameID(12)
	NAME_ID_LICENSE      = TT_NameID(13)
	NAME_ID_LICENSE_URL  = TT_NameID(14)
	/* number 15 is reserved */
	NAME_ID_TYPOGRAPHIC_FAMILY    = TT_NameID(16)
	NAME_ID_TYPOGRAPHIC_SUBFAMILY = TT_NameID(17)
	NAME_ID_MAC_FULL_NAME         = TT_NameID(18)

	/* The following code is new as of 2000-01-21 */
	NAME_ID_SAMPLE_TEXT = TT_NameID(19)

	/* This is new in OpenType 1.3 */
	NAME_ID_CID_FINDFONT_NAME = TT_NameID(20)

	/* This is new in OpenType 1.5 */
	NAME_ID_WWS_FAMILY    = TT_NameID(21)
	NAME_ID_WWS_SUBFAMILY = TT_NameID(22)

	/* This is new in OpenType 1.7 */
	NAME_ID_LIGHT_BACKGROUND = TT_NameID(23)
	NAME_ID_DARK_BACKGROUND  = TT_NameID(24)

	/* This is new in OpenType 1.8 */
	NAME_ID_VARIATIONS_PREFIX = TT_NameID(25)
)
View Source
const Angle2PI = Angle(AnglePI * 2)

Angle2PI is the angle 2*pi expressed in Angle units.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_angle_2pi

View Source
const AnglePI = Angle(180 << 16)

AnglePI is the angle pi expressed in Angle units.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_angle_pi

View Source
const AnglePI2 = Angle(AnglePI / 2)

AnglePI2 is the angle pi/2 expressed in Angle units.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_angle_pi2

View Source
const AnglePI4 = Angle(AnglePI / 4)

AnglePI4 is the angle pi/4 expressed in Angle units.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_angle_pi4

View Source
const FT_VAR_AXIS_FLAG_HIDDEN = UInt(1)

The variation axis should not be exposed to user interfaces.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_var_axis_flag_xxx

View Source
const LCDFilterWeightsLen = 5

Variables

View Source
var (
	GLYPH_FORMAT_NONE      = GlyphFormat(imageTag(0, 0, 0, 0))
	GLYPH_FORMAT_COMPOSITE = GlyphFormat(imageTag('c', 'o', 'm', 'p'))
	GLYPH_FORMAT_BITMAP    = GlyphFormat(imageTag('b', 'i', 't', 's'))
	GLYPH_FORMAT_OUTLINE   = GlyphFormat(imageTag('o', 'u', 't', 'l'))
	GLYPH_FORMAT_PLOTTER   = GlyphFormat(imageTag('p', 'l', 'o', 't'))
	GLYPH_FORMAT_SVG       = GlyphFormat(imageTag('S', 'V', 'G', ' '))
)
View Source
var (
	ENCODING_NONE = Encoding(imageTag(0, 0, 0, 0))

	ENCODING_MS_SYMBOL = Encoding(imageTag('s', 'y', 'm', 'b'))
	ENCODING_UNICODE   = Encoding(imageTag('u', 'n', 'i', 'c'))

	ENCODING_SJIS    = Encoding(imageTag('s', 'j', 'i', 's'))
	ENCODING_PRC     = Encoding(imageTag('g', 'b', ' ', ' '))
	ENCODING_BIG5    = Encoding(imageTag('b', 'i', 'g', '5'))
	ENCODING_WANSUNG = Encoding(imageTag('w', 'a', 'n', 's'))
	ENCODING_JOHAB   = Encoding(imageTag('j', 'o', 'h', 'a'))

	/* for backward compatibility */
	ENCODING_GB2312     = ENCODING_PRC
	ENCODING_MS_SJIS    = ENCODING_SJIS
	ENCODING_MS_GB2312  = ENCODING_PRC
	ENCODING_MS_BIG5    = ENCODING_BIG5
	ENCODING_MS_WANSUNG = ENCODING_WANSUNG
	ENCODING_MS_JOHAB   = ENCODING_JOHAB

	ENCODING_ADOBE_STANDARD = Encoding(imageTag('A', 'D', 'O', 'B'))
	ENCODING_ADOBE_EXPERT   = Encoding(imageTag('A', 'D', 'B', 'E'))
	ENCODING_ADOBE_CUSTOM   = Encoding(imageTag('A', 'D', 'B', 'C'))
	ENCODING_ADOBE_LATIN_1  = Encoding(imageTag('l', 'a', 't', '1'))

	ENCODING_OLD_LATIN_2 = Encoding(imageTag('l', 'a', 't', '2'))

	ENCODING_APPLE_ROMAN = Encoding(imageTag('a', 'r', 'm', 'n'))
)
View Source
var (
	PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY    = ParamTag(imageTag('i', 'g', 'p', 'f'))
	PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY = ParamTag(imageTag('i', 'g', 'p', 's'))
	PARAM_TAG_INCREMENTAL                  = ParamTag(imageTag('i', 'n', 'c', 'r'))
	PARAM_TAG_IGNORE_SBIX                  = ParamTag(imageTag('i', 's', 'b', 'x'))
	PARAM_TAG_LCD_FILTER_WEIGHTS           = ParamTag(imageTag('l', 'c', 'd', 'f'))
	PARAM_TAG_RANDOM_SEED                  = ParamTag(imageTag('s', 'e', 'e', 'd'))
	PARAM_TAG_STEM_DARKENING               = ParamTag(imageTag('d', 'a', 'r', 'k'))
	PARAM_TAG_UNPATENTED_HINTING           = ParamTag(imageTag('u', 'n', 'p', 'a'))
)

Functions

func VectorPolarize added in v0.2.0

func VectorPolarize(tls *libc.TLS, vec Vector) (Fixed, Angle)

VectorPolarize computes both the length and angle of a given vector.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_vector_polarize

Types

type Angle added in v0.2.0

type Angle = libfreetype.TFT_Angle

Angle is used to model angle values in FreeType. Note that the angle is a 16.16 fixed-point value expressed in degrees.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_angle

func AngleDiff added in v0.2.0

func AngleDiff(angle1 Angle, angle2 Angle) Angle

AngleDiff returns the difference between two angles. The result is always constrained to the ]-PI..PI] interval.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_angle_diff

type BBox

type BBox struct {
	XMin Pos
	YMin Pos
	XMax Pos
	YMax Pos
}

BBox is a structure used to hold an outline's bounding box, i.e., the coordinates of its extrema in the horizontal and vertical directions.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_bbox

type Bitmap

type Bitmap struct {
	Rows  uint32
	Width uint32
	Pitch int32

	NumGrays  uint16
	PixelMode PixelMode
	// contains filtered or unexported fields
}

Bitmap is a structure used to describe a bitmap or pixmap to the raster.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_bitmap

func (Bitmap) Buffer

func (bm Bitmap) Buffer() []byte

Buffer returns the Bitmap's buffer as byte slice.

func (Bitmap) BufferVisualization

func (bm Bitmap) BufferVisualization() string

BufferVisualization returns a string containing an ascii representation of a grayscale bitmap. It can be useful for demonstration or debug purposes.

type BitmapSize

type BitmapSize struct {
	Height Short
	Width  Short

	Size Pos

	Xppem Pos
	YPpem Pos
}

BitmapSize structure models the metrics of a bitmap strike (i.e., a set of glyphs for a given point size and resolution) in a bitmap font.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_bitmap_size

type Bool

type Bool = libfreetype.TFT_Bool

Bool is a type of unsigned char, used for simple booleans. As usual, values 1 and 0 represent true and false, respectively.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_bool

type CharMap

type CharMap uintptr

CharMap is a handle to a character map (usually abbreviated to ‘charmap’). A charmap is used to translate character codes in a given encoding into glyph indexes for its parent's face. Some font formats may provide several charmaps per font.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_charmap

func (CharMap) Rec

func (charmap CharMap) Rec() *CharMapRec

Rec returns a pointer to the FaceRec that is referenced by the Face.

type CharMapRec

type CharMapRec struct {
	Face       libfreetype.TFT_Face
	Encoding   Encoding
	PlatformID UShort
	EncodingID UShort
}

CharMapRec is the base charmap structure.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_charmaprec

type Data

type Data struct {
	Pointer *Byte
	Length  UInt
}

Data is read-only binary data represented as a pointer and a length.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_data

type Encoding

type Encoding libfreetype.TFT_Encoding

Encoding is an enumeration to specify character sets supported by charmaps. Used in the FT_Select_Charmap API function.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_encoding

func (Encoding) String

func (encoding Encoding) String() string

String returns a formatted representation of the 4 bytes of the Encoding tag.

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is used to represent errors returned from FreeType functions.

Its FTError method can be used to get the FTError value that was returned from the failing function.

func (Error) Error

func (err Error) Error() string

func (Error) FTError

func (err Error) FTError() FTError

FTError returns the FTError value that was returned from the failing function.

type F26Dot6

type F26Dot6 = libfreetype.TFT_F26Dot6

F26Dot6 is a signed 26.6 fixed-point type used for vectorial pixel coordinates.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_f26dot6

type F2Dot14

type F2Dot14 = libfreetype.TFT_F2Dot14

F2Dot14 is a signed 2.14 fixed-point type used for unit vectors.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_f2dot14

type FACE_FLAG

type FACE_FLAG = Long

A list of bit flags used in the face_flags field of the FaceRec structure. They inform client applications of properties of the corresponding face.

https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_face_flag_xxx

type FSType

type FSType = UShort

FSType is a list of bit flags used in the fsType field of the OS/2 table in a TrueType or OpenType font and the FSType entry in a PostScript font.

https://freetype.org/freetype2/docs/reference/ft2-information_retrieval.html#ft_fstype_xxx

type FTError

type FTError = libfreetype.TFT_Error

FTError is the FreeType error code type. A value of 0 (Err_Ok) is always interpreted as a successful operation.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_error

type FWord

type FWord = libfreetype.TFT_FWord

Word is a signed 16-bit integer used to store a distance in original font units.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_word

type Face

type Face struct {
	// contains filtered or unexported fields
}

Face is a handle to a typographic face object. A face object models a given typeface, in a given style.

https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_face

func (Face) Done

func (face Face) Done() error

Done discards a given face object, as well as all of its child slots and sizes.

https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_done_face

func (Face) GetCMapFormat

func (face Face) GetCMapFormat(charmap CharMap) Long

GetCMapFormat returns the format of an SFNT ‘cmap’ table.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#ft_get_cmap_format

func (Face) GetCMapLanguageID

func (face Face) GetCMapLanguageID(charmap CharMap) ULong

GetCMapLanguageID returns cmap language ID as specified in the OpenType standard. Definitions of language ID values are in file FT_TRUETYPE_IDS_H.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#ft_get_cmap_language_id

func (Face) GetCharIndex

func (face Face) GetCharIndex(charcode rune) UInt

GetCharIndex returns the glyph index of a given character code. This function uses the currently selected charmap to do the mapping.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_get_char_index

func (Face) GetCharmapIndex

func (face Face) GetCharmapIndex(charmap CharMap) Int

GetCharmapIndex retrieves the index of a given charmap.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_get_charmap_index

func (Face) GetFSTypeFlags

func (face Face) GetFSTypeFlags() FSType

GetFSTypeFlags returns the FSType flags for a font.

https://freetype.org/freetype2/docs/reference/ft2-information_retrieval.html#ft_get_fstype_flags

func (Face) GetFirstChar

func (face Face) GetFirstChar() (ULong, UInt)

GetFirstChar returns the first character code in the current charmap of a given face, together with its corresponding glyph index.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_get_first_char

func (Face) GetGlyphName

func (face Face) GetGlyphName(glyphIndex UInt) (string, error)

GetGlyphName retrieves the ASCII name of a given glyph in a face. This only works for those faces where HasGlyphNames returns true.

https://freetype.org/freetype2/docs/reference/ft2-information_retrieval.html#ft_get_glyph_name

func (Face) GetKerning

func (face Face) GetKerning(leftGlyph UInt, rightGlyph UInt, kernMode KerningMode) (Vector, error)

GetKerning returns the kerning vector between two glyphs of the same face.

Use HasKerning to find out whether a font has data that can be extracted with GetKerning.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_get_kerning

func (Face) GetMMBlendCoordinates added in v0.3.0

func (face Face) GetMMBlendCoordinates(numCoords UInt) ([]Fixed, error)

Get the normalized blend coordinates of the currently selected interpolated font.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_get_mm_blend_coordinates

func (Face) GetMMVar added in v0.3.0

func (face Face) GetMMVar() (*MMVar, error)

Retrieve a variation descriptor for a given font.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_get_mm_var

func (Face) GetMMWeightVector added in v0.3.0

func (face Face) GetMMWeightVector(length UInt) (UInt, []Fixed, error)

For Adobe MM fonts, retrieve the current weight vector of the font.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_get_mm_weightvector

func (Face) GetMultiMaster added in v0.3.0

func (face Face) GetMultiMaster() (MultiMaster, error)

Retrieve a variation descriptor of a given Adobe MM font.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_get_multi_master

func (Face) GetNameIndex

func (face Face) GetNameIndex(glyphName string) (UInt, error)

GetNameIndex returns the glyph index of a given glyph name. This only works for those faces where HasGlyphNames returns true.

https://freetype.org/freetype2/docs/reference/ft2-information_retrieval.html#ft_get_name_index

func (Face) GetNextChar

func (face Face) GetNextChar(charCode ULong) (ULong, UInt)

GetNextChar returns the next character code in the current charmap of a given face following the value char_code, as well as the corresponding glyph index.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_get_next_char

func (Face) GetPostscriptName

func (face Face) GetPostscriptName() string

GetPostscriptName retrieves the ASCII PostScript name of a given face, if available.

https://freetype.org/freetype2/docs/reference/ft2-information_retrieval.html#ft_get_postscript_name

func (Face) GetSfntLangTag

func (face Face) GetSfntLangTag(langID UInt) (SfntLangTag, error)

GetSfntLangTag retrieves the language tag associated with a language ID of an SFNT ‘name’ table entry.

https://freetype.org/freetype2/docs/reference/ft2-sfnt_names.html#ft_get_sfnt_langtag

func (Face) GetSfntName

func (face Face) GetSfntName(index UInt) (SfntName, error)

func (Face) GetSfntNameCount

func (face Face) GetSfntNameCount() int

GetSfntNameCount retrieves the number of name strings in the SFNT ‘name’ table.

https://freetype.org/freetype2/docs/reference/ft2-sfnt_names.html#ft_get_sfnt_name_count

func (Face) GetSfntTable

func (face Face) GetSfntTable(tag SfntTag) (unsafe.Pointer, error)

GetSfntTable returns a pointer to a given SFNT table stored within a face.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#ft_get_sfnt_table

func (Face) GetSubGlyphInfo

func (face Face) GetSubGlyphInfo(glyph *GlyphSlotRec, subIndex UInt) (Int, SubglyphFlag, Int, Int, Matrix, error)

GetSubGlyphInfo retrieves a description of a given subglyph. Only use it if glyph->format is GLYPH_FORMAT_COMPOSITE; an error is returned otherwise.

https://freetype.org/freetype2/docs/reference/ft2-information_retrieval.html#ft_get_subglyph_info

func (Face) GetTrackKerning

func (face Face) GetTrackKerning(pointSize Fixed, degree Int) (Fixed, error)

GetTrackKerning returns the track kerning for a given face object at a given size.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_get_track_kerning

func (Face) GetTransform

func (face Face) GetTransform() (Matrix, Vector)

GetTransform returns the transformation that is applied to glyph images when they are loaded into a glyph slot through Load_Glyph. See SetTransform for more details.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_get_transform

func (Face) GetVarAxisFlags added in v0.3.0

func (face Face) GetVarAxisFlags(master *MMVar, axisIndex UInt) (UInt, error)

Get the ‘flags’ field of an OpenType Variation Axis Record.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_get_var_axis_flags

func (Face) GetVarBlendCoordinates added in v0.3.0

func (face Face) GetVarBlendCoordinates(numCoords UInt) ([]Fixed, error)

This is another name of GetMMBlendCoordinates.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_get_var_blend_coordinates

func (Face) GetVarDesignCoordinates added in v0.3.0

func (face Face) GetVarDesignCoordinates(numCoords UInt) ([]Fixed, error)

Get the design coordinates of the currently selected interpolated font.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_get_var_design_coordinates

func (Face) HasColor

func (face Face) HasColor() bool

HasColor returns true whenever a face object contains tables for color glyphs.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_color

func (Face) HasFixedSizes

func (face Face) HasFixedSizes() bool

HasFixedSizes returns true whenever a face object contains some embedded bitmaps.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_fixed_sizes

func (Face) HasGlyphNames

func (face Face) HasGlyphNames() bool

HasGlyphNames returns true whenever a face object contains some glyph names that can be accessed through Get_Glyph_Name.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_glyph_names

func (Face) HasHorizontal

func (face Face) HasHorizontal() bool

HasHorizontal returns true whenever a face object contains horizontal metrics (this is true for all font formats though).

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_horizontal

func (Face) HasKerning

func (face Face) HasKerning() bool

HasKerning returns true whenever a face object contains kerning data that can be accessed with Get_Kerning.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_kerning

func (Face) HasMultipleMasters

func (face Face) HasMultipleMasters() bool

HasMultipleMasters returns true whenever a face object contains some multiple masters.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_multiple_masters

func (Face) HasSVG

func (face Face) HasSVG() bool

HasSVG returns true whenever a face object contains an ‘SVG ’ OpenType table.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_svg

func (Face) HasSbix

func (face Face) HasSbix() bool

HasSbix returns true whenever a face object contains an ‘sbix’ OpenType table and outline glyphs.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_sbix

func (Face) HasSbixOverlay

func (face Face) HasSbixOverlay() bool

HasSbixOverlay returns true whenever a face object contains an ‘sbix’ OpenType table with bit 1 in its flags field set, instructing the application to overlay the bitmap strike with the corresponding outline glyph.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_sbix_overlay

func (Face) HasVertical

func (face Face) HasVertical() bool

HasVertical returns true whenever a face object contains real vertical metrics (and not only synthesized ones).

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_has_vertical

func (Face) IsCIDKeyed

func (face Face) IsCIDKeyed() bool

IsCIDKeyed returns true whenever a face object contains a CID-keyed font.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_is_cid_keyed

func (Face) IsFixedWidth

func (face Face) IsFixedWidth() bool

IsFixedWidth returns true whenever a face object contains a font face that contains fixed-width (or ‘monospace’, ‘fixed-pitch’, etc.) glyphs.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_is_fixed_width

func (Face) IsNamedInstance

func (face Face) IsNamedInstance() bool

IsNamedInstance returns true whenever a face object is a named instance of a GX or OpenType variation font.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_is_named_instance

func (Face) IsScalable

func (face Face) IsScalable() bool

IsScalable returns true whenever a face object contains a scalable font face (true for TrueType, Type 1, Type 42, CID, OpenType/CFF, and PFR font formats).

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_is_scalable

func (Face) IsSfnt

func (face Face) IsSfnt() bool

IsSfnt returns true whenever a face object contains a font whose format is based on the SFNT storage scheme. This usually means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded bitmap fonts.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_is_sfnt

func (Face) IsTricky

func (face Face) IsTricky() bool

IsTricky returns true whenever a face represents a ‘tricky’ font.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_is_tricky

func (Face) IsVariation

func (face Face) IsVariation() bool

IsVariation returns true whenever a face object has been altered by Set_MM_Design_Coordinates, Set_Var_Design_Coordinates, Set_Var_Blend_Coordinates, or Set_MM_WeightVector.

https://freetype.org/freetype2/docs/reference/ft2-font_testing_macros.html#ft_is_variation

func (Face) LoadChar

func (face Face) LoadChar(charCode rune, loadFlags LoadFlag) error

LoadChar loads a glyph into the glyph slot of a face object, accessed by its character code.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_load_char

func (Face) LoadGlyph

func (face Face) LoadGlyph(glyphIndex UInt, loadFlags Int32) error

LoadGlyph loads a glyph into the glyph slot of a face object.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_glyph

func (Face) LoadSfntTable

func (face Face) LoadSfntTable(tag uint32, offset Long, buffer []byte, length *ULong) error

LoadSfntTable loads any SFNT font table into client memory.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#ft_load_sfnt_table

func (Face) Properties

func (face Face) Properties(properties ...Parameter) error

Properties sets or overrides certain (library or module-wide) properties on a face-by-face basis.

https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_face_properties

func (Face) Rec

func (face Face) Rec() *FaceRec

Rec returns a pointer to the FaceRec that is referenced by the Face.

func (Face) Reference

func (face Face) Reference() error

A counter gets initialized to 1 at the time a Face structure is created. This function increments the counter.

https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_reference_face

func (Face) RenderGlyph

func (face Face) RenderGlyph(renderMode RenderMode) error

RenderGlyph convert a given glyph image to a bitmap.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_render_glyph

func (Face) RequestSize

func (face Face) RequestSize(req SizeRequestRec) error

RequestSize resizes the scale of the active Size object in a face.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_request_size

func (Face) SelectCharmap

func (face Face) SelectCharmap(encoding Encoding) error

SelectCharmap selects a given charmap by its encoding tag.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_select_charmap

func (Face) SelectSize

func (face Face) SelectSize(strikeIndex Int) error

SelectSize selects a bitmap strike.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_select_size

func (Face) SetCharSize

func (face Face) SetCharSize(
	charWidth F26Dot6, charHeight F26Dot6,
	horzResolution UInt, vertResolution UInt,
) error

SetCharSize requests the nominal size (in points).

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_set_char_size

func (Face) SetCharmap

func (face Face) SetCharmap(rec CharMapRec) error

SetCharmap selects a given charmap for character code to glyph index mapping.

https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_set_charmap

func (Face) SetMMBlendCoordinates added in v0.3.0

func (face Face) SetMMBlendCoordinates(coords []Fixed) error

Choose an interpolated font design through normalized blend coordinates.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_set_mm_blend_coordinates

func (Face) SetMMDesignCoordinates added in v0.3.0

func (face Face) SetMMDesignCoordinates(coords []Long) error

For Adobe MM fonts, choose an interpolated font design through design coordinates.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_set_mm_design_coordinates

func (Face) SetMMWeightVector added in v0.3.0

func (face Face) SetMMWeightVector(weightVector []Fixed) error

For Adobe MM fonts, choose an interpolated font design by directly setting the weight vector.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_set_mm_weightvector

func (Face) SetNamedInstance added in v0.3.0

func (face Face) SetNamedInstance(instanceIndex UInt) error

Set or change the current named instance..

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_set_named_instance

func (Face) SetPixelSizes

func (face Face) SetPixelSizes(pixelWidth UInt, pixelHeight UInt) error

SetPixelSizes requests the nominal size (in pixels).

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_set_pixel_sizes

func (Face) SetTransform

func (face Face) SetTransform(matrix *Matrix, delta *Vector)

SetTransform sets the transformation that is applied to glyph images when they are loaded into a glyph slot through FT_Load_Glyph.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_set_transform

func (Face) SetVarBlendCoordinates added in v0.3.0

func (face Face) SetVarBlendCoordinates(coords []Fixed) error

This is another name of SetMMBlendCoordinates.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_set_var_blend_coordinates

func (Face) SetVarDesignCoordinates added in v0.3.0

func (face Face) SetVarDesignCoordinates(coords []Fixed) error

Choose an interpolated font design through design coordinates.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_set_var_design_coordinates

func (Face) SfntTableInfo

func (face Face) SfntTableInfo(tableIndex UInt, tag *ULong) (ULong, error)

SfntTableInfo returns information on an SFNT table.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#ft_sfnt_table_info

type FaceRec

type FaceRec struct {
	NumFaces  Long
	FaceIndex Long

	FaceFlags  FACE_FLAG
	StyleFlags STYLE_FLAG

	NumGlyphs Long

	Bbox BBox

	UnitsPerEM UShort
	Ascender   Short
	Descender  Short
	Height     Short

	MaxAdvanceWidth  Short
	MaxAdvanceHeight Short

	UnderlinePosition  Short
	UnderlineThickness Short

	Glyph   GlyphSlot
	Size    Size
	Charmap CharMap
	// contains filtered or unexported fields
}

FaceRec is a FreeType root face class structure. A face object models a typeface in a font file. https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_facerec

func (*FaceRec) AvailableSizes

func (fr *FaceRec) AvailableSizes() []BitmapSize

AvailableSizes returns a slice of Bitmap_Size for all bitmap strikes in the face.

(This exposes the data referenced by the unexported num_fixed_sizes and available_size fields.)

func (*FaceRec) Charmaps

func (fr *FaceRec) Charmaps() []CharMap

Charmaps returns the charmaps of the face.

(This exposes the data referenced by the unexported num_charmaps and charmap fields.)

func (*FaceRec) FamilyName

func (fr *FaceRec) FamilyName() string

FamilyName returns the face's family name.

(This exposes the C string referenced by the unexported family_name field.)

func (*FaceRec) StyleName

func (fr *FaceRec) StyleName() string

Stylename returns the face's style name.

(This exposes the C string referenced by the unexported style_name field.)

type Fixed

type Fixed = libfreetype.TFT_Fixed

Fixed is used to store 16.16 fixed-point values, like scaling values or matrix coefficients.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_fixed

func VectorLength added in v0.2.0

func VectorLength(tls *libc.TLS, vec Vector) Fixed

VectorLength returns the length of a given vector.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_vector_length

type Generic

type Generic struct {
	Data      unsafe.Pointer
	Finalizer GenericFinalizer
}

Client applications often need to associate their own data to a variety of FreeType core objects. For example, a text layout API might want to associate a glyph cache to a given size object.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_generic

type GenericFinalizer

type GenericFinalizer func(object unsafe.Pointer)

GenericFinalizer describes a function used to destroy the ‘client’ data of any FreeType object. See the description of the Generic type for details of usage.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_generic_finalizer

type GlyphFormat

type GlyphFormat libfreetype.TFT_Glyph_Format

GlyphFormat is an enumeration type used to describe the format of a given glyph image.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_glyph_format

func (GlyphFormat) String

func (glyphFormat GlyphFormat) String() string

String returns a formatted representation of the 4 bytes of the GlyphFormat tag.

type GlyphMetrics

type GlyphMetrics struct {
	Width  Pos
	Height Pos

	HoriBearingX Pos
	HoriBearingY Pos
	HoriAdvance  Pos

	VertBearingX Pos
	VertBearingY Pos
	VertAdvance  Pos
}

GlyphMetrics is a structure to model the metrics of a single glyph.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_glyph_metrics

type GlyphSlot

type GlyphSlot uintptr

GlyphSlot is a handle to a given ‘glyph slot’.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_glyphslot

func (GlyphSlot) Rec

func (glyphSlot GlyphSlot) Rec() *GlyphSlotRec

Rec returns a pointer to the FaceRec that is referenced by the Face.

type GlyphSlotRec

type GlyphSlotRec struct {
	Library    libfreetype.TFT_Library
	Face       libfreetype.TFT_Face
	Next       GlyphSlot
	GlyphIndex UInt
	Generic    Generic

	Metrics           GlyphMetrics
	LinearHoriAdvance Fixed
	LinearVertAdvance Fixed
	Advance           Vector

	Format GlyphFormat

	Bitmap     Bitmap
	BitmapLeft Int
	BitmapTop  Int

	Outline libfreetype.TFT_Outline

	NumSubglyphs UInt

	LsbDelta Pos
	RsbDelta Pos

	Other uintptr
	// contains filtered or unexported fields
}

GlyphSlotRec is the FreeType root glyph slot class structure.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_glyphslotrec

func (GlyphSlotRec) SVGDocument added in v0.2.0

func (rec GlyphSlotRec) SVGDocument() *SVGDocumentRec

type KerningMode

type KerningMode = UInt

KerningMode is an enumeration to specify the format of kerning values returned by GetKerning.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_kerning_mode

type Library

type Library struct {
	// contains filtered or unexported fields
}

Library is a handle to a FreeType library instance.

https://freetype.org/freetype2/docs/reference/ft2-library_setup.html#ft_library

func Init

func Init() (Library, error)

Init initializes a new FreeType library object.

https://freetype.org/freetype2/docs/reference/ft2-library_setup.html#ft_init_freetype

func (Library) Done

func (lib Library) Done() error

Done destroys the FreeType library object represented by Library, and all of its children, including resources, drivers, faces, sizes, etc.

https://freetype.org/freetype2/docs/reference/ft2-library_setup.html#ft_done_freetype

func (Library) DoneMMVar added in v0.3.0

func (library Library) DoneMMVar(master *MMVar) error

Free the memory allocated by GetMMVar.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_done_mm_var

func (Library) NewFace

func (lib Library) NewFace(filepathname string, faceIndex int) (Face, error)

NewFace opens a font by its pathname.

https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_new_face

func (Library) NewMemoryFace

func (lib Library) NewMemoryFace(data []byte, faceIndex int) (Face, error)

NewMemoryFace opens a font that has been loaded into memory.

https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_new_memory_face

func (Library) PropertySet added in v0.2.0

func (lib Library) PropertySet(moduleName string, propertyName string, value uintptr) error

Property_Sets set a property for a given module.

https://freetype.org/freetype2/docs/reference/ft2-module_management.html#ft_property_set

func (Library) SetSVGHooks added in v0.2.0

func (lib Library) SetSVGHooks(hooks SVGRendererHooks) error

SetSVGHooks sets the four hooks needed to render OT-SVG glyphs properly.

func (Library) Version

func (lib Library) Version() (int, int, int)

Version returns the version of the FreeType library being used.

The 3 values returned are

  • The major version number.
  • The minor version number.
  • The patch version number.

https://freetype.org/freetype2/docs/reference/ft2-library_setup.html#ft_library_version

type LoadFlag

type LoadFlag = Int32

LoadFlag is a list of bit field constants for LoadGlyph to indicate what kind of operations to perform during glyph loading.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx

type LoadTarget

type LoadTarget = Int32

LoadTarget is a list of values to select a specific hinting algorithm for the hinter.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_target_xxx

type Long

type Long = libfreetype.TFT_Long

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_long

func CeilFix added in v0.2.0

func CeilFix(a Long) Long

CeilFix computes the smallest following integer of a 16.16 fixed number.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_ceilfix

func DivFix added in v0.2.0

func DivFix(a Long, b Long) Long

DivFix computes (a*0x10000)/b with maximum accuracy. Its main use is to divide a given value by a 16.16 fixed-point factor.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_divfix

func FloorFix added in v0.2.0

func FloorFix(a Long) Long

FloorFix computes the largest previous integer of a 16.16 fixed number.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_floorfix

func MulDiv added in v0.2.0

func MulDiv(a Long, b Long, c Long) Long

MulDiv computes (a*b)/c with maximum accuracy, using a 64-bit intermediate integer whenever necessary.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_muldiv

func MulFix added in v0.2.0

func MulFix(a Long, b Long) Long

MulFix computes (a*b)/0x10000 with maximum accuracy. Its main use is to multiply a given value by a 16.16 fixed-point factor.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_mulfix

func RoundFix added in v0.2.0

func RoundFix(a Long) Long

RoundFix rounds a 16.16 fixed number.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_roundfix

type MMAxis added in v0.3.0

type MMAxis struct {
	Minimum Long
	Maximum Long
	// contains filtered or unexported fields
}

A structure to model a given axis in design space for Multiple Masters fonts.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_mm_axis

func (MMAxis) Name added in v0.3.0

func (mma MMAxis) Name() string

type MMVar added in v0.3.0

type MMVar struct {
	NumDesigns UInt
	// contains filtered or unexported fields
}

A structure to model the axes and space of an Adobe MM, TrueType GX, or OpenType variation font.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_mm_var

func (MMVar) Axes added in v0.3.0

func (mmvar MMVar) Axes() []VarAxis

func (MMVar) NamedStyles added in v0.3.0

func (mmvar MMVar) NamedStyles() []VarNamedStyle

type Matrix

type Matrix struct {
	XX, XY Fixed
	YX, YY Fixed
}

Matrix is a simple structure used to store a 2x2 matrix. Coefficients are in 16.16 fixed-point format.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_matrix

func MatrixInvert added in v0.2.0

func MatrixInvert(matrix Matrix) (Matrix, error)

MatrixInvert inverts a 2x2 matrix. Returns an error if it can't be inverted.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_matrix_invert

func MatrixMultiply added in v0.2.0

func MatrixMultiply(a Matrix, b Matrix) Matrix

MatrixMultiply returns the matrix operation a*b.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_matrix_multiply

type MultiMaster added in v0.3.0

type MultiMaster struct {
	NumAxis    UInt
	NumDesigns UInt
	Axis       [T1_MAX_MM_AXIS]MMAxis
}

A structure to model the axes and space of a Multiple Masters font.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_multi_master

type Offset

type Offset = libfreetype.TFT_Offset

Offset is equivalent to the ANSI C size_t type, i.e., the largest unsigned integer type used to express a file size or position, or a memory block size.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_offset

type ParamTag

type ParamTag = libfreetype.TFT_ULong

ParamTag is a tag for use with the Parameter type.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#parameter-tags

type Parameter

type Parameter libfreetype.TFT_Parameter

Parameter is a simple structure to pass more or less generic parameters to Library.OpenFace and Face.Properties.

Use one of the ParameterTagXXX functions to create a Parameter initialized to a specific parameter tag with data. Pass a nil argument to reset the property that the parameter represents.

func ParameterTagIgnoreSbix

func ParameterTagIgnoreSbix(value *bool) Parameter

ParameterTagIgnoreSbix creates a Parameter for the FT_PARAM_TAG_IGNORE_SBIX tag.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#ft_param_tag_ignore_sbix

func ParameterTagIgnoreTypoGraphicFamily

func ParameterTagIgnoreTypoGraphicFamily(value *bool) Parameter

ParameterTagIgnoreTypoGraphicFamily creates a Parameter for the FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY tag.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#ft_param_tag_ignore_typographic_family

func ParameterTagIgnoreTypoGraphicSubfamily

func ParameterTagIgnoreTypoGraphicSubfamily(value *bool) Parameter

ParameterTagIgnoreTypoGraphicSubfamily creates a Parameter for the FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY tag.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#ft_param_tag_ignore_typographic_subfamily

func ParameterTagIncremental

func ParameterTagIncremental(value *bool) Parameter

ParameterTagIncremental creates a Parameter for the FT_PARAM_TAG_INCREMENTAL tag.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#ft_param_tag_incremental

func ParameterTagLCDFilterWeights

func ParameterTagLCDFilterWeights(weights *[LCDFilterWeightsLen]byte) Parameter

ParameterTagLCDFilterWeights creates a Parameter for the FT_PARAM_TAG_LCD_FILTER_WEIGHTS tag.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#ft_param_tag_lcd_filter_weights

func ParameterTagRandomSeed

func ParameterTagRandomSeed(value *int) Parameter

ParameterTagRandomSeed creates a Parameter for the FT_PARAM_TAG_RANDOM_SEED tag.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#ft_param_tag_random_seed

func ParameterTagStemDarkening

func ParameterTagStemDarkening(value *bool) Parameter

ParameterTagStemDarkening creates a Parameter for the FT_PARAM_TAG_STEM_DARKENING tag.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#ft_param_tag_stem_darkening

func ParameterTagUnpatentedHinting

func ParameterTagUnpatentedHinting(value *bool) Parameter

ParameterTagUnpatentedHinting creates a Parameter for the FT_PARAM_TAG_UNPATENTED_HINTING tag.

https://freetype.org/freetype2/docs/reference/ft2-parameter_tags.html#ft_param_tag_unpatented_hinting

type PixelMode

type PixelMode uint8

PixelMode is an enumeration type used to describe the format of pixels in a given bitmap.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_pixel_mode

func (PixelMode) String

func (pixelMode PixelMode) String() string

String returns a formatted representation of the 4 bytes of the PixelMode tag.

type Pointer

type Pointer = libfreetype.TFT_Pointer

Pointer is a simple type for a typeless pointer.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_pointer

type Pos

type Pos = libfreetype.TFT_Pos

Pos is used to store vectorial coordinates. Depending on the context, these can represent distances in integer font units, or 16.16, or 26.6 fixed-point pixel coordinates.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_pos

type PtrDist

type PtrDist = libfreetype.TFT_PtrDist

PtrDist is equivalent to the ANSI C ptrdiff_t type, i.e., the largest signed integer type used to express the distance between two pointers.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_ptrdist

type RenderMode

type RenderMode = libfreetype.TFT_Render_Mode

RenderMode is a list of modes supported by FreeType 2.

https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_render_mode

type STYLE_FLAG

type STYLE_FLAG = Long

A list of bit flags to indicate the style of a given face. These are used in the style_flags field of FaceRec.

https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_style_flag_xxx

type SVGDocument added in v0.2.0

type SVGDocument libfreetype.TFT_SVG_Document

SVGDocument is a handle to an SVGDocumentRec object.

https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html#ft_svg_document

func (SVGDocument) Rec added in v0.2.0

func (sd SVGDocument) Rec() *SVGDocumentRec

Rec returns a pointer to the SVGDocumentRec that is referenced by the SVGDocument.

type SVGDocumentRec added in v0.2.0

type SVGDocumentRec struct {
	Metrics    SizeMetrics
	UnitsPerEM UShort

	StartGlyphID UShort
	EndGlyphID   UShort

	Transform Matrix
	Delta     Vector
	// contains filtered or unexported fields
}

SVGDocumentRec is a structure that models one SVG document.

https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html#ft_svg_documentrec

func (SVGDocumentRec) Document added in v0.2.0

func (rec SVGDocumentRec) Document() []byte

type SVGLibFreeFunc added in v0.2.0

type SVGLibFreeFunc func(tls *libc.TLS, state uintptr)

SVGLibFreeFunc is a callback that is called when the ot-svg module is being freed. It is only called if the init hook was called earlier. This means that neither the init nor the free hook is called if no OT-SVG glyph is rendered.

https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html#svg_lib_free_func

type SVGLibInitFunc added in v0.2.0

type SVGLibInitFunc func(tls *libc.TLS, state uintptr) FTError

SVGLibInitFunc is a callback that is called when the first OT-SVG glyph is rendered in the lifetime of an FT_Library object. In a typical implementation, one would want to allocate a structure and point the data_pointer to it and perform any library initializations that might be needed.

https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html#svg_lib_init_func

type SVGLibPresetSlotFunc added in v0.2.0

type SVGLibPresetSlotFunc func(tls *libc.TLS, slot GlyphSlot, cache Bool, state uintptr) FTError

SVGLibPresetSlotFunc is a callback that is called to preset the glyph slot. It is called from two places.

  • When FT_Load_Glyph needs to preset the glyph slot.
  • Right before the svg module calls the render callback hook.

https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html#svg_lib_preset_slot_func

type SVGLibRenderFunc added in v0.2.0

type SVGLibRenderFunc func(tls *libc.TLS, slot GlyphSlot, state uintptr) FTError

SVGLibRenderFunc is a callback that is called to render an OT-SVG glyph. This callback hook is called right after the preset hook SVG_Lib_Preset_Slot_Func has been called with cache set to TRUE. The data necessary to render is available through the handle FT_SVG_Document, which is set in the other field of FT_GlyphSlotRec.

https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html#svg_lib_render_func

type SVGRendererHooks added in v0.2.0

type SVGRendererHooks struct {
	InitSVG    SVGLibInitFunc
	FreeSvg    SVGLibFreeFunc
	RenderSVG  SVGLibRenderFunc
	PresetSlot SVGLibPresetSlotFunc
}

SVGRendererHooks is a structure that stores the four hooks needed to render OT-SVG glyphs properly. The structure is publicly used to set the hooks via the svg-hooks driver property.

https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html#svg_rendererhooks

type SfntLangTag

type SfntLangTag struct {
	// contains filtered or unexported fields
}

SfntLangTag is a structure to model a language tag entry from an SFNT ‘name’ table.

https://freetype.org/freetype2/docs/reference/ft2-sfnt_names.html#ft_sfntlangtag

func (SfntLangTag) String

func (sn SfntLangTag) String() string

String returns the language tag as a string.

type SfntName

type SfntName struct {
	PlatformID UShort
	EncodingID UShort
	LanguageID UShort
	NameID     UShort
	// contains filtered or unexported fields
}

SfntName is structure used to model an SFNT ‘name’ table entry.

https://freetype.org/freetype2/docs/reference/ft2-sfnt_names.html#ft_sfntname

func (SfntName) String

func (sn SfntName) String() string

String returns the table entry's string field.

type SfntTag

type SfntTag = libfreetype.TFT_Sfnt_Tag

FT_Sfnt_Tag is an enumeration to specify indices of SFNT tables loaded and parsed by FreeType during initialization of an SFNT font. Used in the FT_Get_Sfnt_Table API function.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#ft_sfnt_tag

type Size

type Size uintptr

Size is a handle to an object that models a face scaled to a given character size.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_size

func (Size) Rec added in v0.2.0

func (size Size) Rec() *SizeRec

Rec returns a pointer to the SizeRec that is referenced by the Size.

type SizeMetrics

type SizeMetrics struct {
	Xppem UShort
	Yppem UShort

	XScale Fixed
	YScale Fixed

	Ascender   Pos
	Descender  Pos
	Height     Pos
	MaxAdvance Pos
}

SizeMetrics is the size metrics structure gives the metrics of a size object.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_size_metrics

type SizeRec

type SizeRec struct {
	Face    libfreetype.TFT_Face
	Generic Generic
	Metrics SizeMetrics
	// contains filtered or unexported fields
}

SizeRec is the FreeType root size class structure. A size object models a face object at a given size.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_sizerec

type SizeRequest

type SizeRequest uintptr

SizeRequest is a handle to a size request structure.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_size_request

type SizeRequestRec

type SizeRequestRec struct {
	Type           SizeRequestType
	Width          Long
	Height         Long
	HoriResolution UInt
	VertResolution UInt
}

SizeRequestRec is a structure to model a size request.

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_size_requestrec

type SizeRequestType

type SizeRequestType = libfreetype.TFT_Size_Request_Type

SizeRequestType is an enumeration type that lists the supported size request types, i.e., what input size (in font units) maps to the requested output size (in pixels, as computed from the arguments of SizeRequest).

https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_size_request_type

type SubglyphFlag

type SubglyphFlag = UInt

SubglyphFlag is a list of constants describing subglyphs.

https://freetype.org/freetype2/docs/reference/ft2-information_retrieval.html#ft_subglyph_flag_xxx

type TT_AppleID

type TT_AppleID UShort

TT_AppleID is a list of valid values for the encoding_id for TT_PLATFORM_APPLE_UNICODE charmaps and name entries.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_apple_id_xxx

type TT_Header

type TT_Header struct {
	TableVersion Fixed
	FontRevision Fixed

	CheckSumAdjust Long
	MagicNumber    Long

	Flags      UShort
	UnitsPerEM UShort

	Created   [2]ULong
	Modifield [2]ULong

	XMin Short
	YMin Short
	XMax Short
	YMax Short

	MacStyle      UShort
	LowestRecPPEM UShort

	FontDirection    Short
	IndexToLocFormat Short
	GlyphDataFormat  Short
}

TT_Header is a structure to model a TrueType font header table. All fields follow the OpenType specification. The 64-bit timestamps are stored in two-element arrays Created and Modified, first the upper then the lower 32 bits.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_header

type TT_HoriHeader

type TT_HoriHeader struct {
	Version   Fixed
	Ascender  Short
	Descender Short
	Line_Gap  Short

	AdvanceWidthMax UShort /* advance width maximum */

	MinLeftSideBearing  Short /* minimum left-sb       */
	MinRightSideBearing Short /* minimum right-sb      */
	XMax_Extent         Short /* xmax extents          */
	CaretSlopeRise      Short
	CaretSlopeRun       Short
	CaretOffset         Short

	Reserved [4]Short

	MetricDataFormat Short
	NumberOfHMetrics UShort

	LongMetrics  unsafe.Pointer
	ShortMetrics unsafe.Pointer
}

TT_HoriHeader is a structure to model a TrueType horizontal header, the ‘hhea’ table, as well as the corresponding horizontal metrics table, ‘hmtx’.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_horiheader

type TT_MaxProfile

type TT_MaxProfile struct {
	Version               Fixed
	NumGlyphs             UShort
	MaxPoints             UShort
	MaxContours           UShort
	MaxCompositePoints    UShort
	MaxCompositeContours  UShort
	MaxZones              UShort
	MaxTwilightPoints     UShort
	MaxStorage            UShort
	MaxFunctionDefs       UShort
	MaxInstructionDefs    UShort
	MaxStackElements      UShort
	MaxSizeOfInstructions UShort
	MaxComponentElements  UShort
	MaxComponentDepth     UShort
}

TT_MaxProfile is the maximum profile (‘maxp’) table contains many max values, which can be used to pre-allocate arrays for speeding up glyph loading and hinting.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_maxprofile

type TT_NameID

type TT_NameID = UInt

TT_NameID is the possible values of the ‘name’ identifier field in the name records of an SFNT ‘name’ table. These values are platform independent.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_name_id_xxx

type TT_OS2

type TT_OS2 struct {
	Version             UShort /* 0x0001 - more or 0xFFFF */
	XAvgCharWidth       Short
	UsWeightClass       UShort
	UssWidthClass       UShort
	FsType              UShort
	YSubscriptXSize     Short
	YSubscriptYSize     Short
	YSubscriptXOffset   Short
	YSubscriptYOffset   Short
	YSuperscriptXSize   Short
	YSuperscriptYSize   Short
	YSuperscriptXOffset Short
	YSuperscriptYOffset Short
	YStrikeoutSize      Short
	YStrikeoutPosition  Short
	SFamilyClass        Short

	Panose [10]Byte

	UlUnicodeRange1 ULong /* Bits 0-31   */
	UlUnicodeRange2 ULong /* Bits 32-63  */
	UlUnicodeRange3 ULong /* Bits 64-95  */
	UlUnicodeRange4 ULong /* Bits 96-127 */

	FsSelection      UShort
	UsFirstCharIndex UShort
	UsLastCharIndex  UShort
	STypoAscender    Short
	STypoDescender   Short
	STypoLineGap     Short
	UsWinAscent      UShort
	UsWinDescent     UShort

	UlCodePageRange1 ULong /* Bits 0-31   */
	UlCodePageRange2 ULong /* Bits 32-63  */

	SxHeight       Short
	SCapHeight     Short
	USsDefaultChar UShort
	USsBreakChar   UShort
	USsMaxContext  UShort

	UsLowerOpticalPointSize UShort /* in twips (1/20 points) */
	UsUpperOpticalPointSize UShort /* in twips (1/20 points) */
	// contains filtered or unexported fields
}

TT_OS2 is a structure to model a TrueType ‘OS/2’ table. All fields comply to the OpenType specification.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_os2

type TT_PCLT

type TT_PCLT struct {
	Version             Fixed
	FontNumber          ULong
	Pitch               UShort
	XHeight             UShort
	Style               UShort
	TypeFamily          UShort
	CapHeight           UShort
	SymbolSet           UShort
	TypeFace            [16]Char
	CharacterComplement [8]Char
	FileName            [6]Char
	StrokeWeight        Char
	WidthType           Char
	SerifStyle          Byte
	Reserved            Byte
}

type TT_Platform

type TT_Platform UShort

TT_PLatform is list of valid values for the platform_id identifier code in FT_CharMapRec and FT_SfntName structures.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_platform_xxx

type TT_Postscript

type TT_Postscript struct {
	FormatType         Fixed
	ItalicAngle        Fixed
	UnderlinePosition  Short
	UnderlineThickness Short
	IsFixedPitch       ULong
	MinMemType42       ULong
	MaxMemType42       ULong
	MinMemType1        ULong
	MaxMemType1        ULong
}

TT_Postscript is a structure to model a TrueType ‘post’ table. All fields comply to the OpenType specification. This structure does not reference a font's PostScript glyph names; use GetGlyphName to retrieve them.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_postscript

type TT_VertHeader

type TT_VertHeader struct {
	Version   Fixed
	Ascender  Short
	Descender Short
	Line_Gap  Short

	AdvanceHeightMax UShort /* advance height maximum */

	MinTopSideBearing    Short /* minimum top-sb          */
	MinBottomSideBearing Short /* minimum bottom-sb       */
	YMax_Extent          Short /* ymax extents            */
	CaretSlopeRise       Short
	CaretSlopeRun        Short
	CaretOffset          Short

	Reserved [4]Short

	MetricDataFormat Short
	NumberOfVMetrics UShort

	LongMetrics  unsafe.Pointer
	ShortMetrics unsafe.Pointer
}

TT_VertHeader is a structure used to model a TrueType vertical header, the ‘vhea’ table, as well as the corresponding vertical metrics table, ‘vmtx’.

https://freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#tt_vertheader

type Tag

type Tag = libfreetype.TFT_Tag

Tag is type for 32-bit tags (as used in the SFNT format).

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_tag

type UFWord

type UFWord = libfreetype.TFT_UFWord

UWord is an unsigned 16-bit integer used to store a distance in original font units.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_uword

type UnitVector

type UnitVector struct {
	X F2Dot14
	Y F2Dot14
}

UnitVector is a simple structure used to store a 2D vector unit vector. Uses F2Dot14 types.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_unitvector

type VarAxis added in v0.3.0

type VarAxis struct {
	Minimum Fixed
	Def     Fixed
	Maximum Fixed

	Tag   ULong
	Strid UInt
	// contains filtered or unexported fields
}

A structure to model a given axis in design space for Multiple Masters, TrueType GX, and OpenType variation fonts.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_var_axis

func (VarAxis) Name added in v0.3.0

func (va VarAxis) Name() string

type VarNamedStyle added in v0.3.0

type VarNamedStyle struct {
	Coords *Fixed
	Strid  UInt
	Psid   UInt /* since 2.7.1 */
}

A structure to model a named instance in a TrueType GX or OpenType variation font.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_var_named_style

type Vector

type Vector struct {
	X Pos
	Y Pos
}

Vector is a simple structure used to store a 2D vector; coordinates are of the FT_Pos type.

https://freetype.org/freetype2/docs/reference/ft2-basic_types.html#ft_vector

func VectorFromPolar added in v0.2.0

func VectorFromPolar(tls *libc.TLS, length Fixed, angle Angle) Vector

VectorFromPolar computes vector coordinates from a length and angle.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_vector_from_polar

func VectorRotate added in v0.2.0

func VectorRotate(tls *libc.TLS, vec Vector, angle Angle) Vector

VectorRotate rotates a vector by a given angle.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_vector_rotate

func VectorTransform added in v0.2.0

func VectorTransform(vector Vector, matrix Matrix) Vector

VectorTransform transforms a single vector through a 2x2 matrix.

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_vector_transform

func VectorUnit added in v0.2.0

func VectorUnit(angle Angle) Vector

VectorUnit returns the unit vector corresponding to a given angle. After the call, the value of vec.x will be cos(angle), and the value of vec.y will be sin(angle).

https://freetype.org/freetype2/docs/reference/ft2-computations.html#ft_vector_unit

Directories

Path Synopsis
example
image_with_text command
internal

Jump to

Keyboard shortcuts

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