Matrix functions, for example, computing the exponential, inverse, square root or logarithm of a matrix, are ubiquitous across computational science and engineering. They transform the eigenvalues of the input matrix by the target function. We present a general method for directly synthesising block encodings of matrix functions with exponential convergence in the number of unitaries. Beyond a target error, we exploit redundancy in the Fourier extension basis to produce a bounded, near-optimal subnormalisation, i.e. the scaling of the block within the unitary matrix. The method can be applied to implementing non-unitary operators, solving systems of linear equations, solving partial differential equations, and computing covariance matrices on quantum computers, for example.