UPG100 packet, 12 Prayer Points: point 12's "Short reading:" in bold, and its open-ended praise line on its own line under the reading (bold runs and line breaks in point text)

This commit is contained in:
Doxa Maps 2026-10-03 11:32:13 +00:00
parent 96a0cd6ca8
commit ae0343af98
2 changed files with 10 additions and 3 deletions

View file

@ -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; } for (const w of widths) { if (x > 0 && x + 20 + w > width) { rows++; x = 0; } x += (x > 0 ? 20 : 0) + w; }
return rows; 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. // 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); const ptNormal = (str) => (CJK.test(String(str || '')) ? 1.33 : 1.19);
function pointsHeight(sz) { function pointsHeight(sz) {
@ -1459,7 +1464,7 @@ export function createPacketRenderer({ strings, lang = 'en', fontData = null, de
for (const p of POINTS) { for (const p of POINTS) {
const refs = (p.refs || []).map(refText).join(' · '); 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 += 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); h += 2 + ptLines([[refs, sz.refs, PT_SEMI]], BW) * sz.refs * ptNormal(refs);
if (p.print_passage) { if (p.print_passage) {
const IW = BW - 15; // the passage and heart blocks' 12px inset and 3px rule 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)} <span class="pt-sc-r">${(sref[i] || []).map(refSpan).join(' · ')}</span>`)).join('')}</ol> `${esc(x)} <span class="pt-sc-r">${(sref[i] || []).map(refSpan).join(' · ')}</span>`)).join('')}</ol>
</div>`; </div>`;
} }
// A point's text on the page: escaped first, then **...** -> bold and a line break -> <br> (see ptTextLines).
const ptText = (str) => String(str || '').split('\n').map((ln) => esc(ln).replace(/\*\*(.+?)\*\*/g, '<b>$1</b>')).join('<br>');
// `tier` forces a size tier (0..PT_TIERS); probes and gates only. data-pt-tier states the tier chosen and // `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. // data-pt-est its estimated height, so check:packet-render can hold the estimate to the real page.
function pointsPage(tier) { function pointsPage(tier) {
@ -1536,7 +1543,7 @@ export function createPacketRenderer({ strings, lang = 'en', fontData = null, de
return `<div style="margin-bottom:${PT.gap}px"> return `<div style="margin-bottom:${PT.gap}px">
<div class="pt-h" style="font:700 ${PT.head}px Georgia,serif;color:#1b1a17"> <div class="pt-h" style="font:700 ${PT.head}px Georgia,serif;color:#1b1a17">
${p.n}. ${esc(tr(p.rhythm))}${sub}</div> ${p.n}. ${esc(tr(p.rhythm))}${sub}</div>
<div style="font:400 ${PT.text}px Georgia,serif;color:#3b3226;line-height:1.3;margin-top:2px">${esc(p.text)}</div> <div style="font:400 ${PT.text}px Georgia,serif;color:#3b3226;line-height:1.3;margin-top:2px">${ptText(p.text)}</div>
<div style="font:600 ${PT.refs}px Georgia,serif;color:#7a3b2e;margin-top:2px">${refs}</div> <div style="font:600 ${PT.refs}px Georgia,serif;color:#7a3b2e;margin-top:2px">${refs}</div>
${p.print_passage ? passageBlock(PT) + heartBlock(PT) : ''} ${p.print_passage ? passageBlock(PT) + heartBlock(PT) : ''}
</div>`; </div>`;

View file

@ -163,7 +163,7 @@
"n": 12, "n": 12,
"rhythm": "praise_end", "rhythm": "praise_end",
"sub": "blessing · great · greater · greatest", "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": [ "refs": [
"John 17:3,11–23", "John 17:3,11–23",
"Ephesians 3:20–21" "Ephesians 3:20–21"