Implemented according to official documentation, fileformat.info and a lot of trial and error. Writing text layer with "vertical" orientation may result in broken PSD ...