Linear displacement encoder sensors extensively appear in high-precision instruments, in which the core scale is usually bonded with the scale base by adhesives. However, the curing shrinkage of the adhesives often causes a warping deformation of the moving ruler, which in turn leads to a decrease in measurement accuracy. To improve the accuracy of the bonding assembly, this paper proposes a novel deformation compensation method. A force control fixture is first designed, and a tensile force is applied to tense the scale base. The scale is then bonded to the scale base, and the tensile force is maintained until the adhesive is cured. The optimal tensile force is determined to minimize the warping deformation by combining a finite-element simulation and an artificial fish swarm algorithm. The optimal result is verified experimentally, where the warping deformation is measured using a homemade three-dimensional digital image correlation system. The experimental results demonstrate that the warping deformation of the moving ruler is reduced by 89.2% using the proposed method.