DavBfr / dart_pdf

Pdf creation module for dart/flutter
https://pub.dev/packages/pdf
Apache License 2.0
1.42k stars 632 forks source link

Exception: Invalid argument: Offset is outside the bounds of the DataView #1759

Open ifuterman opened 1 month ago

ifuterman commented 1 month ago

Describe the bug When I use font from the IBM Plex Mono family - I receive this type of exception. With other fonts, it works. Link to the font https://fonts.google.com/specimen/IBM+Plex+Mono

To Reproduce Code snippet to reproduce the behavior:

// final monoRegularFont = await PdfGoogleFonts.iBMPlexMonoRegular();
final monoRegularFont = await fontFromAssetBundle('google_fonts/IBMPlexMono-Regular.ttf');
Text(
  'Some text',
  style: TextStyle(
    font: monoRegularFont,
    fontSize: 7,
    color: PdfColors.black
  )
)

Expected behavior No exception

Flutter Doctor

[✓] Flutter (Channel stable, 3.24.3, on macOS 14.4.1 23E224 darwin-arm64, locale ru-IL)
    • Flutter version 3.24.3 on channel stable at /Users/iosiffuterman/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/iosiffuterman/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/xcode.app/contents/developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA 2.app
    • Flutter plugin version 81.1.3
    • Dart plugin version 242.22855.32

[✓] VS Code (version 1.85.1)
    • VS Code at /Users/iosiffuterman/Downloads/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • iPhone Iosif Futerman (mobile)  • 00008120-00181D0E0A70201E • ios            • iOS 17.3.1 21D61
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 129.0.6668.90

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Desktop (please complete the following information):