This commit is contained in:
949036910@qq.com
2026-06-01 22:47:04 +08:00
parent 4dada0c1a0
commit d637088a34
2 changed files with 119 additions and 15 deletions

View File

@@ -356,13 +356,19 @@ function stripKeywordsFromDisplay(displayText, matches) {
return chars.join("").trim();
}
/** @param {{ start: number, end: number }} record 毫秒 */
/** @param {{ start: number, end: number, text?: string }} record 毫秒 */
function filterMatchesForRecord(record, matches) {
const segStart = record.start / 1000;
const segEnd = record.end / 1000;
return matches.filter(
(m) => m.startSec >= segStart - 0.02 && m.endSec <= segEnd + 0.02,
);
const display = normalizeDisplayText(record.text);
if (!display) return [];
return matches.filter((m) => m.lineText === display);
}
/**
* inline-emphasis关键词用 ASS 内联样式,与正文同行同序(不用 drawtext 叠层)
* @param {string} [mode]
*/
function isInlineKeywordRenderMode(mode) {
return String(mode || "inline-emphasis") === "inline-emphasis";
}
module.exports = {
@@ -372,5 +378,6 @@ module.exports = {
normalizeDisplayText,
stripKeywordsFromDisplay,
filterMatchesForRecord,
isInlineKeywordRenderMode,
resolveFontFile,
};