Jump to content


Photo

Font (un)install Dll (update 1.0.0.10)


  • Please log in to reply
20 replies to this topic

#1 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 09 September 2007 - 01:57 PM

Name: FontInstall DLL
Description: Installs any font file into windows (updates registry and any program that uses fonts such as MS WordPad/Word). Also, populates a realtime list of available fonts (that is, when a font is removed/installed the list changes).
Created for: IceMetalPunk
Coded by: Christian Sciberras
Compiled by: my Delphi7 Personal
Files Included: DLL, delphi source code, GM6 source code (all).
Download Now!
At Covac Software
View GML Script

An important update (1.0.0.16):
-better error handling.
-should fix a bug reported by Edhelcu.
-does not rely on Delphi VCL.
-hence compiles into a 12Kb dll!
A periodic new update (1.0.0.10):
-fixed buffer bug.
-uses stdcall.
-drastically decreased file size (only 155Kb in size).
-license limit removed; uses anywhere you want. Giving credit is not required.
-may be bundled with commercial projects (please do not commercialize the dll only).
-now hosted on our servers.
-rewritten license and copyright issue time :medieval:

Regards,
Christian

Edited by uuf6429, 07 May 2009 - 10:17 AM.

  • 0

#2 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 09 September 2007 - 02:23 PM

Aaaaw... Alright then :medieval:

Hmm, I tested it... if I give it a correct file (font) it will return true but the font won't be added.

Even more HMMMM. The file seems to be added anyway. Wordpad and font dialogs shows it, but it's not in the fonts folder nor can I uninstall it.

Nah, wait, that was the original file it used... Forget this post. Nothing works on Vista.

Edited by Daniel-Dane, 09 September 2007 - 03:09 PM.

  • 0

#3 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 09 September 2007 - 03:33 PM

As I wrote in the GML script, you must copy the font file into windows' fonts directory before using the install script and removing the file from the fonts directory after using the uninstall script. Better still change both scripts into:
// the previous comments should stay here
file_copy(argument0,fontdir_filename)
// dll call goes here
And
// the previous comments should stay here
file_delete(fontdir_filename)
// dll call goes here
fontdir_filename should be something like:
fontdir_filename=Get_Environment_Variable('windir')+'Fonts'+filename_name(argument0)
Make sure that there are slashes were needed.
  • 0

#4 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 09 September 2007 - 06:00 PM

Oooh. Will fix that. :ph34r:

Hmm, GM still doesn't recognize it. Must be non-supported font type (you know, GM is limited :lol:).

Edited by Daniel-Dane, 09 September 2007 - 06:09 PM.

  • 0

#5 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9603 posts
  • Version:GM:Studio

Posted 10 September 2007 - 12:55 AM

I don't know why, but this doesn't work at all for me. Check my post in the original request topic if you think you can help fix it...

BTW, I'm using GM6.1 (the only GM version I have on this computer until my laptop gets fixed, in maybe 2-3 business days) and a computer with the following specs:

Windows XP Home Edition
Pentium 4 Processor, 2GHz
504 MB RAM

-IMP :lol: :ph34r:
  • 0

:GM123: Are you an artist who likes creating original creature designs? Maybe you can help out with Elementa here! Give it a look; you might like the idea :)

:bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny:


#6 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 10 September 2007 - 12:44 PM

@ Daniel-Dane - Good, so did you check the font with another program? Did it work?
@ IMP - It should work with those specs. I'll check the topic and check why it didn't work.
  • 0

#7 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 10 September 2007 - 02:37 PM

It works with any other program...
  • 0

#8 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 11 September 2007 - 09:46 AM

I think GM changes font into textures when 'compiled' (an exe is built) so it can't detect other fonts after that. But if as IMP wants is using a browser window, the fonts should work.
  • 0

#9 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 11 September 2007 - 02:24 PM

I meant with font_add().
  • 0

#10 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 11 September 2007 - 04:11 PM

Well my last suggestion is using/testing another font.
  • 0

#11 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 11 September 2007 - 05:48 PM

The font type is the same as Arial.
  • 0

#12 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 12 September 2007 - 03:36 PM

Well unfortunately I can't do anything from my current position.
  • 0

#13 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 30 September 2007 - 06:57 PM

As people might now, I'm back with my pc running.
So, I redid all the dll and sources, and it works 100%.
Plus the dll tester is awesome. I recommend it to anyone passing around.
Regards,
Christian
  • 0

#14 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 19 April 2009 - 10:37 AM

Did a minor update (well nothing changed much). See the changelog in first post.
By th way, it's now hosted on the Covac Servers.

Regards,
Chris.
  • 0

#15 Edhelcu

