Skip to content

Instantly share code, notes, and snippets.

@oakaigh
Created January 11, 2020 21:10
Show Gist options
  • Save oakaigh/2f970d18c7fe3832a29b22e25d658787 to your computer and use it in GitHub Desktop.
Save oakaigh/2f970d18c7fe3832a29b22e25d658787 to your computer and use it in GitHub Desktop.
function otf2psf() {
local res=72 fontsize=16 cpos=256 avgwid=80
for fontloc in "$@"; do
local fontname="$(basename -- "${fontloc}" .otf)"
otf2bdf -r ${res} -p ${fontsize} ${fontloc} | sed -e "s/AVERAGE_WIDTH.*/AVERAGE_WIDTH ${avgwid}/" > ${fontname}.bdf
bdf2psf --fb ${fontname}.bdf /usr/share/bdf2psf/standard.equivalents /usr/share/bdf2psf/required.set+/usr/share/bdf2psf/useful.set ${cpos} ${fontname}.psf
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment