Skip to content

Task #1350 useFontSpace 직렬화 시 항상 false 고정 (IR 값 무시)#1351

Closed
Martinel2 wants to merge 20 commits into
edwardkim:develfrom
Martinel2:devel
Closed

Task #1350 useFontSpace 직렬화 시 항상 false 고정 (IR 값 무시)#1351
Martinel2 wants to merge 20 commits into
edwardkim:develfrom
Martinel2:devel

Conversation

@Martinel2

Copy link
Copy Markdown
Contributor

변경 요약

요약

  • CharShape 구조체에 use_font_space 필드가 없어 HWP5/HWPX 파싱 시 항상 false로 취급되던 결함 수정
  • HWP5 attr 비트필드 bit 25, HWPX useFontSpace 속성을 실제로 읽어 IR에 보존
  • HWPX 직렬화 시 하드코딩 bool01(false) → IR 값 bool01(cs.use_font_space) 로 교체

원인

CharShape 구조체에 use_font_space: bool 필드 자체가 존재하지 않았음.
HWP5 파서(parse_char_shape)는 attr에서 bit 25를 추출하지 않았고,
HWPX 파서(header.rs)는 useFontSpace 속성을 무시했으며,
HWPX 직렬화기는 항상 useFontSpace="0"을 출력했음.

변경사항

src/model/style.rs : CharShape에 use_font_space: bool 필드 추가, PartialEq impl 반영
src/parser/doc_info.rs : attr & (1 << 25) 추출 → use_font_space 초기화
src/parser/hwpx/header.rs : useFontSpace 속성 실제 파싱 (parse_bool 적용)
src/serializer/hwpx/header.rs : 하드코딩 제거, bool01(cs.use_font_space) 사용
src/serializer/doc_info/tests.rs : 명시적 CharShape 리터럴에 use_font_space: false 보완

Tests

test parser::doc_info::tests::test_parse_char_shape_use_font_space ... ok
test serializer::hwpx::header::tests::write_char_pr_use_font_space_roundtrip ... ok

  • HWP5: bit 25 미설정 → false, 설정 → true, bit 30(kerning)과 동시 설정도 정상
  • HWPX roundtrip: use_font_space=true/false 각각 "1"/"0" 직렬화 확인

관련 이슈

closes #1350

테스트

  • cargo test 통과
  • cargo clippy -- -D warnings 통과
  • 관련 샘플 파일로 SVG 내보내기 확인
  • 웹(WASM) 렌더링 확인 (해당하는 경우)

스크린샷

변경 전후 비교가 필요한 경우 첨부해주세요.

Martinel2 and others added 20 commits June 7, 2026 16:49
)

- render_run_content: text_buf.push(c) 직전에 0-length 필드
  (start == end == idx) fieldEnd 방출 추가 — fieldBegin 슬롯 방출
  직후에 인접 방출되어 올바른 순서 보장
- 기존 post-char fieldEnd 검사에 start < end guard 추가 —
  0-length 필드가 idx-1 시점에 역순 방출되는 것 차단
- 신규 테스트: task1298_zero_length_field_at_para_start,
  task1298_zero_length_field_mid_text (14 passed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- render_run_content: para.text == "" 일 때 메인 루프가 0회 실행되어
  pre-char 0-length 검사가 건너뛰어지는 문제 해결
- 루프 진입 전 빈 문단 전용 블록 추가: slots(fieldBegin)를 먼저 방출한
  뒤 0-length fieldEnd를 방출하여 올바른 순서 보장
- 신규 테스트: task1321_zero_length_field_in_empty_paragraph (51 passed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
)

- render_run_content: text_buf.push(c) 직전에 0-length 필드
  (start == end == idx) fieldEnd 방출 추가 — fieldBegin 슬롯 방출
  직후에 인접 방출되어 올바른 순서 보장
- 기존 post-char fieldEnd 검사에 start < end guard 추가 —
  0-length 필드가 idx-1 시점에 역순 방출되는 것 차단
- 신규 테스트: task1298_zero_length_field_at_para_start,
  task1298_zero_length_field_mid_text (14 passed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- render_run_content: para.text == "" 일 때 메인 루프가 0회 실행되어
  pre-char 0-length 검사가 건너뛰어지는 문제 해결
- 루프 진입 전 빈 문단 전용 블록 추가: slots(fieldBegin)를 먼저 방출한
  뒤 0-length fieldEnd를 방출하여 올바른 순서 보장
- 신규 테스트: task1321_zero_length_field_in_empty_paragraph (51 passed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CharShape 구조체에 use_font_space 필드가 없어 항상 false로 직렬화되던
결함을 수정한다. HWP5 attr bit 25, HWPX useFontSpace 속성을 모두 읽어
IR에 보존하고, HWPX 직렬화 시 IR 값을 그대로 출력한다.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Martinel2 Martinel2 changed the title Devel Task #1350 useFontSpace 직렬화 시 항상 false 고정 (IR 값 무시) Jun 9, 2026
@edwardkim edwardkim self-requested a review June 10, 2026 01:25
@edwardkim edwardkim added the enhancement New feature or request label Jun 10, 2026
@edwardkim edwardkim added this to the v1.0.0 milestone Jun 10, 2026
edwardkim pushed a commit that referenced this pull request Jun 10, 2026
@edwardkim

Copy link
Copy Markdown
Owner

PR #1351 수용 처리 완료했습니다.

반영 방식:

반영 커밋:

  • 26802b18fix: useFontSpace IR 필드 추가 및 HWP5/HWPX 파서·직렬화기 반영 (#1350)
  • 57b0c725fix: preserve useFontSpace in HWP5 serializer

검증:

  • cargo fmt --check
  • git diff --check HEAD~2..HEAD
  • CARGO_INCREMENTAL=0 cargo test --lib test_parse_char_shape_use_font_space -- --nocapture
  • CARGO_INCREMENTAL=0 cargo test --lib write_char_pr_use_font_space_roundtrip -- --nocapture
  • CARGO_INCREMENTAL=0 cargo test --lib test_serialize_char_shape_use_font_space_bit -- --nocapture
  • CARGO_INCREMENTAL=0 cargo test --lib test_serialize_char_shape_roundtrip -- --nocapture
  • CARGO_INCREMENTAL=0 cargo test --lib serializer::hwpx::header -- --nocapture
  • CARGO_INCREMENTAL=0 cargo clippy --lib -- -D warnings

HWPX header.xml<hh:charPr useFontSpace="..."> 속성 보존과 HWP5 CharShape attr bit 25 보존을 함께 맞췄습니다.

기여 감사합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants