Repository navigation
feat(layout): write line caches for more picture paragraphs, columns and pages clear of wrapped objects - #554
Merged
Merged
Conversation
…and pages clear of wrapped objects write_line_caches now also gives these paragraphs the lines Hancom writes: - a paragraph holding nothing but a picture set as a character with a caption (above or below it the caption's lines and its gap join the line, beside it the line stays as tall as the picture), with a soft edge or an inner shadow, in a paragraph spaced fixed, at least or between lines (spaced from the line's height), or setting its characters at the top, centre or bottom; - a paragraph holding several such pictures and nothing else, none of them affecting the line spacing, in a paragraph spaced by a percentage: as many pictures on a line as fit the column, each line as tall as its tallest; - the text and picture paragraphs of newspaper columns of equal width, laid out as wide as their column, where the columns change inside a section as wide as those they are in (they were measured at the section's first columns' width); - the paragraphs of a section with an object text runs beside, on the pages other than the one holding that object's paragraph and the next (the whole section was skipped). A picture whose glow, outer shadow or reflection takes room around it, one with a shadow written as a drawing's, a caption whose lines are less sure, and balanced or parallel columns are left for Hancom, as is a picture paragraph holding spaces. Saved as .hwp, the caches become the paragraphs' PARA_LINE_SEG records, which viewers other than Hancom Office use to place the pictures. Saving without calling write_line_caches is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
airmang
added a commit
that referenced
this pull request
Oct 24, 2026
… default stops (#559) A paragraph under a picture bullet (hh:bullet@useImage) loses the room Hancom gives the picture: an em whatever the picture's shape, then the gap (textOffset) and the width adjustment, off the first line and, with 자동 내어 쓰기, off every line. FormFit took it as no label at all, so such paragraphs broke later than in Hancom, and write_line_caches gave them lines Hancom does not lay out. A picture bullet sized by its picture (useInstWidth) still takes no room in FormFit; write_line_caches leaves its paragraphs to Hancom. A tab reaches the default stops of the section it is in, as far apart as hp:secPr@tabStopVal says; the page estimate and write_line_caches counted 4,000 in every section. A section giving its stops in another unit than HWPUNIT gets no caches. Both came up once write_line_caches wrote the sections around objects text runs beside (#554). Two Hancom-saved fixtures show the layouts. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #552 (#550).
Background
write_line_caches(doc)(experimental, opt-in) writes a paragraph's line layout cache only where it is exactly the one Hancom Office writes: Hancom takes a cache that is present as written, so a wrong one moves or squeezes text. Saved as.hwp, the cache is the paragraph'sPARA_LINE_SEG, which some other HWP viewers need to place a picture on a paragraph of its own. #552 covered a plain picture alone in a paragraph spaced by a percentage, in a one-column section with no object text runs beside.Change
write_line_cachesnow also writes the lines Hancom writes for:Left for Hancom: a picture whose glow, outer shadow or reflection takes room around it, a picture with a shadow written as a drawing's (
hp:shadow), a caption whose lines are less sure, several pictures affecting the line spacing, balanced or parallel columns, and a picture paragraph holding spaces (viewers draw those without a cache). Tables set as a character and table cells keep getting caches in one column only.Saving without calling
write_line_cachesis unchanged.Tests
line_cache_pictures_kinds.hwpx: captions on four sides, fixed / at least / between-lines spacing, top / centre / bottom alignment, a soft edge, an inner shadow, two rows of pictures; it ends with four pictures left for Hancom (long caption, glow, outer shadow, pictures affecting the spacing), which get no cacheline_cache_pictures_columns.hwpx: one column, then two columns from a paragraph inside the sectionline_cache_pictures_beside.hwpx: a square-wrapped picture, picture and text paragraphs on its page and on later pages🤖 Generated with Claude Code