From 6486041c604ba58c2fcddefae193fcc372d78b39 Mon Sep 17 00:00:00 2001 From: CoffeeStraw Date: Sat, 29 May 2021 18:35:50 +0200 Subject: [PATCH] Version 0.9.10: fix #31 concerning lines with alignment between 4 and 6 sometimes seen as vertical kanjis even if unwanted (also, now vertical_kanji is False by default) --- pyonfx/__init__.py | 2 +- pyonfx/ass_core.py | 8 ++++++-- tests/test_ass.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyonfx/__init__.py b/pyonfx/__init__.py index d84300af..47b9412c 100644 --- a/pyonfx/__init__.py +++ b/pyonfx/__init__.py @@ -6,4 +6,4 @@ from .shape import Shape from .utils import Utils, FrameUtility, ColorUtility -__version__ = "0.9.9" +__version__ = "0.9.10" diff --git a/pyonfx/ass_core.py b/pyonfx/ass_core.py index a41fc4da..d0018f1f 100644 --- a/pyonfx/ass_core.py +++ b/pyonfx/ass_core.py @@ -406,7 +406,7 @@ def __init__( path_output: str = "Output.ass", keep_original: bool = True, extended: bool = True, - vertical_kanji: bool = True, + vertical_kanji: bool = False, ): # Starting to take process time self.__saved = False @@ -1029,7 +1029,11 @@ def get_media_abs_path(mediafile): # Calculate character positions with all characters data already available if line.chars and self.meta.play_res_x > 0 and self.meta.play_res_y > 0: - if line.styleref.alignment > 6 or line.styleref.alignment < 4: + if ( + line.styleref.alignment > 6 + or line.styleref.alignment < 4 + or not vertical_kanji + ): cur_x = line.left for char in line.chars: # Horizontal position diff --git a/tests/test_ass.py b/tests/test_ass.py index 3e99d95a..020031c3 100644 --- a/tests/test_ass.py +++ b/tests/test_ass.py @@ -8,7 +8,7 @@ path_ass = os.path.join(dir_path, "Ass", "ass_core.ass") # Extract infos from ass file -io = Ass(path_ass) +io = Ass(path_ass, vertical_kanji=True) meta, styles, lines = io.get_data() # Config