Skip to content

Commit fe2ae56

Browse files
committed
依然无法计算到正确的值
1 parent 505a11c commit fe2ae56

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • Workbench/Wmf/KawkaywecaljalKayjaybelfuber

Workbench/Wmf/KawkaywecaljalKayjaybelfuber/Program.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ Encoding CharacterSetToEncoding(CharacterSet characterSet)
9191
return Encoding.GetEncoding(codePageId);
9292
}
9393

94+
float lastTextOffset = 0;
95+
9496
for (var i = 0; i < wmfDocument.Records.Count; i++)
9597
{
9698
var wmfDocumentRecord = wmfDocument.Records[i];
@@ -127,6 +129,7 @@ Encoding CharacterSetToEncoding(CharacterSet characterSet)
127129
{
128130
currentX = moveToRecord.X;
129131
currentY = moveToRecord.Y;
132+
lastTextOffset = 0;
130133
break;
131134
}
132135
// - [12] {== WmfLineToRecord ==
@@ -238,13 +241,15 @@ Encoding CharacterSetToEncoding(CharacterSet characterSet)
238241
skFont.Typeface = SKTypeface.FromFamilyName(currentFontName);
239242
paint.Style = SKPaintStyle.Fill;
240243

244+
lastTextOffset = lastTextOffset % width;
245+
246+
var currentXOffset = currentX + tx + lastTextOffset;
241247
if (dxLength == 0)
242248
{
243-
canvas.DrawText(text, currentX + tx, currentY + ty, skFont, paint);
249+
canvas.DrawText(text, currentXOffset, currentY + ty, skFont, paint);
244250
}
245251
else
246252
{
247-
var currentXOffset = currentX + tx;
248253
UInt16[] dxArray = new UInt16[dxLength / sizeof(UInt16)];
249254
for (var t = 0; t < dxArray.Length; t++)
250255
{
@@ -262,6 +267,8 @@ Encoding CharacterSetToEncoding(CharacterSet characterSet)
262267

263268
currentXOffset += dxArray[textIndex];
264269
}
270+
271+
lastTextOffset = currentXOffset;
265272
}
266273

267274
break;

0 commit comments

Comments
 (0)