various small changes

This commit is contained in:
probandula
2016-10-28 13:54:57 +02:00
parent 69ecfa2f6f
commit 71c8a58917
4 changed files with 38 additions and 36 deletions

33
font.go
View File

@@ -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
}