Documentation ¶
Overview ¶
Package font is for handling (bitmap) fonts
Index ¶
- type Bitmap
- func (bmp *Bitmap) AlphaAt(x, y int) color.Alpha
- func (bmp *Bitmap) At(x, y int) color.Color
- func (bmp *Bitmap) Bounds() image.Rectangle
- func (bmp *Bitmap) ColorModel() color.Model
- func (bmp *Bitmap) DataOffset(x, y int) int
- func (bmp *Bitmap) Face(width, height int) (face Face, ok bool)
- func (bmp *Bitmap) Glyph(p image.Point, r rune) (dr image.Rectangle, mask image.Image, maskp image.Point, advance int, ok bool)
- func (bmp *Bitmap) GlyphSize() image.Point
- func (bmp *Bitmap) Glyphs() int
- func (bmp *Bitmap) Scale() (*Bitmap, error)
- func (bmp *Bitmap) Sizes() []image.Point
- func (bmp *Bitmap) Smooth() *Bitmap
- type BitmapFont
- type Draw
- type Face
- type Font
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bitmap ¶
type Bitmap struct { // Data is the raw bitmap data bytes Data []uint16 // Size is the size per glyph, in pixels Size image.Point // Advance size Advance int // VerticalSpacing VerticalSpacing int // Alpha 8-bit alpha value Alpha color.Alpha // CodePoints for glyphs in the font CodePoint []rune // Encoding name Encoding string // Replacement character Replacement rune // contains filtered or unexported fields }
func (*Bitmap) ColorModel ¶
func (*Bitmap) DataOffset ¶
DataOffset returns the byte offset for a pixel at (x, y)
func (*Bitmap) Smooth ¶
Smooth edge transitions
This smooths hard edges using a simple algorithm. It finds diagonal transitions and fills the gaps. Eg:
#. ## .# -> smoothed to -> ##
Or:
.# ## #. -> smoothed to -> ##
This is to smooth after scaling up the font, so the resulting effect will be as follows:
#. ##.. ##.. .# -> scaled up to -> ##.. -> smoothed to -> ###. ..## .### ..## ..##
Or:
.# ..## ..## #. -> scaled up to -> ..## -> smoothed to -> .### ##.. ###. ##.. ##..
type BitmapFont ¶
type BitmapFont []*Bitmap
BitmapFont is a Font implementation using bitmap fonts
func (BitmapFont) Face ¶
func (font BitmapFont) Face(width, height int) (face Face, ok bool)
Face returns the face for the given font size
func (BitmapFont) Sizes ¶
func (font BitmapFont) Sizes() []image.Point
Sizes returns the available face sizes
type Draw ¶
type Draw struct { // Dst is the destination image Dst draw.Image // Src is the source image Src image.Image // Cursor is the drawing position in the destination image Cursor image.Point // Face is our font face Face Face }
Draw font glyphs onto an image
type Face ¶
type Face interface { // Glyph returns a mask image suitable for using in draw.DrawMask Glyph(p image.Point, r rune) (dr image.Rectangle, mask image.Image, maskp image.Point, advance int, ok bool) // GlyphSize is the size of a glyph, in pixels GlyphSize() image.Point // Glyphs returns the number of glyphs in the mask Glyphs() int }
Face implements a font face
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
fontmap
Command to dump a font to PNG
|
Command to dump a font to PNG |
Package rom contains tools to convert character ROMS to Go source files This package is mainly for internal use in textmod.es/font/gen.go, used by "go generate" in the containing package.
|
Package rom contains tools to convert character ROMS to Go source files This package is mainly for internal use in textmod.es/font/gen.go, used by "go generate" in the containing package. |
Click to show internal directories.
Click to hide internal directories.