head

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Overview

Package head reads and writes "head" tables. https://docs.microsoft.com/en-us/typography/opentype/spec/head

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	FontRevision Version // set by font manufacturer
	HasYBaseAt0  bool    // baseline for font at y=0
	HasXBaseAt0  bool    // left sidebearing point at x=0 (only for TrueType)
	IsNonlinear  bool    // outline/advance width may change nonlinearly
	UnitsPerEm   uint16  // font design units per em square
	Created      time.Time
	Modified     time.Time
	FontBBox     funit.Rect16

	IsBold      bool
	IsItalic    bool
	HasShadow   bool
	IsCondensed bool
	IsExtended  bool

	LowestRecPPEM uint16 // smallest readable size in pixels
	LocaFormat    int16  // 0 for short offsets, 1 for long (TrueType only)
}

Info represents the information in the "head" table of an sfnt.

func Read

func Read(r io.Reader) (*Info, error)

Read reads and decodes the binary representation of the head table.

func (*Info) Encode

func (info *Info) Encode() []byte

Encode returns the binary representation of the head table.

type Version

type Version uint32

Version represents the font revision in 16.16 fixed point format.

func VersionFromString

func VersionFromString(s string) (Version, error)

VersionFromString parses a version string in the form "1.234" or "Version 1.234". String data after the last digit is ignored.

func (Version) Round

func (v Version) Round() Version

Round removes all information from v which is not visible in the string representation.

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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