[Tex/LaTex] Different format for Chapter in Table of Contents

table of contentstocloft

I have changed the default table of contents format:

\usepackage[titles]{tocloft}
\setlength{\cftbeforechapskip}{0pt}
\setcounter{tocdepth}{0}

\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}

the chapter now are no more in bold. Now I would like to have Table of Contents and Bibliography bold references :

 \tableofcontents
 \addcontentsline{toc}{chapter}{\bf{Bibliography}}
 \addtocontents{toc}{\vspace{\normalbaselineskip}}
[...]
 \printbibliography
 \addtocontents{toc}{\vspace{\normalbaselineskip}}
 \addcontentsline{toc}{chapter}{\bf{Bibliography}}

but this way the page number doesn't appear bold. How can I do to modify just the format of some voices?

EDIT

This is my MWE

\documentclass{book}
\usepackage{blindtext}
\usepackage[titles]{tocloft}
\setlength{\cftbeforechapskip}{0pt}
\setcounter{tocdepth}{0}
\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}
\begin{document}
 \frontmatter
 \tableofcontents
 \addcontentsline{toc}{chapter}{\bf{Contents}}
 \addtocontents{toc}{\vspace{\normalbaselineskip}}
 \mainmatter
 \Blinddocument
 \backmatter
 \chapter*{Bibliography}
 \addtocontents{toc}{\vspace{\normalbaselineskip}}
 \addcontentsline{toc}{chapter}{\bf{Bibliography}}
\end{document}

In the PDF, in the table of contents "Contents" and "Bibliography" are bold but not their pagenumbers. I would like also the pagenumbers to be bold

Best Answer

Temporary changes to the style of the fonts in ToC should be written to the ToC itself with \addtocontents{toc}{\begingroup\protect\renewcommand{...}{...}} etc.

I have defined a new command named \addwithboldpagenumber for this since there are two occurences of such additions, so there is some benefit of shorter code then.

Also don't use the deprecated command \bf but \bfseries or \textbf{}.

\documentclass{book}
\usepackage{blindtext}
\usepackage[titles]{tocloft}
\setlength{\cftbeforechapskip}{0pt}
\setcounter{tocdepth}{0}
\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}

\newcommand{\addwithboldpagenumber}[1]{%
  \addtocontents{toc}{\begingroup\protect\renewcommand{\protect\cftchappagefont}{\protect\bfseries}}%
  \addcontentsline{toc}{chapter}{\bfseries#1}%
  \addtocontents{toc}{\endgroup}%
}


\begin{document}
 \frontmatter
 \tableofcontents
 \addwithboldpagenumber{\contentsname}
 \addtocontents{toc}{\vspace{\normalbaselineskip}}
 \mainmatter
 \Blinddocument
 \backmatter
 \chapter*{\bibname}
 \addtocontents{toc}{\vspace{\normalbaselineskip}}
 \addwithboldpagenumber{\bibname}
\end{document}

enter image description here