HWPX curve 도형 <hp:seg> 파싱 — 외곽선(태그 박스) 렌더링 (closes #1200)#1203
Merged
Conversation
parse_shape_object 가 가변 꼭짓점을 <hc:pt> 에서만 수집해,
geometry 가 <hp:seg x1 y1 x2 y2> 로 인코딩된 curve 는 points 가 비어
외곽선이 그려지지 않았다 ("다른 풀이" 태그 박스 미표시).
<hp:seg> 분기 추가: 첫 seg 시작점 + 각 seg 끝점을 polygon_points 로
폴리라인 재구성 (seg 는 제어점이 아닌 sampled 꼭짓점 → segment_types 비움).
렌더 인프라(stroke→SVG/Skia)는 기존에 완비.
- 회귀 테스트 1건 추가 (curve seg → points chain)
- 검증: 한글 2022 PDF 9쪽 "다른 풀이" 태그 박스 시각 정합, 전체 테스트 통과
closes edwardkim#1200
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
머지했습니다(devel
참고: 이 PR 이 #1202(prefixChar) 머지 전에 분기되어 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제 (closes #1200)
samples/3-09월_교육_통합_2022.hwpx9쪽 우측 단 "다른 풀이"가 한글 2022 PDF에는 태그 박스(〉꺾쇠) 안에 표시되나, 우리 렌더는 텍스트만 있고 박스 외곽선이 없음.근본 원인
"다른 풀이"는
<hp:curve id="0">도형의drawText텍스트이고, 박스는 이 curve 도형의 외곽선이다.이 curve 의 geometry 가
<hp:seg type="..." x1 y1 x2 y2>417개로 인코딩됨 (<hc:pt>0개). 그러나 파서parse_shape_object()(src/parser/hwpx/section.rs)는 가변 꼭짓점을<hc:pt>(b"pt")에서만 수집 →CurveShape.points가 empty →curve_to_path_commands_scaled()가 빈 path 반환 → 외곽선 미렌더. drawText 텍스트는 별도 경로라 텍스트만 보였음.렌더 인프라(stroke → SVG/Skia,
drawing_to_shape_style)는 이미 완비.좌표/구조 확인
orgSz 3175×1090로컬 HWPUNIT (렌더러 기대 공간과 동일).수정
parse_shape_object()에b"seg"분기 추가 → 첫 seg(x1,y1)+ 각 seg(x2,y2)를polygon_points로 폴리라인 구성.segment_types는 비운 채 유지(LineTo). 모델/렌더러 무변경.검증
cargo build --release/cargo test --release전체 통과, 회귀 0.<path stroke="#000000">외곽선 신규 (d_len 105→15577).비고
<hp:seg>CURVE 타입의 진짜 베지어 정밀화는 범위 외(점-대-점 폴리라인으로 시각 정합 달성).