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
Olzhas Suleimen
2023-12-08 14:11:16 +0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2024-01-27 11:47:00 -0400
Commit
5deee6c750a2d1f0d123ada14665fa5604f50459
5deee6c7
1 parent
0a7acd8d
Add an option to disable bidirectional support
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
3 deletions
pdf/CHANGELOG.md
pdf/lib/src/pdf/font/ttf_parser.dart
pdf/lib/src/pdf/obj/ttffont.dart
pdf/lib/src/pdf/options.dart
pdf/lib/src/widgets/text.dart
pdf/CHANGELOG.md
View file @
5deee6c
...
...
@@ -6,6 +6,7 @@
-
Add support for existing reference objects
-
Update barcode golden pdf
-
Add support for hyphenation
[
ilja
]
-
Add an option to disable bidirectional support
[
Olzhas-Suleimen
]
## 3.10.7
...
...
pdf/lib/src/pdf/font/ttf_parser.dart
View file @
5deee6c
...
...
@@ -22,6 +22,7 @@ import 'dart:typed_data';
import
'package:meta/meta.dart'
;
import
'../options.dart'
;
import
'bidi_utils.dart'
as
bidi
;
import
'font_metrics.dart'
;
...
...
@@ -323,7 +324,7 @@ class TtfParser {
/// Having both the unicode and the isolated form code
/// point to the same glyph index because some fonts
/// do not have a glyph for the isolated form.\
if
(
bidi
.
basicToIsolatedMappings
.
containsKey
(
c
))
{
if
(
useBidi
&&
bidi
.
basicToIsolatedMappings
.
containsKey
(
c
))
{
charToGlyphIndexMap
[
bidi
.
basicToIsolatedMappings
[
c
]!]
=
glyphIndex
;
}
}
...
...
pdf/lib/src/pdf/obj/ttffont.dart
View file @
5deee6c
...
...
@@ -28,6 +28,7 @@ import '../format/name.dart';
import
'../format/num.dart'
;
import
'../format/stream.dart'
;
import
'../format/string.dart'
;
import
'../options.dart'
;
import
'font.dart'
;
import
'font_descriptor.dart'
;
import
'object.dart'
;
...
...
@@ -78,7 +79,7 @@ class PdfTtfFont extends PdfFont {
return
PdfFontMetrics
.
zero
;
}
if
(
bidi
.
isArabicDiacriticValue
(
charCode
))
{
if
(
useBidi
&&
bidi
.
isArabicDiacriticValue
(
charCode
))
{
final
metric
=
font
.
glyphInfoMap
[
g
]
??
PdfFontMetrics
.
zero
;
return
metric
.
copyWith
(
advanceWidth:
0
);
}
...
...
pdf/lib/src/pdf/options.dart
0 → 100644
View file @
5deee6c
/// Whether to use the Bidi algorithm to detect RTL text.
const
bool
useBidi
=
bool
.
fromEnvironment
(
'use_bidi'
,
defaultValue:
true
);
...
...
pdf/lib/src/widgets/text.dart
View file @
5deee6c
...
...
@@ -20,6 +20,7 @@ import 'package:meta/meta.dart';
import
'../../pdf.dart'
;
import
'../pdf/font/bidi_utils.dart'
as
bidi
;
import
'../pdf/options.dart'
;
import
'annotations.dart'
;
import
'basic.dart'
;
import
'document.dart'
;
...
...
@@ -928,7 +929,7 @@ class RichText extends Widget with SpanningWidget {
final
space
=
font
.
stringMetrics
(
' '
)
*
(
style
.
fontSize
!
*
textScaleFactor
);
final
spanLines
=
(
_textDirection
==
TextDirection
.
rtl
final
spanLines
=
(
useBidi
&&
_textDirection
==
TextDirection
.
rtl
?
bidi
.
logicalToVisual
(
span
.
text
!)
:
span
.
text
)!
.
split
(
'
\n
'
);
...
...
Please
register
or
login
to post a comment