| 245 | } |
| 246 | else if (type == ST_MULTI) |
| 247 | { |
| 248 | FormatText(); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | void C3DStatic::FormatText() |
| 253 | { |
| 254 | if ((_style & ST_TYPE) != ST_MULTI) |
| 255 | { |
| 256 | return; |
| 257 | } |
| 258 | |
| 259 | _lines.Clear(); |
| 260 | _lines.Add(0); |
| 261 | |
| 262 | Vector3 down = (1.0 / _maxLines) * _down; |
| 263 | Vector3 up = -down; |
| 264 | Vector3 right = 0.75 * up.Size() * _right.Normalized(); |
| 265 | |
| 266 | float lineWidth = _right.Size(); |
| 267 | |
| 268 | const char* p = _text; |
| 269 | while (*p != 0) |
| 270 | { |
| 271 | // begin of the line |
| 272 | const char* word = p; |
| 273 | int n = 0; |
| 274 | float width = 0; |
| 275 | while (true) |
| 276 | { |
| 277 | const char* q = p; |
| 278 | char c = *p++; |
| 279 | if (c == 0) |
| 280 | { |
| 281 | return; |
| 282 | } |
| 283 | if (c == '\r' || c == '\n') |
| 284 | { |
| 285 | // Explicit line break - start the next line after the newline, |
| 286 | // regardless of width (width-wrap still applies within a line). |
| 287 | if (c == '\r' && *p == '\n') |
| 288 | { |
| 289 | p++; |
| 290 | } |
| 291 | _lines.Add(p - (const char*)_text); |
| 292 | break; |
| 293 | } |
| 294 | if (ISSPACE(c)) |
| 295 | { |
| 296 | n++; |
| 297 | word = p; |
| 298 | } |
| 299 | |
| 300 | char temp[8]; |
| 301 | p = _text + CopyTextElement(_text, static_cast<int>(q - (const char*)_text), _font->GetLangID(), temp, |
| 302 | sizeof(temp)); |
| 303 | width += GEngine->GetText3DWidth(right, _font, temp).Size(); |
| 304 |
nothing calls this directly
no test coverage detected