[Class] CustomFont - Load font from file or resource, without needed install to system.

Post your working scripts, libraries and tools for AHK v1.1 and older
m3user
Posts: 235
Joined: 17 Jan 2014, 18:11

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

18 Oct 2019, 04:36

Thanks tmplinshi, looks promising. Unfortunately I only get a rectangle image on the menu, regardless of the icon no.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

18 Oct 2019, 04:58

Works fine here with latest AHK U32/U64. I've packed all necessary files, you can download at: https://drive.google.com/open?id=1a1_RYPLDjE88d90ppc-ealUX3VhGJFxj
m3user
Posts: 235
Joined: 17 Jan 2014, 18:11

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

18 Oct 2019, 08:12

Thanks, very kind. I tried on Win10 and it works great. :D
It still doesn't work on my Win7 machine, I'll check what might be the issue.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

23 Oct 2019, 07:28

m3user wrote:
18 Oct 2019, 08:12
Thanks, very kind. I tried on Win10 and it works great. :D
It still doesn't work on my Win7 machine, I'll check what might be the issue.
Guess what, It works on Win10, it's because the font "Segoe MDL2 Assets" is a built-in font on Win10 :shock:
Then I tried another font generated by http://fontello.com/, it didn't work.

Here is another method without using Class_CustomFont.ahk.

Code: Select all

SetWorkingDir %A_ScriptDir%

#Include <Gdip_All>
#Include <Subtitle> ; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=36384

pToken := Gdip_Startup()

hFamily := Gdip_CreateFontFamilyFromFile("fontello.ttf")
pBitmap := Subtitle.RenderToBitmap(Chr(0xe800), {color:"Transparent"}, {s:24, hFamily:hFamily, color:"black"})
hIcon := Gdip_CreateHICONFromBitmap(pBitmap)

Menu, TestMenu, Add, Smile, MenuOnClick
Menu, TestMenu, Icon, Smile, hIcon:%hIcon%,, 24
Menu, TestMenu, Show
Menu, TestMenu, Delete

Gdip_Shutdown(pToken)
ExitApp

Gdip_CreateFontFamilyFromFile(FontFile, FontName := "") {
	if !FileExist(FontFile)
		throw "Font file not exist: " . FontFile

	DllCall("gdiplus\GdipNewPrivateFontCollection", "ptr*", hCollection)

	; FileRead, fontData, *c %FontFile%
	; DllCall("gdiplus\GdipPrivateAddMemoryFont", "ptr", hCollection, "ptr", &fontData, "uint", VarSetCapacity(fontData))
	DllCall("gdiplus\GdipPrivateAddFontFile", "ptr", hCollection, "str", FontFile)

	if (FontName = "") {
		VarSetCapacity(pFontFamily, 10, 0)
		DllCall("gdiplus\GdipGetFontCollectionFamilyList", "ptr", hCollection, "int", 1, "ptr", &pFontFamily, "int*", found)

		VarSetCapacity(FontName, 100)
		DllCall("gdiplus\GdipGetFamilyName", "ptr", NumGet(pFontFamily, 0, "ptr"), "str", FontName, "ushort", 1033)
	}

	DllCall("gdiplus\GdipCreateFontFamilyFromName", "str", FontName, "ptr", hcollection, "uint*", hFamily)
	return hFamily
}

MenuOnClick(ItemName) {
	MsgBox, % ItemName
}
Note that I added 3 lines to Subtitle.ahk:

Code: Select all

      ; Create Font.
      if style2.hFamily
         hFamily := style2.hFamily
      else
         hFamily := (___ := Gdip_FontFamilyCreate(f)) ? ___ : Gdip_FontFamilyCreate("Arial") ; Default font is Arial.
Attachments
Gidplus load ttf font file example.zip
(37.37 KiB) Downloaded 133 times
m3user
Posts: 235
Joined: 17 Jan 2014, 18:11

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

23 Oct 2019, 09:26

It works, thanks!

But not sure Class_CustomFont is a problem. First part of this works in Win7:

Code: Select all

SetWorkingDir %A_ScriptDir%

#Include <Gdip_All>
#Include <Subtitle> ; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=36384
#Include <Class_CustomFont>

font1 := New CustomFont("SegMDL2.ttf")
gui, font, s12, Segoe MDL2 Assets
gui, add, text,, % chr(0xE713)
gui, show

pToken := Gdip_Startup()
pBitmap := Subtitle.RenderToBitmap(Chr(0xE713), "color:Transparent", "s:24 f:(Segoe MDL2 Assets) color:black")
hIcon := Gdip_CreateHICONFromBitmap(pBitmap)

