| 226 | } |
| 227 | |
| 228 | f32 J2DPrint::parse(const u8* inputString, int inputLength, int maxWidth, u16* outputBuffer, J2DPrint::TSize& textSize, u8 alpha, |
| 229 | bool isDrawing) |
| 230 | { |
| 231 | if (!mFont) { |
| 232 | return 0.0f; |
| 233 | } |
| 234 | |
| 235 | const u8* originalInput = inputString; |
| 236 | u16 outputBufferPos = 0; |
| 237 | |
| 238 | f32 initialCursorX = mCursorX; |
| 239 | f32 initialCursorY = mCursorY; |
| 240 | |
| 241 | f32 maxLineWidth = mCursorX; |
| 242 | f32 maxLineHeight = mCursorY; |
| 243 | |
| 244 | int currentChar = *(inputString++); |
| 245 | |
| 246 | f32 minCursorX = mCursorX; |
| 247 | |
| 248 | f32 boundingBoxLeft = mCursorX; |
| 249 | f32 boundingBoxTop = mCursorY; |
| 250 | f32 boundingBoxBottom = mCursorY; |
| 251 | |
| 252 | JUTColor textColor = mActiveCharColor; |
| 253 | JUTColor gradientColor = mActiveGradColor; |
| 254 | |
| 255 | f32 lastCursorX; |
| 256 | |
| 257 | textColor.a = textColor.a * alpha / 255; |
| 258 | gradientColor.a = gradientColor.a * alpha / 255; |
| 259 | |
| 260 | JUTColor* topColor; |
| 261 | if (mActiveIsGradient) { |
| 262 | topColor = &gradientColor; |
| 263 | } else { |
| 264 | topColor = &textColor; |
| 265 | } |
| 266 | |
| 267 | mFont->setGradColor(textColor, *topColor); |
| 268 | |
| 269 | bool isMultiByteChar; |
| 270 | bool isPrintable; |
| 271 | do { |
| 272 | isMultiByteChar = false; |
| 273 | // Check if the current character is a lead byte. In some multi-byte character encodings, a lead byte indicates the start of a |
| 274 | // multi-byte character. |
| 275 | if (mFont->isLeadByte(currentChar)) { |
| 276 | // If the current character is a lead byte, combine it with the next byte to form a 16-bit multi-byte character, then increment |
| 277 | // the input string pointer. |
| 278 | currentChar = (currentChar << 8) | (*(inputString++)); |
| 279 | |
| 280 | // Set isLeadingByte to true, indicating that a lead byte (and thus a multi-byte character) has been processed. |
| 281 | isMultiByteChar = true; |
| 282 | } |
| 283 | |
| 284 | // Verify if the string's end is reached or if the current position exceeds the expected length. |
| 285 | if (currentChar == '\0' || ((u32)inputString - (u32)originalInput) > inputLength) { |
nothing calls this directly
no test coverage detected