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

◆ InternalMeasure()

Vector2 Microsoft.Xna.Framework.Graphics.SpriteFont.InternalMeasure ( ref StringProxy text)
inlineprivate

Definition at line 152 of file SpriteFont.cs.

153 {
154 if (text.Length == 0)
155 {
156 return Vector2.Zero;
157 }
158 Vector2 zero = Vector2.Zero;
159 zero.Y = lineSpacing;
160 float val = 0f;
161 int num = 0;
162 float num2 = 0f;
163 bool flag = true;
164 for (int i = 0; i < text.Length; i++)
165 {
166 if (text[i] == '\r')
167 {
168 continue;
169 }
170 if (text[i] == '\n')
171 {
172 zero.X += Math.Max(num2, 0f);
173 num2 = 0f;
174 val = Math.Max(zero.X, val);
175 zero = Vector2.Zero;
176 zero.Y = lineSpacing;
177 flag = true;
178 num++;
179 continue;
180 }
182 if (flag)
183 {
184 vector.X = Math.Max(vector.X, 0f);
185 }
186 else
187 {
188 zero.X += spacing + num2;
189 }
190 zero.X += vector.X + vector.Y;
191 num2 = vector.Z;
193 zero.Y = Math.Max(zero.Y, rectangle.Height);
194 flag = false;
195 }
196 zero.X += Math.Max(num2, 0f);
197 zero.Y += num * lineSpacing;
198 zero.X = Math.Max(zero.X, val);
199 return zero;
200 }
static byte Max(byte val1, byte val2)
Definition Math.cs:738

References Microsoft.Xna.Framework.Graphics.SpriteFont.croppingData, Microsoft.Xna.Framework.Graphics.SpriteFont.GetIndexForCharacter(), Microsoft.Xna.Framework.Graphics.SpriteFont.kerning, Microsoft.Xna.Framework.Graphics.SpriteFont.lineSpacing, System.Math.Max(), Microsoft.Xna.Framework.Graphics.SpriteFont.spacing, System.text, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Microsoft.Xna.Framework.Graphics.SpriteFont.InternalDraw(), Microsoft.Xna.Framework.Graphics.SpriteFont.MeasureString(), and Microsoft.Xna.Framework.Graphics.SpriteFont.MeasureString().