promotional bannermobile promotional banner

cinematic subtitles

A subtitle API that can generate subtitles for videos
Back to Files

cinematic_subtitles-0.2.5.jar

File namecinematic_subtitles-0.2.5.jar
Uploaded
Nov 10, 2026
Downloads
19
Size
254.7 KB
Mod Loaders
Forge
File ID
9539257
Type
R
Release
Supported game versions
  • 1.20.1

Curse Maven Snippet

Forge

implementation fg.deobf("curse.maven:cinematic-subtitles-1786568:9539257")

Learn more about Curse Maven

What's new

English

0.2.5 — Keyframes, particles, glow, nested credits

Added

  • Editor-style keyframe animation. A top-level keyframes array in any style JSON animates subtitle text with move / scale / rotate / fade. Fields: time (seconds since that line appeared), dx / dy, scale, rotation, alpha, easing. Sampling matches a video editor: hold the first frame before it starts, hold the last frame after it ends, interpolate between frames with an easing curve, and carry forward any channel that a frame omits. Easings: linear, ease_in, ease_out, ease_in_out, step. Offset and alpha are added directly; scale and rotation are applied around the line's bounding-box center so layout is untouched.

    "keyframes": [
      { "time": 0,   "dy": 24, "scale": 0.6, "rotation": -6, "alpha": 0, "easing": "ease_out" },
      { "time": 0.8, "dy": 0,  "scale": 1,   "rotation": 0,  "alpha": 1 },
      { "time": 3,   "dx": 14, "alpha": 0 }
    ]
    
  • Keyframes on images. InlineImage accepts the same keyframes in JSON, or the compact inline form kf=, e.g. {img:file:a.png|kf=0@0,20,0.6,-6,0;0.8@0,0,1,0,1;3@14}. Works in horizontal and vertical layout, in subtitle text, and in the credits scrolling flow.

  • Resource-based particles via particles. Any registered image / GIF can be used as particles around a subtitle (GIFs make particles change frames over time). Style-level particles follow the subtitle's bounding box; credits-level particles use the whole screen. Full parameter set: path, count, size / jitter, lifetime, speed, direction (up / down / outward radial / custom angle), angle_jitter, gravity, drift_x, alpha, fade_in / fade_out, spin, tint, additive blending, front (behind / in front of text) and margin. The particle field is a deterministic pure-Java evaluation: the same time input always yields the same output, so pausing or seeking never causes a jump.

  • Custom glow via glow_effect. color, radius, intensity, pulse_period (breathing pulse), pulse_min / pulse_max. Rendering overrides the halo color and radius and scales intensity by a sine pulse; effective in horizontal layout, vertical per-glyph layout and credits.

  • Nested credits sections via sections. A section's items can mix String text / InlineImage / nested sub-sections, so text-only, image-only and mixed sections are all valid. Sub-sections nest to any depth and each level can pick its own style (style references a registered style name, or style_override supplies an inline style; otherwise the parent / default style is inherited). hasContent() enforces "at least one text line" and warns when a section has none. The legacy groups config remains fully backwards compatible. Credits elements also support style-level keyframes, image keyframes and glow.

  • Added samples keyframes_demo.json, particle_glow_demo.json, credits_nested.json (with a two-level nested cast group) and demo_keyframes.sfst; all are extracted automatically.

Changed

  • Self-tests expanded to six suites, 520 assertions passing, 0 failures (new suite 6 with 103 assertions: easing curves, keyframe sampling and compact syntax, particle determinism / gravity / lifetime envelope, glow pulse, nested section expansion and style inheritance, JSON / SFST parsing).
  • Full javac review: every compile error is caused by missing external MC / Forge / Gson dependencies; no syntax or signature errors in the new code.

