Skip to content

Commit 7d16797

Browse files
l0g1nguoqiangfumiama
authored
fix: 修复Font设置 (#45)
* fix: 修复Font设置 * Update main.go * fix: 修复测试函数 --------- Co-authored-by: guoqiang <guoqiang@antiy.cn> Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
1 parent f7d29bb commit 7d16797

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

apirun.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,12 @@ func (r *Run) AddTab() *Run {
100100
}
101101

102102
// Font sets the font of the run
103-
func (r *Run) Font(ascii, hansi, hint string) *Run {
103+
func (r *Run) Font(ascii, eastAsia, hansi, hint string) *Run {
104104
r.RunProperties.Fonts = &RunFonts{
105-
ASCII: ascii,
106-
HAnsi: hansi,
107-
Hint: hint,
105+
ASCII: ascii,
106+
EastAsia: eastAsia,
107+
HAnsi: hansi,
108+
Hint: hint,
108109
}
109110
return r
110111
}

cmd/main/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ func main() {
6666
para1.AddText("italic").Italic().AddTab()
6767
para1.AddText("underline").Underline("double").AddTab()
6868
para1.AddText("highlight").Highlight("yellow").AddTab()
69-
para1.AddText("font").Font("Consolas", "", "cs").AddTab()
69+
para1.AddText("font").Font("Consolas", "", "", "cs").AddTab()
7070

7171
para2 := w.AddParagraph().Justification("end")
7272
para2.AddText("test all font attrs").
73-
Size("44").Color("ff0000").Font("Consolas", "", "cs").
73+
Size("44").Color("ff0000").
74+
Font("Consolas", "", "", "cs").
7475
Shade("clear", "auto", "E7E6E6").
7576
Bold().Italic().Underline("wave").
7677
Highlight("yellow")

structdrawing_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestDrawingStructure(t *testing.T) {
3737
Shade("clear", "auto", "E7E6E6").
3838
AddTab().Bold().Underline("single").
3939
Highlight("yellow").Italic().
40-
Font("宋体", "宋体", "eastAsia")
40+
Font("宋体", "宋体", "宋体", "eastAsia")
4141
r, err := para1.AddAnchorDrawingFrom("testdata/fumiama.JPG")
4242
if err != nil {
4343
t.Fatal(err)

0 commit comments

Comments
 (0)