Menu, TestMenu, Add, Settings, MenuOnClick
Menu, TestMenu, Icon, Settings, hIcon:%hIcon%,, 24
Menu, TestMenu, Show
Menu, TestMenu, Delete
ExitApp

MenuOnClick(ItemName) {
	MsgBox, % ItemName
}
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

27 Oct 2019, 11:46

I will include this into the GDI+ library edition I created. It works great.

Please let me know if you wish not to have it included in my GDI+ lib.

Best regards, Marius.

tmplinshi wrote:
23 Oct 2019, 07:28
m3user wrote:
18 Oct 2019, 08:12
Thanks, very kind. I tried on Win10 and it works great. :D
It still doesn't work on my Win7 machine, I'll check what might be the issue.
Guess what, It works on Win10, it's because the font "Segoe MDL2 Assets" is a built-in font on Win10 :shock:
Then I tried another font generated by http://fontello.com/, it didn't work.

Here is another method without using Class_CustomFont.ahk.

Code: Select all

SetWorkingDir %A_ScriptDir%

#Include <Gdip_All>
#Include <Subtitle> ; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=36384

pToken := Gdip_Startup()

hFamily := Gdip_CreateFontFamilyFromFile("fontello.ttf")
pBitmap := Subtitle.RenderToBitmap(Chr(0xe800), {color:"Transparent"}, {s:24, hFamily:hFamily, color:"black"})
hIcon := Gdip_CreateHICONFromBitmap(pBitmap)

Menu, TestMenu, Add, Smile, MenuOnClick
Menu, TestMenu, Icon, Smile, hIcon:%hIcon%,, 24
Menu, TestMenu, Show
Menu, TestMenu, Delete

Gdip_Shutdown(pToken)
ExitApp

Gdip_CreateFontFamilyFromFile(FontFile, FontName := "") {
	if !FileExist(FontFile)
		throw "Font file not exist: " . FontFile

	DllCall("gdiplus\GdipNewPrivateFontCollection", "ptr*", hCollection)

	; FileRead, fontData, *c %FontFile%
	; DllCall("gdiplus\GdipPrivateAddMemoryFont", "ptr", hCollection, "ptr", &fontData, "uint", VarSetCapacity(fontData))
	DllCall("gdiplus\GdipPrivateAddFontFile", "ptr", hCollection, "str", FontFile)

	if (FontName = "") {
		VarSetCapacity(pFontFamily, 10, 0)
		DllCall("gdiplus\GdipGetFontCollectionFamilyList", "ptr", hCollection, "int", 1, "ptr", &pFontFamily, "int*", found)

		VarSetCapacity(FontName, 100)
		DllCall("gdiplus\GdipGetFamilyName", "ptr", NumGet(pFontFamily, 0, "ptr"), "str", FontName, "ushort", 1033)
	}

	DllCall("gdiplus\GdipCreateFontFamilyFromName", "str", FontName, "ptr", hcollection, "uint*", hFamily)
	return hFamily
}

MenuOnClick(ItemName) {
	MsgBox, % ItemName
}
Note that I added 3 lines to Subtitle.ahk:

Code: Select all

      ; Create Font.
      if style2.hFamily
         hFamily := style2.hFamily
      else
         hFamily := (___ := Gdip_FontFamilyCreate(f)) ? ___ : Gdip_FontFamilyCreate("Arial") ; Default font is Arial.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
doubledave22
Posts: 343
Joined: 08 Jun 2019, 17:36

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

04 Feb 2021, 11:16

Anyone know why Class_CustomFont.ahk might fail?

Here is a snip of the code below:

Code: Select all

#Include Class_CustomFont.ahk

fileinstall, Images\logos\Lato-Regular.ttf ,% Base_Folder "Images\logos\Lato-Regular.ttf"
font1 := New CustomFont(Base_Folder "Images\logos\Lato-Regular.ttf")

gui, font, s13 cWhite underline, Lato
gui, add, text, backgroundtrans xs+11 w225 center ys+15, Profiles
On all systems I have tested on this works completely fine (top picture). A user has sent me a screenshot and the text is all random characters (bottom picture).
https://gyazo.com/15e8ae23e07f5b577e738f8ee0aca59e
vanheartnet098
Posts: 61
Joined: 01 Sep 2020, 09:49

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

19 Apr 2023, 20:31

@tmplinshi
@robodesign
do you know how to make it work on gdip bitmaps? I cant make it work in my bitmaps. Its only working on Default Gui controls but not on bitmaps.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

