DavBfr / dart_pdf

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

Currency symbol show as cross block in release mode on android #1559

Open burhankhanzada opened 11 months ago

burhankhanzada commented 11 months ago

Describe the bug Currency symbol show as cross block in release mode on android.

Expected behavior Should Show Euro Symbol as showing in debug mode

To Reproduce Run this code on android release mode

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';

void main() {
  runApp(
    const App(),
  );
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Home(),
    );
  }
}

class Home extends StatelessWidget {
  const Home({super.key});

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: PDF(),
    );
  }
}

class PDF extends StatelessWidget {
  const PDF({super.key});

  @override
  Widget build(BuildContext context) {
    return PdfPreview(
      build: (context) => makePdf(),
    );
  }
}

Future<Uint8List> makePdf() async {
  final font = await PdfGoogleFonts.nunitoRegular();

  final document = pw.Document();

  document.addPage(
    pw.MultiPage(
      build: (context) {
        return [
          pw.Text(
            '€',
            style: pw.TextStyle(font: font),
          )
        ];
      },
    ),
  );

  return await document.save();
}

Screenshots Screenshot_1702461991

Flutter Doctor

[✓] Flutter (Channel stable, 3.16.3, on macOS 14.2 23C5055b darwin-arm64, locale en-US)
    • Flutter version 3.16.3 on channel stable at /Users/burhankhanzada/Development/Google/Flutter/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0366e0a3f (7 days ago), 2023-12-05 19:46:39 -0800
    • Engine revision 54a7145303
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/burhankhanzada/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 installation is incomplete; a full installation is necessary for iOS and macOS development.
      Download at: https://developer.apple.com/xcode/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    • CocoaPods version 1.14.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)

[✓] VS Code (version 1.84.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 14 (API 34) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 14.2 23C5055b darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 120.0.6099.71

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

! Doctor found issues in 1 category.

Desktop (please complete the following information):

Smartphone (please complete the following information):

remylavergne commented 8 months ago

Edit: my bad, it's in the documentation => https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management

Same problem. Did you find a solution ? Error : flutter: Unable to find a font to draw "€" (U+20ac) try to provide a TextStyle.fontFallback