How to make the system use its own font
Posted: Fri May 22, 2020 9:54 pm
How do I make the system use my own font? So that the interface is displayed correctly on any computer with any version of Windows?
Donnay Software Web Forums
http://bb.mobile.donnay-software.com/Donnay/
http://bb.mobile.donnay-software.com/Donnay/viewtopic.php?f=2&t=2731
Code: Select all
DC_XbpMenuConfig( ;
{ GRA_CLR_WHITE,; // 1 - Sub Menu Background Color
fColor,; // 2 - Sub Menu Vertical Bar Foreground Color
bColor,; // 3 - Sub Menu Vertical Bar Background Color
GRA_CLR_BLACK,; // 4 - Sub Menu Outline Color
'8.MS Sans Serif Bold', ; // 5 - Sub Menu Vertical Bar Font
.F., ;
'8.MS Sans Serif', ; // 6 - Sub Menu Check Character Font
'b', ; // 7 - Sub Menu Check Character
fColor,; // 8 - Menu Bar Foreground Color
bColor, ; // 9 - Menu Bar Background Color
GRA_CLR_BLACK,; // 10 - Sub Menu Foreground Color
'8.MS Sans Serif' } ) // 11 - Menu Bar Font
Code: Select all
Hi,
You can put all the needed fonts is a subfolder of your application. Then load them when you start.
Code:
************************
FUNCTION InstallFonts() // <<<===################################
************************
Local aList := directory(".\fonts\*.ttf")
Local i , cFont , cPath:=Disk_dir
for i := 1 to len(aList)
cFont := cPath+'\fonts\'+aList[i][F_NAME]
DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", cFont )
next
RETURN NIL
It is also a good idea to remove them when you close your application.
Code:
************************
FUNCTION RemoveFonts()
************************
Local aList := directory(".\fonts\*.ttf")
Local i , cFont , cPath:=Disk_dir , nGo , nteller := 1
for i := 1 to len(aList)
cFont := cPath+'\fonts\'+aList[i][F_NAME]
nTeller := 1
nGo := 999
do while nGo > 0 .and. nTeller < 20 // try up to 20 times to remove is the result 'ngo' is bigger than nul.
nGo := DllCall("GDI32.DLL", DLL_STDCALL, "RemoveFontResourceA", cFont )
nTeller ++
enddo
next
RETURN NIL
you have to sendEugene Lutsenko wrote:I tried it, but it didn't work out
Code: Select all
SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0)
Code: Select all
cTest := SUBSTR( cTxt, 30, 1 ) // 0-29 / 1-30
// look for Codepage
DO CASE
CASE cTest = CHR( 0x01 )
_CodePage := "DOS 437"
CASE cTest = CHR( 0x02 )
_CodePage := "DOS 850"
CASE cTest = CHR( 0x03 )
_CodePage := "WIN 1251"
CASE cTest = CHR( 0xC8 )
_CodePage := "WIN 1250"
CASE cTest = CHR( 0x64 )
_CodePage := "DOS 852"
CASE cTest = CHR( 0x65 )
_CodePage := "DOS 865"
CASE cTest = CHR( 0x66 )
_CodePage := "DOS 866"
OTHERWISE
_CodePage := STR( ASC( cTest ) )
// ??? mehr
ENDCASE
i guess i can, under Windows 10, when using Codepage "Russian WINDOWS-1" and "RUWIN" as Nation-LanguageEugene Lutsenko wrote:I am more concerned about the correct display of the interface language on computers with fonts without Cyrillic
Code: Select all
STATIC FUNCTION WinCodePage()
LOCAL cRet := ""
LOCAL aLangName := { "Basque", ;
"Czech 852", ;
"Czech ISO-8859-2", ;
"Czech KAM", ;
"Catalan", ;
"English", ;
"French", ;
"Galician", ;
"German Ansi", ;
"German OEM", ;
"Hebrew 862", ;
"Hebrew 1255", ;
"Hungarian 852", ;
"Hungarian CWI-2", ;
"Hungarian WINDOWS-1", ;
"Italian", ;
"Polish 852", ;
"Polish ISO-8859-1", ;
"Polish Mozowia", ;
"Portuguese", ;
"Romanian", ;
"Russian WINDOWS-1", ;
"Serbian ISO-8859-2", ;
"Serbian 852", ;
"Spanish" }
LOCAL aLangID := { "EU", ;
"CS852", ;
"CSISO", ;
"CSKAM", ;
"CA", ;
"EN", ;
"FR", ;
"GL", ;
"DEWIN", ;
"DE850", ;
"HE862", ;
"HEWIN", ;
"HU852", ;
"HUCWI", ;
"HUWIN", ;
"IT", ;
"PL852", ;
"PLISO", ;
"PLMAZ", ;
"PT", ;
"RO", ;
"RUWIN", ;
"SRISO", ;
"SR852", ;
"ES" }