  Multifractal formalism is designed to describe the distribution at small
scales of the elements of $\mathcal M^+_c(\R^d)$, the set of positive, finite
and compactly supported Borel measures on $\R^d$. It is valid for such a
measure $\mu$ when its Hausdorff spectrum is the upper semi-continuous function
given by the concave Legendre-Fenchel transform of the free energy function
$\tau_\mu$ associated with $\mu$; this is the case for fundamental classes of
exact dimensional measures.
  For any function $\tau$ candidate to be the free energy function of some
$\mu\in \mathcal M^+_c(\R^d)$, we build such a measure, exact dimensional, and
obeying the multifractal formalism. This result is extended to a refined
formalism considering jointly Hausdorff and packing spectra. Also, for any
upper semi-continuous function candidate to be the lower Hausdorff spectrum of
some exact dimensional $\mu\in\mathcal M^+_c(\R^d)$, we build such a measure.
  Our results transfer to the analoguous inverse problems in multifractal
analysis of H\"older continuous functions.
