Dot gain is a classic problem in digital printing that causes printed halftones and text to appear darker than desired. For printing of text, we propose a method to preprocess the image sent to the printer in order to compensate for dot gain. It is based on an accurate model that predicts the printed absorptance for given local neighborhood in the digital image, a cost function to penalize lack of fidelity to the desired target text image, and the use of direct binary search (DBS) to minimize the cost.