Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
2f18b15e
Commit
2f18b15e
authored
Jan 25, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix non-breaking space
parent
be296d97
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
cell/graphics/DrawingContext.js
cell/graphics/DrawingContext.js
+10
-4
No files found.
cell/graphics/DrawingContext.js
View file @
2f18b15e
...
...
@@ -908,10 +908,13 @@
* @return {TextMetrics} Returns the dimension of string {width: w, height: h}
*/
DrawingContext
.
prototype
.
measureText
=
function
(
text
,
units
)
{
var
fm
=
this
.
fmgrGraphics
[
3
],
r
=
getCvtRatio
(
0
/*px*/
,
units
>=
0
&&
units
<=
3
?
units
:
this
.
units
,
this
.
ppiX
);
var
code
;
var
fm
=
this
.
fmgrGraphics
[
3
];
var
r
=
getCvtRatio
(
0
/*px*/
,
units
>=
0
&&
units
<=
3
?
units
:
this
.
units
,
this
.
ppiX
);
for
(
var
tmp
,
w
=
0
,
w2
=
0
,
i
=
0
;
i
<
text
.
length
;
++
i
)
{
tmp
=
fm
.
MeasureChar
(
text
.
charCodeAt
(
i
));
code
=
text
.
charCodeAt
(
i
);
// Replace Non-breaking space(0xA0) with White-space(0x20)
tmp
=
fm
.
MeasureChar
(
0xA0
===
code
?
0x20
:
code
);
w
+=
asc_round
(
tmp
.
fAdvanceX
);
// ToDo скачет при wrap в ячейке и zoom
}
w2
=
w
-
tmp
.
fAdvanceX
+
tmp
.
oBBox
.
fMaxX
-
tmp
.
oBBox
.
fMinX
+
1
;
...
...
@@ -936,6 +939,7 @@
};
DrawingContext
.
prototype
.
fillText
=
function
(
text
,
x
,
y
,
maxWidth
,
charWidths
,
angle
)
{
var
code
;
var
manager
=
angle
?
this
.
fmgrGraphics
[
1
]
:
this
.
fmgrGraphics
[
0
];
var
_x
=
this
.
_mift
.
transformPointX
(
x
,
y
);
...
...
@@ -944,7 +948,9 @@
var
length
=
text
.
length
;
for
(
var
i
=
0
;
i
<
length
;
++
i
)
{
try
{
_x
=
asc_round
(
manager
.
LoadString4C
(
text
.
charCodeAt
(
i
),
_x
,
_y
));
code
=
text
.
charCodeAt
(
i
);
// Replace Non-breaking space(0xA0) with White-space(0x20)
_x
=
asc_round
(
manager
.
LoadString4C
(
0xA0
===
code
?
0x20
:
code
,
_x
,
_y
));
}
catch
(
err
)
{
// do nothing
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment