We study the energy spectrum of a two-dimensional electron in the presence of both a perpendicular magnetic field and a potential. In the limit where the potential is small compared to the Landau level spacing, we show that the broadening of Landau levels is simply expressed in terms of the structure factor of the potential. For potentials that are either periodic or random, we recover known results. Interestingly, for potentials with a dense Fourier spectrum made of Bragg peaks (as found, e.g., in quasicrystals), we find an algebraic broadening with the magnetic field characterized by the hyperuniformity exponent of the potential. Furthermore, if the potential is self-similar such that its structure factor has a discrete scale invariance, the broadening displays log-periodic oscillations together with an algebraic envelope.