Repository navigation
fix(writer): produce spec-compliant HWP 5.0 files that Hancom Office accepts - #10
Open
helenanova wants to merge 1 commit into
Open
helenanova wants to merge 1 commit into
helenanova wants to merge 1 commit into
Conversation
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.
Problem
Files generated by
HwpWriterwere rejected by Hancom Office with "파일이 손상되었습니다" (file is corrupted) even for a minimal document (#4).Root causes
The writer emitted structurally invalid HWP 5.0 output in several independent ways:
\005HwpSummaryInformationstreamFaceNamerecord didn't follow spec 4.1.4 (truncated panose, extra substitute byte, wrong flags)CharShapereferenced face name IDs in language categories with no registered face namesTabDefmissing its count field;ParaShape58 bytes instead of 54tbl,gso) missing thedescriptionBSTR (HWP 5.0.0.5+)BorderFilldropped the color-pattern fill block on serializeFaceName/TabDef/BorderFillparsing didn't match the spec either, so real files were misparsedFix
FaceNameLanguage) so ID_MAPPINGS counts and CharShape references are always valid; new fonts register in all 7 categories\005HwpSummaryInformationproperty-set stream is writtenHwpWriter::set_compressed()API; compressed output uses raw deflate (nowrap), matching hwplib and pyhwpTesting
tests/writer_hancom_compat_test.rsassert the structural invariants of valid HWP 5.0 filesNote: I don't have Hancom Office available in this environment, so compatibility is verified against pyhwp and a real Hancom-produced file rather than the application itself. A final smoke test of
examples/create_document.rsoutput in Hancom Office would be appreciated.