mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
1 parent
e35533859c
commit
89a7ef04c7
23 files changed
+410
-114
No files matched your search
@@ -16,6 +16,7 @@ package ofdgo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"math"
|
||||
"strconv"
|
||||
@@ -430,6 +431,14 @@ func (obj *TextObject) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement
|
||||
return err
|
||||
}
|
||||
*obj = TextObject(value)
|
||||
for _, attr := range start.Attr {
|
||||
if attr.Name.Space == textLayoutNamespace && attr.Name.Local == "Layout" {
|
||||
var meta textLayoutMetadata
|
||||
if json.Unmarshal([]byte(attr.Value), &meta) == nil && validateRichLayout(meta.Options) == nil && structureXMLText(meta.Text) && meta.Digest == obj.layoutDigest() {
|
||||
obj.layout = &textLayout{value: meta.Text, options: meta.Options, autoWidth: meta.AutoWidth}
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, attr := range ofdXMLStart(start).Attr {
|
||||
if attr.Name.Local == "LineWidth" {
|
||||
obj.LineWidthSet = obj.LineWidth == 0
|
||||
|
||||
Reference in new issue
Block a user