Using codebooks of fragmented connected-component contours in forensic and historic writer identification