Author Topic: [XP] Memory Font Loader  (Read 22572 times)

Dust

  • Guest
Re: [XP] Memory Font Loader
« Reply #20 on: May 25, 2014, 01:22:02 PM »
I will take a look into it soon when I get a chance. One more reason Windows 8 sucks.
Just out of curiosity, are you running the game in compatibility mode or anything? That shouldn't be a problem, but may help track down the cause of the error.

It would be reaaally great if you could get this to work c: And no, I'm not running the Game.exe or RPG Maker itself in compatibility mode

Offline Cremno

  • Trained Member
  • *
  • Posts: 12
  • LV: 2
    • View Profile
Re: [XP] Memory Font Loader
« Reply #21 on: May 25, 2014, 05:22:37 PM »
I don't know exactly why it doesn't work, but it's neither the fault of the (unnecessary) SendMessage call nor Windows 8. Does it work for you or someone else? It doesn't even work for me under the good old Windows XP SP3.

By the way, it works if you write your own Game.exe.
« Last Edit: May 25, 2014, 06:27:40 PM by Cremno »

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3255
  • LV: 298
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Memory Font Loader
« Reply #22 on: May 25, 2014, 07:27:32 PM »
Yes, SendMessage should most definitely be used.

http://msdn.microsoft.com/en-us/library/aa911393.aspx

Quote from: MSDN
Remarks

An application that adds or removes fonts from the system (for example, by using the AddFontResource or RemoveFontResource function) should send this message to all top–level windows.
To send the WM_FONTCHANGE message to all top–level windows, an application can call the SendMessage function with the hwnd parameter set to HWND_BROADCAST.

I am hardly going to rewrite Game.exe just to load a font from memory, that is ludicrous.

I only think that it could be the fault of Win 8 due to the fact that it worked perfectly for me before making a switch from Win7 to Win8, though it is obviously unconfirmed at this point.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Offline Cremno

  • Trained Member
  • *
  • Posts: 12
  • LV: 2
    • View Profile
Re: [XP] Memory Font Loader
« Reply #23 on: May 25, 2014, 07:48:26 PM »
AddFontResource != AddFontResourceEx (especially with FR_PRIVATE)

I think RGSS1 has an internal font list which is initialized at start and that's why calling AddFont* functions don't work afterwards.
« Last Edit: May 25, 2014, 07:51:01 PM by Cremno »

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 775
  • LV: 33
    • View Profile
Re: [XP] Memory Font Loader
« Reply #24 on: October 10, 2014, 11:10:24 AM »
Methinks time for Blizz to step in...

I cant get this to work either.  Renaming fonts, case sensitive, spaces, putting ".ttf" in the name, and this box is XP-SP3.  I monkeyed with the scripts, but even after its there, using Font.exist?(name) I get nada.  AddFontResourceEx.call returns 1 so it says the font is loaded into memory.  Fantastic idea, and already implemented into VXA apparently, just can not get it to work.  Only thing I could find that was relevant was this:

https://github.com/Ancurio/mkxp

Way over my head...
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Memory Font Loader
« Reply #25 on: October 10, 2014, 12:33:57 PM »
Try AddFontResourceExA(), that's probably the reason. Using just AddFontResourceExW() will cause problems because of wide-chars.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 775
  • LV: 33
    • View Profile
Re: [XP] Memory Font Loader
« Reply #26 on: October 10, 2014, 07:36:31 PM »
Still no luck.  Ex, ExA, ExW, no Ex, my brain just keeps coming up short.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3255
  • LV: 298
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Memory Font Loader
« Reply #27 on: October 10, 2014, 09:51:50 PM »
I have yet to find a pattern to what works definitely and what does not. I do believe it has SOMETHING to do with the OS, but I cannot even say that for sure.

@heretic:
Just for a test, run the game as admin and see if has something to do with permissions or not. I have had success and not being an admin, put it could possibly be a combination of OS and UAC.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 775
  • LV: 33
    • View Profile
Re: [XP] Memory Font Loader
« Reply #28 on: October 11, 2014, 10:45:57 AM »
Still doesnt work as Administrator either.

