[Tex/LaTex] Tikz-adjust node size according to text length

tikz-pgf

I want to create a rectangle with Tikz as a background for a text. It will be a headline for my custom titlepage. I created the rectangle node and a node for the text separately. I want to change the rectangle's size(automatically) depending on the size of the text, but if i write a long text it falls off the rectangle. I read a lot of questions and answers and the tikz documentation, but I can't solve it. It's similar when creating flowchart where the the rectangle changes according to the text size.

(edit) Here is a working example:(I use XeLaTeX)

\documentclass[12pt,a4paper]{report}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{anyfontsize}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay, inner sep=0pt,outer sep=0pt]

\node [rectangle,inner sep=0pt, fill=blue, anchor=north west, minimum width=198mm, minimum height=24.5mm,xshift=20mm,yshift=0mm] 
(boxtitle) at (current page.west){};

\node[anchor = west, align = left, font=\bfseries, color=white,xshift=0mm] at (boxtitle.west) 
{\fontsize{35}{1}\selectfont Headline headline headline\\ \\ \fontsize{35}{1}\selectfont headline headline \\ \\ \fontsize{36}{1}\selectfont headline headline};

\end{tikzpicture}   

\end{document}

Best Answer

You don't need two nodes but only one:

\documentclass[12pt,a4paper]{report}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
%\usepackage{fontspec}
%\setmainfont{Arial}
\usepackage{anyfontsize}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay, inner sep=0pt,outer sep=0pt]

\node [rectangle,inner sep=0pt, fill=blue, anchor=north west, minimum width=198mm, minimum height=24.5mm,xshift=20mm,yshift=0mm,font=\bfseries, text=white,align=left]
(boxtitle) at (current page.west){\fontsize{35}{1}\selectfont Headline headline headline\\ \\ \fontsize{35}{1}\selectfont headline headline \\ \\ \fontsize{36}{1}\selectfont headline headline};

\end{tikzpicture}

\end{document}

enter image description here