Skip to content

Commit

Permalink
Version 0.9.10: fix #31 concerning lines with alignment between 4 and…
Browse files Browse the repository at this point in the history
… 6 sometimes seen as vertical kanjis even if unwanted (also, now vertical_kanji is False by default)
  • Loading branch information
CoffeeStraw committed May 29, 2021
1 parent 9543b23 commit 6486041
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyonfx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
from .shape import Shape
from .utils import Utils, FrameUtility, ColorUtility

__version__ = "0.9.9"
__version__ = "0.9.10"
8 changes: 6 additions & 2 deletions pyonfx/ass_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6486041

Please sign in to comment.