0.2.4 — Inline `

Added

  • Inline images / GIFs anywhere in subtitle text with {img:file:...} / {img:resource:...}. The image is inserted at the marker's position and pushes following text aside; an image-only line is valid too.
    • file: searches external files only (absolute paths, or paths relative to config/cinematic_subtitles/, its images/ subfolder, or the game directory) and skips silently when missing. resource: / res: searches MC resource packs only (namespace:path, or this mod's textures/ shorthand). With no prefix, AUTO tries files first and falls back to resource packs.
    • Parameters are separated by |: w / h (px, screen fractions, auto), fit (stretch / cover / contain / native), fps (override GIF frame rate), alpha, gap (spacing to adjacent text), align, x / y. path= / src= can carry the locator inside the parameters, e.g. {img:path=foo.png|src=resource}.
  • Zero-width anchors. Image markers share the same parser as {#hex}, {mc:...} and bare §: fully consumed, no visible character, absent from plain text, no typewriter budget. Each image is bound to a plain-text code point index, and splitLines() / limit() / slice() / withCharTint() all carry and remap those anchors — so \n breaks, typewriter truncation and shimmer tinting never displace or drop an image. Images beyond the typing progress are clipped together with the text that has not appeared yet.
  • Space-reserving flow layout. InlineImageLayout splits a line into alternating TEXT / IMAGE pieces; the image takes space along the main axis and grows the line height / column width. Horizontal layout pushes the following glyphs, vertical layout pushes the following glyph cells. Stacks with inline coloring, {-end}, {mc:}, §, \n, all three idle animations, rotation, dissolve and outline. SRT exports strip image markers automatically.
  • Multiple styles in one .sfst CG. Each block in a file may name a different style, yet all blocks go into one SubtitleTable → one SubtitleInstance → one timeline, playing in order with unified pause / stop / interrupt. A single CG can therefore combine a top narration, bottom dialogue, left-side vertical lyrics and a centered title.
  • Added demo_inline_images.sfst (syntax reference) and demo_cg.sfst (7 blocks, 4 styles, inline images); /subtitles play demo_cg.sfst plays the whole sequence. Writing {img:...} directly in credits text or group titles also works and is equivalent to the structured image / images config on credits.json members; both forms can be mixed.

Fixed

  • Mixed styles no longer collapse into one layout. Previously renderLines() always took the LayoutConfig of the table's default type, so typeOverride only changed font / color / animation while anchor, orientation, line spacing and offset were unified — every line landed in the same spot and horizontal / vertical could not coexist. Now each VisualLine carries its own LayoutConfig, and LineGrouping groups consecutive lines with identical layout signatures so each group positions itself with its own anchor, orientation, spacing and offset. Lines with identical layouts still form one group, producing byte-for-byte the same output as before (no regression).
  • ImageTexture.resolve(path, source) now explicitly distinguishes FILE / RESOURCE / AUTO and includes the source in the cache key, so identical paths from different sources can no longer cross-contaminate.

Changed

  • Self-tests expanded to five suites, 417 assertions passing, 0 failures (new suite 2 with 103 assertions covering syntax, zero-width behavior, anchor remapping, flow layout and grouping). The integration suite uses the real SfstParser on demo_cg.sfst: 7 blocks, 4 styles, increasing timeline, all on a single table / single track instead of being split into mutually interrupting instances.

0.2.3 — Credits images & GIFs, vanilla § formatting, idle animations

Added

  • Inline images and GIFs in credits. Each entry of groups[].members can carry an image object, or be paired with an images array; image-only entries are supported too. Images take part in the scrolling flow layout: they reserve vertical space and push subsequent text down instead of overlapping it. Sizes accept screen pixels (320, "320px"), screen fractions ("30%", 0.3, "25%w", "25%h") and "auto" derived from the source aspect ratio. fit offers stretch, cover (scale to fill, center-crop), contain (fit with letterboxing, default) and native (source pixels). Also available: align, position (after / before), spacing_above / spacing_below, offset_x / offset_y, alpha and fps.
  • Image sources and GIF playback. path accepts absolute paths, paths relative to config/cinematic_subtitles/, its images/ subfolder, or the game directory, and finally falls back to MC resource packs (namespace:path, or this mod's textures/ shorthand). GIFs are decoded frame-by-frame with JDK ImageIO, composited according to disposal methods, registered as DynamicTextures and advanced by elapsed display time (fps > 0 overrides the built-in frame delays). background.fit and overlay_images use the same texture source, so they support GIFs and fit modes as well. demo_badge.png / .gif are included and ready to use.
  • Vanilla § formatting in subtitle text. Both {mc:vanilla-color-or-§-style} and bare § codes are supported: the 16 legacy colors, color names (red, dark_red, gold), direct #RRGGBB values, style codes or names (bold / italic / underline / strikethrough / obfuscated), reset, combinations (§c§l), and 1.16+ §x§F§F§5§5§A§A custom RGB. Three color layers stack: {-end} restores the line's base color, while §r only clears the bare-§ layer and falls back to the tag layer.
  • Per-type idle animations via idle_animation, set at the top level of any style JSON. They run for the whole time a subtitle stays on screen, independently of one-shot entry / exit animations.
    • shake — amplitude_x / amplitude_y (pixels), speed (cycles per second); two sine frequencies are combined for X / Y jitter.
    • blink — period (ms per light/dark cycle), min_alpha (0..1); a triangle wave loops between 1.0 and the minimum.
    • shimmer — band_width (highlight band in glyph cells), color, gap (cells between bands), speed_tick (cells per tick); a highlight band sweeps across the text.
  • Added three ready-to-use styles (idle_shake.json, idle_blink.json, idle_shimmer.json), the demo_mc_format.sfst sample, and API methods clearImageCache(), setIdleAnimation(type, config), idleAnimation(type). reloadStyles() now releases the texture cache automatically.

Fixed

  • Bare § codes and their following code characters were previously drawn as visible garbage and incorrectly counted toward width and typewriter progress. Format codes are now zero-width markers: no visible character, absent from plain text, no typewriter budget — they only attach color and style to the following segment.
  • Font style bits (bold, etc.) no longer vanish during per-glyph drawing: segments are converted to MC Style so every glyph carries its style, and bold's extra advance is added to the segment cursor.

Changed

  • Idle animation evaluation is a deterministic pure function of elapsed display time (no RNG, no system clock), so pausing and resuming never causes a visual jump. Shimmer is applied after typewriter truncation, affecting only visible glyphs, and works in vertical per-glyph layout too.
  • Remote credits JSON accepts the same image syntax; SRT exports strip format codes. All sources (LRC / SRT / JSON / SFST, commands, API, localization, credits) are covered automatically.

0.2.2 — .sfst format and \n manual line breaks

Added

  • .sfst, a custom subtitle format. Each entry is a three-line block: style name, timeline, then text. The style name becomes that line's typeOverride, so every line can pick its own subtitle style. type: dialogue / type=dialogue are also accepted, and the line may be omitted to fall back to the table's default type.
  • Flexible timelines. SRT-style 00:00:01 - 00:00:04, milliseconds 00:00:05.500 (. or ,), LRC-style [01:23.45] - [01:27.00] (brackets optional), or plain seconds 15 - 18. Separators -, -->, ~, 至, 到 all work. Leave the end time blank (or - / ?) and it is filled to the next entry's start; the last entry gets +3 seconds.
  • Manual line breaks with \n. A literal \n (backslash + n) in any line breaks it without splitting the entry. \N / \r / \R work too, \\n prints a literal \n, \\ prints one backslash, and other sequences (e.g. C:\path) are left untouched. Real newlines / CRLF in the file are normalized.
  • API and command: SubtitleAPI.triggerFromSfst(...), triggerFromSfstString(...), triggerFromFile(...) handle .sfst, decodeNewlines(String) decodes early, and /subtitles play demo_styles.sfst [fallbackType] plays it. demo_styles.sfst is extracted to config/cinematic_subtitles/subtitles/ on first launch.

Changed

  • Newline decoding happens at a single point in the render layer, before color markers are parsed. That makes LRC / SRT / JSON / SFST, localization keys, commands, the API, and credits titles & member lists all support it automatically, and it stacks with inline coloring. A break counts as one character for the typewriter effect.
  • .sfst blocks are split on timeline lines: blank lines between entries are optional, multi-line text is not swallowed by the next style line, and lines starting with # or // are comments.
  • /subtitles export writes manual breaks as standard SRT \N and strips inline color markers, so exported files remain valid for other players.
  • Removed the command's old replace("\\n", "\n"), which double-decoded and broke \\n escaping.

0.2.1 — Color conversion and inline coloring

Added

  • Automatic hex ↔ decimal color conversion. Style JSON now accepts #RRGGBB, 0xRRGGBB, plain decimal integers (e.g. 16777215), 3-digit shorthand #F0F, and 8-digit ARGB values. Values without an alpha channel are padded to 0xFF; 8-digit values are read as ARGB so explicit transparency is preserved.
  • Inline coloring with {tag or color}text{-end}. Switch colors mid-line and restore the line's base color with {-end} (also {reset}, {end}, {-}, {/}). Markers accept {#5c668e}, {0x5c668e}, {16777215}, {time}, etc. {{ / }} escape literal braces, and unknown tags are silently consumed while their text is kept. Example: {#5c668e}星辰大海{time}11:45:14{-end}你好世界.
  • Color tag tables. A global config/cinematic_subtitles/color_tags.json is shipped on first launch (time = #00662c); a color_tags object at the top level of any style overrides it, and SubtitleAPI.registerColorTag(...) registers tags from code. Precedence: per-style > global.
  • Added the demo_inline_colors.json sample set and color/tag utility methods on SubtitleAPI.

Fixed

  • Pure white no longer disappears. 0xFFFFFFFF equals -1 as a Java int, and the painter used -1 as a "skip drawing" sentinel, so #FFFFFF / 0xffffff / 16777215 rendered as fully transparent and the whole line vanished. The sentinel is gone; drawing is now gated by alpha.
  • Decimal color values were previously read as 8-digit hex (16777215 → 0x16777215, alpha 0x16, nearly invisible). They are now interpreted as decimal numbers.

Changed

  • Inline markers are zero-width for the typewriter effect: colors survive character-by-character truncation, horizontal layout accumulates segment widths precisely, and vertical layout samples color per glyph. char_spacing, outline, glow, rotation and dissolve keep working.
  • Parsing happens in a single place at render time, so LRC / SRT / JSON tables, localization keys, SubtitleAPI.trigger*, commands and credits all support the syntax automatically.
  • SRT exports and animation inputs use plain text; markers are never written out.

0.2.0

The original upstream release, used as the decompilation baseline. None of the enhancements above are present.


中文

0.2.5 — 关键帧动画 / 资源粒子 / 发光特效 / Credits 嵌套子标题

新增

  • 关键帧动画(剪辑软件式):样式 JSON 顶层 keyframes 数组可为字幕文字配置移动 / 缩放 / 旋转 / 渐变,字段 time(相对该句出现时刻的秒)、dx / dy、scale、rotation、alpha、easing。采样规则与剪辑软件一致:首帧前保持第一帧、末帧后 hold、帧间按缓动曲线插值、未写的通道自动沿用上一帧。缓动支持 linear / ease_in / ease_out / ease_in_out / step。位移与渐变直接叠加,缩放 / 旋转绕行包围盒中心做变换,不干扰排版。

    "keyframes": [
      { "time": 0,   "dy": 24, "scale": 0.6, "rotation": -6, "alpha": 0, "easing": "ease_out" },
      { "time": 0.8, "dy": 0,  "scale": 1,   "rotation": 0,  "alpha": 1 },
      { "time": 3,   "dx": 14, "alpha": 0 }
    ]
    
  • 图片关键帧:InlineImage 同样可挂 keyframes(JSON 配置图),或在行内用紧凑写法 kf=,例如 {img:file:a.png|kf=0@0,20,0.6,-6,0;0.8@0,0,1,0,1;3@14}。横排、竖排、字幕正文与 Credits 滚动流中的图片全部生效。

  • 资源素材粒子 particles:可用任意已注册的图片 / GIF 作为字幕周围的粒子(GIF 会让粒子逐帧换图)。样式级 particles 的区域跟随字幕包围盒,Credits 级 particles 的区域为全画面。参数齐全:path、count、size / jitter、lifetime、speed、direction(up / down / outward 辐射 / 自定义角度)、angle_jitter、gravity、drift_x、alpha、fade_in / fade_out、spin(自转)、tint(着色)、additive(加色混合)、front(字幕前 / 后)、margin。粒子场是确定性的纯 Java 求值:同一时间输入永远得到同一输出,暂停 / 跳时间不会跳变。

  • 自定义发光特效 glow_effect:color / radius / intensity / pulse_period(呼吸脉冲周期)/ pulse_min / pulse_max。渲染时覆盖光晕颜色与半径,并按强度 × 正弦脉冲求倍率;横排、竖排逐字、Credits 全部生效。

  • Credits 嵌套子标题 sections:节的 items 可混排 String 正文 / InlineImage 图片 / 嵌套子节,因此纯文本节、纯图片节、图文混排节都允许;子标题可无限层嵌套,且每层可独立指定样式(style 引用已注册样式名,或 style_override 内联样式,否则继承父层 / 默认样式)。hasContent() 校验「至少一条正文」,解析时无正文会告警;旧 groups 配置完全向后兼容。Credits 元素同样支持样式级关键帧 + 图片关键帧 + 发光特效。

  • 新增示例 keyframes_demo.json、particle_glow_demo.json、credits_nested.json(含两层嵌套配音组)、demo_keyframes.sfst,均随模组自动释放。

改进

  • 自检扩展为六段 520 项全部通过 / 0 失败(新增第 6 段 103 项:缓动曲线、关键帧采样与紧凑写法、粒子确定性与重力 / 生命周期包络、发光脉冲、嵌套节展开与样式继承、JSON / SFST 解析)。
  • 全量 javac 复核:所有编译错误均为缺少 MC / Forge / Gson 外部依赖所致,新代码零语法或签名错误。

0.2.4 — `

