MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / OSGetFontTexture

Function OSGetFontTexture

src/dolphin/src/os/OSFont.c:517–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517char* OSGetFontTexture(char* string, void** image, s32* x, s32* y, s32* width)
518{
519 u16 code;
520 int fontCode;
521 int sheet;
522 int numChars;
523 int row;
524 int column;
525
526 code = *(u8*)string;
527 if (code == 0)
528 {
529 *image = NULL;
530 return string;
531 }
532
533 string++;
534 if (OSGetFontEncode() == OS_FONT_ENCODE_SJIS)
535 {
536 if (((((u8)code >= 0x81) && ((u8)code <= 0x9F)) != FALSE ||
537 (((u8)code >= 0xE0) && ((u8)code <= 0xFC))) != FALSE &&
538 (*string != 0) != FALSE)
539 {
540 code = (code << 8) | (*(u8*)string++); // Shift-JIS encoded byte
541 }
542 }
543
544 fontCode = GetFontCode(code);
545
546 sheet = fontCode / CharsInSheet;
547 *(void**)image = (void*)(SheetImage + (FontData->sheetSize * sheet));
548 numChars = fontCode - (sheet * CharsInSheet);
549 row = numChars / FontData->sheetColumn;
550 column = (numChars - (row * FontData->sheetColumn));
551 *x = column * FontData->cellWidth;
552 *y = row * FontData->cellHeight;
553
554 if (width)
555 {
556 *width = WidthTable[fontCode];
557 }
558 return string;
559}

Callers 2

DrawStringMethod · 0.85
GetWidthMethod · 0.85

Calls 2

OSGetFontEncodeFunction · 0.85
GetFontCodeFunction · 0.85

Tested by

no test coverage detected