Edhelcu

    GMC Member

  • GMC Member
  • 350 posts
  • Version:GM8.1

Posted 06 May 2009 - 06:38 PM

This is just the thing that I need for my game. However, I'm running into a problem whenever the FontInstall or FontUninstall script is executed - in whatever application I am using (your tester.exe or my own game), the view goes all black and I can't do anything. I open Task Manager and find that the program is not responding. I can End Task very easily - no problems there, it shuts right down, and the font gets installed/uninstalled on the computer. But I think you would agree that I can't have the game going into an unresponsive state every time I try to install a font.

EDIT: I've tried this on a few other computers. It acted the same way on the first one, but the other two computers installed the font and ran the game just fine. Whenever I try to install a new font on my own computer, the program still goes into a nonresponsive state.
EDIT AGAIN: Tried it on a few more computers, one of them can't even run the game outright - my friend boots it up and gets "this program has encountered and error and needs to close..."
The code I'm using looks like:

FontInit();

fonts = FontsGet("|");
if string_count("LCARS",fonts) = 0
{
  if file_exists('lcars.ttf') {FontInstall(working_directory+'\lcars.ttf');}
  else {show_message("FONT FILE lcars.ttf NOT FOUND. UNABLE TO INITIALIZE FONT.");
  show_message("Please ensure that the lcars.ttf file is in the same directory as the game executable, and/or re-download the program if you have lost the font file.");}
}

Help please.

Edited by Edhelcu, 06 May 2009 - 08:15 PM.

  • 0
Posted Image
Trekkieroids - Star Trek Asteroids, with PvP, online play, multiple ships/special abilities, and more
The Land of Eldoreth <-- WIP open RPG
The Zegowebe Invasion <-- vertical space scroller
Nibenon <-- 2d platformer with 15 levels

#16 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 06 May 2009 - 09:31 PM

That means the dll is running into some exception, so let's debug it. Change your code into (keep a backup of your current code):
show_message("starting dll...");
FontInit();
show_message("getting fonts...");
fonts = FontsGet("|");
show_message("installing font...");
FontInstall(working_directory+'\lcars.ttf');
show_message("font installed!");
Now run the game on all problematic PCs. Keep clicking the messages till the game stops responding (or any other bad thing that may happen).
Next record the very last message you clicked (before the game crashing).
Please come back here and tell me the results.

After I get the results, I can determine the faulty function and (hopefully) find the fault.
Thank you for supporting this product!

Kind regards,
Christian Sciberras.

Edited by uuf6429, 06 May 2009 - 09:33 PM.

  • 0

#17 Edhelcu

Edhelcu

    GMC Member

  • GMC Member
  • 350 posts
  • Version:GM8.1

Posted 07 May 2009 - 02:19 AM

Okay, I've tested it on a few more friend's computers - it does work on most of them.

I tried your code, and the original error I described - the view going black and the program becoming unresponive - comes right after the "installing font..." message (as I expected). I never get to "font installed!".

The second error I described - the program "has encountered a serious error and needs to close" I've determined to not be a problem with your DLL - I tried another GM game on his computer without the DLL and he got the same error, so don't worry about that one.
  • 0

#18 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 07 May 2009 - 09:39 AM

The second error I described - the program "has encountered a serious error and needs to close" I've determined to not be a problem with your DLL - I tried another GM game on his computer without the DLL and he got the same error, so don't worry about that one.

Good! One less thing to fix :D.

I tried your code, and the original error I described - the view going black and the program becoming unresponive - comes right after the "installing font..." message (as I expected). I never get to "font installed!".

I'll check what's wrong with this asap.

Kindly,
Christian Sciberras,


Important Edit
The dll was rewritten with better error handling techniques. Also, code has changed considerably; it does not rely on Delphi's VCL, thus the file size has decreased considerably: was 300Kb, now is only 12Kb!!
Download link is the same as above.

Edited by uuf6429, 07 May 2009 - 10:17 AM.

  • 0

#19 PickleMan

PickleMan

    Programmer

  • New Member
  • 995 posts
  • Version:Unknown

Posted 07 May 2009 - 12:48 PM

Well, thats a relief!
  • 0

#20 Edhelcu

Edhelcu

    GMC Member

  • GMC Member
  • 350 posts
  • Version:GM8.1

Posted 07 May 2009 - 08:21 PM

I hate to break it to you but...
it's not fixed :D

I now get "An unexpected error occurred when running the game" just after "getting fonts"... so this function is somehow failing too. If I remove the FontsGet("|") line, I get the same black screen just after "installing font".
  • 0

#21 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 08 May 2009 - 08:24 AM

Good you pointed that out. I'll try again. lol
  • 0