If I have a letter of type "(vertical) rectangle with rounded corners" and put it in a \colorbox{<fillcolor>}{text}
, is there a way to set the colorbox-parameters so that exactly the inner area is filled with color?
Problem: The 'rounded corners' makes the task difficult. The setting \setlength{\fboxsep}{-0.57505pt}
is probably not enough.
Hint 1: I created the "(vertical) rectangle with rounded corners" myself using FontForge.
For a test example, I used U+25A2 "White Square with Rounded Corners"
(because I only found a square with rounded corners, not a rectangle) with the font Cambria.ttf
.
The font is not important for the test example and can also be replaced, as long as the font contains U+25A2
.
Hint 2: There is certainly something with TikZ, tcolorbox etc. But I try to find out whether one can do that with the normal \colorbox
(!).
\documentclass[margin=5pt]{standalone}
\usepackage{xcolor}
\usepackage{fontspec}
\newfontfamily\myfont{Cambria}% a font that contains U+25A2
\newcommand\mychar{\myfont\char"25A2}%U+25A2 ---> White Square with Rounded Corners
\begin{document}
\setlength{\fboxsep}{-0.57505pt}
Test: \colorbox{yellow}{\mychar}
\end{document}