@hyperframes/core 0.9.19 → 0.9.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -579,6 +579,18 @@ function partitionWeightRuns(faces, coveredWeights) {
579
579
  runs.push([face]);
580
580
  return runs;
581
581
  }
582
+ function bundledWeightsWithin(weight, style, covered) {
583
+ const range = /^(\d+)\s+(\d+)$/.exec(weight.trim());
584
+ if (!range)
585
+ return [];
586
+ const [low, high] = [Number(range[1]), Number(range[2])];
587
+ return [...covered].flatMap((key) => {
588
+ const [value, coveredStyle] = key.split(":");
589
+ return coveredStyle === style && Number(value) >= low && Number(value) <= high
590
+ ? [value ?? ""]
591
+ : [];
592
+ });
593
+ }
582
594
  // Path 1: pre-bundled fonts via FONT_ALIASES — emit embedded faces,
583
595
  // then fetch from Google Fonts to fill missing weights and character subsets.
584
596
  async function bundledFamilyFaceRules(canonical, normalizedFamily, emitFamily, optional, options, fontText) {
@@ -619,6 +631,9 @@ async function bundledFamilyFaceRules(canonical, normalizedFamily, emitFamily, o
619
631
  if (!first || !last)
620
632
  continue;
621
633
  const weight = run.length > 1 ? `${first.weight} ${last.weight}` : first.weight;
634
+ // The exact-weight bundled face (Latin only) wins over a range face: emit the range at each bundled weight too.
635
+ for (const exact of bundledWeightsWithin(weight, first.style, coveredWeights))
636
+ rules.push(buildFontFaceRule(emitFamily, first.dataUri, exact, first.style, first.unicodeRange));
622
637
  rules.push(buildFontFaceRule(emitFamily, first.dataUri, weight, first.style, first.unicodeRange));
623
638
  }
624
639
  // Broader or text-subset responses can overlap Latin. Emit the bundle