bitmap
1.0.0
✍ Bitmap -Schriftladerbibliothek für GO.
Diese Bibliothek lädt Schriftdaten aus einem Bild ("Bitmap").
Es wird in eine GO map geladen, was bedeutet, dass ein Glyphe mit font[glyph] abgerufen werden kann, z. B. font["A"] .
bm := bitmap . New ()
font := bm . Load ( "font.png" )
x := 0
y := 0
xx := x
yy := y
ch := font [ glyph ]
for i := 0 ; i < ch . Height ; i ++ {
bin := ch . Data [ i ] // Gets a line: a glyph is 8x8
binarr := strings . Split ( bin , "" )
for _ , pix := range binarr {
if pix == "1" { draw ( xx , yy ) }
xx += 1
}
yy += 1
xx = x
}Diese Bibliothek wird in Pinwheel für ihre Pixel -Schriftart verwendet.
Wenn Sie dies auch aus Gründen verwenden, können Sie eine PR erstellen, um Ihre Verwendung hier hinzuzufügen.
BSD 3-Klausel