  We present a calculation of the scalar, vector, and tensor form factors for
the pion and kaon in lattice QCD. We use an ensemble of two degenerate light, a
strange and a charm quark ($N_f=2+1+1$) of maximally twisted mass fermions with
clover improvement. The corresponding pion and kaon masses are about 265 MeV
and 530 MeV, respectively. The calculation is done in both rest and boosted
frames obtaining data for four-vector momentum transfer squared up to
$-q^2=2.5$ GeV$^2$ for the pion and 3 GeV$^2$ for the kaon. The excited-states
effects are studied by analyzing six values of the source-sink time separation
for the rest frame ($1.12-2.23$ fm) and for four values for the boosted frame
($1.12-1.67$ fm). The lattice data are renormalized non-perturbatively and the
results for the scheme- and scale-dependent scalar and tensor form factors are
presented in the $\overline{\rm MS}$ scheme at a scale of 2 GeV. We apply
different parametrizations to describe $q^2$-dependence of the form factors to
extract the scalar, vector, and tensor radii, as well as the tensor anomalous
magnetic moment. We compare the pion and kaon form factors to study SU(3)
flavor symmetry breaking effects. By combining the data for the vector and
tensor form factors we also obtain the lowest moment of the densities of
transversely polarized quarks in the impact parameter space. Finally, we give
an estimate for the average transverse shift in the $y$ direction for polarized
quarks in the $x$ direction.
