Skip to content

exam_science 페이지 2 박스 안 사각형이 multi-line paragraph 의 잘못된 줄 위치에 그려짐 #500

@planet6897

Description

@planet6897

증상

`samples/exam_science.hwp` 페이지 2 7번 박스 안 paragraph p[1] 의 ctrl[1] 사각형(tac=true, wrap=TopAndBottom, w=4724 h=1716, text_box="㉠") 이 잘못된 위치에 그려진다.

  • PDF 기준 위치: paragraph p[1] 의 ls[1] (두번째 줄, "[사각형] 이다.") 에 위치 → y≈228
  • 현재 SVG 위치: y=206.75 (= ls[0] 시작 y), x=465.07 (= ls[0] 텍스트 누적 폭)

즉 사각형이 첫 줄 끝의 가짜 위치에 그려져 있다.

원인

`src/renderer/layout/table_layout.rs:1640~1646` 의 셀 paragraph 인라인 Shape 분기:

```rust
let shape_area = LayoutRect {
x: inline_x, // ← 첫 줄 누적 inline_x
y: para_y_before_compose, // ← paragraph 시작 y (ls[0])
...
};
self.layout_cell_shape(tree, &mut cell_node, shape, &shape_area, para_y_before_compose, ...);
```

`inline_x`, `para_y_before_compose` 모두 paragraph 첫 줄 기준이므로 multi-line paragraph 의 ls[1]+ 에 위치한 사각형이 잘못된 좌표가 된다.

Picture 분기 비교

같은 함수의 `Control::Picture` 분기 (라인 1483~1530) 는 `target_line` 산출 + 줄 변경 시 `inline_x/y` 리셋 로직을 갖는다 — multi-line 정상 처리.

관련 이슈

수정 방향 후보

  • Picture 분기와 정합: `target_line` 산출 + 줄 변경 시 `inline_x/y` 리셋. 단 paragraph_layout 의 인라인 사각형 자리 비움 동작과의 정합 검증 필요.

재현

```bash
cargo build --release
./target/release/rhwp export-svg samples/exam_science.hwp -p 1 -o output/svg/
grep '<rect[^/]*y="206\.74"' output/svg/exam_science_002.svg
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions