Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
psd.js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
regiostart
psd.js
Commits
4a810737
Commit
4a810737
authored
Aug 19, 2014
by
Ryan LeFevre
Browse files
Options
Browse Files
Download
Plain Diff
Change name and add property to easily get text value
parents
e0251111
c80af038
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
4 deletions
+47
-4
tree.js
examples/node/tree.js
+1
-1
file.coffee
lib/psd/file.coffee
+1
-2
info.coffee
lib/psd/layer/info.coffee
+2
-1
typetool.coffee
lib/psd/layer_info/typetool.coffee
+43
-0
No files found.
examples/node/tree.js
View file @
4a810737
lib/psd/file.coffee
View file @
4a810737
...
@@ -42,8 +42,7 @@ module.exports = class File
...
@@ -42,8 +42,7 @@ module.exports = class File
readString
:
(
length
)
->
String
.
fromCharCode
.
apply
(
null
,
@
read
(
length
)).
replace
/\u0000/g
,
""
readString
:
(
length
)
->
String
.
fromCharCode
.
apply
(
null
,
@
read
(
length
)).
replace
/\u0000/g
,
""
readUnicodeString
:
(
length
=
null
)
->
readUnicodeString
:
(
length
=
null
)
->
length
or=
@
readInt
()
length
or=
@
readInt
()
data
=
new
Buffer
(
@
read
(
length
*
2
))
iconv
.
decode
(
new
Buffer
(
@
read
(
length
*
2
)),
'utf-16be'
).
replace
/\u0000/g
,
""
iconv
.
decode
(
data
,
'utf-16be'
)
readByte
:
->
@
read
(
1
)[
0
]
readByte
:
->
@
read
(
1
)[
0
]
readBoolean
:
->
@
readByte
()
isnt
0
readBoolean
:
->
@
readByte
()
isnt
0
lib/psd/layer/info.coffee
View file @
4a810737
...
@@ -13,6 +13,7 @@ LAYER_INFO = {
...
@@ -13,6 +13,7 @@ LAYER_INFO = {
name
:
require
(
'../layer_info/unicode_name.coffee'
)
name
:
require
(
'../layer_info/unicode_name.coffee'
)
nestedSectionDivider
:
require
(
'../layer_info/nested_section_divider.coffee'
)
nestedSectionDivider
:
require
(
'../layer_info/nested_section_divider.coffee'
)
sectionDivider
:
require
(
'../layer_info/section_divider.coffee'
)
sectionDivider
:
require
(
'../layer_info/section_divider.coffee'
)
typeTool
:
require
(
'../layer_info/typetool.coffee'
)
}
}
module
.
exports
=
module
.
exports
=
...
...
lib/psd/layer_info/typetool.coffee
0 → 100644
View file @
4a810737
LayerInfo
=
require
'../layer_info.coffee'
Descriptor
=
require
'../descriptor.coffee'
module
.
exports
=
class
TextElements
extends
LayerInfo
@
shouldParse
:
(
key
)
->
key
is
'TySh'
TRANSFORM_VALUE
=
[
'xx'
,
'xy'
,
'yx'
,
'yy'
,
'tx'
,
'ty'
]
COORDS_VALUE
=
[
'left'
,
'top'
,
'right'
,
'bottom'
]
constructor
:
(
layer
,
length
)
->
super
(
layer
,
length
)
@
version
=
null
@
transform
=
{}
@
textVersion
=
null
@
descriptorVersion
=
null
@
textData
=
null
@
textValue
=
null
@
warpVersion
=
null
@
descriptorVersion
=
null
@
warpData
=
null
@
coords
=
{}
parse
:
->
@
version
=
@
file
.
readShort
()
for
name
,
index
in
TRANSFORM_VALUE
@
transform
[
name
]
=
@
file
.
readDouble
()
@
textVersion
=
@
file
.
readShort
()
@
descriptorVersion
=
@
file
.
readInt
()
@
textData
=
new
Descriptor
(
@
file
).
parse
()
@
textValue
=
@
textData
[
'Txt '
]
@
warpVersion
=
@
file
.
readShort
()
@
descriptorVersion
=
@
file
.
readInt
()
@
warpData
=
new
Descriptor
(
@
file
).
parse
()
for
name
,
index
in
COORDS_VALUE
@
coords
[
name
]
=
@
file
.
readDouble
()
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