ugcinc-render 1.8.111 → 1.8.113

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.
package/dist/index.js CHANGED
@@ -3547,7 +3547,7 @@ var MESSAGE_DEFAULTS = {
3547
3547
  profilePicSize: 83,
3548
3548
  profilePicGap: 37
3549
3549
  };
3550
- var FONT_FAMILY = '"SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif';
3550
+ var FONT_FAMILY = getFontFamily("apple");
3551
3551
  function calculateAutoWidthAndLines2({
3552
3552
  text,
3553
3553
  maxWidth,
@@ -3563,6 +3563,10 @@ function calculateAutoWidthAndLines2({
3563
3563
  if (availableWidth <= 0) {
3564
3564
  return { width: maxWidth, lines: [text] };
3565
3565
  }
3566
+ const fontLoaded = typeof document.fonts !== "undefined" ? document.fonts.check(`normal ${fontSize}px "SF Pro"`) : false;
3567
+ if (!fontLoaded) {
3568
+ console.warn("[convertPropsToElements] SF Pro font not loaded! Text measurement may be inaccurate.");
3569
+ }
3566
3570
  const measureSpan = document.createElement("span");
3567
3571
  measureSpan.style.cssText = `
3568
3572
  position: absolute;
@@ -3570,7 +3574,7 @@ function calculateAutoWidthAndLines2({
3570
3574
  pointer-events: none;
3571
3575
  font-family: ${FONT_FAMILY};
3572
3576
  font-size: ${fontSize}px;
3573
- font-weight: 400;
3577
+ font-weight: normal;
3574
3578
  letter-spacing: ${letterSpacing}px;
3575
3579
  white-space: nowrap;
3576
3580
  `;
@@ -3597,9 +3601,11 @@ function calculateAutoWidthAndLines2({
3597
3601
  const testLine = currentLine + word;
3598
3602
  const testWidth = measureText(testLine);
3599
3603
  const WRAP_TOLERANCE = 0.5;
3600
- if (testWidth > availableWidth + WRAP_TOLERANCE && currentLine.trim()) {
3601
- lines.push(currentLine.trimEnd());
3602
- currentLine = word;
3604
+ if (testWidth > availableWidth + WRAP_TOLERANCE) {
3605
+ if (currentLine.trim()) {
3606
+ lines.push(currentLine.trimEnd());
3607
+ currentLine = "";
3608
+ }
3603
3609
  const wordWidth = measureText(word);
3604
3610
  if (wordWidth > availableWidth) {
3605
3611
  let remainingWord = word;
@@ -3621,6 +3627,8 @@ function calculateAutoWidthAndLines2({
3621
3627
  remainingWord = remainingWord.substring(breakPoint);
3622
3628
  }
3623
3629
  }
3630
+ } else {
3631
+ currentLine = word;
3624
3632
  }
3625
3633
  } else {
3626
3634
  currentLine = testLine;
@@ -4052,7 +4060,17 @@ function InstagramDmComposition(props) {
4052
4060
  const [fontsLoaded, setFontsLoaded] = (0, import_react8.useState)(false);
4053
4061
  (0, import_react8.useEffect)(() => {
4054
4062
  const handle = (0, import_remotion9.delayRender)("Loading fonts for InstagramDmComposition");
4055
- preloadFonts().then(() => {
4063
+ const loadFonts = async () => {
4064
+ await preloadFonts();
4065
+ if (typeof document !== "undefined" && document.fonts?.ready) {
4066
+ await document.fonts.ready;
4067
+ }
4068
+ if (typeof document !== "undefined" && document.fonts) {
4069
+ const sfProLoaded = document.fonts.check('normal 51px "SF Pro"');
4070
+ console.log("[InstagramDmComposition] Font check - SF Pro loaded:", sfProLoaded);
4071
+ }
4072
+ };
4073
+ loadFonts().then(() => {
4056
4074
  setFontsLoaded(true);
4057
4075
  (0, import_remotion9.continueRender)(handle);
4058
4076
  }).catch((err) => {
package/dist/index.mjs CHANGED
@@ -2616,7 +2616,7 @@ var MESSAGE_DEFAULTS = {
2616
2616
  profilePicSize: 83,
2617
2617
  profilePicGap: 37
2618
2618
  };
2619
- var FONT_FAMILY = '"SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif';
2619
+ var FONT_FAMILY = getFontFamily("apple");
2620
2620
  function calculateAutoWidthAndLines2({
2621
2621
  text,
2622
2622
  maxWidth,
@@ -2632,6 +2632,10 @@ function calculateAutoWidthAndLines2({
2632
2632
  if (availableWidth <= 0) {
2633
2633
  return { width: maxWidth, lines: [text] };
2634
2634
  }
2635
+ const fontLoaded = typeof document.fonts !== "undefined" ? document.fonts.check(`normal ${fontSize}px "SF Pro"`) : false;
2636
+ if (!fontLoaded) {
2637
+ console.warn("[convertPropsToElements] SF Pro font not loaded! Text measurement may be inaccurate.");
2638
+ }
2635
2639
  const measureSpan = document.createElement("span");
2636
2640
  measureSpan.style.cssText = `
2637
2641
  position: absolute;
@@ -2639,7 +2643,7 @@ function calculateAutoWidthAndLines2({
2639
2643
  pointer-events: none;
2640
2644
  font-family: ${FONT_FAMILY};
2641
2645
  font-size: ${fontSize}px;
2642
- font-weight: 400;
2646
+ font-weight: normal;
2643
2647
  letter-spacing: ${letterSpacing}px;
2644
2648
  white-space: nowrap;
2645
2649
  `;
@@ -2666,9 +2670,11 @@ function calculateAutoWidthAndLines2({
2666
2670
  const testLine = currentLine + word;
2667
2671
  const testWidth = measureText(testLine);
2668
2672
  const WRAP_TOLERANCE = 0.5;
2669
- if (testWidth > availableWidth + WRAP_TOLERANCE && currentLine.trim()) {
2670
- lines.push(currentLine.trimEnd());
2671
- currentLine = word;
2673
+ if (testWidth > availableWidth + WRAP_TOLERANCE) {
2674
+ if (currentLine.trim()) {
2675
+ lines.push(currentLine.trimEnd());
2676
+ currentLine = "";
2677
+ }
2672
2678
  const wordWidth = measureText(word);
2673
2679
  if (wordWidth > availableWidth) {
2674
2680
  let remainingWord = word;
@@ -2690,6 +2696,8 @@ function calculateAutoWidthAndLines2({
2690
2696
  remainingWord = remainingWord.substring(breakPoint);
2691
2697
  }
2692
2698
  }
2699
+ } else {
2700
+ currentLine = word;
2693
2701
  }
2694
2702
  } else {
2695
2703
  currentLine = testLine;
@@ -3121,7 +3129,17 @@ function InstagramDmComposition(props) {
3121
3129
  const [fontsLoaded, setFontsLoaded] = useState3(false);
3122
3130
  useEffect3(() => {
3123
3131
  const handle = delayRender2("Loading fonts for InstagramDmComposition");
3124
- preloadFonts().then(() => {
3132
+ const loadFonts = async () => {
3133
+ await preloadFonts();
3134
+ if (typeof document !== "undefined" && document.fonts?.ready) {
3135
+ await document.fonts.ready;
3136
+ }
3137
+ if (typeof document !== "undefined" && document.fonts) {
3138
+ const sfProLoaded = document.fonts.check('normal 51px "SF Pro"');
3139
+ console.log("[InstagramDmComposition] Font check - SF Pro loaded:", sfProLoaded);
3140
+ }
3141
+ };
3142
+ loadFonts().then(() => {
3125
3143
  setFontsLoaded(true);
3126
3144
  continueRender2(handle);
3127
3145
  }).catch((err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc-render",
3
- "version": "1.8.111",
3
+ "version": "1.8.113",
4
4
  "description": "Unified rendering package for UGC Inc - shared types, components, and compositions for pixel-perfect client/server rendering",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",