feat(渲染注释): 渲染注释,可配置不渲染

This commit is contained in:
2026-06-26 11:26:09 +08:00
parent 1446705bb6
commit 94fa027446
8 changed files with 283 additions and 19 deletions
+10
View File
@@ -67,6 +67,7 @@ func NewRenderer(reader *Reader, opts ...RendererOption) *Renderer {
r := &Renderer{
Reader: reader,
DPI: 300.0,
RenderAnnotations: true,
DrawParams: reader.drawParamCache,
CompositeGraphicUnits: reader.compositeGraphicUnitCache,
FontMap: make(map[string]*canvas.FontFamily),
@@ -87,6 +88,15 @@ func WithDPI(dpi float64) RendererOption {
}
}
// WithAnnotations 设置是否渲染注释外观
// 入参: enable 是否渲染
// 返回: RendererOption 渲染选项
func WithAnnotations(enable bool) RendererOption {
return func(r *Renderer) {
r.RenderAnnotations = enable
}
}
// WithFontDirs 设置外部字体查找目录
// 入参: dirs 字体目录列表
// 返回: RendererOption 渲染选项