diff --git a/scripts/badges/convert-illustrator-svg.py b/scripts/badges/convert-illustrator-svg.py index f71b6ba..fe3bd4c 100644 --- a/scripts/badges/convert-illustrator-svg.py +++ b/scripts/badges/convert-illustrator-svg.py @@ -36,6 +36,8 @@ ASSETS = { 'Asset 7.svg': ('SUPER VÝHODNÉ', 'cervena', ''), 'Asset 8.svg': ('SUPER CENA', 'oranzova', ''), 'Asset 9.svg': ('SUPER VÝHODNÉ', 'zelena', ''), + 'Asset 10.svg': ('SUPER VÝHODNÉ', 'oranzova', 'SK'), + 'Asset 11.svg': ('SUPER VÝHODNÉ', 'oranzova', ''), } diff --git a/src/components/editor/BadgeEditorModal.tsx b/src/components/editor/BadgeEditorModal.tsx index d8b74e8..79631e1 100644 --- a/src/components/editor/BadgeEditorModal.tsx +++ b/src/components/editor/BadgeEditorModal.tsx @@ -942,6 +942,14 @@ export const BadgeEditorModal: React.FC = ({ )} updateLayer(layer.id, { fontSize: v })} /> + updateLayer(layer.id, { letterSpacing: v ? v / 100 : undefined })} + />
Farba textu diff --git a/src/lib/badgeUtils.ts b/src/lib/badgeUtils.ts index ab81d67..4b003a1 100644 --- a/src/lib/badgeUtils.ts +++ b/src/lib/badgeUtils.ts @@ -187,20 +187,20 @@ export function renderCleanBadgeSvg( if (priceMatch) { const [tokMain, tokSub] = badgePriceParts(priceMatch[1], product); const idx = priceMatch.index || 0; - const before = escapeXml(replaceBadgeTextVars(rawText.slice(0, idx), product)); - const after = escapeXml(replaceBadgeTextVars(rawText.slice(idx + priceMatch[0].length), product)); + const before = tightenCarons(escapeXml(replaceBadgeTextVars(rawText.slice(0, idx), product))); + const after = tightenCarons(escapeXml(replaceBadgeTextVars(rawText.slice(idx + priceMatch[0].length), product))); contentSvg = `${before}${escapeXml(tokMain)}${escapeXml(tokSub)}${after ? `${after}` : ''}`; } else if (rawText.includes('{centy}')) { const parts = rawText.split('{centy}'); - const before = escapeXml(parts[0] || ''); - const after = escapeXml(parts[1] || ''); + const before = tightenCarons(escapeXml(parts[0] || '')); + const after = tightenCarons(escapeXml(parts[1] || '')); contentSvg = `${before}${escapeXml(pSub)}${after ? `${after}` : ''}`; } else { - contentSvg = escapeXml(replaceBadgeTextVars(rawText, product)); + contentSvg = tightenCarons(escapeXml(replaceBadgeTextVars(rawText, product))); } // data-layer-index: editor cenoviek podľa neho nájde a odmeria vrstvu na plátne - return `${contentSvg}`; + return `${contentSvg}`; }).join('\n '); return ` @@ -261,6 +261,11 @@ export async function svgToCleanPng( }); } +// Mäkčeň pri ľ, ť, ď je v písme široký – písmeno za ním trochu pritiahneme (ako v návrhoch z Illustratora) +function tightenCarons(text: string): string { + return text.replace(/([ľťď])([^\s<&])/g, '$1$2'); +} + function escapeXml(unsafe: string): string { if (!unsafe) return ''; return unsafe diff --git a/src/types/newsletter.ts b/src/types/newsletter.ts index 3980a93..c1b33a6 100644 --- a/src/types/newsletter.ts +++ b/src/types/newsletter.ts @@ -230,6 +230,7 @@ export interface BadgeLayer { indexOffsetY?: number; // Vertikálny posun horného indexu v px (posun hore / dole) indexOffsetX?: number; // Horizontálny posun horného indexu v px (medzera) longPriceScale?: number; // zmenšenie ceny od 10 € (dvojciferné eurá), napr. 0.8; účiaria ostáva + letterSpacing?: number; // rozostup písmen v em (napr. -0.03 = tesnejšie) } export interface BadgeTemplate {