Fix portrait image flow and drop-cap spacing
This commit is contained in:
@@ -873,23 +873,21 @@ class SentenceQueueModule extends BaseModule {
|
||||
computed.fontFamily
|
||||
].filter(Boolean).join(' ');
|
||||
const metrics = context.measureText(dropCapText);
|
||||
inkRight = Math.max(
|
||||
metrics.width || 0,
|
||||
metrics.actualBoundingBoxRight || 0
|
||||
);
|
||||
inkRight = Number.isFinite(metrics.actualBoundingBoxRight) && metrics.actualBoundingBoxRight > 0
|
||||
? metrics.actualBoundingBoxRight
|
||||
: (metrics.width || 0);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('SentenceQueue: Could not measure drop-cap canvas ink bounds', error);
|
||||
}
|
||||
probeParagraph.remove();
|
||||
|
||||
const measuredAdvance = Math.max(
|
||||
const fallbackAdvance = Math.max(
|
||||
Number.isFinite(rect.width) && rect.width > 0 ? rect.width : 0,
|
||||
Number.isFinite(probe.offsetWidth) && probe.offsetWidth > 0 ? probe.offsetWidth : 0,
|
||||
Number.isFinite(probe.scrollWidth) && probe.scrollWidth > 0 ? probe.scrollWidth : 0,
|
||||
inkRight
|
||||
Number.isFinite(probe.scrollWidth) && probe.scrollWidth > 0 ? probe.scrollWidth : 0
|
||||
);
|
||||
const glyphAdvance = measuredAdvance > 0 ? measuredAdvance : lineHeight * 1.34;
|
||||
const glyphAdvance = inkRight > 0 ? inkRight : (fallbackAdvance > 0 ? fallbackAdvance : lineHeight * 1.34);
|
||||
return glyphAdvance + this.measureNormalTextGap(container, lineHeight);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user