\documentclass{article}
\pagestyle{empty}

\usepackage{fontspec}
\usepackage{amsfonts}
\usepackage{amsmath}
\def\mathbfbb#1{\text{\normalfont\fontspec{bfbb.ttf}#1}}
\def\mybf{\bf\boldmath\let\mathbb\mathbfbb}
\def\Z{\mathbb{Z}}

\begin{document}

\centerline{\Large\bf Building and using bfbb}
\medskip
\centerline{Daniel J. Bernstein, 24 April 2024}
\bigskip

In boldface definitions, boldface section titles, etc., \verb|\bf\boldmath| almost works,
but it doesn't affect \verb|\mathbb|:
for example, it turns $\Z/12\Z$ into {\bf\boldmath $\Z/12\Z$}.

Solution: replace \verb|\bf\boldmath| with \verb|\mybf|,
which turns $\Z/12\Z$ into {\mybf $\Z/12\Z$}.
Internally, \verb|\mybf| uses a new font bfbb that thickens the \verb|\mathbb| lines,
leaving a slight space between the lines.
More examples (see macro definitions below):
$$
\begin{tabular}{|l|l|}
\hline
$\mathbb{Z}$
&
\verb|$\mathbb{Z}$|
\\
$\mathbfbb{Z}$
&
\verb|$\mathbfbb{Z}$|
\\
{\mybf $\mathbb{Z}$}
&
\verb|{\mybf $\mathbb{Z}$}|
\\
$\Z/12\Z$
&
\verb|$\Z/12\Z$|
\\
{\mybf $\Z/12\Z$}
&
\verb|{\mybf $\Z/12\Z$}|
\\
$\operatorname{Hom}_{\Z/12}$
&
\verb|$\operatorname{Hom}_{\Z/12}$|
\\
{\mybf $\operatorname{Hom}_{\Z/12}$}
&
\verb|{\mybf $\operatorname{Hom}_{\Z/12}$}|
\\
\hline
\end{tabular}
$$
Horizontal spacing for bfbb is slightly wider than regular bfbb:
$$
\begin{tabular}{|l|r|}
\hline
$\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}+xyz$&text XYZ
\\
{\mybf $\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}+xyz$}&{\bf text XYZ}
\\
\hline
\end{tabular}
$$

Some files attached to this PDF:
A simple \verb|bfbb.py| script
uses \verb|mftrace| to convert some \verb|amsfonts| files into
\verb|bfbb.tfm| and \verb|bfbb.ttf| in this directory.
This document is produced by \verb|bfbb.tex|,
which uses the following packages and macros, which rely on this directory having \verb|bfbb.tfm| and \verb|bfbb.ttf|:
\begin{verbatim}
    \usepackage{fontspec}
    \usepackage{amsfonts}
    \usepackage{amsmath}
    \def\mathbfbb#1{\text{\normalfont\fontspec{bfbb.ttf}#1}}
    \def\mybf{\bf\boldmath\let\mathbb\mathbfbb}
    \def\Z{\mathbb{Z}}
\end{verbatim}
This has been tested in both \verb|xelatex| and \verb|lualatex|.
It won't work in \verb|pdflatex|.

A different approach, without a separate bfbb font, is
\begin{verbatim}
    $\pdfliteral{2 Tr 0.25 w}\mathbb{Z}\pdfliteral{0 Tr 0 w}$
\end{verbatim}
in \verb|lualatex|
after \verb|\usepackage{luatex85}|.
A variant that works in both \verb|xelatex| and \verb|lualatex|
(see also \verb|xfakebold|, which also covers \verb|pdflatex|) is
\begin{verbatim}
    $\special{pdf:literal 2 Tr 0.25 w}\mathbb{Z}
     \special{pdf:literal 0 Tr 0 w}$
\end{verbatim}
producing
$\special{pdf:literal 2 Tr 0.25 w}\mathbb{Z}
 \special{pdf:literal 0 Tr 0 w}$
(vs.~bfbb $\mathbfbb{Z}$ and regular $\mathbb{Z}$;
side by side:
$\special{pdf:literal 2 Tr 0.25 w}\mathbb{Z}
 \special{pdf:literal 0 Tr 0 w}\mathbfbb{Z}\mathbb{Z}$),
but this scales badly in some PDF readers (e.g., Evince),
appearing much too heavy when the user zooms out.

There's also
\verb|$\pmb{\mathbb{Z}}$|
producing $\pmb{\mathbb{Z}}$,
which looks okay from a distance
but not close up.
More options: DSSerif; mathalpha.

\end{document}
