Skip to content

Commit

Permalink
Fix linter sug.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanSchroeder committed May 27, 2023
1 parent ef277c4 commit 5dccb71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions ttfsample.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func main() {
Printjabber(*fontfile, wantedText)
}

// Writefile writes the png file to disk.
func Writefile(outputName string, i *image.RGBA) {
outFile, err := os.Create(outputName)
if err != nil {
Expand All @@ -150,6 +151,7 @@ func Writefile(outputName string, i *image.RGBA) {
}
}

// Printjabber prints the string to an Image.
func Printjabber(ffile string, textToJabber []string) {
// Draw the background and the guidelines.
fg := image.Black
Expand Down Expand Up @@ -236,25 +238,25 @@ func Printjabber(ffile string, textToJabber []string) {
log.Println(err)
return
}
boring_face := truetype.NewFace(fBoringFont, &truetype.Options{
boringFace := truetype.NewFace(fBoringFont, &truetype.Options{
Size: fontsize,
DPI: *dpi,
Hinting: h,
})

// Draw the title in the boring font
drawer_boring := &font.Drawer{
drawerBoring := &font.Drawer{
Dst: rgba,
Src: fg,
Face: boring_face,
Face: boringFace,
}

y = 10 + int(math.Ceil(fontsize**dpi/72))
drawer_boring.Dot = fixed.Point26_6{
drawerBoring.Dot = fixed.Point266{

Check failure on line 255 in ttfsample.go

View workflow job for this annotation

GitHub Actions / build

undefined: fixed.Point266

Check failure on line 255 in ttfsample.go

View workflow job for this annotation

GitHub Actions / Test

undefined: fixed.Point266
X: 100,
Y: fixed.I(y),
}
drawer_boring.DrawString(title)
drawerBoring.DrawString(title)

// **********************************
// Done writing to canvas.
Expand Down
6 changes: 3 additions & 3 deletions ttfsample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
"testing"
)

var test_outdir = "test-output" + string(os.PathSeparator)
var testOutdir = "test-output" + string(os.PathSeparator)

func Test_Example00(t *testing.T) {
strArr := []string{"Abc", "Xyz", "Mno"}
outdir = &test_outdir
outdir = &testOutdir
Printjabber("fonts/FreeSansBold.ttf", strArr)
}

func Test_Example01(t *testing.T) {
strArr := []string{"Abc", "Xyz", "Mno"}
outdir = &test_outdir
outdir = &testOutdir
Printjabber("fonts/FreeSerifBold.otf", strArr)
}

0 comments on commit 5dccb71

Please sign in to comment.