- NSIS Discussion
- Create Font API Function
Archive: Create Font API Function
deguix
12th September 2003 01:31 UTC
Create Font API Function
I published a function (called CreateFont API) that I made when I had a personal computer (beggining of July), now I made another change on the function, so please, someone test the function and report here, so I can know that I'm in the right way.
kichik
12th September 2003 09:14 UTC
The signature link points to the wrong page.
deguix
12th September 2003 20:45 UTC
Fixed. Appear me that no one tested and reported to at least say that is working... Maybe if no one is talking, it's working, isn't?
kichik
12th September 2003 20:52 UTC
Well, personally, I don't see why you need it when you have CreateFont... Unless I've missed something it does exactly the same, only with System. The only addition is that it can set the font to a certain window which can be useful, but why use System for it? It also doesn't work with the normal points unit.
deguix
12th September 2003 21:01 UTC
What you mean with "doesn't work with the normal points unit"?
[EDIT]I know, the simplest way to use it is using the CreateFont command, but you know that every function I do, is to do something only the program NSIS don't do or to enhance something already existant... See the function again, and say if is the SAME thing.[/EDIT]
kichik
12th September 2003 21:04 UTC
You need to make a special conversion using MulDiv of the height given in order for the user to be able to use the points unit. If I remember correctly, the fonts come out it in the wrong size and even worse when the DPI is different. I'm not sure of the exact outcome, but I do know you're supposed to make that conversion in order for it to work as the user expects. See MSDN's documentation about CreateFont's parameter nHeight for more information.
[edit]As I've said, same but only with the window setting. I still don't see why you'd want to use System instead of CreateFont even for that.[/edit]
deguix
12th September 2003 21:23 UTC
nHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72)
And how to convert this function to use with NSIS? (or with System.dll)
kichik
12th September 2003 21:26 UTC
NSIS's CreateFont already uses it. If you want to use it with System just call it like any other function, it's in Kernel32.dll.
deguix
12th September 2003 21:34 UTC
Hummm... To see this in a public computer isn't so good... but just to know, is only put that code as it is or have to do changes to work right?
kichik
12th September 2003 21:40 UTC
Well, your function will work anyway, but without that extra MulDiv something goes wrong. I think the font size is always wrong and looks especially wrong when the DPI is different. Testing it would probably give you the best answer.
deguix
13th September 2003 20:52 UTC
I'm saying the MulDiv code, is only put it as it is or have to do changes to work right?
kichik
13th September 2003 21:00 UTC
Put it as is. To get the DC use GetDC on $HWNDPARENT.
deguix
16th September 2003 01:09 UTC
I know that is easy after these explainations but I want this function (MulDiv) to be ready to use, give me the complete code...
(Now I have a computer to work in, but don't have internet, and uses the Win95 (I got from the trash the hard disk), so Kichik, you have a tarball compressed development snapshoot? Because is too big to put in a diskette)
[EDIT](And only the plugins UNCOMPRESSED of ZipDll and UnTGZ?)
kichik
16th September 2003 10:14 UTC
The complete code is:
font_size = -MulDiv(font_size,GetDeviceCaps(GetDC($HWNDPARENT),LOGPIXELSY),72)
There is no tarball version of the snapshot, just ZIP. But if you don't have enough space on the diskette you can remove a few plug-ins that you won't use, some graphics, docs and even the language files.
deguix
17th September 2003 01:13 UTC
Thanks for the code...
But if you don't have enough space on the diskette you can remove a few plug-ins that you won't use, some graphics, docs and even the language files.
How, if public computers doesn't have WinZip? (Have a way to donwload all the new files, without downloading files one-to-one on CVS and not using more space than the diskette supports?)
kichik
17th September 2003 09:09 UTC
Well, if you can download a zip file, why can't you download WinZip in a zip file? Even a command line program will do.
deguix
17th September 2003 22:09 UTC
Well, if you can download a zip file, why can't you download WinZip in a zip file? Even a command line program will do.
I have a program to decompress .zip files in my machine, and I'm not permited to install anything in public library computers. The problem is, I have a computer without internet, and I want to pass files got from internet of library computers to it by diskettes. NSIS development Snapshot don't fit in a diskette, and I can't install WinZip in a library machine to split it. So, what can I do to I install NSIS development snapshot in my machine, fitting the installation program in my diskette?
kichik
20th September 2003 10:23 UTC
This one for example, will allow to change ZIP files contests and it doesn't require an install. It just extracts the files in it to the current directory (extract them to temp or something like that). Using this unzip program you can change the zip file contents and delete things you don't need.
Joost Verburg
20th September 2003 12:00 UTC
1) First copy the unzip application and use multiple disks to store the snapshot.
2) Split the installer file, put it on mulitple disks and put the stuff together using normal DOS commands.
deguix
20th September 2003 21:38 UTC
Thanks, I downloaded but I will use it in a public computer Monday.
deguix
22nd September 2003 22:22 UTC
Hummm... I took a look on this, and it don't split zip files. The one solution is, make a program with NSIS to unzip all the files on a temp directory, try to put 'em all into diskette, and when it fills, put it in another diskette... so will don't use much things of public libraries computers. But if the file inside the zip is bigger (uncompressed) than 1,44 mb, adios. But is a re-starting point, to get all I need...
(these programs don't work itself because they close automatically after execution, and I cannot use the "Run" start menu command or run the "command.com" program)
Joost Verburg
23rd September 2003 15:57 UTC
You can also split a file without using zip or anything else and combine the parts using DOS commands.
deguix
24th September 2003 01:08 UTC
Spliting by notepad or other program to edit files? Notepad and Wordpad are worst in editing files, other programs aren't allowed in public library computers.
But a function that will save from the "diskette darkness", a really easy thing... maybe it can arrive in archive tomorrow (if someone got the idea, maybe can do it first than me). Thanks for all!
deguix
26th September 2003 01:32 UTC
Ops, no function, but I get a splitter program, and I'm using it now. Thanks Kichik and Joost. (NOW I'M UPDATED!)
deguix
29th September 2003 21:40 UTC
font_size = -MulDiv(font_size,GetDeviceCaps(GetDC($HWNDPARENT),LOGPIXELSY),72)
Hmmmm... put the code to use with the System.dll... like System::Call "Something...".
kichik
29th September 2003 23:35 UTC
Not tested:
!define LOGPIXELSY 90
StrCpy $0 8 # font size
System::Call "user32::GetDC(i $HWNDPARENT) i .s"
System::Call "gdi32::GetDeviceCaps(i s, i ${LOGPIXELSY}) i .s"
System::Call "kernel32::MulDiv(i $0, i s, 72) i .r0"
deguix
11th October 2003 21:10 UTC
Too late... but I tested it yesterday and I made one fix, but it works good. Thanks Kichik! (I will update Create Font API soon!)