Jump to content



Photo

Font Info Udf


  • Please log in to reply
4 replies to this topic

#1 Simucal

Simucal

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 777 posts

Posted 02 May 2006 - 05:32 AM

This is my first UDF and if my headers do not meet the standard that everyone uses then please let me know.

The work for Font Info UDF stems from a question posted in the support forums about retreiving a list of fonts installed on the system and finding their corresponding filename. So I wrote two functions.

;=============================================================================== ; ; Function Name: _FontGetList() ; Description: Returns an array with a list of all fonts currently installed on the system. ; Parameter(s): $i_opt - An Integer, 0 or 1.  0 will create a 1D array with font names only. ;                                             1 will create a 2d array with font names in the first column, font file names in the second ; Requirement(s): None ; Return Value(s): 1D-2D Array = [0] or [0][0] Contains total number of fonts. ; Author(s): Simucal <simucal@gmail.com> ; Revision: 20060501A ; ;===============================================================================


Examples (Click for screenshot of array, using Blindwigs _Array1Box):

_FontGetList(0)
_FontGetList(1)


;=============================================================================== ; ; Function Name: _FontSearchList() ; Description: Returns an array with search results of font names/file names from a specified search string. (i.e. "Wingding" or "ding") ; Parameter(s): $s_SearchString - A string, the name of the font you are searching for. ; $i_opt - An Integer, 0 or 1.  0 will create a 1D array with font names that match $s_SearchString. ;                               1 will create a 2d array with font names that match $s_SearchString the first column, and their corresponding font file names in the second ; Requirement(s): $s_SearchString, must be a string. ; Return Value(s): 1D-2D Array = Fonts Found, [0] or [0][0] Contains total number of fonts matched. ;                 0 = no font matched the $s_SearchString ; Author(s): Simucal <simucal@gmail.com> ; Revision: 20060501A ; ;===============================================================================


Examples (Click for screenshot of array, using Blindwigs _Array1Box):

_FontSearchList("ding")
_FontSearchList("Arial",1)


If anyone has any other font functions they want written, let me know and I'll add them.
-Simucal

EDIT: Added in a RegExpReplace to get rid of words like "(TrueType)" in font names.

Attached Files


Edited by Simucal, 06 May 2006 - 05:47 AM.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)







#2 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,729 posts

Posted 02 May 2006 - 08:06 AM

Nice job Simucal, I'll look a bit deeper later... but it worked well (the first UDF hadn't tried the 2nd yet).

How about a "_FontDefault()" With the option to return the default font, or change it?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.


#3 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 02 May 2006 - 03:55 PM

Nice UDF simucal. i like the way it lists fonts with a specific string in their name
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

#4 gseller

gseller

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,057 posts

Posted 03 April 2007 - 07:05 PM

This is my first UDF and if my headers do not meet the standard that everyone uses then please let me know.

The work for Font Info UDF stems from a question posted in the support forums about retreiving a list of fonts installed on the system and finding their corresponding filename. So I wrote two functions.

;=============================================================================== ; ; Function Name: _FontGetList() ; Description: Returns an array with a list of all fonts currently installed on the system. ; Parameter(s): $i_opt - An Integer, 0 or 1.  0 will create a 1D array with font names only. ;                                             1 will create a 2d array with font names in the first column, font file names in the second ; Requirement(s): None ; Return Value(s): 1D-2D Array = [0] or [0][0] Contains total number of fonts. ; Author(s): Simucal <simucal@gmail.com> ; Revision: 20060501A ; ;===============================================================================

Examples (Click for screenshot of array, using Blindwigs _Array1Box):

_FontGetList(0)
_FontGetList(1)
;=============================================================================== ; ; Function Name: _FontSearchList() ; Description: Returns an array with search results of font names/file names from a specified search string. (i.e. "Wingding" or "ding") ; Parameter(s): $s_SearchString - A string, the name of the font you are searching for. ; $i_opt - An Integer, 0 or 1.  0 will create a 1D array with font names that match $s_SearchString. ;                               1 will create a 2d array with font names that match $s_SearchString the first column, and their corresponding font file names in the second ; Requirement(s): $s_SearchString, must be a string. ; Return Value(s): 1D-2D Array = Fonts Found, [0] or [0][0] Contains total number of fonts matched. ;                 0 = no font matched the $s_SearchString ; Author(s): Simucal <simucal@gmail.com> ; Revision: 20060501A ; ;===============================================================================

Examples (Click for screenshot of array, using Blindwigs _Array1Box):

_FontSearchList("ding")
_FontSearchList("Arial",1)
If anyone has any other font functions they want written, let me know and I'll add them.
-Simucal

EDIT: Added in a RegExpReplace to get rid of words like "(TrueType)" in font names.

Hello...
I know it has been a while since posted, get an error when trying to run. I compiled and same error. Am I running it wrong? Are there any prereqs to running it?

Error: "Func" Statement has no matching :EndFunc"

ThankS
JD

#5 Simucal

Simucal

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 777 posts

Posted 17 April 2007 - 03:54 PM

Remove the last function in the file, it is incomplete for some reason. The font dialog one.

Edited by Simucal, 17 April 2007 - 03:54 PM.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users