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
|
// type === 'recipient' / 'free'. Ist ein Absender gesetzt, sitzt der
|
||||||
// Empfänger UNTEN RECHTS (klassisches Kuvert), sonst wie bisher oben links.
|
// Empfänger UNTEN RECHTS (klassisches Kuvert), sonst wie bisher oben links.
|
||||||
const hatAbsender = !!String(options.sender || '').trim();
|
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({
|
lines = wrapTextToLinesByWidth({
|
||||||
text: String(text || ''),
|
text: String(text || ''),
|
||||||
@@ -307,8 +307,11 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (hatAbsender) {
|
if (hatAbsender) {
|
||||||
startX = Math.max(marginLeftPx, Math.round(widthPx * 0.48));
|
// Empfänger unten rechts – bewusst über Höhen-/Breiten-Anteile, damit der
|
||||||
startY = Math.max(marginTopPx + fontSizePx, heightPx - marginTopPx - lines.length * lineHeightPx + fontSizePx);
|
// 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 {
|
} else {
|
||||||
startX = marginLeftPx;
|
startX = marginLeftPx;
|
||||||
startY = marginTopPx + fontSizePx;
|
startY = marginTopPx + fontSizePx;
|
||||||
@@ -364,8 +367,9 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
|
|||||||
lines: absLines,
|
lines: absLines,
|
||||||
fontFileName: fontConfig.file,
|
fontFileName: fontConfig.file,
|
||||||
fontSizePx: absSize,
|
fontSizePx: absSize,
|
||||||
startX: marginLeftPx,
|
// Echt oben links – unabhängig vom großen Kuvert-Rand.
|
||||||
startY: marginTopPx + absSize,
|
startX: Math.round(widthPx * 0.06),
|
||||||
|
startY: Math.round(heightPx * 0.14),
|
||||||
lineHeightPx: absLH,
|
lineHeightPx: absLH,
|
||||||
realisticHandwriting: options.realisticHandwriting ?? false,
|
realisticHandwriting: options.realisticHandwriting ?? false,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user