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
2019-09-14 09:43:11 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c51acaf82175f10c0269e421ff37baa8c4dd839d
c51acaf8
1 parent
63a02533
Style: Improve indentation
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
13 deletions
pdf/lib/widgets/text.dart
pdf/lib/widgets/text.dart
View file @
c51acaf
...
...
@@ -272,8 +272,13 @@ class RichText extends Widget {
final
List
<
_Span
>
_spans
=
<
_Span
>[];
double
_realignLine
(
List
<
_Span
>
spans
,
double
totalWidth
,
double
wordsWidth
,
bool
last
,
double
baseline
)
{
double
_realignLine
(
List
<
_Span
>
spans
,
double
totalWidth
,
double
wordsWidth
,
bool
last
,
double
baseline
,
)
{
double
delta
=
0
;
switch
(
textAlign
)
{
case
TextAlign
.
left
:
...
...
@@ -359,7 +364,8 @@ class RichText extends Widget {
constraintWidth
,
offsetX
-
space
.
advanceWidth
*
style
.
wordSpacing
,
false
,
bottom
));
bottom
,
));
lineStart
+=
wCount
;
...
...
@@ -379,12 +385,21 @@ class RichText extends Widget {
}
final
double
baseline
=
span
.
baseline
*
textScaleFactor
;
top
=
math
.
min
(
top
??
metrics
.
top
+
baseline
,
metrics
.
top
+
baseline
);
top
=
math
.
min
(
top
??
metrics
.
top
+
baseline
,
metrics
.
top
+
baseline
,
);
bottom
=
math
.
max
(
bottom
??
metrics
.
bottom
+
baseline
,
metrics
.
bottom
+
baseline
);
bottom
??
metrics
.
bottom
+
baseline
,
metrics
.
bottom
+
baseline
,
);
final
_Word
wd
=
_Word
(
word
,
style
,
metrics
,
span
.
annotation
);
final
_Word
wd
=
_Word
(
word
,
style
,
metrics
,
span
.
annotation
,
);
wd
.
offset
=
PdfPoint
(
offsetX
,
-
offsetY
+
baseline
);
_spans
.
add
(
wd
);
...
...
@@ -401,7 +416,8 @@ class RichText extends Widget {
constraintWidth
,
offsetX
-
space
.
advanceWidth
*
style
.
wordSpacing
,
false
,
bottom
));
bottom
,
));
lineStart
+=
wCount
;
...
...
@@ -433,13 +449,22 @@ class RichText extends Widget {
double
.
infinity
,
style
.
fontSize
*
textScaleFactor
,
)));
final
_WidgetSpan
ws
=
_WidgetSpan
(
span
.
child
,
style
,
span
.
annotation
);
final
_WidgetSpan
ws
=
_WidgetSpan
(
span
.
child
,
style
,
span
.
annotation
,
);
if
(
offsetX
+
ws
.
width
>
constraintWidth
&&
wCount
>
0
)
{
width
=
math
.
max
(
width
,
_realignLine
(
_spans
.
sublist
(
lineStart
),
constraintWidth
,
offsetX
,
false
,
bottom
));
_realignLine
(
_spans
.
sublist
(
lineStart
),
constraintWidth
,
offsetX
,
false
,
bottom
,
));
lineStart
+=
wCount
;
...
...
@@ -460,7 +485,10 @@ class RichText extends Widget {
final
double
baseline
=
span
.
baseline
*
textScaleFactor
;
top
=
math
.
min
(
top
??
baseline
,
baseline
);
bottom
=
math
.
max
(
bottom
??
ws
.
height
+
baseline
,
ws
.
height
+
baseline
);
bottom
=
math
.
max
(
bottom
??
ws
.
height
+
baseline
,
ws
.
height
+
baseline
,
);
ws
.
offset
=
PdfPoint
(
offsetX
,
-
offsetY
+
baseline
);
_spans
.
add
(
ws
);
...
...
@@ -474,7 +502,12 @@ class RichText extends Widget {
width
=
math
.
max
(
width
,
_realignLine
(
_spans
.
sublist
(
lineStart
),
constraintWidth
,
offsetX
,
true
,
bottom
));
_spans
.
sublist
(
lineStart
),
constraintWidth
,
offsetX
,
true
,
bottom
,
));
bottom
??=
0.0
;
top
??=
0.0
;
...
...
Please
register
or
login
to post a comment