Skip to content

Commit 7e309c5

Browse files
committed
Fixes rds1983#6
1 parent 062dba9 commit 7e309c5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/SpriteFontPlus/FontStashSharp/FontSystem.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ public float DrawText(SpriteBatch batch, float x, float y, StringSegment str)
200200
float originX = 0.0f;
201201
float originY = 0.0f;
202202

203-
204203
originY += GetVertAlign(font, Alignment, isize);
205204
for (int i = 0; i < str.Length; i += Char.IsSurrogatePair(str.String, i + str.Location) ? 2 : 1)
206205
{
@@ -211,12 +210,19 @@ public float DrawText(SpriteBatch batch, float x, float y, StringSegment str)
211210
GetQuad(font, prevGlyphIndex, glyph, scale, Spacing, ref originX,
212211
ref originY, &q);
213212
if (_vertsNumber + 6 > 1024)
213+
{
214214
Flush(batch);
215+
}
216+
217+
q.X0 = (int)(q.X0 * Scale.X);
218+
q.X1 = (int)(q.X1 * Scale.X);
219+
q.Y0 = (int)(q.Y0 * Scale.Y);
220+
q.Y1 = (int)(q.Y1 * Scale.Y);
215221

216-
AddVertex(new Rectangle((int)(x + q.X0 * Scale.X),
217-
(int)(y + q.Y0 * Scale.Y),
218-
(int)((q.X1 - q.X0) * Scale.X),
219-
(int)((q.Y1 - q.Y0) * Scale.Y)),
222+
AddVertex(new Rectangle((int)(x + q.X0),
223+
(int)(y + q.Y0),
224+
(int)(q.X1 - q.X0),
225+
(int)(q.Y1 - q.Y0)),
220226
new Rectangle((int)(q.S0 * _params_.Width),
221227
(int)(q.T0 * _params_.Height),
222228
(int)((q.S1 - q.S0) * _params_.Width),

0 commit comments

Comments
 (0)