Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-10-29 05:15:39 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-10-29 05:15:39 +0300
commit1e2589bfa580aaa087dd9a6dffd5e0785bb91322 (patch)
treef26b1406f90f9e9d25ee6a3dbb009dbb7ba346f9 /source/blender/blenfont
parent0e71162e68939d90ff92e7ada3bf4fc11e0953ea (diff)
Cleanup: remove redundant BLI_UTF8_ERR check
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_font.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 52c412a42bb..4125dde1fd1 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -301,6 +301,9 @@ BLI_INLINE GlyphBLF *blf_utf8_next_fast(
FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t str_len, size_t *i_p)
{
uint charcode = BLI_str_utf8_as_unicode_step(str, str_len, i_p);
+ /* Invalid unicode sequences return the byte value, stepping forward one.
+ * This allows `latin1` to display (which is sometimes used for file-paths). */
+ BLI_assert(charcode != BLI_UTF8_ERR);
return blf_glyph_ensure(font, gc, charcode);
}
@@ -366,9 +369,6 @@ static void blf_font_draw_ex(FontBLF *font,
if (UNLIKELY(g == NULL)) {
continue;
}
- if (UNLIKELY(g->c == BLI_UTF8_ERR)) {
- break;
- }
pen_x += blf_kerning(font, g_prev, g);
/* do not return this loop if clipped, we want every character tested */
@@ -410,10 +410,6 @@ int blf_font_draw_mono(FontBLF *font, const char *str, const size_t str_len, int
if (UNLIKELY(g == NULL)) {
continue;
}
- if (UNLIKELY(g->c == BLI_UTF8_ERR)) {
- break;
- }
-
/* do not return this loop if clipped, we want every character tested */
blf_glyph_draw(font, gc, g, (float)pen_x, (float)pen_y);
@@ -466,9 +462,6 @@ static void blf_font_draw_buffer_ex(FontBLF *font,
if (UNLIKELY(g == NULL)) {
continue;
}
- if (UNLIKELY(g->c == BLI_UTF8_ERR)) {
- break;
- }
pen_x += blf_kerning(font, g_prev, g);
chx = pen_x + ((int)g->pos[0]);
@@ -600,12 +593,10 @@ static bool blf_font_width_to_strlen_glyph_process(
if (UNLIKELY(g == NULL)) {
return false; /* continue the calling loop. */
}
- if (UNLIKELY(g->c == BLI_UTF8_ERR)) {
- return true; /* break the calling loop. */
- }
*pen_x += blf_kerning(font, g_prev, g);
*pen_x += g->advance_i;
+ /* When true, break the calling loop. */
return (*pen_x >= width_i);
}
@@ -709,9 +700,6 @@ static void blf_font_boundbox_ex(FontBLF *font,
if (UNLIKELY(g == NULL)) {
continue;
}
- if (UNLIKELY(g->c == BLI_UTF8_ERR)) {
- break;
- }
pen_x += blf_kerning(font, g_prev, g);
gbox.xmin = (float)pen_x;
@@ -880,9 +868,6 @@ static void blf_font_boundbox_foreach_glyph_ex(FontBLF *font,
if (UNLIKELY(g == NULL)) {
continue;
}
- if (UNLIKELY(g->c == BLI_UTF8_ERR)) {
- break;
- }
pen_x += blf_kerning(font, g_prev, g);
gbox.xmin = pen_x;
@@ -968,9 +953,6 @@ static void blf_font_wrap_apply(FontBLF *font,
if (UNLIKELY(g == NULL)) {
continue;
}
- if (UNLIKELY(g->c == BLI_UTF8_ERR)) {
- break;
- }
pen_x += blf_kerning(font, g_prev, g);
/**