diff --git a/CHANGELOG.md b/CHANGELOG.md index 45347ef9..6e1bd09d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -140,6 +140,8 @@ 나누는 표는 마지막 행의 남는 높이를 잘라 그 쪽에서 끝날 때도 그렇다. 나누지 않는 표가 그 자리에 들어가지 않으면 표만 다음 쪽 맨 위로 가고, 문단 줄과 그 뒤 문단은 제자리에 남는다. 전에는 앞의 두 경우 표를 그 자리에 두어 쪽 수가 한/글과 달랐고, 나누지 않는 표는 첫 줄과 함께 넘겨 쪽이 하나 더 나왔다. +- FormFit과 쪽 수 추정이 공백 뒤의 말줄임표(`…`)로 줄을 시작한다. 한/글이 그렇게 놓는다. 앞 글자에 붙은 `…`는 전처럼 + 그 글자와 함께 다음 줄로 간다. - 쪽 수 추정이 문단 아래로 띄워 둔 위아래 배치 개체가 쪽 끝 가까이 있을 때 한/글처럼 놓는다. 개체 아래로 내려간 다음 줄이 쪽 끝을 넘으면 다음 쪽 맨 위에서 시작한다(개체 아래 간격은 그 쪽으로 가져가지 않는다). 개체의 앵커 줄이 다음 쪽으로 넘어가면 개체도 그 줄과 함께 넘어가, 그 줄 위에서 오프셋만큼 아래에 선다. 전에는 앞의 경우를 지원하지 diff --git a/src/hwpx/form_fit/measure.py b/src/hwpx/form_fit/measure.py index 4319fa2c..c8e3636d 100644 --- a/src/hwpx/form_fit/measure.py +++ b/src/hwpx/form_fit/measure.py @@ -122,7 +122,7 @@ #: same: rounded, \uc7a5\ud3c9 and \uc790\uac04 applied as any other is). _HALF_EM_GLYPHS = frozenset("!") #: Closing punctuation that never starts a line; it moves down with the -#: character before it. +#: character before it; but the ellipsis starts a line after a space. _NO_LINE_START = frozenset("!%),.:;?]}¢°’”‰′″℃〉》」』】〕…·、。") #: Opening punctuation that never ends a line. _NO_LINE_END = frozenset("([{‘“〈《「『【〔") @@ -1599,7 +1599,7 @@ def hancom_line_starts( options = [ index for index in breaks if start < index <= end - and text[index] not in _NO_LINE_START + and (text[index] not in _NO_LINE_START or text[index] == "…" and text[index - 1] in _HANGING_SPACES) and text[index - 1] not in _NO_LINE_END ] start = max(options) if options else end diff --git a/tests/fixtures/hancom_saved/pages_ellipsis_starts_a_cell_line.hwpx b/tests/fixtures/hancom_saved/pages_ellipsis_starts_a_cell_line.hwpx new file mode 100644 index 00000000..64d91ed3 Binary files /dev/null and b/tests/fixtures/hancom_saved/pages_ellipsis_starts_a_cell_line.hwpx differ diff --git a/tests/test_layout_page_estimate.py b/tests/test_layout_page_estimate.py index 7a5707d2..3cc66301 100644 --- a/tests/test_layout_page_estimate.py +++ b/tests/test_layout_page_estimate.py @@ -203,6 +203,9 @@ "pages_square_band_then_a_table_margin_top": 1, # the rectangle's top outer margin 1417 in its band "pages_square_band_then_a_table_after_the_band": 1, # the paragraph after the band "pages_fixed_width_spaces": 2, # rows of a syllable and a fixed-width space: a quarter em that hangs + # Tables of short sentences, one cell holding "… " among its words: Hancom starts a line with the ellipsis after + # a space (attached to the character before it, it keeps to that one). + "pages_ellipsis_starts_a_cell_line": 4, "pages_no_break_spaces": 2, # rows of "가나" and a no-break space: each is half an em and keeps the row # one word "pages_typed_ideographic_spaces": 5, # cells of "가나다라마" and a U+3000 typed in the text, a full em