feat(转换能力): 增强PDF字体与裁剪转换
build.yaml / build (push) Successful in 41s

This commit is contained in:
xiaoqidun committed 2026-09-26 08:59:54 +08:00
1 parent c64bc9d594
commit 35631cdf98
13 files changed
+1188 -76

No files matched your search

+11 -3
View File
@@ -767,7 +767,7 @@ func (e *Editor) prepareObject(id string, object GraphicObject) (GraphicObject,
return cloneEditorObject(object)
}
// validateObjectClips 校验对象的路径裁剪,仅接受无资源引用及嵌套裁剪的路径
// validateObjectClips 校验对象的路径与文字裁剪,拒绝嵌套裁剪和无效资源
// 入参: clips 裁剪集合,nil表示无裁剪
// 返回: error 错误信息
func (e *Editor) validateObjectClips(clips *Clips) error {
@@ -782,8 +782,8 @@ func (e *Editor) validateObjectClips(clips *Clips) error {
return fmt.Errorf("clip must contain an area")
}
for _, area := range clip.Area {
if len(area.Path) == 0 || area.DrawParam != "" || len(area.Text) != 0 {
return fmt.Errorf("clips only support paths without draw parameter references")
if len(area.Path)+len(area.Text) == 0 || area.DrawParam != "" {
return fmt.Errorf("clip area requires paths or text without draw parameter references")
}
if area.CTM != "" {
if _, err := creationNumbers(area.CTM, 6); err != nil {
@@ -798,6 +798,14 @@ func (e *Editor) validateObjectClips(clips *Clips) error {
return err
}
}
for _, text := range area.Text {
if text.ID != "" || text.Clips != nil || text.Actions != nil {
return fmt.Errorf("clip text must not have object IDs, actions or nested clips")
}
if _, err := e.prepareObject("", GraphicObject{Type: "TextObject", TextObject: text}); err != nil {
return err
}
}
}
}
return nil