Skip to content

Commit

Permalink
Gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
drahoslove committed Dec 24, 2017
1 parent 41d8a21 commit 0b3b26d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions draw2d.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ const (

func (cap LineCap) String() string {
return map[LineCap]string{
RoundCap: "round",
ButtCap: "cap",
RoundCap: "round",
ButtCap: "cap",
SquareCap: "square",
}[cap]
}
Expand Down
11 changes: 9 additions & 2 deletions draw2dsvg/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ func toSvgPathDesc(p *draw2d.Path) string { // TODO move elsewhere
nom := math.Hypot(ry*cosfi, rx*sinfi)
x := cx + (rx*ry*cosfi)/nom
y := cy + (rx*ry*sinfi)/nom
x += 0.001 // dirty hack to ensure whole arc is drawn if start point equals endpoint
y += 0.001

// compute large and sweep flags
large := 0
Expand All @@ -144,6 +142,15 @@ func toSvgPathDesc(p *draw2d.Path) string { // TODO move elsewhere
if !math.Signbit(ps[5]) {
sweep = 1
}
// dirty hack to ensure whole arc is drawn
// if start point equals end point
if sweep == 1 {
x += 0.001 * sinfi
y += 0.001 * -cosfi
} else {
x += 0.001 * sinfi
y += 0.001 * cosfi
}

// rx ry x-axis-rotation large-arc-flag sweep-flag x y
parts[i] = fmt.Sprintf("A %.4f %.4f %v %v %v %.4f %.4f",
Expand Down
8 changes: 3 additions & 5 deletions font.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"log"
"path/filepath"

"sync"
"github.com/golang/freetype/truetype"
"sync"
)

// FontStyle defines bold and italic styles for the font
Expand Down Expand Up @@ -125,7 +125,7 @@ type FolderFontCache struct {
namer FontFileNamer
}

// NewFolderFontCache creates FolderFontCache
// NewFolderFontCache creates FolderFontCache
func NewFolderFontCache(folder string) *FolderFontCache {
return &FolderFontCache{
fonts: make(map[string]*truetype.Font),
Expand Down Expand Up @@ -168,9 +168,7 @@ type SyncFolderFontCache struct {
namer FontFileNamer
}



// NewSyncFolderFontCache creates SyncFolderFontCache
// NewSyncFolderFontCache creates SyncFolderFontCache
func NewSyncFolderFontCache(folder string) *SyncFolderFontCache {
return &SyncFolderFontCache{
fonts: make(map[string]*truetype.Font),
Expand Down
1 change: 0 additions & 1 deletion sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package draw2d_test


import (
"fmt"
"github.com/llgcode/draw2d"
Expand Down

0 comments on commit 0b3b26d

Please sign in to comment.