Commit f041cfd5 authored by Halla Rempt's avatar Halla Rempt

psd: read the unicode layer name

parent a8e1234c
......@@ -461,6 +461,7 @@ bool PSDLayerRecord::read(QIODevice* io)
error = "Could not read key for additional layer info block";
return false;
}
dbgFile << "found info block with key" << key;
if (infoBlocks.contains(key)) {
error = QString("Duplicate layer info block with key %1").arg(key);
......@@ -484,7 +485,33 @@ bool PSDLayerRecord::read(QIODevice* io)
return false;
}
dbgFile << "\tRead layer info block" << infoBlock->data.size();
dbgFile << "\tRead layer info block" << key << "for size" << infoBlock->data.size();
// get the unicode layer name
if (key == "luni") {
QBuffer buf(&infoBlock->data);
buf.open(QBuffer::ReadOnly);
quint32 stringlen;
if (!psdread(&buf, &stringlen)) {
error = "Could not read string length for luni block";
return false;
}
QString unicodeLayerName;
for (uint i = 0; i < stringlen; ++i) {
quint16 ch;
psdread(&buf, &ch);
QChar uch(ch);
unicodeLayerName.append(uch);
}
dbgFile << "unicodeLayerName" << unicodeLayerName;
if (!unicodeLayerName.isEmpty()) {
layerName = unicodeLayerName;
}
}
infoBlocks[key] = infoBlock;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment