@flowaccount/pdfmake 1.0.2 → 1.0.3-staging.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowaccount/pdfmake",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-staging.11",
4
4
  "description": "Client/server side PDF printing in pure JavaScript",
5
5
  "main": "src/printer.js",
6
6
  "browser": "build/pdfmake.js",
package/src/textTools.js CHANGED
@@ -133,6 +133,11 @@ function splitWords(text, noWrap) {
133
133
  text = text.replace(/\t/g, ' ');
134
134
  text = text.replace(/\r/g, '');
135
135
 
136
+ // Remove all invisible/hidden Unicode characters that can cause font rendering issues
137
+ // This includes: zero-width spaces, directional marks, line/paragraph separators, and other control characters
138
+ // See CLAUDE.md "Hidden Unicode Characters & Font Rendering Issues" for full list
139
+ text = text.replace(/[\u200B-\u200D\uFEFF\u200E\u200F\u202A-\u202E\u2028\u2029\u180E\u2060-\u2064\u206A-\u206F]/g, '');
140
+
136
141
  if (noWrap) {
137
142
  results.push({ text: text });
138
143
  return results;
@@ -288,6 +293,12 @@ function normalizeTextArray(array, styleContextStack) {
288
293
  result.lineEnd = true;
289
294
  }
290
295
 
296
+ // Preserve leading spaces for words that come after a line break (not the first word)
297
+ // This fixes the issue where spaces at the beginning of new lines are removed
298
+ if (i2 > 0 && words[i2 - 1].lineEnd) {
299
+ result.preserveLeadingSpaces = true;
300
+ }
301
+
291
302
  copyStyle(style, result);
292
303
  results.push(result);
293
304
  }
@@ -443,7 +454,8 @@ function needsTokenizer(word) {
443
454
  return false;
444
455
  }
445
456
 
446
- return /[\u0E00-\u0E7F]/.test(word);
457
+ // Disable tokenizer for Thai text - let it wrap naturally at spaces
458
+ return false;
447
459
  }
448
460
 
449
461
  function primeFontCaches(styleContextStack) {