20 Apr 2023, 03:31

vanheartnet098 wrote:
19 Apr 2023, 20:31
@tmplinshi
@robodesign
do you know how to make it work on gdip bitmaps? I cant make it work in my bitmaps. Its only working on Default Gui controls but not on bitmaps.
If you use my GDI+ library [found in my footer], you can load a font to use it to draw texts in bitmaps, without preinstalling it on the system.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
vanheartnet098
Posts: 61
Joined: 01 Sep 2020, 09:49

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

21 Apr 2023, 00:19

robodesign wrote:
20 Apr 2023, 03:31
vanheartnet098 wrote:
19 Apr 2023, 20:31
@tmplinshi
@robodesign
do you know how to make it work on gdip bitmaps? I cant make it work in my bitmaps. Its only working on Default Gui controls but not on bitmaps.
If you use my GDI+ library [found in my footer], you can load a font to use it to draw texts in bitmaps, without preinstalling it on the system.

Best regards, Marius.
I already tried your GDI+ library but Im having problems when Im using it. My script is almost done just having trouble with the custom fonts, I Attached 2 images , 1st is using the original GDI+ lib then the 2nd is what looks like when i use your GDI+ Lib the whole bitmap becomes blurry except the default controls. I tried your example even that doesnt seems to work even how many times I change the Fontfile.

Code: Select all

hFamily := Gdip_CreateFontFamilyFromFile(A_AppData "\Fonts\PLANK.ttf","Planet Kosmos")

Gdip_CreateFontFamilyFromFile(FontFile, FontName := "") {
	if !FileExist(FontFile)
		throw "Font file not exist: " . FontFile
	DllCall("gdiplus\GdipNewPrivateFontCollection", "ptr*", hCollection)

	;~ ;FileRead, fontData, *c %FontFile%
	;~ ;DllCall("gdiplus\GdipPrivateAddMemoryFont", "ptr", hCollection, "ptr", &fontData, "uint", VarSetCapacity(fontData))
	DllCall("gdiplus\GdipPrivateAddFontFile", "ptr", hCollection, "str", FontFile)

	if (FontName = "") {
		VarSetCapacity(pFontFamily, 10, 0)
		DllCall("gdiplus\GdipGetFontCollectionFamilyList", "ptr", hCollection, "int", 1, "ptr", &pFontFamily, "int*", found)

		VarSetCapacity(FontName, 100)
		DllCall("gdiplus\GdipGetFamilyName", "ptr", NumGet(pFontFamily, 0, "ptr"), "str", FontName, "ushort", 1033)
	}

	DllCall("gdiplus\GdipCreateFontFamilyFromName", "str", FontName, "ptr", hcollection, "uint*", hFamily)
	return hFamily
}
This example also not working :(
Attachments
Image-20230421131215-5.png
Image-20230421131215-5.png (6.8 KiB) Viewed 2087 times
Image-20230421131235-6.png
Image-20230421131235-6.png (6.32 KiB) Viewed 2087 times
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

21 Apr 2023, 04:26

Lol, @vanheartnet098 . You are using it wrong.

Code: Select all

#SingleInstance, Force
#NoEnv
SetBatchLines, -1

#Include, Lib\Gdip_All.ahk

; Start gdi+
If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}
OnExit, Exit

; Set the width and height we want as our drawing area, to draw everything in. This will be the dimensions of our bitmap
Width :=1400, Height := 1050

; Create a layered window (+E0x80000 : must be used for UpdateLayeredWindow to work!) that is always on top (+AlwaysOnTop), has no taskbar entry or caption
Gui, 1: -Caption -DPIScale +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs

; Show the window
Gui, 1: Show, NA

; Get a handle to this window we have created in order to update it later
hwnd1 := WinExist()

; Create a gdi bitmap with width and height of what we are going to draw into it. This is the entire drawing area for everything
hbm := CreateDIBSection(Width, Height)

; Get a device context compatible with the screen
hdc := CreateCompatibleDC()

; Select the bitmap into the device context
obm := SelectObject(hdc, hbm)

; Get a pointer to the graphics of the bitmap, for use with drawing functions
G := Gdip_GraphicsFromHDC(hdc)

; Set the smoothing mode to antialias = 4 to make shapes appear smother (only used for vector drawing and filling)
Gdip_SetSmoothingMode(G, 4)

; fill the background 
pBrushBgr := Gdip_BrushCreateSolid("0xddeeffee")
Gdip_FillRectangle(G, pBrushBgr, 1, 1, 990, 990)

; draw text with custom font
FontName := "E:\twins\artworks\texte\zgandurele-vol2\Northwell-Font\TTF\Northwell.ttf"
Gdip_TextToGraphics(G, "Hello world", "c003300 w990 h990 Center vCenter s50", FontName)

; Delete the brush as it is no longer needed and wastes memory
Gdip_DeleteBrush(pBrushBgr)

; Update the specified window we have created (hwnd1) with a handle to our bitmap (hdc), specifying the x,y,w,h we want it positioned on our screen
; So this will position our gui at (0,0) with the Width and Height specified earlier
UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width, Height)

; Select the object back into the hdc
SelectObject(hdc, obm)

; Now the bitmap may be deleted
DeleteObject(hbm)

; Also the device context related to the bitmap may be deleted
DeleteDC(hdc)

; The graphics may now be deleted
Gdip_DeleteGraphics(G)
Return

;#######################################################################

Esc::
GoSub, Exit
Return

Exit:
; gdi+ may now be shutdown on exiting the program
Gdip_Shutdown(pToken)
ExitApp
Return
That is how you use it.

To run it, download latest GDI+ lib from Github. Version 1.95. Released today.
Oh, and point FontName to an existing file on your PC.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
vanheartnet098
Posts: 61
Joined: 01 Sep 2020, 09:49

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

21 Apr 2023, 08:53

robodesign wrote:
21 Apr 2023, 04:26
Lol, @vanheartnet098 . You are using it wrong.
That is just an Example i copied from this thread.
robodesign wrote:
21 Apr 2023, 04:26
That is how you use it.

To run it, download latest GDI+ lib from Github. Version 1.95. Released today.
Oh, and point FontName to an existing file on your PC.

Best regards, Marius.
This is the same sample you posted and i dont know why but it doesnt really work on my pc.
here below your code I didnt change anything except the fontname and im sure its exist on my pc.
1st image is your GDIP 1.95
2nd image is the font that supposed to appear on your sample but it wont.

Code: Select all

; gdi+ ahk tutorial 1 written by tic (Tariq Porter)
; Requires Gdip_all.ahk v1.69
; GDI+ library compilation of user contributed GDI+ functions
; made by Marius ?ucan: https://github.com/marius-sucan/AHK-GDIp-Library-Compilation
;

#SingleInstance, Force
#NoEnv
SetBatchLines, -1

; Uncomment if Gdip.ahk is not in your standard library
;~ #Include <Gdip_All>
#Include <GDI_Marius>
;~ #Include <Gdip_Fonts>
;~ #Include <Class_CustomFont>
;~ #Include <Subtitle>
; Start gdi+
#SingleInstance, Force
#NoEnv
SetBatchLines, -1


if not A_IsAdmin
{
	Run, *RunAs "%A_ScriptFullpath%"
	ExitApp
}

; Start gdi+
If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}
OnExit, Exit

; Set the width and height we want as our drawing area, to draw everything in. This will be the dimensions of our bitmap
Width :=1400, Height := 1050

; Create a layered window (+E0x80000 : must be used for UpdateLayeredWindow to work!) that is always on top (+AlwaysOnTop), has no taskbar entry or caption
Gui, 1: -Caption -DPIScale +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs

; Show the window
Gui, 1: Show, NA

; Get a handle to this window we have created in order to update it later
hwnd1 := WinExist()

; Create a gdi bitmap with width and height of what we are going to draw into it. This is the entire drawing area for everything
hbm := CreateDIBSection(Width, Height)

; Get a device context compatible with the screen
hdc := CreateCompatibleDC()

; Select the bitmap into the device context
obm := SelectObject(hdc, hbm)

; Get a pointer to the graphics of the bitmap, for use with drawing functions
G := Gdip_GraphicsFromHDC(hdc)

; Set the smoothing mode to antialias = 4 to make shapes appear smother (only used for vector drawing and filling)
Gdip_SetSmoothingMode(G, 4)

; fill the background 
pBrushBgr := Gdip_BrushCreateSolid("0xddeeffee")
Gdip_FillRectangle(G, pBrushBgr, 1, 1, 990, 990)

; draw text with custom font
;~ FontName := "E:\twins\artworks\texte\zgandurele-vol2\Northwell-Font\TTF\Northwell.ttf"
FontName := A_AppData "\Fonts\PLANK.ttf"
Gdip_TextToGraphics(G, "Hello world", "c003300 w990 h990 Center vCenter s50", FontName )

; Delete the brush as it is no longer needed and wastes memory
Gdip_DeleteBrush(pBrushBgr)