However, I do use a program for my VPN called PIA (Private Internet Access) and when I set it up and my firewall complained about it, it is also Ruby based, so not sure if that could somehow cause a conflict.  It may not sound like it might, but since RMXP uses system globals (like fonts), I wonder if the two might conflict?  I did exit the VPN program, and still didnt get any results.  Perhaps Adobe Flash?  I messed with some of the geek config settings, namely "DisableDeviceFontEnumeration", and think Flash shouldnt cause a conflict, but perhaps Font Enumeration?  Some sort of other Windows permission?  AVG?  All disabled for testing, and no luck on anything I've tried.  Shortcuts are not set to run in compatability mode, the advanced text services are not turned off.  Just related things, but dont seem to have any impact...
« Last Edit: October 11, 2014, 11:16:07 AM by Heretic86 »
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Duds

  • Guest
Re: [XP] Memory Font Loader
« Reply #29 on: December 01, 2014, 02:13:57 AM »
Hi guys, this is my first post here. :haha:
I was very interested in this script so I gave a try on fixing it.
It works with AddFontResource (without Ex).


(click to show/hide)
« Last Edit: December 01, 2014, 04:38:14 PM by Duds »

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 775
  • LV: 33
    • View Profile
Re: [XP] Memory Font Loader
« Reply #30 on: December 02, 2014, 04:19:25 PM »
+Rep

Changing AddFontResourceEx (ExA or ExW also) to just AddFontResource works perfectly!  At least on XP SP3, so Im not sure how that will affect Windows 7 / 8 / 8.1 but feedback on the proposed fix would be appreciated by many...
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3255
  • LV: 298
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Memory Font Loader
« Reply #31 on: December 17, 2014, 02:37:43 PM »
* Updates script to version 1.1 *

I added the fix that Duds pointed out to the script as a backup if the original method fails. If you were having troubles getting the script to work before, it may be worth your while to check again.

Thank you, Duds.  8)
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Memory Font Loader
« Reply #32 on: August 23, 2015, 02:34:39 PM »
I think that I can offer some more insight here after experimenting with this a bit.
The problem seems to be indeed that RMXP keeps a list of available fonts that it creates on load. AddFontResourceEx() can't work, because the fonts are uninstalled again right after it closes. AddFontResource() will work, because it temporarily installs the fonts until the next reboot. So yeah, I don't think this problem can be solved.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Memory Font Loader
« Reply #33 on: May 12, 2016, 09:13:15 AM »
*BUMP*

I just had an idea that I shared with Heretic:

Quote from: le me
There MIGHT be one last possible solution. You could reinstall the fonts every time the game runs and copy the file into the fonts directory regardless if it's already there. In that case you would just have to change the code a bit to avoid reporting missing fonts to users.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline F117Landers

  • Total Beginner
  • Posts: 2
  • LV: 0
    • View Profile
Re: [XP] Memory Font Loader
« Reply #34 on: July 11, 2016, 04:48:23 AM »
I'm rather new to this, so perhaps someone can help:

what is "PATH_TO_FILE"? Is that to add a script from outside the Fonts folder into the game? or is that to actually set the font once it is loaded?

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3203
  • LV: 386
  • Gender: Male
  • Choco Octo <3
    • View Profile
Re: [XP] Memory Font Loader
« Reply #35 on: July 11, 2016, 06:46:10 AM »
If you're not using AUTO_LOAD, you'll have to use that script call to add your fonts. Otherwise, just throw all your fonts into whatever Font folder you package your game with; you won't have to worry about making any script calls.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Offline F117Landers

  • Total Beginner
  • Posts: 2
  • LV: 0
    • View Profile
Re: [XP] Memory Font Loader
« Reply #36 on: July 11, 2016, 01:46:14 PM »
Thanks KK20. I am using auto load, but the fonts weren't loading (Edit: using Font.default_name = "King's Gambit") and I had checked the font size, name (within the ttf), and capitalization already.
« Last Edit: July 11, 2016, 02:05:13 PM by F117Landers »

Offline ThallionDarkshine

  • Ethereal Devastator
  • ****
  • Posts: 274
  • LV: 56
  • Gender: Male
    • View Profile
Re: [XP] Memory Font Loader
« Reply #37 on: December 20, 2017, 04:54:47 PM »
So I seem to have found a bug with this on Windows 8.1. After the call to
Code: [Select]
SendMessage, the game freezes. Have you tried with just
Code: [Select]
SendNotifyMessage? From what I can tell in the docs,
Code: [Select]
SendMessage blocks until all windows process the notification, whereas
Code: [Select]
SendNotifyMessage returns immediately... I tried removing the
Code: [Select]
SendMessage call, and the game appears to run fine. Is there a reason you're making both calls?