David PHAM-VAN

Fix missing chars with pdfjs

1 # Changelog 1 # Changelog
2 2
  3 +## 3.7.1
  4 +
  5 +- Fix missing chars with pdfjs
  6 +
3 ## 3.7.0 7 ## 3.7.0
4 8
5 - Fix imports for Dart 2.15 9 - Fix imports for Dart 2.15
@@ -76,8 +76,12 @@ class TtfWriter { @@ -76,8 +76,12 @@ class TtfWriter {
76 continue; 76 continue;
77 } 77 }
78 78
79 - final glyph =  
80 - ttf.readGlyph(ttf.charToGlyphIndexMap[chars[index]] ?? 0).copy(); 79 + final glyphIndex = ttf.charToGlyphIndexMap[chars[index]] ?? 0;
  80 + if (glyphIndex >= ttf.glyphOffsets.length) {
  81 + continue;
  82 + }
  83 +
  84 + final glyph = ttf.readGlyph(glyphIndex).copy();
81 for (final g in glyph.compounds) { 85 for (final g in glyph.compounds) {
82 compounds[g] = -1; 86 compounds[g] = -1;
83 } 87 }
@@ -23,7 +23,7 @@ class PdfUnicodeCmap extends PdfObjectStream { @@ -23,7 +23,7 @@ class PdfUnicodeCmap extends PdfObjectStream {
23 PdfUnicodeCmap(PdfDocument pdfDocument, this.protect) : super(pdfDocument); 23 PdfUnicodeCmap(PdfDocument pdfDocument, this.protect) : super(pdfDocument);
24 24
25 /// List of characters 25 /// List of characters
26 - final cmap = <int>[]; 26 + final cmap = <int>[0];
27 27
28 /// Protects the text from being "seen" by the PDF reader. 28 /// Protects the text from being "seen" by the PDF reader.
29 final bool protect; 29 final bool protect;
@@ -3,7 +3,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl @@ -3,7 +3,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl
3 homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf 3 homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf
4 repository: https://github.com/DavBfr/dart_pdf 4 repository: https://github.com/DavBfr/dart_pdf
5 issue_tracker: https://github.com/DavBfr/dart_pdf/issues 5 issue_tracker: https://github.com/DavBfr/dart_pdf/issues
6 -version: 3.7.0 6 +version: 3.7.1
7 7
8 environment: 8 environment:
9 sdk: ">=2.12.0 <3.0.0" 9 sdk: ">=2.12.0 <3.0.0"
@@ -22,7 +22,7 @@ dependencies: @@ -22,7 +22,7 @@ dependencies:
22 image: ">=3.0.1 <4.0.0" 22 image: ">=3.0.1 <4.0.0"
23 js: ^0.6.3 23 js: ^0.6.3
24 meta: ">=1.3.0 <2.0.0" 24 meta: ">=1.3.0 <2.0.0"
25 - pdf: ^3.7.0 25 + pdf: ^3.7.1
26 plugin_platform_interface: ^2.0.0 26 plugin_platform_interface: ^2.0.0
27 27
28 dev_dependencies: 28 dev_dependencies: