Hello,

I've been spending some time in pai's MTS engine on Peace and Protection(PnP) and created a dark theme. I like using the font Consolas and before applying a new theme PnP checks whether a font exists with this function:


Code:
alias -l font.exists {
  var %chr = 32
  while (%chr < 127) {
    if (($width($chr(%chr),$1-,100) != $width($chr(%chr),$1- bold,100)) || ($height($chr(%chr),$1-,100) != $height($chr(%chr),$1- bold,100))) return 1
    inc %chr
  }
  return 0
}


This code returns 1 for Courier New, Times New Roman, Verdana, FixedSys etc. However it returns 0 for Consolas or - my new favorite - Hack (https://github.com/chrissimpkins/Hack)

Without going into com objects to query for installed fonts, I wanted to float the feature suggestion of $font(Consolas).exists identifier and property that returns True if a Font exists on a machine and False if it doesn't.

Thanks for reading!

kind regards,


GNU Terry Pratchett - Looking for a mIRC help channel -> Check #mircscripting @ irc.swiftirc.net