A printer, comprising: feeding means for feeding a printing medium in an auxiliary scanning direction; printing means comprising a plurality of heating elements arrayed in a main scanning direction, the main scanning direction being orthogonal to the auxiliary scanning direction, the plurality of heating elements being adapted to perform printing of one line at a time on the printing medium fed in the auxiliary scanning direction by the feeding means, the one line extending in the main scanning direction; first specifying means for specifying numbers of ON dots for at least a first specified block and a second specified block among a plurality of lines that make up a printed pattern, the first specified block being one of a plurality of blocks, each of the plurality of blocks including a first specified number of lines, the second specified block being another of the plurality of blocks and including a line to be printed before the first specified block, and the number of ON dots being a number of heating elements, among the plurality of heating elements, to be operated when the printing of one line is performed; second specifying means for specifying first speeds that respectively correspond to at least the first specified block and the second specified block based on the numbers of ON dots that have been specified by the first specifying means; setting means for setting a second speed based on the first speeds that respectively correspond to the first specified block and the second specified block, such that the printing medium is fed by the feeding means at the first speed for the first specified block when the printing of the first specified block is performed by the printing means, the second speed being a feed speed of the printing medium fed by the feeding means when the printing of the second specified block is performed by the printing means; and control means for controlling the feeding means and the printing means such that the printing medium is fed by the feeding means at the second speed when the printing of the second specified block is performed by the printing means. feeding means for feeding a printing medium in an auxiliary scanning direction; printing means comprising a plurality of heating elements arrayed in a main scanning direction, the main scanning direction being orthogonal to the auxiliary scanning direction, the plurality of heating elements being adapted to perform printing of one line at a time on the printing medium fed in the auxiliary scanning direction by the feeding means, the one line extending in the main scanning direction; first specifying means for specifying numbers of ON dots for at least a first specified block and a second specified block among a plurality of lines that make up a printed pattern, the first specified block being one of a plurality of blocks, each of the plurality of blocks including a first specified number of lines, the second specified block being another of the plurality of blocks and including a line to be printed before the first specified block, and the number of ON dots being a number of heating elements, among the plurality of heating elements, to be operated when the printing of one line is performed; second specifying means for specifying first speeds that respectively correspond to at least the first specified block and the second specified block based on the numbers of ON dots that have been specified by the first specifying means; setting means for setting a second speed based on the first speeds that respectively correspond to the first specified block and the second specified block, such that the printing medium is fed by the feeding means at the first speed for the first specified block when the printing of the first specified block is performed by the printing means, the second speed being a feed speed of the printing medium fed by the feeding means when the printing of the second specified block is performed by the printing means; and control means for controlling the feeding means and the printing means such that the printing medium is fed by the feeding means at the second speed when the printing of the second specified block is performed by the printing means.