BloomBerry's picture
Add files using upload-large-folder tool
723f01e verified
Raw
History Blame Contribute Delete
24 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AddSlideBorderGroundTruthB</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro:wght@400&display=swap">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #1a1a2e;
color: #e0e0e0;
padding: 40px 20px;
}
h1 {
text-align: center;
margin-bottom: 8px;
font-size: 28px;
color: #fff;
}
.meta {
text-align: center;
margin-bottom: 40px;
color: #888;
font-size: 14px;
}
.slide-container {
margin: 0 auto 60px auto;
max-width: 100%;
}
.slide-label {
text-align: center;
margin-bottom: 12px;
font-size: 16px;
font-weight: 600;
color: #aaa;
}
.slide-wrapper {
display: flex;
justify-content: center;
overflow-x: auto;
}
.slide {
flex-shrink: 0;
transform-origin: top left;
box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.images-section {
max-width: 1400px;
margin: 60px auto;
}
.images-section h2 {
text-align: center;
margin-bottom: 24px;
color: #fff;
}
.images-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}
.image-card {
background: #16213e;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.image-card img {
width: 100%;
height: 200px;
object-fit: contain;
background: #0f0f23;
padding: 8px;
}
.image-label {
padding: 8px 12px;
font-size: 11px;
color: #888;
word-break: break-all;
}
@media (max-width: 1920px) {
.slide {
transform: scale(0.5);
margin-bottom: -25%;
}
.slide-wrapper {
max-height: 600px;
}
}
@media (min-width: 1921px) {
.slide {
transform: scale(0.75);
margin-bottom: -12%;
}
}
</style>
</head>
<body>
<h1>AddSlideBorderGroundTruthB</h1>
<div class="meta">5 slide(s)</div>
<div class="slide-container">
<div class="slide-label">Slide 0 &mdash; Frame</div>
<div class="slide-wrapper">
<div class="slide" data-slide-id="1:21" style="width: 1920.0px; height: 1080.0px; background-color: rgba(252,247,232,1.0); background-image: linear-gradient(rgba(252,247,232,1.0), rgba(252,247,232,1.0)); background-size: auto; background-position: 0 0; background-repeat: repeat; position: relative; overflow: hidden;">
<div class="ft" data-id="1:22" style="position: absolute; left: 100.0px; top: 80.0px; width: 163.0px; height: 35.0px; opacity: 0.5; overflow: visible; box-sizing: border-box; mix-blend-mode: multiply; display: flex; flex-direction: column; justify-content: flex-start"><div style="font-size: 28.0px; font-family: 'Source Sans Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 600; letter-spacing: 0.0px; line-height: 35.19599914550781px; text-align: left; white-space: nowrap; text-transform: uppercase; color: rgba(22,22,29,1.0)">26 june 2024</div></div>
<div class="ft" data-id="1:23" style="position: absolute; left: 100.0px; top: 372.0px; width: 1576.0px; height: 336.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center"><div style="font-size: 140.0px; font-family: 'Source Serif Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 400; letter-spacing: 0.0px; line-height: 168.0px; text-align: left; color: rgba(22,22,29,1.0)">A line is length without breadth.</div></div>
<svg data-id="1:24" style="position: absolute; left: 100.0px; top: 776.0px; width: 268.0px; height: 1px; opacity: 1.0; overflow: visible" viewBox="0 0 268.0 1" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><path d="M0 -1.5L0 0L268 0L268 -1.5L268 -3L0 -3L0 -1.5Z" fill="rgba(212,42,32,1.0)" fill-rule="nonzero"/></svg>
<div data-id="1:25" style="position: absolute; left: 80.0px; top: 40.0px; width: 1760.0px; height: 1000.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; background-image: linear-gradient(rgba(0,0,0,0.0), rgba(0,0,0,0.0)); background-size: auto; background-position: 0 0; background-repeat: repeat;; border: 2.0px solid rgba(76,76,76,1.0);"></div>
</div>
</div>
</div>
<div class="slide-container">
<div class="slide-label">Slide 1 &mdash; Frame</div>
<div class="slide-wrapper">
<div class="slide" data-slide-id="1:26" style="width: 1920.0px; height: 1080.0px; background-color: rgba(252,247,232,1.0); background-image: linear-gradient(rgba(252,247,232,1.0), rgba(252,247,232,1.0)); background-size: auto; background-position: 0 0; background-repeat: repeat; position: relative; overflow: hidden;">
<div data-id="1:27" style="position: absolute; left: 960.0px; top: -1.5px; width: 1080.0px; height: 3.0px; background-color: rgba(252,247,232,1.0); opacity: 1.0; transform: matrix(4.371138828673793e-08, 1.0, -1.0, 4.371138828673793e-08, 0, 0); transform-origin: 0 0"></div>
<div class="ft" data-id="1:28" style="position: absolute; left: 100.0px; top: 80.0px; width: 720.0px; height: 35.0px; opacity: 0.5; overflow: visible; box-sizing: border-box; mix-blend-mode: multiply; display: flex; flex-direction: column; justify-content: flex-start"><div style="font-size: 28.0px; font-family: 'Source Sans Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 600; letter-spacing: 0.0px; line-height: 35.19599914550781px; text-align: left; white-space: nowrap; text-transform: uppercase; color: rgba(22,22,29,1.0)">Agenda</div></div>
<div class="ft" data-id="1:29" style="position: absolute; left: 100.0px; top: 457.0px; width: 760.0px; height: 166.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center"><div style="font-size: 64.0px; font-family: 'Source Serif Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 400; letter-spacing: -1.4080000305175782px; line-height: 83.19999694824219px; text-align: left; color: rgba(22,22,29,1.0)">Equal circles are those whose diameters are equal.</div></div>
<div class="ft" data-id="1:30" style="position: absolute; left: 1060.0px; top: 374.0px; width: 750.0px; height: 332.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center"><div style="font-size: 42.0px; font-family: 'Source Sans Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 400; letter-spacing: 0.0px; line-height: 52.5px; text-align: left; color: rgba(22,22,29,1.0)"><ol style="margin: 0; padding-left: 2em"><li>Refresher on problem statement</li><li>Update on metrics</li><li>Review design proposal</li><li>Align on GTM</li></ol></div></div>
<div data-id="1:31" style="position: absolute; left: 960.0px; top: -1.5px; width: 1080.0px; height: 3.0px; background-color: rgba(136,136,140,1.0); opacity: 0.30000001192092896; transform: matrix(4.371138828673793e-08, 1.0, -1.0, 4.371138828673793e-08, 0, 0); transform-origin: 0 0"></div>
<div data-id="1:32" style="position: absolute; left: 80.0px; top: 40.0px; width: 1760.0px; height: 1000.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; background-image: linear-gradient(rgba(0,0,0,0.0), rgba(0,0,0,0.0)); background-size: auto; background-position: 0 0; background-repeat: repeat;; border: 2.0px solid rgba(76,76,76,1.0);"></div>
</div>
</div>
</div>
<div class="slide-container">
<div class="slide-label">Slide 2 &mdash; Frame</div>
<div class="slide-wrapper">
<div class="slide" data-slide-id="1:33" style="width: 1920.0px; height: 1080.0px; background-color: rgba(252,247,232,1.0); background-image: linear-gradient(rgba(252,247,232,1.0), rgba(252,247,232,1.0)); background-size: auto; background-position: 0 0; background-repeat: repeat; position: relative; overflow: hidden;">
<div class="ft" data-id="1:34" style="position: absolute; left: 100.0px; top: 80.0px; width: 163.0px; height: 35.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-start"><div style="font-size: 28.0px; font-family: 'Source Sans Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 600; letter-spacing: 0.0px; line-height: 35.19599914550781px; text-align: left; white-space: nowrap; text-transform: uppercase">26 june 2024</div></div>
<div class="ft" data-id="1:35" style="position: absolute; left: 100.0px; top: 456.0px; width: 1720.0px; height: 168.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center"><div style="font-size: 140.0px; font-family: 'Source Serif Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 400; letter-spacing: 0.0px; line-height: 168.0px; text-align: center; white-space: nowrap; color: rgba(212,42,32,1.0)">Section headline</div></div>
<div data-id="1:36" style="position: absolute; left: 80.0px; top: 40.0px; width: 1760.0px; height: 1000.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; background-image: linear-gradient(rgba(0,0,0,0.0), rgba(0,0,0,0.0)); background-size: auto; background-position: 0 0; background-repeat: repeat;; border: 2.0px solid rgba(76,76,76,1.0);"></div>
</div>
</div>
</div>
<div class="slide-container">
<div class="slide-label">Slide 3 &mdash; Frame</div>
<div class="slide-wrapper">
<div class="slide" data-slide-id="1:37" style="width: 1920.0px; height: 1080.0px; background-color: rgba(252,247,232,1.0); background-image: linear-gradient(rgba(252,247,232,1.0), rgba(252,247,232,1.0)); background-size: auto; background-position: 0 0; background-repeat: repeat; position: relative; overflow: hidden;">
<div class="ft" data-id="1:38" style="position: absolute; left: 100.0px; top: 80.0px; width: 720.0px; height: 35.0px; opacity: 0.5; overflow: visible; box-sizing: border-box; mix-blend-mode: multiply; display: flex; flex-direction: column; justify-content: flex-start"><div style="font-size: 28.0px; font-family: 'Source Sans Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 600; letter-spacing: 0.0px; line-height: 35.19599914550781px; text-align: left; white-space: nowrap; text-transform: uppercase; color: rgba(22,22,29,1.0)">section name</div></div>
<div data-id="1:39" style="position: absolute; left: 100.0px; top: 346.0px; width: 760.0px; height: 388.0px; opacity: 1.0; overflow: visible; box-sizing: border-box">
<div class="ft" data-id="1:40" style="position: absolute; left: 0.0px; top: 0.0px; width: 760.0px; height: 166.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-start"><div style="font-size: 64.0px; font-family: 'Source Serif Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 400; letter-spacing: -1.4080000305175782px; line-height: 83.19999694824219px; text-align: left; color: rgba(22,22,29,1.0)">A surface is that which has length and breadth only.</div></div>
<div class="ft" data-id="1:41" style="position: absolute; left: 0.0px; top: 196.0px; width: 760.0px; height: 192.0px; opacity: 0.5; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-start"><div style="font-size: 32.0px; font-family: 'Source Sans Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 400; letter-spacing: 0.0px; line-height: 48.0px; text-align: left; color: rgba(22,22,29,1.0)">Longer description of slide content. Typically used to provide extra context or nuance to slides. A good description ensures slides can be consumed async without a live presentation.</div></div>
</div>
<div data-id="1:42" style="position: absolute; left: 960.0px; top: -1.5px; width: 1080.0px; height: 3.0px; background-color: rgba(136,136,140,1.0); opacity: 0.30000001192092896; transform: matrix(4.371138828673793e-08, 1.0, -1.0, 4.371138828673793e-08, 0, 0); transform-origin: 0 0"></div>
<svg data-id="1:43" style="position: absolute; left: 960.0px; top: 540.0px; width: 960.0px; height: 1px; opacity: 0.30000001192092896; overflow: visible" viewBox="0 0 960.0 1" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><path d="M0 -1.5L0 0L960 0L960 -1.5L960 -3L0 -3L0 -1.5Z" fill="rgba(136,136,140,1.0)" fill-rule="nonzero"/></svg>
<div data-id="1:44" style="position: absolute; left: 960.0px; top: 2.0px; width: 960.0px; height: 1078.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; background-image: url('images/7dd95746823114f625a5f320ba342b61de664519.png'); background-size: cover; background-position: center; background-repeat: no-repeat;"></div>
<div data-id="1:45" style="position: absolute; left: 80.0px; top: 40.0px; width: 1760.0px; height: 1000.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; background-image: linear-gradient(rgba(0,0,0,0.0), rgba(0,0,0,0.0)); background-size: auto; background-position: 0 0; background-repeat: repeat;; border: 2.0px solid rgba(76,76,76,1.0);"></div>
</div>
</div>
</div>
<div class="slide-container">
<div class="slide-label">Slide 4 &mdash; Frame</div>
<div class="slide-wrapper">
<div class="slide" data-slide-id="1:46" style="width: 1920.0px; height: 1080.0px; background-color: rgba(252,247,232,1.0); background-image: linear-gradient(rgba(252,247,232,1.0), rgba(252,247,232,1.0)); background-size: auto; background-position: 0 0; background-repeat: repeat; position: relative; overflow: hidden;">
<div class="ft" data-id="1:47" style="position: absolute; left: 100.0px; top: 80.0px; width: 163.0px; height: 35.0px; opacity: 0.5; overflow: visible; box-sizing: border-box; mix-blend-mode: multiply; display: flex; flex-direction: column; justify-content: flex-start"><div style="font-size: 28.0px; font-family: 'Source Sans Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 600; letter-spacing: 0.0px; line-height: 35.19599914550781px; text-align: left; white-space: nowrap; text-transform: uppercase; color: rgba(22,22,29,1.0)">26 june 2024</div></div>
<div class="ft" data-id="1:48" style="position: absolute; left: 100.0px; top: 456.0px; width: 1720.0px; height: 168.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center"><div style="font-size: 140.0px; font-family: 'Source Serif Pro', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 400; letter-spacing: 0.0px; line-height: 168.0px; text-align: center; white-space: nowrap; color: rgba(22,22,29,1.0)">Thank you!</div></div>
<div data-id="1:49" style="position: absolute; left: 80.0px; top: 40.0px; width: 1760.0px; height: 1000.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; background-image: linear-gradient(rgba(0,0,0,0.0), rgba(0,0,0,0.0)); background-size: auto; background-position: 0 0; background-repeat: repeat;; border: 2.0px solid rgba(76,76,76,1.0);"></div>
</div>
</div>
</div>
<div class="images-section"><h2>Images</h2><div class="images-grid">
<div class="image-card">
<img src="images/7dd95746823114f625a5f320ba342b61de664519.png" alt="7dd95746823114f625a5f320ba342b61de664519">
<div class="image-label">7dd95746823114f625a5f320ba342b61de664519.png</div>
</div>
</div></div>
<script>
// Shrink-to-fit: when a custom font fails to load and the fallback is wider/taller, the rendered text overflows the Figma bbox. The shrink is SLACK-AWARE — each text is allowed to overflow into the empty space between it and its nearest neighbor in the overflow direction. Figma sizes text containers tightly around the original font's glyph extent, but the surrounding layout often leaves visual breathing room (e.g. 56px gaps between nav labels). Squeezing every label into its tight bbox makes them look weak; letting them grow into the gap keeps the design closer to the source while still preventing actual overlap.
(function() {
// Per-element "how far can I overflow before hitting a neighbor" computed once. Position-fixed: depends only on bbox layout, not on font shrink state.
var slackCache = new WeakMap();
function computeSlack(container) {
if (slackCache.has(container)) return slackCache.get(container);
var slide = container.closest('.slide');
var er = container.getBoundingClientRect();
var sliderc = slide ? slide.getBoundingClientRect() : null;
var leftS = Infinity, rightS = Infinity, topS = Infinity, botS = Infinity;
if (slide) {
// Collide against other text labels only — overlapping decorative shapes/backgrounds is usually fine and often intentional. Text-on-text is what creates unreadable layouts.
slide.querySelectorAll('.ft').forEach(function(other) {
if (other === container || container.contains(other) || other.contains(container)) return;
var or = other.getBoundingClientRect();
var vertOverlap = or.top < er.bottom - 0.5 && or.bottom > er.top + 0.5;
var horzOverlap = or.left < er.right - 0.5 && or.right > er.left + 0.5;
if (vertOverlap) {
if (or.left >= er.right - 0.5) rightS = Math.min(rightS, or.left - er.right);
if (or.right <= er.left + 0.5) leftS = Math.min(leftS, er.left - or.right);
}
if (horzOverlap) {
if (or.top >= er.bottom - 0.5) botS = Math.min(botS, or.top - er.bottom);
if (or.bottom <= er.top + 0.5) topS = Math.min(topS, er.top - or.bottom);
}
});
}
if (sliderc) {
leftS = Math.min(leftS, Math.max(0, er.left - sliderc.left));
rightS = Math.min(rightS, Math.max(0, sliderc.right - er.right));
topS = Math.min(topS, Math.max(0, er.top - sliderc.top));
botS = Math.min(botS, Math.max(0, sliderc.bottom - er.bottom));
}
var scale = er.width / (container.clientWidth || 1); // rendered-px → layout-px
var toLayout = function(v) { return v === Infinity ? 99999 : Math.max(0, v / (scale || 1)); };
var s = { left: toLayout(leftS), right: toLayout(rightS), top: toLayout(topS), bottom: toLayout(botS) };
slackCache.set(container, s);
return s;
}
function fitOne(container) {
var inner = container.firstElementChild;
if (!inner) return;
var cw = container.clientWidth, ch = container.clientHeight;
if (!cw || !ch) return;
if (inner.dataset.origFs) {
inner.style.fontSize = inner.dataset.origFs;
if (inner.dataset.origLs) inner.style.letterSpacing = inner.dataset.origLs;
if (inner.dataset.origLh) inner.style.lineHeight = inner.dataset.origLh;
} else {
inner.dataset.origFs = getComputedStyle(inner).fontSize;
inner.dataset.origLs = getComputedStyle(inner).letterSpacing;
inner.dataset.origLh = getComputedStyle(inner).lineHeight;
}
var origFs = parseFloat(inner.dataset.origFs);
var origLs = parseFloat(inner.dataset.origLs) || 0;
var origLh = parseFloat(inner.dataset.origLh) || 0;
// Single-line text (white-space: nowrap, or no <br> in the source) only needs to fit its WIDTH — the fallback font's natural line-box (ascender + descender) is usually a few px taller than the Figma bbox even at the correct font, and that's expected, not an overflow to fix.
var isSingleLine = getComputedStyle(inner).whiteSpace === 'nowrap' || !/<br/i.test(inner.innerHTML);
var slack = computeSlack(container);
var align = getComputedStyle(inner).textAlign;
// Effective allowed width: bbox + slack on the side(s) the text actually overflows toward, per text-align.
var allowedW;
if (align === 'right' || align === 'end') allowedW = cw + slack.left;
else if (align === 'center') allowedW = cw + 2 * Math.min(slack.left, slack.right);
else allowedW = cw + slack.right; // left / start / justify
var allowedH = ch + slack.bottom; // text typically grows downward when wrapping
var fs = origFs;
for (var iter = 0; iter < 8; iter++) {
var iw = inner.scrollWidth, ih = inner.scrollHeight;
var rw = iw > allowedW + 0.5 ? allowedW / iw : 1;
var rh = (!isSingleLine && ih > allowedH + 0.5) ? allowedH / ih : 1;
var r = Math.min(rw, rh);
if (r > 0.998) break;
var newFs = Math.max(6, fs * r);
if (newFs >= fs - 0.05) break;
fs = newFs;
inner.style.fontSize = fs + 'px';
// Scale letter-spacing AND line-height proportionally so they shrink with font-size — otherwise the absolute-px values dominate at small sizes.
if (origLs) inner.style.letterSpacing = (origLs * fs / origFs) + 'px';
if (origLh) inner.style.lineHeight = (origLh * fs / origFs) + 'px';
}
}
function fitAll() { document.querySelectorAll('.ft').forEach(fitOne); }
if (document.fonts && document.fonts.ready) {
document.fonts.ready.then(fitAll);
} else {
window.addEventListener('load', fitAll);
}
var t;
window.addEventListener('resize', function() { clearTimeout(t); t = setTimeout(fitAll, 150); });
})();
</script>
</body>
</html>