font

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 8 Imported by: 9

Documentation

Overview

Package font provides functionality to load ascii fonts from png files.

Index

Constants

This section is empty.

Variables

View Source
var Zaratustra8x8 = []byte("\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x80\x00\x00\x00\x80\b\x06\x00\x00\x00\xc3>a\xcb\x00\x00\fKIDATx\x9c\xed]\xedr\xe3:\buv\xfa\xfe\xaf\x9c\xfb\xa3\xa3\xbd\x84\x85\xc3\x01\x84\xed693\x99\xc6FBHB|9M\x1e\xcf\xe7\xf3 \xa1\x1b>\x12\xf4\xa7\xb8\xf74貝u\u007f\x17\xdd냰\xf8=\x8d{\xf2\xbeuO߷Ƌ\xf8\xa3q\x18\xbe\xba\xcd\xcb\xfd?\x0e3\xaf\xa3|=\x15\xdd\x13\xc8k\xa7\xfbX\xedw\xd2;\xd0\xf3\xb7\x16\xfb)^H\t\x1f\x06=\xe2\xaf\xc7\xc9\xf0^\xfc\xcdkF\x01\x96pz\xf3\xe4\xa4\xd7\xe0\x87z\xcfn\x86+\xa0\x1ao\xf1f\xda\uf0b5\xa1ڒ!yY\x9e,\x90\x12<\x1d\x9a\xec\xf326k\x01\x16\x13\xeb\xbd\x1c\xdcz\x1f\x81=\xd1\xd1߈\xaf\xb78\x12\xde\t\xea\xe2\xa9^\x13c\x1c\x87o]\xf4!\xfd{/\xa3\x00\xd5\r\xf6&\xfbHҽ\xbfw\x876\xef\x12ڪ1\n\x92U 9\xeeS\xdf\xcbZ\x00$ \xb2\x10\x93\xd7zq\xd1bG\vgY\x89\xc8\xc4G.\x82\x05\xab\xd8\xe8\x84{p]\xe8\x17)\x98\xd4b\x8b\xa9V\f/.@\xda\x1b\xd1M\x1f\x96\xa0w\xa07\xd4\v\xe2\xb4,,,뚍\xa3\xa2\xe0Ѽ~\x9c\x94\x06\xde\x19l\x1a\xd8\xe9\x1f\xa5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x14\xe0͑\xf9\xc7\x10/\u007f\xaf|Pq:\xb2π\x1d?\xaa\x1f\xa0\xbe\xb2\xcd\xd4\xf3\x16$\x83K\xcb\xfcx\xb4\x0e\xf6$І\xca\xc0\x8b\t\x10+AQ\xc4\x1f\xd1Ѽ\x98\xfe\xcc'\xa1\xba\xb1E\xa4`\x99\xe2\xd6˵\xfc~\x00+E\xaa\xa0\x1253\x13\x94\xaf\f\xd8\n\xa0\xfck\xf5\xb7d=\x03\xd1\xf8-\xe5\xd2\xff\x1d\x1c-\xd2T\x94\x8c\x16V\xcaw\x1c5\x05C`6\xb8\xaa|R\x06\xe6C\x1aU\xfe\xe5\x03\x92y\x1c̘\xca*\xee\x9e~u]\x1c\xe3B:\xcfbZ\x16\xe0jD\x85\x99,\x9fl\u007f\xd9Nj\x11\x10}\x1a\x19\xf9\xd2\xd0?\x18\x11i\xf1\xe1\xd0\x10\xd8 \xc9C\xf6\tbe\x83\xa2\x93Ǭ\x8b'Of\xecj\x00\xc9\xc4QvG\"\rܕ\xbeLag\x84\xbd01\xd7[\xba\xb9l\x1d\xa0k\x19\xa2\xb6\x99t\xe6\xa7\xc1S46K\x19\x99\xbb~\x1a(\x05c!\x83C\xaf/\xa3$\x9d H\xf6\xef\xf0\xee\xce!\x82W\x03\xc9\x04\x89\x1eJ. \xfb4\x10-\x82\x97%T|b\x05;6\x1f\xcd\xc1jw\x06F\xc7b,\x00\x9b\xfey\xca\x11\x05q]\xb0\xf2\xfft\xf71\xe6\x02\xba\x8c\x99\xcde\xdcD\x15l\xec\xc1F\xfa\x16OF\x89=:\x1b\xc5{\xbcGS\xd0L\f\x80\x16\x8e\xc5\xe4)\xac\x14a4\x18%\xce\xd2[y:1n\v\xd5O\x04E\x85\x9b\f=\x02\xab\xf9\x91\x82^\xe9\x02\xbaJ0\x86;}O\xe0oN\x01o\x8b\xff\x00+\f\xe3Uz\xdd\xfe\x96\x00\x00\x00\x00IEND\xaeB`\x82")

Zaratustra8x8 is the data from 'zaratustra_msx-8x8.png' generated by file2byteslice.

Functions

This section is empty.

Types

type Font

type Font struct {
	File       string
	Image      *ebiten.Image
	TileWidth  int
	TileHeight int
	TileSizeX  int
	TileSizeY  int
	Tiles      map[int]bool
}

Font represents a console font.

var DefaultFont *Font

DefaultFont instance using Zaratustra8x8 font.

func New

func New(filePath string, tileWidth, tileHeight int) (*Font, error)

New creates a new font.

func NewFromReader

func NewFromReader(reader io.Reader, tileWidth, tileHeight int) (*Font, error)

NewFromReader creates a new font from a reader.

func (*Font) IsTile

func (f *Font) IsTile(char int) bool

IsTile checks if the given char represents a colored tile

func (*Font) SetTiles

func (f *Font) SetTiles(start, count int, value bool)

SetTiles changes if a char is a colored tile or not. start specifies the char where SetTiles should start setting the value and count is the amount of chars after start that should also be set.

func (*Font) ToSubImage

func (f *Font) ToSubImage(char int) *ebiten.Image

ToSubImage extracts the image of a given char from the base image of the font.

Jump to

Keyboard shortcuts

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