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:
Diffstat (limited to 'source/blender/blenfont/intern/blf_font.c')
-rw-r--r--source/blender/blenfont/intern/blf_font.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 8e306730e3c..0dfb2e843c9 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -318,7 +318,7 @@ static GlyphBLF **blf_font_ensure_ascii_table(FontBLF *font, GlyphCacheBLF *gc)
if (glyph_ascii_table['0'] == NULL) {
GlyphBLF *g;
/* Skip control characters and just cache rendered glyphs for visible ASCII range. */
- for (uint i = 32; i < 128; i++) {
+ for (uint i = GLYPH_ASCII_CACHE_MIN; i <= GLYPH_ASCII_CACHE_MAX; i++) {
g = blf_glyph_search(gc, i);
if (!g) {
FT_UInt glyph_index = FT_Get_Char_Index(font->face, i);
@@ -355,7 +355,7 @@ static void blf_font_ensure_ascii_kerning(FontBLF *font,
/* NOTE: `blf_font_ensure_ascii_table(font, gc);` must be called before this macro. */
#define BLF_UTF8_NEXT_FAST(_font, _gc, _g, _str, _i, _c, _glyph_ascii_table) \
- if (((_c) = (_str)[_i]) < 0x80) { \
+ if (((_c) = (_str)[_i]) < GLYPH_ASCII_TABLE_SIZE) { \
_g = (_glyph_ascii_table)[_c]; \
_i++; \
} \
@@ -370,11 +370,10 @@ static void blf_font_ensure_ascii_kerning(FontBLF *font,
(void)0
#define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) \
- const bool _has_kerning = FT_HAS_KERNING((_font)->face) != 0; \
- const FT_UInt _kern_mode = (_has_kerning == 0) ? 0 : \
- (((_font)->flags & BLF_KERNING_DEFAULT) ? \
- ft_kerning_default : \
- (FT_UInt)FT_KERNING_UNFITTED)
+ const bool _has_kerning = FT_HAS_KERNING((_font)->face); \
+ const FT_UInt _kern_mode = (_has_kerning && !((_font)->flags & BLF_KERNING_DEFAULT)) ? \
+ FT_KERNING_UNFITTED : \
+ FT_KERNING_DEFAULT;
/* NOTE: `blf_font_ensure_ascii_kerning(font, gc, kern_mode);` must be called before this macro. */
@@ -382,7 +381,7 @@ static void blf_font_ensure_ascii_kerning(FontBLF *font,
{ \
if (_g_prev) { \
FT_Vector _delta; \
- if (_c_prev < 0x80 && _c < 0x80) { \
+ if (_c_prev < KERNING_CACHE_TABLE_SIZE && _c < GLYPH_ASCII_TABLE_SIZE) { \
_pen_x += (_font)->kerning_cache->table[_c][_c_prev]; \
} \
else if (FT_Get_Kerning((_font)->face, (_g_prev)->idx, (_g)->idx, _kern_mode, &(_delta)) == \
@@ -482,7 +481,7 @@ static void blf_font_draw_ascii_ex(
blf_batch_draw_begin(font);
while ((c = *(str++)) && len--) {
- BLI_assert(c < 128);
+ BLI_assert(c < GLYPH_ASCII_TABLE_SIZE);
if ((g = glyph_ascii_table[c]) == NULL) {
continue;
}
@@ -1262,7 +1261,7 @@ int blf_font_count_missing_chars(FontBLF *font,
while (i < len) {
unsigned int c;
- if ((c = str[i]) < 0x80) {
+ if ((c = str[i]) < GLYPH_ASCII_TABLE_SIZE) {
i++;
}
else if ((c = BLI_str_utf8_as_unicode_step(str, &i)) != BLI_UTF8_ERR) {