Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateCroppedText()

string ReLogic.Graphics.DynamicSpriteFont.CreateCroppedText ( string text,
float maxWidth )
inline

Definition at line 309 of file DynamicSpriteFont.cs.

310 {
311 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
312 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
313 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
314 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
315 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
316 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
317 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
318 //IL_0071: Unknown result type (might be due to invalid IL or missing references)
319 //IL_006b: Unknown result type (might be due to invalid IL or missing references)
320 //IL_0070: Unknown result type (might be due to invalid IL or missing references)
323 maxWidth -= vector2.X;
324 if (maxWidth <= vector2.X)
325 {
326 return "…";
327 }
328 if (vector.X > maxWidth)
329 {
330 int num = 200;
331 while (vector.X > maxWidth && text.Length > 1)
332 {
333 num--;
334 if (num <= 0)
335 {
336 break;
337 }
338 text = text.Substring(0, text.Length - 1);
339 if (text.Length == 1)
340 {
341 text = "";
342 break;
343 }
345 }
346 text += "…";
347 }
348 return text;
349 }

References ReLogic.Graphics.DynamicSpriteFont.MeasureString(), and System.text.