  Heavy quark fragmenting jet functions describe the fragmentation of a parton
into a jet containing a heavy quark, carrying a fraction of the jet momentum.
They are two-scale objects, sensitive to the heavy quark mass, $m_Q$, and to a
jet resolution variable, $\tau_N$. We discuss how cross sections for heavy
flavor production at high transverse momentum can be expressed in terms of
heavy quark fragmenting jet functions, and how the properties of these
functions can be used to achieve a simultaneous resummation of logarithms of
the jet resolution variable, and logarithms of the quark mass. We calculate the
heavy quark fragmenting jet function $\mathcal G_Q^Q$ at $\mathcal
O(\alpha_s)$, and the gluon and light quark fragmenting jet functions into a
heavy quark, $\mathcal G_g^Q$ and $\mathcal G_l^Q$, at $\mathcal
O(\alpha_s^2)$. We verify that, in the limit in which the jet invariant mass is
much larger than $m_Q$, the logarithmic dependence of the fragmenting jet
functions on the quark mass is reproduced by the heavy quark fragmentation
functions. The fragmenting jet functions can thus be written as convolutions of
the fragmentation functions with the matching coefficients $\mathcal J_{i j}$,
which depend only on dynamics at the jet scale. We reproduce the known matching
coefficients $\mathcal J_{i j}$ at $\mathcal O(\alpha_s)$, and we obtain the
expressions of the coefficients $\mathcal J_{g Q}$ and $\mathcal J_{l Q}$ at
$\mathcal O(\alpha_s^2)$. Our calculation provides all the perturbative
ingredients for the simultaneous resummation of logarithms of $m_Q$ and
$\tau_N$.
