Skip to content

fix: HWPX 렌더링 버그 수정 — underline/strikeout/내어쓰기#225

Open
hulryung wants to merge 2 commits into
ohah:mainfrom
hulryung:fix/hwpx-rendering-bugs
Open

fix: HWPX 렌더링 버그 수정 — underline/strikeout/내어쓰기#225
hulryung wants to merge 2 commits into
ohah:mainfrom
hulryung:fix/hwpx-rendering-bugs

Conversation

@hulryung
Copy link
Copy Markdown
Contributor

Summary

HWPX 문서 렌더링 시 발생하는 3가지 버그를 수정합니다.

1. underline/strikeout이 모든 텍스트에 적용되는 문제

  • HWPX XML에서 <underline type="NONE" shape="SOLID"/>처럼 type="NONE"인 경우에도 Some(Underline {...})로 파싱되어 모든 텍스트에 <u> 태그가 적용됨
  • <strikeout shape="NONE"/>도 마찬가지로 Some(Strikeout {...})로 파싱되어 <del> 태그 적용
  • 수정: 파서에서 type="NONE" / shape="NONE"이면 설정하지 않고, 렌더러에서도 shape=None 검사 추가

2. 음수 text-indent(내어쓰기)로 텍스트 앞부분이 잘리는 문제

  • text-indent: -71.8pt처럼 음수 indent가 있을 때 margin-left가 0이면 첫 줄 텍스트가 컨테이너 밖으로 밀림
  • 수정: abs(indent) > left일 때 차액만큼 padding-left 보정 추가

변경 파일

  • crates/hwpx-parser/src/header.rs — underline/strikeout 파싱 조건 추가
  • crates/hwp-core/src/viewer/doc_html/paragraph.rs — shape=None 검사 + padding-left 보정
  • crates/hwp-core/src/viewer/doc_html/layout_text.rs — shape=None 검사

Test plan

  • HWPX 파일에서 불필요한 밑줄/취소선이 사라지는지 확인
  • 실제 밑줄이 있는 텍스트(type="BOTTOM")는 정상 렌더링되는지 확인
  • 내어쓰기(hanging indent) 텍스트 앞부분이 잘리지 않는지 확인
  • 기존 HWP 파일 렌더링에 영향 없는지 확인

- hwpx-parser: underline type="NONE"이면 밑줄 설정하지 않음
- hwpx-parser: strikeout shape="NONE"이면 취소선 설정하지 않음
- doc_html: underline/strikeout shape=None일 때 <u>/<del> 태그 렌더링 제외
- doc_html: 음수 text-indent(내어쓰기)에 left margin이 부족하면 padding-left 보정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant