Before I made this script I rarely used anything but the default font, but with this tool I find it much easier to select a font to use on a project.
Notes:
- To use this script you will first need to get the font list from here: https://pastebin.com/uKdFfD1M
then copy it into a .txt file named "Font Family List.txt" saved into the same folder as the script.
When I made the list I only added the default fonts that I had when I got my computer, if you are missing any from my list the script will give you a error when you select
that font. If that happens, just remove that font from the text file and rerun the script.
- If you have fonts that are not on the list you can just add them to the text file
- There are two commented out hotkeys at the bottom of the script that can be used to create a new font list if needed.
- If the font editor is not the active window it will shrink down to about 50x20 pixels in the bottom right corner. I think I did this because I would often have multiple gui's
running at once and this made jumping to the editor quicker. The point is, it can take a few mins to get used to it shrinking.
- If you switch fonts/size/etc too many times the script will crash. When it does, just remember what font options you were at and hit the reload button and continue
from where you were. As far as I have been able to tell, there is nothing else that can be done about this, but after the first few times it happens you will get used to it.
- The script will auto generate the code for your selected font, just copy it and paste it into your script and adjust the "Q" value as needed (1-5)
Code: Select all
;Written By: Hellbent aka. CivReborn
;Written For: The CivReborn YouTube Channel (https://www.youtube.com/user/CivReborn/featured)
;Date Written: May 1st, 2017
;PasteBin Link Of Script: https://pastebin.com/E9tLF47g
;PasteBin Link Of Font Text Doc:https://pastebin.com/uKdFfD1M
#SingleInstance,Force
SetWorkingDir,%A_ScriptDir%
OnMessage(0x201, "WM_LBUTTONDOWN")
Edit_Color:= "White"
Set_Window_Size:=0
Family:=0
;Loading Font Faimly Dir
;-------------------------------
FileRead,Temp,Font Family List.txt
Font_Family_Index := 0
loop, read,Font Family List.txt
{
Font_Family%A_Index% :=A_LoopReadLine
Font_Family0 = %A_Index%
}
Loop,%Font_Family0%
{
if A_Index = 1
List2 .= Font_Family%A_Index% . "||"
else if A_Index != 1
List2 .= Font_Family%A_Index% . "|"
}
;-------------------------------------------------------
;Loading Font Favourites Dir
;-------------------------------
FileRead,Temp,Font Favourites.txt
Font_Favorites_Index := 0
loop, read,Font Favourites.txt
{
Font_Favorites%A_Index% :=A_LoopReadLine
Font_Favorites0 = %A_Index%
}
Loop,%Font_Favorites0%
{
if A_Index = 2
List1 .= Font_Favorites%A_Index% . "||"
else
List1 .= Font_Favorites%A_Index% . "|"
}
;-------------------------------------------------------
Gui, 1:Color,Gray,
Gui, 1:Add, Groupbox, xm ym-5 w830 h150 center Section,Options
Gui, 1:Add, Groupbox, xs+10 ym+20 w220 h55 Section,Font Family
Gui, 1:Add, DropDownList,xs+5 ys+20 w200 r20 Sort vFont_Family_Selected gCheck ,%List2%
Gui, 1:Add, Groupbox, xs w220 h55 Section,Favourites
Gui, 1:Add, DropDownList,xs+10 ys+20 w200 r20 Sort vFont_Favorites gCheck1,%List1%
Gui, 1:Add, Groupbox, x250 ym+20 w120 h117 Section,Save / Delete
Gui, 1:Add, Button, xs+10 ys+20 w100 h30 gAdd_To_Favourites,Add To Favourites
Gui, 1:Add, Button, xp yp+55 w100 h30 gRemove_From_Favourites,Remove From Favourites
Gui, 1:Add, Groupbox, x380 ym+20 w220 h55 Section,Type Colour
Gui, 1:Add, DropDownList,xs+10 ys+20 w200 r20 vFont_Color gUpdate_Font,Black||Silver|Gray|White|Maroon|Red|Purple|Fuchsia|Green|Lime|Olive|Yellow|Navy|Blue|Teal|Aqua|
Gui, 1:Add, Groupbox, xs w220 h55 Section,Type Size
Gui, 1:Font,cBlack s16 Bold
Gui, 1:Add, Edit, xs+10 ys+20 w180 h30 vFont_Size gUpdate_Font
Gui, 1:Add, UpDown, range1-200,12
Gui, 1:Font,
Gui, 1:Add, Groupbox,x610 ym+20 w220 h55 Section,Background Colour
Gui, 1:Add, DropDownList,xs+10 ys+20 w200 r20 vEdit_Color gUpdate_Edit,Black|Silver|Gray|White||Maroon|Red|Purple|Fuchsia|Green|Lime|Olive|Yellow|Navy|Blue|Teal|Aqua|
Gui, 1:Add, Checkbox, xs ys+65 w100 BackgroundTrans vBold_Font gUpdate_Font,Bold
Gui, 1:Add, Checkbox, x+20 ys+65 BackgroundTrans vUnderline_Font gUpdate_Font,Underline
Gui, 1:Add, Checkbox, xs yp+30 w100 BackgroundTrans vItalic_Font gUpdate_Font,Italic
Gui, 1:Add, Checkbox, x+20 w100 BackgroundTrans vStrike_Font gUpdate_Font,Strike
Gui, 1:Color,Gray,%Edit_Color%
Gui, 1:Add, Edit, xm w830 h270 vFont_Display,Sample Text`n1 2 3 4 5 6 7 8 9 0`na A b B c C d D e E f F g G h H i I j J k K l L m M n N o O p P q Q r R s S t T u U v V w W x X y Y z Z
Gui, 1:Add, Edit, xm w730 h20 vGui_Display,
Gui, 1:Add, Button, x+10 w90 h20 gReload,Reload
Gui,1:+AlwaysOnTop
Gui,1:-Caption ;+Owner
Gui, 1:Show, x500 y100 w850 h470,Font Tool
SetTimer,Watch_Window,400
return
Watch_Window:
WinGetTitle,Active_Window,A
if(Active_Window!="Font Tool"&&Set_Window_Size==0)
{
WinGetTitle,New_Active_Window,A
Gui,1:Show,x1300 y700 w50 h20,Font Tool
WinActivate,%New_Active_Window%
Set_Window_Size:=1
}
if(Active_Window=="Font Tool"&&Set_Window_Size==1)
{
Gui, 1:Show,x500 y100 w850 h470,Font Tool
Set_Window_Size:=2
}
if(Set_Window_Size==2&&Active_Window!="Font Tool")
{
Set_Window_Size:=0
}
return
GuiClose:
ExitApp
Reload:
Reload
return
Check:
Family:=0
gosub, Update_Font
return
Check1:
Family:=1
gosub, Update_Font
return
Update_Edit:
Gui, 1:Submit,NoHide
Gui, 1:Color,,%Edit_Color%
return
Update_Font:
Gui, 1:Submit,NoHide
Gui,1:Font,
if(Font_Size>200)
{
Font_Size:=200
GuiControl,1:,Font_Size,200
}
if(Font_Size<1)
{
Font_Size:=1
GuiControl,1:,Font_Size,1
}
if(Bold_Font==1)
Bold1:="Bold"
if(Bold_Font==0)
{
Gui,1:Font,
Bold1:=""
}
if(Underline_Font==1)
Underline1:="Underline"
if(Underline_Font==0)
{
Gui,1:Font,
Underline1:=""
}
if(Italic_Font==1)
Italic1:= "Italic"
if(Italic_Font==0)
{
Gui,1:Font,
Italic1:=""
}
if(Strike_Font==1)
Strike1:="Strike"
if(Strike_Font==0)
{
Gui,1:Font,
Strike1:=""
}
if(Family==0)
{
Gui,1:Font,
Gui, 1:Font,c%Font_Color% s%Font_Size% %Underline1% %Bold1% %Italic1% %Strike1% Q4,%Font_Family_Selected%
Gui_Out := Font_Family_Selected
}
if(Family==1)
{
Gui,1:Font
Gui, 1:Font,c%Font_Color% s%Font_Size% %Underline1% %Bold1% %Italic1% %Strike1% Q4,%Font_Favorites%
Gui_Out := Font_Favorites
}
GuiControl,1:Font,Font_Display
Gui,1:Font,
Gui,1:Font,c%Font_Color%
GuiControl,1:Font,Gui_Display
Gui,1:Font,s16
GuiControl,1:Font,Font_Size
GuiControl,1:,Gui_Display,% "Gui,Font,c" Font_Color " s" Font_Size " " Underline1 " " Bold1 " " Italic1 " " Strike1 " Q4," Gui_Out
Gui,1:Font,
return
Add_To_Favourites:
FileAppend,%Font_Family_Selected%`n,Font Favourites.txt
GuiControl,1:,Font_Favorites,%Font_Family_Selected%
return
Remove_From_Favourites:
MsgBox, 262144, Remove Font Family From Favourites, Open the file called Font Favourites.txt and delete the one you don't want anymore.`n`nDid you think I was going to do everything for you? For free? `nlol you are funny lol`n`nNo really just delete the font family from the text doc and you are good to go.
Run, Font Favourites.txt
return
WM_LBUTTONDOWN() {
IfWinActive,Font Tool
PostMessage, 0xA1, 2
}
;~ ~Up::
;~ MouseGetPos,,,Active_Window,Ctrl
;~ ControlGetText, TUM , %Ctrl%, ahk_id %Active_Window%
;~ FileAppend,%TUM%`n,Temp text file to test.txt
;~ return
;~ ~Down::
;~ MouseGetPos,,,Active_Window,Ctrl
;~ ControlGetText, TUM , %Ctrl%, ahk_id %Active_Window%
;~ FileAppend,%TUM%`n,Temp text file to test.txt
;~ return
Esc::ExitApp