Issue Description:
Problem Summary
Text layers created with ag-psd consistently show 0x0 dimensions and appear invisible in Photoshop, despite correct input parameters. Analysis shows ag-psd is not implementing
Adobe's official PSD specification for TypeTool data structure.
Expected Behavior
Text layers should:
- Have correct bounding dimensions matching input width/height
- Be visible and editable in Photoshop
- Follow Adobe's official 'TySh' key specification
Actual Behavior
Text layers consistently show:
- Bounds: left=X, top=Y, right=X, bottom=Y (0x0 dimensions)
- Invisible text in Photoshop
- Photoshop warnings when opening files
Code to Reproduce
const { writePsd } = require('ag-psd');
const psd = {
width: 200,
height: 200,
children: [
{
name: 'Test Text',
left: 50,
top: 50,
right: 150,
bottom: 80,
text: {
text: 'Hello World',
transform: [1, 0, 0, 1, 50, 50],
style: {
font: { name: 'Arial' },
fontSize: 24,
fillColor: { r: 0, g: 0, b: 0 }
}
}
}
]
};
const buffer = writePsd(psd);
// Result: Text layer has 0x0 dimensions
Analysis: Adobe Specification Compliance
According to https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_72092, TypeTool ('TySh' key) requires:
- Version: 1 (2 bytes)
- Transform: 6 doubles (xx, xy, yx, yy, tx, ty)
- Text version: 50 (2 bytes)
- Descriptor version: 16 (4 bytes)
- Text data descriptor (variable)
- Warp version: 1 (2 bytes)
- Descriptor version: 16 (4 bytes)
- Warp data descriptor (variable)
- Bounding rectangle: 4 doubles (left, top, right, bottom)
ag-psd appears to be missing:
- Required version numbers (Text version: 50, Descriptor version: 16)
- Proper descriptor structure for text data
- Warp data descriptor implementation
- Correct bounding rectangle handling
Testing Results
Multiple approaches tested, all resulting in 0x0 dimensions:
- Manual bounds setting: left: 50, top: 50, right: 150, bottom: 80
- No manual bounds (auto-calculation): Still 0x0
- Different transform matrices: No improvement
- Various text styling options: No improvement
PSD Analysis Tool Output:
Layer: "Test Text"
├─ Bounds: left=50, top=50, right=50, bottom=50
├─ Dimensions: 0x0
├─ TEXT LAYER DETECTED: Present
└─ Error reading type tool data: typeToolResult.transform.join is not a function
Environment
- ag-psd version: 28.3.1 (latest)
- Node.js version: [your version]
- OS: Windows/Mac/Linux
- Photoshop version: [if testing with Photoshop]
Proposed Solution
ag-psd should implement the complete Adobe TypeTool specification including:
- Proper version number handling
- Complete descriptor structure implementation
- Warp data descriptor support
- Correct bounding rectangle calculation from text metrics
Workaround
Currently using rasterized text layers as a fallback, but this eliminates editability which is a key PSD feature.
Additional Notes
This issue affects any application trying to generate PSDs with editable text layers. The current implementation makes ag-psd unsuitable for professional PSD generation workflows
requiring text editability.
Issue Description:
Problem Summary
Text layers created with ag-psd consistently show 0x0 dimensions and appear invisible in Photoshop, despite correct input parameters. Analysis shows ag-psd is not implementing
Adobe's official PSD specification for TypeTool data structure.
Expected Behavior
Text layers should:
Actual Behavior
Text layers consistently show:
Code to Reproduce
const { writePsd } = require('ag-psd');
const psd = {
width: 200,
height: 200,
children: [
{
name: 'Test Text',
left: 50,
top: 50,
right: 150,
bottom: 80,
text: {
text: 'Hello World',
transform: [1, 0, 0, 1, 50, 50],
style: {
font: { name: 'Arial' },
fontSize: 24,
fillColor: { r: 0, g: 0, b: 0 }
}
}
}
]
};
const buffer = writePsd(psd);
// Result: Text layer has 0x0 dimensions
Analysis: Adobe Specification Compliance
According to https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_72092, TypeTool ('TySh' key) requires:
ag-psd appears to be missing:
Testing Results
Multiple approaches tested, all resulting in 0x0 dimensions:
PSD Analysis Tool Output:
Layer: "Test Text"
├─ Bounds: left=50, top=50, right=50, bottom=50
├─ Dimensions: 0x0
├─ TEXT LAYER DETECTED: Present
└─ Error reading type tool data: typeToolResult.transform.join is not a function
Environment
Proposed Solution
ag-psd should implement the complete Adobe TypeTool specification including:
Workaround
Currently using rasterized text layers as a fallback, but this eliminates editability which is a key PSD feature.
Additional Notes
This issue affects any application trying to generate PSDs with editable text layers. The current implementation makes ag-psd unsuitable for professional PSD generation workflows
requiring text editability.