diff --git a/library/packet/packet-render.js b/library/packet/packet-render.js index 5515195bd..35b553f67 100644 --- a/library/packet/packet-render.js +++ b/library/packet/packet-render.js @@ -1440,6 +1440,11 @@ export function createPacketRenderer({ strings, lang = 'en', fontData = null, de for (const w of widths) { if (x > 0 && x + 20 + w > width) { rows++; x = 0; } x += (x > 0 ? 20 : 0) + w; } return rows; }; + // A point's text may carry two marks: **...** sets a run in bold, and a line break starts a new line inside the + // point (point 12: the reading, then its open-ended praise line under it). Measured the same way: each line on + // its own (an empty one still takes a line), the bold runs at PT_BOLD. + const ptTextLines = (str, fs, width) => String(str || '').split('\n').reduce((n, ln) => + n + Math.max(1, ptLines(ln.split('**').map((part, i) => [part, fs, i % 2 ? PT_BOLD : 1]).filter(([part]) => part.trim()), width)), 0); // A line's "normal" height, measured: 1.18-1.19 x its size in the serif faces, 1.31-1.32 where it is Chinese. const ptNormal = (str) => (CJK.test(String(str || '')) ? 1.33 : 1.19); function pointsHeight(sz) { @@ -1459,7 +1464,7 @@ export function createPacketRenderer({ strings, lang = 'en', fontData = null, de for (const p of POINTS) { const refs = (p.refs || []).map(refText).join(' · '); h += ptLines([[`${p.n}. ${tr(p.rhythm)}`, sz.head, PT_BOLD], ...(p.sub ? [[`— ${p.sub}`, sz.sub, 1]] : [])], BW) * sz.head * ptNormal(tr(p.rhythm)); - h += 2 + ptLines([[p.text, sz.text, 1]], BW) * sz.text * 1.3; + h += 2 + ptTextLines(p.text, sz.text, BW) * sz.text * 1.3; h += 2 + ptLines([[refs, sz.refs, PT_SEMI]], BW) * sz.refs * ptNormal(refs); if (p.print_passage) { const IW = BW - 15; // the passage and heart blocks' 12px inset and 3px rule @@ -1525,6 +1530,8 @@ export function createPacketRenderer({ strings, lang = 'en', fontData = null, de `${esc(x)} ${(sref[i] || []).map(refSpan).join(' · ')}`)).join('')} `; } + // A point's text on the page: escaped first, then **...** -> bold and a line break ->
(see ptTextLines). + const ptText = (str) => String(str || '').split('\n').map((ln) => esc(ln).replace(/\*\*(.+?)\*\*/g, '$1')).join('
'); // `tier` forces a size tier (0..PT_TIERS); probes and gates only. data-pt-tier states the tier chosen and // data-pt-est its estimated height, so check:packet-render can hold the estimate to the real page. function pointsPage(tier) { @@ -1536,7 +1543,7 @@ export function createPacketRenderer({ strings, lang = 'en', fontData = null, de return `
${p.n}. ${esc(tr(p.rhythm))}${sub}
-
${esc(p.text)}
+
${ptText(p.text)}
${refs}
${p.print_passage ? passageBlock(PT) + heartBlock(PT) : ''}
`; diff --git a/library/scripts/posters/packet-strings.json b/library/scripts/posters/packet-strings.json index 7d3eb631b..353417ad5 100644 --- a/library/scripts/posters/packet-strings.json +++ b/library/scripts/posters/packet-strings.json @@ -163,7 +163,7 @@ "n": 12, "rhythm": "praise_end", "sub": "blessing · great · greater · greatest", - "text": "Short reading: It is a blessing from God for people in these people groups to be saved through Jesus and have eternal life (John 17:3). It is a great blessing from God for indigenous disciples to lead their friends, family, coworkers, classmates, neighbors, and people they don't know, to Jesus through their witness (John 17:20). It is a greater blessing from God when indigenous leaders in these people groups start new churches that are unified in Jesus (John 17:21). It is one of the greatest blessings from God, when indigenous leaders train other indigenous leaders to start more churches unified in Christ. They begin to worship Jesus and spread throughout neighboring unreached people groups bringing the life of Jesus to the ends of the earth. Spend time singing praise to God. He is worthy of worshippers in all these people groups!", + "text": "**Short reading:** It is a blessing from God for people in these people groups to be saved through Jesus and have eternal life (John 17:3). It is a great blessing from God for indigenous disciples to lead their friends, family, coworkers, classmates, neighbors, and people they don't know, to Jesus through their witness (John 17:20). It is a greater blessing from God when indigenous leaders in these people groups start new churches that are unified in Jesus (John 17:21). It is one of the greatest blessings from God, when indigenous leaders train other indigenous leaders to start more churches unified in Christ. They begin to worship Jesus and spread throughout neighboring unreached people groups bringing the life of Jesus to the ends of the earth.\nSpend time in praise to God.", "refs": [ "John 17:3,11–23", "Ephesians 3:20–21"