; Update the specified window we have created (hwnd1) with a handle to our bitmap (hdc), specifying the x,y,w,h we want it positioned on our screen
; So this will position our gui at (0,0) with the Width and Height specified earlier
UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width, Height)

; Select the object back into the hdc
SelectObject(hdc, obm)

; Now the bitmap may be deleted
DeleteObject(hbm)

; Also the device context related to the bitmap may be deleted
DeleteDC(hdc)

; The graphics may now be deleted
Gdip_DeleteGraphics(G)
Return


Esc::
GoSub, Exit
Return

Exit:
; gdi+ may now be shutdown on exiting the program
Gdip_Shutdown(pToken)
ExitApp
Return
[\Code]
Attachments
1.png
1.png (35.55 KiB) Viewed 2061 times
2.png
2.png (62.12 KiB) Viewed 2061 times
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

21 Apr 2023, 09:34

Maybe it's an unsupported font.
Or... maybe app data folder is inaccessible. Try to move the file in c:/temp/

Or... Try other fonts. GDIp is limited on what fonts it can handle.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
vanheartnet098
Posts: 61
Joined: 01 Sep 2020, 09:49

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

21 Apr 2023, 09:59

robodesign wrote:
21 Apr 2023, 09:34
Maybe it's an unsupported font.
Or... maybe app data folder is inaccessible. Try to move the file in c:/temp/

Or... Try other fonts. GDIp is limited on what fonts it can handle.

Best regards, Marius.
App data is accessible and i already tried moving the fontfile on the scriptfolder.
Can you attach a link of fontfile that you are using?

I attached the Fontfile can you show me a screenshot, if the font working on you?
Attachments
planet-kosmos.zip
(16.46 KiB) Downloaded 27 times
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

21 Apr 2023, 15:41

On my system, it works with the plank.ttf file you provided.

Proof: https://i2.paste.pics/13e9f2b90c4714b7d79f62026afbd983.png

I'm using ahk 64 bits, Unicode version. Windows 10 x64.

So, I suppose you are doing something wrong. I do not know what. Please make sure you are using the correct library.

Maybe some other people are willing to try it as well .

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
vanheartnet098
Posts: 61
Joined: 01 Sep 2020, 09:49

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

21 Apr 2023, 17:46

Im using ahk 32bit ANSI maybe thats the problem.

And the library i downloaded on your github has your name on it on folder ahk v.1.1 name GDip_All.ahk. Im sure its the correct library besides the script wont run on the original gdip lib.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

22 Apr 2023, 02:34

Next time use the MS-DOS edition :-)
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
vanheartnet098
Posts: 61
Joined: 01 Sep 2020, 09:49

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

22 Apr 2023, 04:21

robodesign wrote:
22 Apr 2023, 02:34
Next time use the MS-DOS edition :-)
Does that mean your lib is not 32bit compatible?
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

22 Apr 2023, 06:34

vanheartnet098 wrote:
22 Apr 2023, 04:21
robodesign wrote:
22 Apr 2023, 02:34
Next time use the MS-DOS edition :-)
Does that mean your lib is not 32bit compatible?
It should be compatible with 32 bits Unicode..... , not ANSI.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
vanheartnet098
Posts: 61
Joined: 01 Sep 2020, 09:49

Re: [Class] CustomFont - Load font from file or resource, without needed install to system.

22 Apr 2023, 09:56

robodesign wrote:
22 Apr 2023, 06:34
It should be compatible with 32 bits Unicode..... , not ANSI.
Thanks that solves the problem :D :D :D

One thing I notice using your Gdip and the reason why my text becomes blurry (correction to what i said earlier not the whole bitmap is blurry) only the text created from gdip becomes blurry and i found the reason why

On the original Gdip i use this example code below:

Code: Select all

Brush := Gdip_BrushCreateSolid( "0xFF222222" )
Gdip_TextToGraphics( G , "VANHEARTNET" , "s25 Center vCenter Bold c" Brush " x29 y10" , "Arial black", 390 , 50 )
Gdip_DeleteBrush( Brush )
but on your version:

Code: Select all

Brush :="222222" 
Gdip_TextToGraphics( G , "VANHEARTNET" , "s25 Center vCenter Bold c" Brush " x29 y10" , "Arial black", 390 , 50 )
also, this only works on solid colors, I think... I tried line brush but wont work... I hope this is something could be Fix on the next release.
Thank you so much again for this... i can now continue my script... :bravo: :bravo: :bravo:

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: gwarble and 80 guests