From 58eaa5f6c04bf9a7c9d974fffb550a975a0a71ca Mon Sep 17 00:00:00 2001 From: MIRIMIRIM <59959583+MIRIMIRIM@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:05:02 +0800 Subject: [PATCH] afs.core: subset keep vert, fix vertical layout --- AssFontSubset.Core/src/PyFontTools.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/AssFontSubset.Core/src/PyFontTools.cs b/AssFontSubset.Core/src/PyFontTools.cs index 873ae11..6f3d55b 100644 --- a/AssFontSubset.Core/src/PyFontTools.cs +++ b/AssFontSubset.Core/src/PyFontTools.cs @@ -253,13 +253,21 @@ private void ExecuteCmd(ProcessStartInfo startInfo) private ProcessStartInfo GetSubsetCmd(SubsetFont ssf) { var startInfo = GetSimpleCmd(_pyftsubset); + + // GDI doesn’t seem to use any features (may use vert?), and it has its own logic for handling vertical layout. + // https://github.com/libass/libass/pull/702 + // libass seems to be trying to use features like vert/vrt2 to solve this problem. + // These are features related to vertical layout but are not enabled: "vchw", "vhal", "vkrn", "vpal", "vrtr". Maybe "vrt2" is also not used. + // https://github.com/libass/libass/blob/6e83137cdbaf4006439d526fef902e123129707b/libass/ass_shaper.c#L147 + string[] enableFeatures = ["vert", "vrt2", "vkna"]; string[] argus = [ ssf.OriginalFontFile.FullName, $"--text-file={ssf.CharactersFile!}", $"--output-file={ssf.SubsetFontFileTemp!}", "--name-languages=*", $"--font-number={ssf.TrackIndex}", - "--no-layout-closure", + // "--no-layout-closure", + $"--layout-features='{string.Join(',', enableFeatures)}'" ]; foreach (var arg in argus) {