Wrap column text around a floated image - #511
Open
jakejackson1 wants to merge 1 commit into
Open
jakejackson1 wants to merge 1 commit into
jakejackson1 wants to merge 1 commit into
Conversation
A floated image inside <columns> was always set inline. It now floats as it does in normal flow, wrapping the lines of its own column only: - Pending floats are drawn when their column is left (AcceptPageBreak, NewColumn, SetColumns), which also clears the float margins so they do not narrow lines in the next column. - Each float is filed in the column buffer ahead of the lines beside it and under the column it was placed in, so balancing moves it with them. - Balancing ignores break points inside a float's vertical extent, and a column's bottom reaches down to the float's. - An image too tall or too wide for an empty column is still set inline. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
A floated
<img>inside<columns>used to be set inline, becauseImgnever setfloatwhile columns were active. It now floats as it does in normal flow, and the text of its own column wraps around it. This lets a template run a photo inside a column of an article, which a magazine layout needs.How
AcceptPageBreak(),NewColumn()orSetColumns(). Drawing a float there also clearsfloatmargins, so it never narrows lines in the next column.printColumnFloats()draws it into the column buffer ahead of the first line level with or below its top. Balancing assigns columns in buffer order, so the float then moves with the lines beside it.$columnFloats,besideColumnFloat()), and a column's bottom reaches down to the float's margin.Limits
<div>s in columns are still laid out as blocks.vAlign="J", stretching a column also stretches the image vertically, up tomax_colH_correction, as it already did for inline images.PaintImgBorder()returns early), so a floated image's border doesn't show there either.Tests
FloatImageInColumnsTestreads the balanced page stream. It checks that lines level with the image in its column are clear of it, and that every other line, including lines level with it in the other column, starts at its column's edge. It covers:vAlign="J",keepColumnsand<columnbreak>float-images-in-columns, shows a two-column article with a right float in mid-paragraph and a left float. The existingcolumnssnapshot is unchanged.composer testpasses (4107 tests; 5 skipped for missing ICU data). phpcs and PHPStan are clean.🤖 Generated with Claude Code