mIRC Home    About    Download    Register    News    Help

Print Thread
#232649 14/06/11 09:22 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
I planned on making a picwin character map but ran into a problem: there's no way to get a list of installed fonts, so I suggest:
Code:
$font(name|N)
  Returns $true if the specified font is installed, if not $false
  You can specify a number to return the Nth installed font name
  if N is zero the total number of installed fonts is returned



I am SReject
My Stuff
FroggieDaFrog #232667 14/06/11 10:01 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Good idea. Here's a scripted version, but it returns the font's file name rather than the name of the font.

Code:
alias -l fontdir {
  if (%windowsfontdir) { return $v1 }
  var %object = fonts $+ $ticks
  .comopen %object wscript.shell
  noop $com(%object,expandenvironmentstrings,3,bstr,% $+ windir%\fonts\)
  if ($com(%object).result != $null) { set %windowsfontdir $v1 }
  .comclose %object
  return %windowsfontdir
}
alias font {
  if ($1 !isnum) { return $iif($isfile($fontdir $+ $1.ttf) || $isfile($fontdir $+ $1.fon),$true,$false) }
  return $findfile($fontdir,*,$1)
}


You also have to use things like $font(times) rather than $font(times new roman) frown

hixxy #232670 15/06/11 01:40 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Exactly.


I am SReject
My Stuff
FroggieDaFrog #232673 15/06/11 05:30 AM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Definitely a good idea.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
FroggieDaFrog #232810 24/06/11 05:35 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
After thinking about this so more, I have decided to edit my suggestion:

Code:
$font(name|N)
  Returns the name of the font(or $Null) if the specified font is installed.

  You can specify a number to return the Nth installed font name
  if N is zero the total number of installed fonts is returned

  Properties: .fname, .type, .sizes
    .fname will return the path\file to the specified font
    .type will return the type of font. TrueType for example
    .Sizes will return a space delimited string of supported sizes or $Null if the font supports all sizes.



I am SReject
My Stuff

Link Copied to Clipboard