Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2021-06-18 08:07:20 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
42cd5502d2ac952d12f1362b1040cee22d917f99
42cd5502
1 parent
aee549d5
Allow reusing an ImageProvider and Font on multiple documents
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
pdf/CHANGELOG.md
pdf/lib/src/widgets/font.dart
pdf/lib/src/widgets/image_provider.dart
pdf/CHANGELOG.md
View file @
42cd550
...
...
@@ -3,6 +3,7 @@
## 3.4.1
-
Fix Nunito font parsing
-
Allow reusing an ImageProvider and Font on multiple documents
## 3.4.0
...
...
@@ -19,7 +20,7 @@
## 3.3.0
-
Implement To be signed f
lie
ds
-
Implement To be signed f
iel
ds
-
Improve Text rendering
-
Add individual cell decoration
-
Improve Bullet Widget
...
...
pdf/lib/src/widgets/font.dart
View file @
42cd550
...
...
@@ -128,14 +128,11 @@ class Font {
PdfFont
?
_pdfFont
;
PdfFont
?
getFont
(
Context
context
)
{
if
(
_pdfFont
==
null
)
{
if
(
_pdfFont
==
null
||
_pdfFont
!.
pdfDocument
!=
context
.
document
)
{
final
pdfDocument
=
context
.
document
;
_pdfFont
=
buildFont
(
pdfDocument
);
}
assert
(
_pdfFont
!.
pdfDocument
==
context
.
document
,
'Do not reuse a Font object across multiple documents'
);
return
_pdfFont
;
}
...
...
pdf/lib/src/widgets/image_provider.dart
View file @
42cd550
...
...
@@ -57,8 +57,10 @@ abstract class ImageProvider {
if
(
effectiveDpi
==
null
||
_cache
[
0
]
!=
null
)
{
_cache
[
0
]
??=
buildImage
(
context
);
assert
(
_cache
[
0
]!.
pdfDocument
==
context
.
document
,
'Do not reuse an ImageProvider object across multiple documents'
);
if
(
_cache
[
0
]!.
pdfDocument
!=
context
.
document
)
{
_cache
[
0
]
=
buildImage
(
context
);
}
return
_cache
[
0
]!;
}
...
...
@@ -69,8 +71,10 @@ abstract class ImageProvider {
_cache
[
width
]
??=
buildImage
(
context
,
width:
width
,
height:
height
);
}
assert
(
_cache
[
width
]!.
pdfDocument
==
context
.
document
,
'Do not reuse an ImageProvider object across multiple documents'
);
if
(
_cache
[
width
]!.
pdfDocument
!=
context
.
document
)
{
_cache
[
width
]
=
buildImage
(
context
,
width:
width
,
height:
height
);
}
return
_cache
[
width
]!;
}
}
...
...
Please
register
or
login
to post a comment