embroidery-qc-image 1.0.34 → 1.0.35

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.esm.js CHANGED
@@ -679,7 +679,7 @@ const renderStrokePatchesCanvas = (ctx, canvas, config, imageRefs) => {
679
679
  // Calculate text size to fit top section
680
680
  let previewFontSize = LAYOUT.HEADER_FONT_SIZE * 3; // Start with large size
681
681
  const fontToUse = isFontMissing ? LAYOUT.FONT_FAMILY : position.font;
682
- ctx.font = `${previewFontSize}px ${fontToUse}`;
682
+ ctx.font = `${previewFontSize}px "${fontToUse}"`;
683
683
  const text = position.text || "";
684
684
  const maxTextWidth = usableWidth * 0.9; // Use 75% of width for better padding
685
685
  const maxTextHeight = actualTopSectionHeight; // Use 60% of height
@@ -687,13 +687,13 @@ const renderStrokePatchesCanvas = (ctx, canvas, config, imageRefs) => {
687
687
  let textWidth = ctx.measureText(text).width;
688
688
  while (textWidth > maxTextWidth && previewFontSize > 50) {
689
689
  previewFontSize *= 0.95;
690
- ctx.font = `${previewFontSize}px ${fontToUse}`;
690
+ ctx.font = `${previewFontSize}px "${fontToUse}"`;
691
691
  textWidth = ctx.measureText(text).width;
692
692
  }
693
693
  // Ensure text height also fits
694
694
  while (previewFontSize > maxTextHeight && previewFontSize > 50) {
695
695
  previewFontSize *= 0.95;
696
- ctx.font = `${previewFontSize}px ${fontToUse}`;
696
+ ctx.font = `${previewFontSize}px "${fontToUse}"`;
697
697
  }
698
698
  // Update textWidth after final scaling
699
699
  textWidth = ctx.measureText(text).width;
@@ -773,7 +773,7 @@ const renderStrokePatchesCanvas = (ctx, canvas, config, imageRefs) => {
773
773
  // Render font name với chính font đó
774
774
  const prefixWidth = ctx.measureText(fontPrefix).width;
775
775
  const fontName = position.font || LAYOUT.FONT_FAMILY;
776
- ctx.font = `${infoFontSize}px ${fontName}`;
776
+ ctx.font = `${infoFontSize}px "${fontName}"`;
777
777
  ctx.fillText(fontName, startX + prefixWidth, infoY);
778
778
  }
779
779
  infoY += infoLineHeight;
@@ -1063,7 +1063,7 @@ const renderTemplateCustomTextPatchesCanvas = (ctx, canvas, config, imageRefs) =
1063
1063
  let high = previewFontSize;
1064
1064
  while (high - low > 1) {
1065
1065
  const mid = (low + high) / 2;
1066
- ctx.font = `${mid}px ${fontToUse}`;
1066
+ ctx.font = `${mid}px "${fontToUse}"`;
1067
1067
  // Kiểm tra width của tất cả các dòng
1068
1068
  const maxLineWidth = Math.max(...textLines.map(line => ctx.measureText(line).width));
1069
1069
  // Kiểm tra height với line height = 1.1 (giảm từ 1.2 để text to hơn)
@@ -1080,7 +1080,7 @@ const renderTemplateCustomTextPatchesCanvas = (ctx, canvas, config, imageRefs) =
1080
1080
  }
1081
1081
  }
1082
1082
  previewFontSize = bestFontSize;
1083
- ctx.font = `${previewFontSize}px ${fontToUse}`;
1083
+ ctx.font = `${previewFontSize}px "${fontToUse}"`;
1084
1084
  // Center the text inside rectangle
1085
1085
  const finalLineHeight = previewFontSize * 1.1;
1086
1086
  const totalTextHeightFinal = textLines.length * finalLineHeight;
@@ -1138,7 +1138,7 @@ const renderTemplateCustomTextPatchesCanvas = (ctx, canvas, config, imageRefs) =
1138
1138
  // Render font name với chính font đó
1139
1139
  const prefixWidth = ctx.measureText(fontPrefix).width;
1140
1140
  const fontName = position.font || LAYOUT.FONT_FAMILY;
1141
- ctx.font = `${infoFontSize}px ${fontName}`;
1141
+ ctx.font = `${infoFontSize}px "${fontName}"`;
1142
1142
  ctx.fillText(fontName, startX + prefixWidth, infoY);
1143
1143
  }
1144
1144
  infoY += infoLineHeight;
@@ -1748,7 +1748,7 @@ const renderUniformLabels = (ctx, uniformProps, x, y, maxWidth, scaleFactor, ima
1748
1748
  let currentX = x + prefixWidth;
1749
1749
  ctx.fillText(prefix, x, cursorY);
1750
1750
  // Render tên font với font từ config
1751
- ctx.font = `${fontSize}px ${values.font}`;
1751
+ ctx.font = `${fontSize}px "${values.font}"`;
1752
1752
  const fontNameWidth = ctx.measureText(values.font).width;
1753
1753
  ctx.fillText(values.font, currentX, cursorY);
1754
1754
  currentX += fontNameWidth;
@@ -1973,7 +1973,7 @@ displayIndex, showLabels, scaleFactor, imageRefs, mockupBounds = null) => {
1973
1973
  const measureFontTextWidth = (fontSize) => {
1974
1974
  ctx.font = `${fontSize}px ${LAYOUT.FONT_FAMILY}`;
1975
1975
  const prefixWidth = ctx.measureText(prefix).width;
1976
- ctx.font = `${fontSize}px ${position.font}`;
1976
+ ctx.font = `${fontSize}px "${position.font}"`;
1977
1977
  const fontNameWidth = ctx.measureText(fontName).width;
1978
1978
  ctx.font = `${fontSize}px ${LAYOUT.FONT_FAMILY}`;
1979
1979
  const suffixWidth = ctx.measureText(suffix).width;
@@ -2049,7 +2049,7 @@ displayIndex, showLabels, scaleFactor, imageRefs, mockupBounds = null) => {
2049
2049
  const prefixWidth = ctx.measureText(prefix).width;
2050
2050
  let currentX = x + prefixWidth;
2051
2051
  ctx.fillText(prefix, x, currentY);
2052
- ctx.font = `${effectiveFontSize}px ${position.font}`;
2052
+ ctx.font = `${effectiveFontSize}px "${position.font}"`;
2053
2053
  const fontNameWidth = ctx.measureText(fontName).width;
2054
2054
  const totalWidth = prefixWidth + fontNameWidth;
2055
2055
  if (totalWidth > shrunkEffectiveMaxWidth) {