mirror of
https://github.com/KevinMidboe/motdGOi.git
synced 2025-10-29 09:40:24 +00:00
various small changes
This commit is contained in:
33
font.go
33
font.go
@@ -1,9 +1,9 @@
|
||||
// Explanation of the .flf file header
|
||||
// THE HEADER LINE
|
||||
//
|
||||
//
|
||||
// The header line gives information about the FIGfont. Here is an example
|
||||
// showing the names of all parameters:
|
||||
//
|
||||
//
|
||||
// flf2a$ 6 5 20 15 3 0 143 229 NOTE: The first five characters in
|
||||
// | | | | | | | | | | the entire file must be "flf2a".
|
||||
// / / | | | | | | | \
|
||||
@@ -12,24 +12,41 @@
|
||||
// Height / | | \ Print_Direction
|
||||
// Baseline / \ Comment_Lines
|
||||
// Max_Length Old_Layout*
|
||||
//
|
||||
//
|
||||
// * The two layout parameters are closely related and fairly complex.
|
||||
// (See "INTERPRETATION OF LAYOUT PARAMETERS".)
|
||||
//
|
||||
package figlet4go
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Represents a single font
|
||||
type font struct {
|
||||
// Hardblank symbol
|
||||
hardblank string
|
||||
// Height of one char
|
||||
height int
|
||||
height int
|
||||
//
|
||||
fontSlice []string
|
||||
}
|
||||
|
||||
func (f *font) getCharSlice() []string {
|
||||
// TODO here will be the logic of NewAsciiChar
|
||||
return []string{}
|
||||
}
|
||||
// Get a slice of strings containing the chars lines
|
||||
func (f *font) getCharSlice(char rune) []string {
|
||||
|
||||
height := f.height
|
||||
beginRow := (int(char) - 32) * height
|
||||
|
||||
lines := make([]string, height)
|
||||
|
||||
// Get the char lines of the char
|
||||
for i := 0; i < height; i++ {
|
||||
row := f.fontSlice[beginRow+i]
|
||||
row = strings.Replace(row, "@", "", -1)
|
||||
row = strings.Replace(row, f.hardblank, " ", -1)
|
||||
lines[i] = row
|
||||
}
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user