diff --git a/CHANGELOG.md b/CHANGELOG.md index 989f3b4f..ccb34ca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ 글꼴 기준이면 글 높이의 85 %, 위면 0, 가운데면 절반, 아래면 글 높이 그대로 쓴다. - 한/글은 줄이 어디서 나뉘는지도 배치 정보를 따르므로, 줄 나눔이 덜 확실한 문단은 쓰지 않는다: 한컴오피스 2024 데스크톱에서 폭을 확인한 글꼴(함초롬·맑은 고딕·바탕·돋움·굴림·궁서·한컴 고딕·HY헤드라인M 등·휴먼·한양·HCI)이 - 아니거나, 굵은 글자가 한양 글꼴·HCI Hollyhock이거나(한/글은 한양 글꼴의 굵은 글자를 1/20 em 넓게 그린다), + 아니거나, 굵은 글자가 한양견고딕·HCI Hollyhock이거나, 장평 50~200 %·자간 −30~30 %·최소 공백 50 % 밖이거나, 최소 공백이나 자간이 있는 문단에 묶음 빈칸이 있거나, 한글 음절과 확인한 기호 밖의 글자가 든 문단, 쪽 컨트롤이 글자 뒤에 있는 문단, 글자 폭 표에 없는 글자나 한 줄보다 긴 낱말이 든 문단, 줄 폭을 100 HWPUNIT @@ -142,6 +142,8 @@ - `apply_body_ops`의 `replace_text`가 표를 담은 문단과 그 표의 칸 문단에서 함께 찾은 글을 바꿀 때 XML을 깨뜨려 저장 검사에서 `ValueError: malformed XML`로 멈추던 것을 고친다. 두 문단의 편집 구간이 겹쳐 있었다. 이제 바깥 문단 하나로 묶어 그 안의 치환과 칸의 줄 나눔(SQUEEZE→BREAK) 편집을 한 번에 적용한다. +- (실험) `write_line_caches`가 한양신명조·한양중고딕의 굵은 글자가 든 문단에도 줄 배치 정보를 쓴다. FormFit이 그 폭(em의 + 1/20 넓게)을 한/글처럼 잡게 되어서다. 한양견고딕·HCI Hollyhock의 굵은 글자는 여전히 쓰지 않는다. - FormFit과 쪽 수 추정이 한양 글꼴(한양신명조·한양중고딕·한양견고딕)의 굵은 글자를 em의 1/20만큼 넓게 잡는다. 한/글은 그 폭을 더한 뒤 배치 단위로 반올림한다(14pt "가"가 1,400이 아니라 1,472). 전에는 굵은 글자도 보통 폭으로 셌다. 다른 글꼴의 굵은 글자는 전처럼 보통 폭이다. `TextStyle.bold`가 글자 모양의 굵게를 담는다. diff --git a/src/hwpx/layout/line_cache.py b/src/hwpx/layout/line_cache.py index 6eb9dd34..3d53a193 100644 --- a/src/hwpx/layout/line_cache.py +++ b/src/hwpx/layout/line_cache.py @@ -94,9 +94,10 @@ "한컴 고딕", "HY헤드라인M", "HY견고딕", "HY울릉도M", "HY견명조", "HY동녘M", "휴먼명조", "휴먼고딕", "휴먼옛체", "한양중고딕", "한양신명조", "한양견고딕", "HCI Poppy", "HCI Hollyhock", }) -#: The faces Hancom was seen to lay bold characters out in at their regular advances. The 한양 faces it draws a -#: twentieth of an em wider when bold, and some glyphs of HCI Hollyhock: bold characters in them are left. -_BOLD_SURE_FACES = _SURE_FACES - {"한양중고딕", "한양신명조", "한양견고딕", "HCI Hollyhock"} +#: The faces whose bold characters FormFit lays out at Hancom's advances: their regular ones, or a twentieth of +#: an em wider in 한양신명조 and 한양중고딕. Some bold glyphs of 한양견고딕 and HCI Hollyhock Hancom lays out at +#: other advances: bold characters in them are left. +_BOLD_SURE_FACES = _SURE_FACES - {"한양견고딕", "HCI Hollyhock"} #: The 장평 (%), 자간 (%) and 최소 공백 (%) Hancom was seen to lay lines out at as FormFit does, on the desktop. _SURE_RATIOS = (50, 200) _SURE_SPACINGS = (-30, 30) diff --git a/tests/test_layout_line_cache.py b/tests/test_layout_line_cache.py index 1b99fe75..e5b6fba7 100644 --- a/tests/test_layout_line_cache.py +++ b/tests/test_layout_line_cache.py @@ -144,8 +144,8 @@ def test_a_larger_paragraph_end_makes_the_last_lines_text_as_tall() -> None: @pytest.mark.parametrize("style", [{"font": "HY신명조"}, {"font": "KoPub바탕체 Light"}, {"letter_spacing": -40}, - {"ratio": 210}, {"font": "한양신명조", "bold": True}, - {"font": "한양견고딕", "bold": True}]) + {"ratio": 210}, {"font": "한양견고딕", "bold": True}, + {"font": "HCI Hollyhock", "bold": True}]) def test_a_paragraph_in_a_face_or_look_not_seen_on_the_desktop_is_left_for_hancom(style: dict) -> None: # A face Hancom may draw in another one, or 장평 and 자간 past those seen on the desktop, are left for Hancom. document = HwpxDocument.new() @@ -159,7 +159,7 @@ def test_a_paragraph_in_a_face_or_look_not_seen_on_the_desktop_is_left_for_hanco @pytest.mark.parametrize("style", [{"letter_spacing": -5}, {"ratio": 90}, {"ratio": 110, "letter_spacing": 5}, {"font": "한양신명조"}, {"font": "맑은 고딕", "bold": True}, - {"font": "휴먼명조", "bold": True}]) + {"font": "휴먼명조", "bold": True}, {"font": "한양신명조", "bold": True}]) def test_a_paragraph_at_a_look_seen_on_the_desktop_gets_a_cache(style: dict) -> None: document = HwpxDocument.new() paragraph = document.add_paragraph("", include_run=False)