Files
tp/libs/JSystem/JUtility/JUTFont.cpp
T

60 lines
1.5 KiB
C++
Raw Normal View History

/**
* JUTFont.cpp
* JUtility - Font Management
*/
2020-12-03 17:58:53 -08:00
2021-04-01 02:07:58 +02:00
#include "JSystem/JUtility/JUTFont.h"
2021-03-28 22:49:05 +02:00
2021-04-06 18:00:35 +02:00
/* 802DECF8-802DED24 2D9638 002C+00 0/0 2/2 0/0 .text __ct__7JUTFontFv */
2021-05-03 02:03:24 +02:00
JUTFont::JUTFont() : mColor1(), mColor2(), mColor3(), mColor4() {
2021-08-28 07:25:03 -07:00
mValid = false;
2020-12-03 17:58:53 -08:00
}
2021-04-06 18:00:35 +02:00
/* 802DED24-802DED70 2D9664 004C+00 0/0 9/9 0/0 .text initialize_state__7JUTFontFv */
2021-05-03 02:03:24 +02:00
void JUTFont::initialize_state() {
setCharColor(JUtility::TColor());
2021-08-28 07:25:03 -07:00
mFixed = false;
mFixedWidth = 0;
mValid = false;
2020-12-03 17:58:53 -08:00
}
2021-04-06 18:00:35 +02:00
/* 802DED70-802DEDC4 2D96B0 0054+00 1/1 3/3 0/0 .text setCharColor__7JUTFontFQ28JUtility6TColor */
2021-05-03 02:03:24 +02:00
void JUTFont::setCharColor(JUtility::TColor col1) {
mColor1 = col1;
mColor2 = col1;
mColor3 = col1;
mColor4 = col1;
2020-12-03 17:58:53 -08:00
}
2021-04-06 18:00:35 +02:00
/* 802DEDC4-802DEE28 2D9704 0064+00 0/0 2/2 0/0 .text
2021-04-01 02:07:58 +02:00
* setGradColor__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor */
2021-05-03 02:03:24 +02:00
void JUTFont::setGradColor(JUtility::TColor col1, JUtility::TColor col2) {
mColor1 = col1;
mColor2 = col1;
mColor3 = col2;
mColor4 = col2;
2020-12-03 17:58:53 -08:00
}
2021-04-06 18:00:35 +02:00
/* 802DEE28-802DEF48 2D9768 0120+00 0/0 3/3 0/0 .text drawString_size_scale__7JUTFontFffffPCcUlb
2021-04-01 02:07:58 +02:00
*/
2021-05-03 02:03:24 +02:00
f32 JUTFont::drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* str, u32 usz,
bool a7) {
f32 temp = a1;
for (; usz > 0; usz--, str++) {
2023-02-09 17:52:32 +02:00
u32 c = *(u8*)str;
u32 b = c;
2021-05-03 02:03:24 +02:00
if (isLeadByte(b)) {
str++;
2023-02-09 17:52:32 +02:00
b <<= 8;
b |= *(u8*)str;
2021-05-03 02:03:24 +02:00
usz--;
}
2023-02-09 17:52:32 +02:00
a1 += drawChar_scale(a1, a2, a3, a4, b, a7);
2021-05-03 02:03:24 +02:00
a7 = 1;
}
return a1 - temp;
}