Codechange: replace error/usererror printf variant with fmt variant and rename

This commit is contained in:
Rubidium
2023-04-19 22:47:36 +02:00
committed by rubidium42
parent 43c65a3fec
commit f74e26ca7e
39 changed files with 176 additions and 131 deletions

View File

@@ -11,6 +11,7 @@
#include "../../debug.h"
#include "font_osx.h"
#include "../../blitter/factory.hpp"
#include "../../error_func.h"
#include "../../fileio_func.h"
#include "../../fontdetection.h"
#include "../../string_func.h"
@@ -272,7 +273,7 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa)
} else {
bounds = CTFontGetBoundingRectsForGlyphs(this->font.get(), kCTFontOrientationDefault, &glyph, nullptr, 1);
}
if (CGRectIsNull(bounds)) usererror("Unable to render font glyph");
if (CGRectIsNull(bounds)) UserError("Unable to render font glyph");
uint bb_width = (uint)std::ceil(bounds.size.width) + 1; // Sometimes the glyph bounds are too tight and cut of the last pixel after rounding.
uint bb_height = (uint)std::ceil(bounds.size.height);
@@ -283,7 +284,7 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa)
uint height = std::max(1U, bb_height + shadow);
/* Limit glyph size to prevent overflows later on. */
if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) usererror("Font glyph is too large");
if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) UserError("Font glyph is too large");
SpriteLoader::Sprite sprite;
sprite.AllocateData(ZOOM_LVL_NORMAL, width * height);

View File

@@ -12,6 +12,7 @@
#include "../../blitter/factory.hpp"
#include "../../core/alloc_func.hpp"
#include "../../core/math_func.hpp"
#include "../../error_func.h"
#include "../../fileio_func.h"
#include "../../fontdetection.h"
#include "../../fontcache.h"
@@ -439,7 +440,7 @@ void Win32FontCache::ClearFontCache()
/* Call GetGlyphOutline with zero size initially to get required memory size. */
DWORD size = GetGlyphOutline(this->dc, key, GGO_GLYPH_INDEX | (aa ? GGO_GRAY8_BITMAP : GGO_BITMAP), &gm, 0, nullptr, &mat);
if (size == GDI_ERROR) usererror("Unable to render font glyph");
if (size == GDI_ERROR) UserError("Unable to render font glyph");
/* Add 1 scaled pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel. */
uint shadow = (this->fs == FS_NORMAL) ? ScaleGUITrad(1) : 0;
@@ -447,7 +448,7 @@ void Win32FontCache::ClearFontCache()
uint height = std::max(1U, (uint)gm.gmBlackBoxY + shadow);
/* Limit glyph size to prevent overflows later on. */
if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) usererror("Font glyph is too large");
if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) UserError("Font glyph is too large");
/* Call GetGlyphOutline again with size to actually render the glyph. */
byte *bmp = new byte[size];