0x004949BC
| 171 | |
| 172 | // 0x004949BC |
| 173 | static void initialiseCharacterWidths() |
| 174 | { |
| 175 | struct FontEntry |
| 176 | { |
| 177 | Font offset; |
| 178 | int8_t widthFudge; |
| 179 | }; |
| 180 | |
| 181 | constexpr std::array<FontEntry, 4> fonts = { |
| 182 | FontEntry{ Font::medium_normal, -1 }, |
| 183 | FontEntry{ Font::medium_bold, -1 }, |
| 184 | FontEntry{ Font::small, -1 }, |
| 185 | FontEntry{ Font::large, 1 }, |
| 186 | }; |
| 187 | |
| 188 | for (const auto& font : fonts) |
| 189 | { |
| 190 | // Supported character range is from 32 -> 255 |
| 191 | for (uint8_t i = 0; i < 224; ++i) |
| 192 | { |
| 193 | uint8_t chr = i + 32; |
| 194 | auto* element = getG1Element(getImageIdForCharacter(font.offset, chr)); |
| 195 | if (element == nullptr) |
| 196 | { |
| 197 | continue; |
| 198 | } |
| 199 | auto width = element->width + font.widthFudge; |
| 200 | // Characters from 123 to 150 are unused |
| 201 | // Unsure why this zeros it out though since a negative width isn't an issue |
| 202 | if (chr >= 123 && chr <= 150) |
| 203 | { |
| 204 | width = 0; |
| 205 | } |
| 206 | _characterWidths[enumValue(font.offset) / 224][i] = width; |
| 207 | } |
| 208 | } |
| 209 | // Vanilla setup scrolling text related globals here (unused) |
| 210 | } |
| 211 | |
| 212 | void initialise() |
| 213 | { |
no test coverage detected