mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 10:22:52 +01:00
rwengine: throw runtime_error on loading illegal font
This commit is contained in:
parent
ee63911acb
commit
b10c36e747
@ -148,10 +148,6 @@ TextRenderer::TextRenderer(GameRenderer* renderer) : renderer(renderer) {
|
||||
}
|
||||
|
||||
void TextRenderer::setFontTexture(font_t font, const std::string& textureName) {
|
||||
if (font >= FONTS_COUNT) {
|
||||
RW_ERROR("Illegal font: " << font);
|
||||
return;
|
||||
}
|
||||
auto ftexture = renderer->getData()->findSlotTexture("fonts", textureName);
|
||||
const glm::u32vec2 textureSize = ftexture->getSize();
|
||||
glm::u8vec2 glyphOffset{textureSize.x / 16, textureSize.x / 16};
|
||||
@ -169,6 +165,8 @@ void TextRenderer::setFontTexture(font_t font, const std::string& textureName) {
|
||||
case FONT_ARIAL:
|
||||
glyphWidths = &fontWidthsArial;
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("Illegal font");
|
||||
}
|
||||
std::uint8_t monoWidth = 0;
|
||||
if (font == FONT_PAGER) {
|
||||
|
Loading…
Reference in New Issue
Block a user