Skip to content

Commit

Permalink
Merge pull request #7 from crossoverJie/fix-chinese
Browse files Browse the repository at this point in the history
  • Loading branch information
crossoverJie authored Jun 28, 2022
2 parents 8263534 + f3da2e3 commit 613860b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GOBUILD=go build -ldflags "-s -w" -o ${BINARY}
GOCLEAN=go clean
RMTARGZ=rm -rf *.gz
RMMACAPP=rm -rf ptg.app
VERSION=1.0.4
VERSION=1.0.5

# Build
build:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/cheggaaa/pb/v3 v3.0.5
github.com/docker/go-units v0.4.0
github.com/fatih/color v1.13.0
github.com/flopp/go-findfont v0.1.0 // indirect
github.com/golang/protobuf v1.5.2
github.com/jhump/protoreflect v1.10.1
github.com/pkg/errors v0.9.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/flopp/go-findfont v0.1.0 h1:lPn0BymDUtJo+ZkV01VS3661HL6F4qFlkhcJN55u6mU=
github.com/flopp/go-findfont v0.1.0/go.mod h1:wKKxRDjD024Rh7VMwoU90i6ikQRCr+JTHB5n4Ejkqvw=
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 h1:FDqhDm7pcsLhhWl1QtD8vlzI4mm59llRvNzrFg6/LAA=
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3/go.mod h1:CzM2G82Q9BDUvMTGHnXf/6OExw/Dz2ivDj48nVg7Lg8=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
Expand Down
16 changes: 16 additions & 0 deletions gui/app.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package main

import (
"github.com/flopp/go-findfont"
"os"
"strings"
)

const (
AppName = "PTG gRPC client"
AppWeight = 1000
Expand Down Expand Up @@ -39,6 +45,16 @@ type RightResponse struct {
}

func InitApp() *App {
// init font
fontPaths := findfont.List()
for _, path := range fontPaths {
//楷体:simkai.ttf
//黑体:simhei.ttf
if strings.Contains(path, "阿里汉仪智能黑体") || strings.Contains(path, "simkai.ttf") || strings.Contains(path, "msyhl.ttc") {
os.Setenv("FYNE_FONT", path)
break
}
}
return &App{
AppName: AppName,
AppWidth: AppWeight,
Expand Down
2 changes: 2 additions & 0 deletions gui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"image/color"
gio "io"
"net/url"
"os"
"strings"
)

Expand Down Expand Up @@ -341,6 +342,7 @@ func main() {
}
})
window.ShowAndRun()
os.Unsetenv("FYNE_FONT")
}

func buildWithMetadata(ctx context.Context, meta string) (context.Context, error) {
Expand Down
5 changes: 4 additions & 1 deletion reflect/reflect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ func (o *Order) Create(ctx context.Context, in *v1.OrderApiCreate) (*v1.Order, e
fmt.Println(in.OrderId)
return &v1.Order{
OrderId: in.OrderId,
Reason: nil,
Reason: []*v1.Reason{{
Id: 0,
Remark: in.Remark,
}},
}, nil
}

Expand Down

0 comments on commit 613860b

Please sign in to comment.