Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bffb7a1085 | ||
|
|
13f8394512 |
@@ -297,7 +297,7 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
|
||||
// type === 'recipient' / 'free'. Ist ein Absender gesetzt, sitzt der
|
||||
// Empfänger UNTEN RECHTS (klassisches Kuvert), sonst wie bisher oben links.
|
||||
const hatAbsender = !!String(options.sender || '').trim();
|
||||
const maxWidthPx = Math.min(widthPx - marginLeftPx - 20, widthPx * (hatAbsender ? 0.48 : 0.6));
|
||||
const maxWidthPx = Math.min(widthPx - marginLeftPx - 20, widthPx * (hatAbsender ? 0.36 : 0.6));
|
||||
|
||||
lines = wrapTextToLinesByWidth({
|
||||
text: String(text || ''),
|
||||
@@ -307,8 +307,11 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
|
||||
});
|
||||
|
||||
if (hatAbsender) {
|
||||
startX = Math.max(marginLeftPx, Math.round(widthPx * 0.48));
|
||||
startY = Math.max(marginTopPx + fontSizePx, heightPx - marginTopPx - lines.length * lineHeightPx + fontSizePx);
|
||||
// Empfänger unten rechts – bewusst über Höhen-/Breiten-Anteile, damit der
|
||||
// große Kuvert-Rand (marginTop bis ~50 % der Höhe) nicht alles nach oben zieht.
|
||||
startX = Math.round(widthPx * 0.60);
|
||||
const untenBaseline = heightPx * 0.80; // unterste Zeile ~20 % über der Unterkante
|
||||
startY = Math.round(untenBaseline - Math.max(0, lines.length - 1) * lineHeightPx);
|
||||
} else {
|
||||
startX = marginLeftPx;
|
||||
startY = marginTopPx + fontSizePx;
|
||||
@@ -364,8 +367,9 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
|
||||
lines: absLines,
|
||||
fontFileName: fontConfig.file,
|
||||
fontSizePx: absSize,
|
||||
startX: marginLeftPx,
|
||||
startY: marginTopPx + absSize,
|
||||
// Echt oben links – unabhängig vom großen Kuvert-Rand.
|
||||
startX: Math.round(widthPx * 0.06),
|
||||
startY: Math.round(heightPx * 0.14),
|
||||
lineHeightPx: absLH,
|
||||
realisticHandwriting: options.realisticHandwriting ?? false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user