This is a follow-up from Page numbering at the bottom right of the page, when the page margin is very small.
Based on the solution provided by @David Carlisle (related to the page numbering at the bottom center of the page), I tried to move the page numbering to the bottom right corner of the page:
\documentclass{article}
\usepackage[a4paper,
left = 0.2cm,
right = 0.2cm,
top = 0.1cm,
bottom = 0.5cm]{geometry}
\usepackage{lipsum}
% \pagestyle{plain}
\setlength\footskip{1pt}
\def\thepage{\smash{\raisebox{.2pt}{---\arabic{page}---}}}
\usepackage{fancyhdr}
\fancyhf{}
\pagestyle{fancy}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\begin{document}
\lipsum[1-5]
\lipsum[1-5]
\lipsum[1-5]
\lipsum[1-5]
\lipsum[1-5]
\lipsum[1-5]
\end{document}
However, it works properly only when bottom = 0.5cm or larger than 0.5mm.
Is there a way to make the page numbering work for bottom = 0.2cm? Maybe with some overlap with the text?

