11
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user