Skip to content

Commit 519863f

Browse files
committed
尝试去掉多余的内容
1 parent f26b8c2 commit 519863f

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/MediaConverters/SkiaWmfRenderer/src/wieslawsoltes-wmf/src/library/Records/Object/WmfCreateFontIndirectRecord.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using System.Linq;
23
using System.Text;
34

45
namespace Oxage.Wmf.Records
@@ -142,7 +143,17 @@ public override void Read(BinaryReader reader)
142143
if (left > 0)
143144
{
144145
byte[] buffer = reader.ReadBytes(left);
145-
this.FaceName = AnsiEncoding.GetString(buffer);
146+
var terminatingNullIndex = buffer.Length;
147+
for (var i = 0; i < buffer.Length; i++)
148+
{
149+
if (buffer[i] == 0x00)
150+
{
151+
terminatingNullIndex = i;
152+
break;
153+
}
154+
}
155+
156+
this.FaceName = AnsiEncoding.GetString(buffer, 0, terminatingNullIndex);
146157
}
147158
}
148159

0 commit comments

Comments
 (0)