9

I need to write large fonts which are included in nodes of a tikzpicture. When I change scale, everything changes but not fonts. Here´s my code:

\documentclass[10pt,a4paper]{book}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=2.5]

\path [fill=red] (0cm,1.5576cm)--(0cm,.6227cm).. controls (.05cm,.28cm) and (.25cm,.17cm) ..(.6512cm,0cm)--(.6512cm,.9076cm) .. controls (.4cm,1cm)and(.1cm,1.1cm)..(0cm,1.5576cm)--cycle;

\path [fill=red](0cm,1.5576cm).. controls (.12cm,1.2cm)and(.45cm,1.1cm)..(.8118cm,.9918cm)--(.8118cm,.0931cm)--(.9764cm,.2014cm)--(.9764cm,1.0681cm) .. controls (.45cm,1.12cm)and(.15cm,1.31cm)..(0cm,1.5576cm)--cycle;

\path [fill=red](0cm,1.5576cm).. controls (.2cm,1.32cm)and(.7cm,1.21cm)..(1.141cm,1.1644cm)--(1.141cm,.3418cm) .. controls (1.2781cm,.4793cm).. (1.3016cm,.6227cm)--(1.3016cm,1.2727cm) .. controls (.7cm,1.3cm)and(.2cm,1.4cm)..(0cm,1.5576cm)--cycle;

\path [fill=red] (0cm,1.5576cm).. controls (.2cm,1.47cm)and(.7cm,1.3cm)..(1.3016cm,1.4212cm)--(1.3016cm,1.5576cm) .. controls (.7cm,1.42cm)and(.2cm,1.49cm)..(0cm,1.5576cm)--cycle;

\draw (2,1.5) node {\fontsize{52}{58}\sffamily\bfseries TEXT};

\end{tikzpicture}



\end{document}
Isai
  • 4,153

1 Answers1

12

If you load a font that will scale properly, then your example will work without scaling. If you want to use the standard Computer Modern, then load the fix-cm package. Otherwise, load the lmodern package. Scaling on the picture specifically doesn't apply to node text in TikZ by default.

As noted in the comments, it's better style to put the font parameters as part of the font key of the node rather than directly inside the node itself.

See How to specify an arbitrary (possibly non-integer) font size in LaTeX for more information on font sizes.

\documentclass[10pt,a4paper]{book}

\usepackage{tikz}
%\usepackage{fix-cm}
\usepackage{lmodern} 
\begin{document}

\begin{tikzpicture}

\path [fill=red] (0cm,1.5576cm)--(0cm,.6227cm).. controls (.05cm,.28cm) and
   (.25cm,.17cm) ..(.6512cm,0cm)--(.6512cm,.9076cm) .. controls
   (.4cm,1cm)and(.1cm,1.1cm)..(0cm,1.5576cm)--cycle;

\path [fill=red](0cm,1.5576cm).. controls (.12cm,1.2cm)and(.45cm,1.1cm)..
   (.8118cm,.9918cm)--(.8118cm,.0931cm)--(.9764cm,.2014cm)--(.9764cm,1.0681cm) ..
   controls (.45cm,1.12cm)and(.15cm,1.31cm)..(0cm,1.5576cm)--cycle;

\path [fill=red](0cm,1.5576cm).. controls (.2cm,1.32cm)and(.7cm,1.21cm)..
   (1.141cm,1.1644cm)--(1.141cm,.3418cm) .. controls (1.2781cm,.4793cm)..
   (1.3016cm,.6227cm)--(1.3016cm,1.2727cm) .. controls (.7cm,1.3cm)and(.2cm,1.4cm)..
   (0cm,1.5576cm)--cycle;

\path [fill=red] (0cm,1.5576cm).. controls (.2cm,1.47cm)and(.7cm,1.3cm)..
   (1.3016cm,1.4212cm)--(1.3016cm,1.5576cm) .. controls
   (.7cm,1.42cm)and(.2cm,1.49cm)..(0cm,1.5576cm)--cycle;

\draw (2,1.5) node[font=\fontsize{52}{58}\sffamily\bfseries]{TEXT};

\end{tikzpicture}
\end{document}

output of code

Alan Munn
  • 218,180