新增

  • {img:file:...} / {img:resource:...} 任意字幕正文行内插图 / GIF:在标记位置插入图片并把后面的文字顶开,纯图片也能单独成一行。
    • file: 只查外部文件(绝对路径,或相对 config/cinematic_subtitles/、其 images/ 子目录、游戏目录),找不到静默跳过;resource: / res: 只查 MC 资源包(namespace:path 或本 mod 的 textures/ 简写);不写前缀为 AUTO,先找文件再回落资源包。
    • 参数用 | 分隔:w / h(px、屏幕比例、auto)、fit(stretch / cover / contain / native)、fps(GIF 固定帧率覆盖)、alpha、gap(与左右文字留白)、align、x / y;也可用 path= / src= 把定位串写进参数,例如 {img:path=foo.png|src=resource}。
  • 零宽锚点:图片标记与 {#色值}、{mc:...}、裸 § 共用同一个解析器,整体消费,不产生可见字符、不进入纯文本、不占打字机预算。图片挂在纯文本 code point 索引上;splitLines() / limit() / slice() / withCharTint() 都会携带并重映射锚点,因此 \n 换行、打字机截断、炫光着色都不会让图片错位或丢失,超出打字进度的图片与未打出的文字一起被裁掉。
  • 占位顶开:InlineImageLayout 把一行切成「文字段 / 图片段」交替的 Piece 序列,图片占主方向长度并撑大行高 / 列宽;横排顶开后面的字,竖排顶开后面的字格。与行内着色、{-end}、{mc:}、§、\n、三种常驻动画、旋转、溶解、描边全部兼容,导出 SRT 会自动剥掉图片标记。
  • .sfst 多样式整合成一个 CG:一个文件内每个块可指定不同样式,全部进同一张 SubtitleTable → 同一个 SubtitleInstance → 同一条时间轴,按顺序播放、统一暂停 / 终止 / 打断。于是同一段 CG 里可以同时出现「顶部旁白 + 底部对白 + 左侧竖排歌词 + 居中标题」。
  • 新增示例 demo_inline_images.sfst(语法大全)与 demo_cg.sfst(7 个块、4 种样式、含行内图片的完整 CG);/subtitles play demo_cg.sfst 可直接观看。片尾字幕正文与组标题里直接写 {img:...} 同样生效,与 credits.json 里 members 的结构化 image / images 配置等价,两种写法可混用。

修复

  • 修复混用样式时布局被统一的缺陷:原先 renderLines() 里布局永远取整表默认 type 的 LayoutConfig,typeOverride 只换了字体 / 颜色 / 动画,锚点、横竖排、行距、偏移全被统一,导致所有句子挤在同一位置、横排竖排只能二选一。现在每个 VisualLine 携带自己那一句的 LayoutConfig,由 LineGrouping 按布局签名把连续且签名相同的行分组,各组按自己的锚点 / 横竖排 / 行距 / 偏移独立定位。布局完全相同的句子仍走同一组,结果与旧版逐字节一致,无回归。
  • ImageTexture.resolve(path, source) 显式区分 FILE / RESOURCE / AUTO,缓存键带上来源,避免同名路径在两种来源之间互相串图。

改进

  • 自检扩展为五段 417 项全部通过 / 0 失败(新增第 2 段 103 项:语法 / 零宽 / 锚点重映射 / 流布局 / 分组),集成自检用真实 SfstParser 验证 demo_cg.sfst:7 个块、4 种样式、时间轴递增、全部落在同一张表 / 同一条轨道,不会被拆成互相打断的多个实例。

0.2.3 — Credits 图片与 GIF / 原版 § 格式 / 常驻动画

新增

  • Credits 正文段插图 / GIF 动图:groups[].members 的每条正文段可携带 image 对象,或用 images 平行数组一一对应,也支持纯图片段。图片参与滚动流布局,占据一块垂直高度并把后续正文顶开,不会重叠。宽高支持屏幕像素 320 / "320px"、屏幕比例 "30%" / 0.3 / "25%w" / "25%h",以及按原图比例推算的 "auto";fit 提供 stretch(拉伸)、cover(等比填满后居中裁剪)、contain(完整显示留白,默认)、native(原图像素)。另有 align、position(after / before)、spacing_above / spacing_below、offset_x / offset_y、alpha、fps 等参数。
  • 图片来源与 GIF:path 支持绝对路径、config/cinematic_subtitles/ 相对路径及其 images/ 子目录、游戏目录相对路径,最后回落到 MC 资源包(namespace:path 或本 mod 的 textures/ 简写)。GIF 用 JDK ImageIO 逐帧解码并按 disposal 方式合成,每帧注册为 DynamicTexture,按字幕已显示时间取帧(fps > 0 可覆盖自带帧延迟)。背景图 background.fit 与 overlay_images 走同一贴图源,同样支持 GIF 与 fit。随附可直接使用的 demo_badge.png / .gif。
  • 原版 § 格式兼容:正文支持 {mc:原版预设颜色值/§字体} 与裸 § 两种写法,含 16 色码、颜色名(red / dark_red / gold)、直接色值 #RRGGBB、样式码或名字(粗体 / 斜体 / 下划线 / 删除线 / 混淆字)、reset、组合(§c§l)以及 1.16+ 的 §x§F§F§5§5§A§A 自定义 RGB。三层颜色可叠加:{-end} 还原整句基础色,§r 只清裸 § 层回到标签层颜色。
  • 每个 type 独立的常驻动画 idle_animation:挂在任意样式 JSON 顶层,字幕停留在屏幕上的整个期间持续生效,与只播放一次的入场 / 退场动画互不干扰。
    • shake:amplitude_x / amplitude_y(像素幅度)、speed(每秒周期数),两组不同频率正弦叠加出 X / Y 抖动。
    • blink:period(一次明暗周期毫秒)、min_alpha(最低透明度 0..1),三角波循环。
    • shimmer:band_width(高亮字格宽度)、color、gap(两组炫光间字格数)、speed_tick(每 tick 前进字格数),高亮带扫过文字。
  • 新增三个可直接使用的样式 idle_shake.json / idle_blink.json / idle_shimmer.json,示例字幕 demo_mc_format.sfst,以及 API clearImageCache() / setIdleAnimation(type, config) / idleAnimation(type);reloadStyles() 会自动释放贴图缓存。

修复

  • 修复逐段 / 逐字绘制时 § 与其后的码字符被当成可见字符画成乱码、并错误计入宽度与打字进度的问题。格式码现在是零宽标记:不产生可见字符、不进入纯文本、不占打字机预算,只给整段文字附带颜色与样式。
  • 修复字体样式位(粗体等)在逐字绘制时丢失的问题:整段转成 MC 的 Style 后每个字符都带样式,粗体带来的额外字宽正确计入段间游标。

改进

  • 常驻动画求值器是纯函数、确定性的(只依赖字幕已显示时间),不读随机数或系统时钟,因此暂停 / 恢复时画面不跳变;炫光在打字机截断之后应用,只作用于当前可见字符,竖排逐字取色同样生效。
  • 远程 credits JSON 同步支持图片语法;导出 SRT 时自动剥离格式码。所有来源(LRC / SRT / JSON / SFST / 命令 / API / 本地化 / credits)自动生效。

0.2.2 — .sfst 自定义格式 / \n 手动换行

新增

  • .sfst 自定义字幕格式:每个条目为一个三行块 —— 第 1 行字体样式名、第 2 行时间轴、第 3 行起正文。样式名写入该句的 typeOverride,因此每一句都能单独指定字幕样式;也支持 type: dialogue / type=dialogue 写法,或省略该行以使用整表默认 type。
  • 时间轴兼容多种写法:SRT 风格 00:00:01 - 00:00:04、带毫秒 00:00:05.500(. 或 ,)、LRC 风格 [01:23.45] - [01:27.00](可带方括号)、纯秒数 15 - 18;分隔符兼容 - / --> / ~ / 至 / 到。结束时间可留空(或写 - / ?),自动补到下一条开始时间,末条补 3 秒。
  • \n 手动换行:任意台词里写字面的 \n(反斜杠 + n)即可换行,无需把一条字幕拆成多个条目。支持 \N / \r / \R,\\n 显示字面 \n 两个字符,\\ 输出单个反斜杠,其它组合(如 C:\path)原样保留;文件里的真实换行 / CRLF 会归一化。
  • API 与命令:SubtitleAPI.triggerFromSfst(...) / triggerFromSfstString(...) / triggerFromFile(...) 支持 .sfst,decodeNewlines(String) 可提前解码;/subtitles play demo_styles.sfst [兜底type] 直接播放。模组首次启动会把 demo_styles.sfst 释放到 config/cinematic_subtitles/subtitles/。

改进

  • 换行解码集中在渲染层唯一一处(在解析颜色标记之前),因此 .lrc / .srt / .json / .sfst、本地化键、命令、API 以及片尾字幕的标题与成员名单全部自动支持,且与行内着色可以叠加;换行符计入打字机进度(占 1 个字符)。
  • .sfst 以时间轴行为锚点切块:条目之间写不写空行都能正确切分,正文占多个物理行时不会被下一条的样式行吞掉;以 # 或 // 开头的行视为注释。
  • /subtitles export 生成的 SRT 会把手动换行写成标准的 \N 并剥掉行内颜色标记,仍可被其它播放器正确识别。
  • 移除了命令里原有的 replace("\\n", "\n"),避免重复解码破坏 \\n 转义。

0.2.1 — 色值换算 / 行内着色

新增

  • 色值十六进制 ↔ 十进制自动换算:样式 JSON 中的 #RRGGBB、0xRRGGBB、十进制整数(如 16777215)、3 位简写 #F0F、8 位 ARGB 写法全部统一解析;不带 alpha 的值自动补 0xFF,8 位写法按 ARGB 读取并保留半透明。
  • 行内着色语法 {标签或色值}内容{-end}:同一句里可分段换色,{-end}(兼容 {reset} / {end} / {-} / {/})还原为整句基础色。标记支持 {#5c668e}、{0x5c668e}、{16777215}、{time} 等写法;{{ / }} 转义出字面花括号;未注册的标签会被吞掉而文字保留。例:{#5c668e}星辰大海{time}11:45:14{-end}你好世界。
  • 颜色标签表:全局 config/cinematic_subtitles/color_tags.json(首次启动自动释放模板,time = #00662c),样式 JSON 顶层可用 color_tags 局部覆盖,也可通过 SubtitleAPI.registerColorTag(...) 在代码里注册。优先级为「样式局部 > 全局」。
  • 新增示例台词 demo_inline_colors.json,以及 SubtitleAPI.decodeNewlines(...) 等色值 / 标签工具方法。

修复

  • 修复不透明白被判为透明导致整行不绘制的问题:0xFFFFFFFF 在 Java int 里恰好等于 -1,而绘制层把 -1 当作「跳过绘制」哨兵;现在删除该哨兵,改由 alpha 判断,#FFFFFF / 0xffffff / 16777215 / -1 都能正确显示为白色。
  • 修复十进制色值被当作 8 位十六进制读取的问题(原先 16777215 会被解析成 0x16777215,alpha 只有 0x16,几乎全透明)。

改进

  • 行内着色标记不占打字机字符预算:按字符截断时颜色分段仍被正确保留;横排按段绘制并精确累加横坐标,竖排逐字取色,char_spacing、描边、发光、旋转、溶解照常工作。
  • 解析统一在渲染层完成,因此 .lrc / .srt / .json 字幕表、本地化翻译键、SubtitleAPI.trigger*、命令以及片尾字幕(credits)全部自动支持,无需改动解析器。
  • 导出的 SRT 与动画入参使用纯文本,不会把标记写出去。

0.2.0

原始模组版本,作为反编译与后续改动的基线;未包含以上任何增强。

This mod has no additional files