Merge branch 'blender-v4.4-release'
This commit is contained in:
@@ -420,6 +420,9 @@ enum {
|
||||
* \note Can be checked without checking #BLF_MONOSPACED which can be assumed to be disabled.
|
||||
*/
|
||||
BLF_RENDER_SUBPIXELAA = 1 << 18,
|
||||
|
||||
/* Do not look in other fonts when a glyph is not found in this font. */
|
||||
BLF_NO_FALLBACK = 1 << 19,
|
||||
};
|
||||
|
||||
#define BLF_DRAW_STR_DUMMY_MAX 1024
|
||||
|
||||
@@ -787,8 +787,8 @@ static FT_UInt blf_glyph_index_from_charcode(FontBLF **font, const uint charcode
|
||||
return glyph_index;
|
||||
}
|
||||
|
||||
/* Only fonts managed by the cache can fallback. */
|
||||
if (!((*font)->flags & BLF_CACHED)) {
|
||||
/* Fonts managed by the cache can fallback. Unless specifically forbidden. */
|
||||
if (!((*font)->flags & BLF_CACHED) || ((*font)->flags & BLF_NO_FALLBACK)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -553,6 +553,11 @@ namespace blender::seq {
|
||||
|
||||
static void text_draw(const TextVarsRuntime *runtime, float color[4])
|
||||
{
|
||||
const bool use_fallback = (runtime->font <= 1);
|
||||
if (!use_fallback) {
|
||||
BLF_enable(runtime->font, BLF_NO_FALLBACK);
|
||||
}
|
||||
|
||||
for (const LineInfo &line : runtime->lines) {
|
||||
for (const CharInfo &character : line.characters) {
|
||||
BLF_position(runtime->font, character.position.x, character.position.y, 0.0f);
|
||||
@@ -560,6 +565,10 @@ static void text_draw(const TextVarsRuntime *runtime, float color[4])
|
||||
BLF_draw_buffer(runtime->font, character.str_ptr, character.byte_length);
|
||||
}
|
||||
}
|
||||
|
||||
if (!use_fallback) {
|
||||
BLF_disable(runtime->font, BLF_NO_FALLBACK);
|
||||
}
|
||||
}
|
||||
|
||||
static rcti draw_text_outline(const SeqRenderData *context,
|
||||
@@ -805,6 +814,12 @@ static blender::Vector<CharInfo> build_character_info(const TextVars *data, int
|
||||
const size_t len_max = BLI_strnlen(data->text, sizeof(data->text));
|
||||
int byte_offset = 0;
|
||||
int char_index = 0;
|
||||
|
||||
const bool use_fallback = (font <= 1);
|
||||
if (!use_fallback) {
|
||||
BLF_enable(font, BLF_NO_FALLBACK);
|
||||
}
|
||||
|
||||
while (byte_offset <= len_max) {
|
||||
const char *str = data->text + byte_offset;
|
||||
const int char_length = BLI_str_utf8_size_safe(str);
|
||||
@@ -819,6 +834,11 @@ static blender::Vector<CharInfo> build_character_info(const TextVars *data, int
|
||||
byte_offset += char_length;
|
||||
char_index++;
|
||||
}
|
||||
|
||||
if (!use_fallback) {
|
||||
BLF_disable(font, BLF_NO_FALLBACK);
|
||||
}
|
||||
|
||||
return characters;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user