jassub 2.5.16 → 2.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -180,7 +180,7 @@ export class ASSRenderer {
180
180
 
181
181
  async _log (log: string) {
182
182
  console.debug(log)
183
- const match = log.match(/JASSUB: fontselect:[^(]+: \(([^,]+), (\d{1,4}), \d\)/)
183
+ const match = log.match(/JASSUB: fontselect:[^(]+: \(([^,]+), (\d{1,4}), \d+\)/)
184
184
  if (match && !await this._findAvailableFont(match[1]!.trim().toLowerCase(), WEIGHT_MAP[Math.ceil(parseInt(match[2]!) / 100) - 1])) {
185
185
  await this._findAvailableFont(this._defaultFont)
186
186
  }
@@ -300,6 +300,21 @@ export class ASSRenderer {
300
300
  this._gpurender.render(images, self.HEAPU8RAW)
301
301
  }
302
302
 
303
+ // single-frame readback for tests
304
+ _drawCapture (time: number) {
305
+ const images = (this._wasm.rawRender(time, 1) ?? []) as ASSImage[]
306
+ this._gpurender.render(images, self.HEAPU8RAW)
307
+
308
+ const canvas = this._gpurender.canvas
309
+ if (!canvas) return
310
+ const { width, height } = canvas
311
+ const surface = new OffscreenCanvas(width, height)
312
+ const ctx = surface.getContext('2d')
313
+ if (!ctx) return
314
+ ctx.drawImage(canvas, 0, 0)
315
+ return { data: ctx.getImageData(0, 0, width, height).data, width, height }
316
+ }
317
+
303
318
  _setColorSpace (videoColorSpace: 'RGB' | 'BT709' | 'BT601') {
304
319
  if (videoColorSpace === 'RGB') return
305
320
  this._videoColorSpace = videoColorSpace