[Tex/LaTex] How does \fontsize{}{} work

fontsize

With the package anyfontsize I can use the command \fontsize{}{}. But the second argument seems to be without any effect. I read there that it is related to the line space. It doesn't work.

\documentclass{article}
\usepackage{anyfontsize}
\begin{document}

{\fontsize{1cm}{1cm}\selectfont First test : I need to put some text here.}

\bigskip

{\fontsize{1cm}{2cm}\selectfont Second test : I need to put some text here --- does it work?}

\end{document}

enter image description here

Any clue?

Best Answer

You need to end the paragraph before you close the group. While the fontsize is updated when you issue \selectfont the new leading only is updated when the paragraph is ended. In your case the group ends (with }) before the paragraph ends (the empty line after the line end). Either write

{\fontsize{1cm}{2cm}\selectfont Second test : I need to put some text here ---
  does it work?

}

or use \par at the end:

{\fontsize{1cm}{2cm}\selectfont Second test : I need to put some text here ---
  does it work?\par}
\documentclass{article}
\usepackage{anyfontsize}
\begin{document}

{\fontsize{1cm}{1cm}\selectfont First test : I need to put some text here.\par}

\bigskip

{\fontsize{1cm}{2cm}\selectfont Second test : I need to put some text here ---
  does it work?\par}

\end{document}

enter image description here