PGS Subtitles: The palette was incorrectly parsed.

This commit fixes some cases where PGS subtitles were displayed
with wrong colors or even not displayed at all.

Backport of MPC-HC commit 2fc627e
TextFile: Fix a potential bug when reopening a file as text.

Copy the filename before reopening the file since not doing that can lead to an incorrect memory access because the filename is emptied during the process.

Backport of MPC-HC commit 2a75078
Subtitles: Improve error checking with ASS rendering.

Some crashes could occur when the SSA script was using obviously wrong values.

Uses the same check as libass for maximum glyph size.

Backport of MPC-HC WIP commit 7d31a49 (U78's repository)