fonts

package
v0.0.0-...-9bb2769 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

Copied here from tiny-go/tinyfont, to improve compilation performance.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TinySZ8pt7b = Font{
	TinySZ8pt7bBitmaps,
	TinySZ8pt7bGlyphs,
	0x20, 0x7E, 10}
View Source
var TinySZ8pt7bBitmaps = []byte{}/* 389 elements not displayed */
View Source
var TinySZ8pt7bGlyphs = []Glyph{
	{0, 1, 1, 6, 0, 0},
	{1, 1, 7, 6, 2, -6},
	{2, 3, 3, 6, 1, -7},
	{4, 5, 6, 6, 0, -5},
	{8, 5, 7, 6, 0, -6},
	{13, 6, 6, 6, 0, -5},
	{18, 6, 7, 6, 0, -6},
	{24, 1, 3, 6, 2, -7},
	{25, 3, 9, 6, 1, -7},
	{29, 3, 9, 6, 1, -7},
	{33, 5, 5, 6, 0, -5},
	{37, 5, 5, 6, 0, -5},
	{41, 2, 2, 6, 1, 0},
	{42, 5, 1, 6, 0, -3},
	{43, 1, 1, 6, 2, 0},
	{44, 5, 9, 6, 0, -7},
	{50, 5, 7, 6, 0, -6},
	{55, 3, 7, 6, 1, -6},
	{58, 5, 7, 6, 0, -6},
	{63, 5, 7, 6, 0, -6},
	{68, 5, 7, 6, 0, -6},
	{73, 5, 7, 6, 0, -6},
	{78, 5, 7, 6, 0, -6},
	{83, 5, 7, 6, 0, -6},
	{88, 5, 7, 6, 0, -6},
	{93, 5, 7, 6, 0, -6},
	{98, 1, 4, 6, 2, -4},
	{99, 2, 5, 6, 1, -4},
	{101, 5, 5, 6, 0, -5},
	{105, 5, 3, 6, 0, -4},
	{107, 5, 5, 6, 0, -5},
	{111, 5, 7, 6, 0, -6},
	{116, 6, 7, 6, 0, -6},
	{122, 5, 7, 6, 0, -6},
	{127, 5, 7, 6, 0, -6},
	{132, 5, 7, 6, 0, -6},
	{137, 5, 7, 6, 0, -6},
	{142, 5, 7, 6, 0, -6},
	{147, 5, 7, 6, 0, -6},
	{152, 5, 7, 6, 0, -6},
	{157, 5, 7, 6, 0, -6},
	{162, 3, 7, 6, 1, -6},
	{165, 5, 7, 6, 0, -6},
	{170, 5, 7, 6, 0, -6},
	{175, 5, 7, 6, 0, -6},
	{180, 5, 7, 6, 0, -6},
	{185, 5, 7, 6, 0, -6},
	{190, 5, 7, 6, 0, -6},
	{195, 5, 7, 6, 0, -6},
	{200, 5, 7, 6, 0, -6},
	{205, 5, 7, 6, 0, -6},
	{210, 5, 7, 6, 0, -6},
	{215, 5, 7, 6, 0, -6},
	{220, 5, 7, 6, 0, -6},
	{225, 5, 7, 6, 0, -6},
	{230, 5, 7, 6, 0, -6},
	{235, 5, 7, 6, 0, -6},
	{240, 5, 7, 6, 0, -6},
	{245, 5, 7, 6, 0, -6},
	{250, 3, 9, 6, 1, -7},
	{254, 5, 9, 6, 0, -7},
	{260, 3, 9, 6, 1, -7},
	{264, 5, 3, 6, 0, -6},
	{266, 6, 1, 6, 0, 1},
	{267, 2, 2, 6, 2, -6},
	{268, 5, 5, 6, 0, -4},
	{272, 5, 8, 6, 0, -7},
	{277, 5, 5, 6, 0, -4},
	{281, 5, 8, 6, 0, -7},
	{286, 5, 5, 6, 0, -4},
	{290, 5, 8, 6, 0, -7},
	{295, 5, 7, 6, 0, -4},
	{300, 5, 8, 6, 0, -7},
	{305, 2, 7, 6, 1, -6},
	{307, 4, 9, 6, 0, -6},
	{312, 4, 8, 6, 1, -7},
	{316, 2, 8, 6, 1, -7},
	{318, 5, 5, 6, 0, -4},
	{322, 5, 5, 6, 0, -4},
	{326, 5, 5, 6, 0, -4},
	{330, 5, 7, 6, 0, -4},
	{335, 5, 7, 6, 0, -4},
	{340, 5, 5, 6, 0, -4},
	{344, 5, 5, 6, 0, -4},
	{348, 4, 7, 6, 1, -6},
	{352, 5, 5, 6, 0, -4},
	{356, 5, 5, 6, 0, -4},
	{360, 5, 5, 6, 0, -4},
	{364, 5, 5, 6, 0, -4},
	{368, 5, 7, 6, 0, -4},
	{373, 5, 5, 6, 0, -4},
	{377, 3, 9, 6, 1, -7},
	{381, 1, 9, 6, 2, -7},
	{383, 3, 9, 6, 1, -7},
	{387, 6, 2, 6, 0, -3},
}

Functions

func DrawChar

func DrawChar(display drivers.Displayer, font *Font, x int16, y int16, char byte, color color.RGBA)

DrawChar sets a single char in the buffer of the display

func DrawCharRotated

func DrawCharRotated(display drivers.Displayer, font *Font, x int16, y int16, char byte, color color.RGBA, rotation Rotation)

DrawCharRotated sets a single char in the buffer of the display

func LineWidth

func LineWidth(font *Font, text []byte) (innerWidth uint32, outboxWidth uint32)

func WriteLine

func WriteLine(display drivers.Displayer, font *Font, x int16, y int16, text []byte, color color.RGBA)

WriteLine writes a string in the selected font in the buffer

func WriteLineColors

func WriteLineColors(display drivers.Displayer, font *Font, x int16, y int16, text []byte, colors []color.RGBA)

WriteLineColors writes a string in the selected font in the buffer. Each char is in a different color if not enough colors are defined, colors are cycled.

func WriteLineColorsRotated

func WriteLineColorsRotated(display drivers.Displayer, font *Font, x int16, y int16, text []byte, colors []color.RGBA, rotation Rotation)

WriteLineColorsRotated writes a string in the selected font in the buffer. Each char is in a different color if not enough colors are defined, colors are cycled.

func WriteLineRotated

func WriteLineRotated(display drivers.Displayer, font *Font, x int16, y int16, text []byte, color color.RGBA, rotation Rotation)

WriteLineRotated writes a string in the selected font in the buffer

Types

type Font

type Font struct {
	Bitmaps  []byte
	Glyphs   []Glyph
	First    byte
	Last     byte
	YAdvance uint8
}

type Glyph

type Glyph struct {
	BitmapIndex uint16
	Width       uint8
	Height      uint8
	XAdvance    uint8
	XOffset     int8
	YOffset     int8
}

type Rotation

type Rotation uint8
const (
	NO_ROTATION  Rotation = 0
	ROTATION_90  Rotation = 1 // 90 degrees clock-wise rotation
	ROTATION_180 Rotation = 2
	ROTATION_270 Rotation = 3
)

Jump to

Keyboard shortcuts

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