A compact synchrotron is now under development at the National Institutes for Quantum Science and Technology (QST), with the goal of downsizing the heavy-ion therapy system with superconducting magnets conduction-cooled by GM cryocoolers. The synchrotron is required to accelerate several kinds of heavy-ion beams from 4 MeV/u to 430 MeV/u. A superconducting magnet with both dipole and quadrupole coils is adopted to generate a dipole field from 0.3 to 3.5 T and a quadrupole field from 0.1 to 1.5 T/m with a ramp rate of 0.6 T/s. A coil winding pattern and iron yoke are optimized to achieve field homogeneity in the required area. For the small-scale synchrotron, the coil ends are optimized with a novel parameter combining the beta function and multipole errors considering the beam dynamics.