mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 01:27:26 +08:00
1 parent
5f790e5408
commit
c2d9a349c5
5 files changed
+105
-21
No files matched your search
+7
-2
@@ -34,7 +34,7 @@ type OutputFormat struct {
|
||||
Raster bool `json:"raster,omitempty"`
|
||||
}
|
||||
|
||||
// ConvertProgress 回报open、pages、convert、fonts、prepare、write、write.*及export阶段,Total为0表示总量未知
|
||||
// ConvertProgress 回报open、pages、convert、fonts、fonts.*、prepare、write、write.*及export阶段,Total为0表示总量未知
|
||||
type ConvertProgress struct {
|
||||
Stage string `json:"stage"`
|
||||
Completed int `json:"completed"`
|
||||
@@ -279,7 +279,12 @@ func Convert(ctx context.Context, source io.ReaderAt, size int64, output io.Writ
|
||||
editor.SetRenderBackends(configuration.Backends())
|
||||
editor.SetFontDirs(configuration.fontDirs...)
|
||||
editor.SetFontFS(configuration.fontFS...)
|
||||
report.Fonts, err = editor.ProcessFonts(ctx, options.Fonts)
|
||||
report.Fonts, err = editor.ProcessFontsWithOptions(ctx, FontProcessOptions{Mode: options.Fonts, OnProgress: func(stage string, completed, total int) error {
|
||||
if stage == "fonts" {
|
||||
return progress(stage, completed, total)
|
||||
}
|
||||
return progress("fonts."+stage, completed, total)
|
||||
}})
|
||||
if err != nil {
|
||||
return report, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user