Commit 17aafc9
committed
feat(epub): inline images and floats (T-66)
Inline <img> is no longer dropped: an image with computed inline
display (the CSS default) flows on the line as a single unbreakable
token, sized from CSS width/height, the HTML attributes, or its
intrinsic pixel size at 0.75pt/px, capped to the content width. It
advances the pen, sits bottom-on-baseline, grows the line's ascent to
its height, rides PositionedLine.images as PlacedImage (draw width kept
separate from the justification-stretched advance), and paints next to
the run loop for both raster and SVG payloads. display:block or floated
images keep the block ImageBox path.
float:left/right leaves the flow, lays out against the content edge,
and registers an exclusion band; wrap gained an optional per-line width
callback (the no-float path is the exact old code) and placeLines
shortens and offsets overlapping lines; clear drops the flow cursor
below matching floats. Simplifications are commented at the source:
same-side floats stack downward, blocks grow to contain their floats
so pagination never splits across one, band widths use the authored
line-height estimate, and a widthless floated block takes half the
content width as shrink-to-fit.
Sweep moves 4148 -> 4149 pages (+1): a real book reflowing under
inline-image layout, recorded in the progress log. Existing tests that
relied on every img being a block now say display:block explicitly.1 parent 0a4cb33 commit 17aafc9
14 files changed
Lines changed: 483 additions & 21 deletions
File tree
- kitepdf-epub/src
- commonMain/kotlin/io/github/yuroyami/kitepdf/epub
- css
- commonTest/kotlin/io/github/yuroyami/kitepdf/epub
- kitepdf-native-renderer/src/jvmTest/kotlin/io/github/yuroyami/kitepdf/nativerenderer/difftest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
464 | 516 | | |
465 | 517 | | |
466 | 518 | | |
| |||
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
78 | 88 | | |
79 | 89 | | |
80 | 90 | | |
| |||
282 | 292 | | |
283 | 293 | | |
284 | 294 | | |
285 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
286 | 306 | | |
287 | 307 | | |
288 | 308 | | |
| |||
389 | 409 | | |
390 | 410 | | |
391 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
392 | 423 | | |
393 | 424 | | |
394 | 425 | | |
| |||
0 commit comments