From 43d65b906b69afca2ec7109e8fe10ac17513e62d Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Fri, 7 Apr 2023 18:49:09 +0200 Subject: [PATCH] Also detect fonts used in drawings in font collector --- src/font_file_lister.cpp | 8 +++++++- src/font_file_lister.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/font_file_lister.cpp b/src/font_file_lister.cpp index 813e2ca96..a98c58264 100644 --- a/src/font_file_lister.cpp +++ b/src/font_file_lister.cpp @@ -139,6 +139,8 @@ void FontCollector::ProcessDialogueLine(const AssDialogue *line, int index) { break; } case AssBlockType::DRAWING: + used_styles[style].drawing = true; + break; case AssBlockType::COMMENT: break; } @@ -146,7 +148,11 @@ void FontCollector::ProcessDialogueLine(const AssDialogue *line, int index) { } void FontCollector::ProcessChunk(std::pair const& style) { - if (style.second.chars.empty()) return; + if (style.second.chars.empty() && !style.second.drawing) return; + + if (style.second.chars.empty() && style.second.drawing) { + status_callback(fmt_tl("Font '%s' is used in a drawing, but not in any text.\n", style.first.facename), 3); + } auto res = lister.GetFontPaths(style.first.facename, style.first.bold, style.first.italic, style.second.chars); diff --git a/src/font_file_lister.h b/src/font_file_lister.h index 9c7cd51ad..82f02cca9 100644 --- a/src/font_file_lister.h +++ b/src/font_file_lister.h @@ -127,6 +127,7 @@ class FontCollector { /// Data about where each style is used struct UsageData { std::vector chars; ///< Characters used in this style which glyphs will be needed for + bool drawing = false; ///< Whether this style is used for a drawing std::vector lines; ///< Lines on which this style is used via overrides std::vector styles; ///< ASS styles which use this style };