Skip to content

Commit

Permalink
Also detect fonts used in drawings in font collector
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Dec 17, 2024
1 parent 72f8c91 commit abb2597
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/font_file_lister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,20 @@ void FontCollector::ProcessDialogueLine(const AssDialogue *line, int index) {
break;
}
case AssBlockType::DRAWING:
used_styles[style].drawing = true;
break;
case AssBlockType::COMMENT:
break;
}
}
}

void FontCollector::ProcessChunk(std::pair<StyleInfo, UsageData> 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);

Expand Down
1 change: 1 addition & 0 deletions src/font_file_lister.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class FontCollector {
/// Data about where each style is used
struct UsageData {
std::vector<int> 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<int> lines; ///< Lines on which this style is used via overrides
std::vector<std::string> styles; ///< ASS styles which use this style
};
Expand Down

0 comments on commit abb2597

Please sign in to comment.