Skip to content

Commit

Permalink
fix: 修复Font设置 (#45)
Browse files Browse the repository at this point in the history
* fix: 修复Font设置

* Update main.go

* fix: 修复测试函数

---------

Co-authored-by: guoqiang <[email protected]>
Co-authored-by: 源文雨 <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent f7d29bb commit 7d16797
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions apirun.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ func (r *Run) AddTab() *Run {
}

// Font sets the font of the run
func (r *Run) Font(ascii, hansi, hint string) *Run {
func (r *Run) Font(ascii, eastAsia, hansi, hint string) *Run {
r.RunProperties.Fonts = &RunFonts{
ASCII: ascii,
HAnsi: hansi,
Hint: hint,
ASCII: ascii,
EastAsia: eastAsia,
HAnsi: hansi,
Hint: hint,
}
return r
}
5 changes: 3 additions & 2 deletions cmd/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ func main() {
para1.AddText("italic").Italic().AddTab()
para1.AddText("underline").Underline("double").AddTab()
para1.AddText("highlight").Highlight("yellow").AddTab()
para1.AddText("font").Font("Consolas", "", "cs").AddTab()
para1.AddText("font").Font("Consolas", "", "", "cs").AddTab()

para2 := w.AddParagraph().Justification("end")
para2.AddText("test all font attrs").
Size("44").Color("ff0000").Font("Consolas", "", "cs").
Size("44").Color("ff0000").
Font("Consolas", "", "", "cs").
Shade("clear", "auto", "E7E6E6").
Bold().Italic().Underline("wave").
Highlight("yellow")
Expand Down
2 changes: 1 addition & 1 deletion structdrawing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestDrawingStructure(t *testing.T) {
Shade("clear", "auto", "E7E6E6").
AddTab().Bold().Underline("single").
Highlight("yellow").Italic().
Font("宋体", "宋体", "eastAsia")
Font("宋体", "宋体", "宋体", "eastAsia")
r, err := para1.AddAnchorDrawingFrom("testdata/fumiama.JPG")
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 7d16797

Please sign in to comment.