• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows Font changes not refreshing

T

Talsmic

Guest
You'll have to forgive me, I'm struggling to think of the correct words to explain the issue, so I'll just describe the situation.

I've created my own fonts (Using FontStruct, if relevant), and while drawing them in game have noticed I needed to adjust how some of the characters look and the size of the space. So I updated the font, installed a new version on my computer and now... I'm stuck on how to actually refresh the font inside GMS2 because it hasn't updated it's fonts.
My font is definitely updated on the computer, in any other program the characters use their new appearance, but in GMS2 it isn't and I can't force it to.
Cleaning my build and recompiling doesn't work.
Reopening Game Maker doesn't work.
Rebooting my computer doesn't work.
Creating new resources with the font still use the old appearance.
Deleting the old resource and recreating it doesn't work.

As far as I can tell GMS2 has stored what my fonts look like and refuses to update it. Have I missed something obvious?
 

Mike

nobody important
GMC Elder
Fonts are generated into bitmaps when you create a resource. They do not "update" based on font changes - as this is an incredibly rare thing for anyone to do. This means you'll have to make a change to the font somehow - make it bold then back again etc. or you can load it dynamically and modify the one in the data files directly?
 
T

Talsmic

Guest
Fonts are generated into bitmaps when you create a resource. They do not "update" based on font changes - as this is an incredibly rare thing for anyone to do. This means you'll have to make a change to the font somehow - make it bold then back again etc. or you can load it dynamically and modify the one in the data files directly?
If I say, change it to be a different font, compile the game, change it back and compile again, thus changing the bitmap twice, that's what you're talking about right? I understand the need to do that, and it would have worked on GMS1.4

That doesn't actually fix the issue, because it (for some reason) still recreates the bitmap using the old font appearance, as if it has memory of it. That old font appearance doesn't exist on my computer anywhere though, so GMS2 has to have stored it somewhere. If I use any other program (even GMS1.4!) to use the font, it draws the correct new characters.
 

Mike

nobody important
GMC Elder
Ah...I suspect the font is loaded in on startup, so you're picking from an already loaded font.

File a bug/suggestion and we'll try to put in a "refresh" button in the font dialog that can reload the font. include a link to this topic in the report.

For now, I'd suggest loading the font dynamically using "font_add" and pointing to the TTF, then when editing it, modify THAT one (in the datafiles folder). otherwise you'll have to quit the IDE and start again to see your font changes.
 
T

Talsmic

Guest
Ah...I suspect the font is loaded in on startup, so you're picking from an already loaded font..
I think you're almost right, though quitting the IDE and reopening it does not reload it. So GMS2 must be caching the font files or something like that. If quitting the IDE refreshed it, that'd be good enough for me.

File a bug/suggestion and we'll try to put in a "refresh" button in the font dialog that can reload the font. include a link to this topic in the report.
I'll do that, that seems like the best overall solution.

For now, I'd suggest loading the font dynamically using "font_add" and pointing to the TTF, then when editing it, modify THAT one (in the datafiles folder). otherwise you'll have to quit the IDE and start again to see your font changes.
That produces the correct results, though I can't turn off antialiasing doing this, which is no good for pixel fonts. But if anyone else is encountering this and doesn't need to use pixel fonts, this is a workable solution.


I actually just took this one step further and reinstalled GMS2. Even that does not refresh the cached fonts. This is clearly a bug (though understandably as frustrating as it is to me a small one) so I'll submit it and hope you guys can figure out what's going on here.
 

Mike

nobody important
GMC Elder
Well, you're kind of half right. So we DO cache the font in the resource, so as not to make them up all the time - it's an expensive process. So that means to get your new font, you'd have restart the IDE, AND THEN! go into the font and change it to BOLD and back, then it would swap.

File a separate suggestion for allowing AA to be switched off in loaded fonts, I can see that being a good addition as well...
 
T

Talsmic

Guest
I can't figure out where you cache the fonts, but it can't only be in the resource.

See if I:
-Close the IDE
-Open a new project
-Create a new font resource in this empty project

I will still get the old font appearance. So you're not caching it on a resource or even project level.

Where do I submit suggestions? I can only find the bug report form, which I wouldn't use for something not a bug.
 

Mike

nobody important
GMC Elder
Mmmmm... that sounds like Windows caching rather than us. Do you re-install the font to the windows font folder? All we do is trawl the windows font directory.

The bug form is also used for suggestions - although, if its a windows cache thing, refreshing inside the IDE won't help.
 
T

Talsmic

Guest
It's not a window caching thing, I did consider that.

If I completely delete the font from my windows folder, GMS2 still thinks the font exists.
If I update the font, both GMS1.4 and Wordpad use the new font. It seems like the first time GMS2 sees a font, it memorises it and never lets go of that image. I'm aware of how bizarre that sounds.

For now, I can work around it by renaming the font each time I change it. That's literally the only thing that works though. Hopefully when you guys get the chance to take a look you'll be able to reproduce it figure out what went wrong.
 

Mike

nobody important
GMC Elder
If I completely delete the font from my windows folder, GMS2 still thinks the font exists.
Do you mean the drop-down list STILL shows the font, even though it's been deleted from the machine?

So, if you quit the IDE, delete the font, restart the IDE create a new font - then the drop down STILL has that font in it?
 
T

Talsmic

Guest
Do you mean the drop-down list STILL shows the font, even though it's been deleted from the machine?

So, if you quit the IDE, delete the font, restart the IDE create a new font - then the drop down STILL has that font in it?
Yes indeed. I know how absurd that seems.
 
Z

zmads

Guest
Bumping because I'm with the same problem, someone has figured it out what to do?
 

xot

GMLscripter
GMC Elder
This is driving me batty! This was giving me great difficulty yesterday and it seemed some combination of cleaning the project, removing the font resource, or redefining the range was updating the font. Today, nothing is working, restarting the IDE, restarting the system – nothing helps, no matter what angle I point my tongue (and I've tried them all!). It's crazy. Fonts that I've deleted from the system are still appearing in the GMS2 font selector and are able to be inserted into the project. It makes no sense. Other software has no problem handling the updated font.

The only thing that works is creating a new TTF with altered name/family metadata and installing that. It is possible that whatever success I had yesterday was due to this kind of modification. If you are developing your font iteratively, have fun with lots of duplicate fonts with slightly altered names clogging up the GMS2 font selector.
 
Last edited:

DukeSoft

Member
Did y'all check the installed folder of GMS2 for a place where stuff might be cached? I mean if its being loaded even though its no longer in windows, it has to be somewhere, right? :p
 

xot

GMLscripter
GMC Elder
I submitted a bug report and I suspect I know what the problem is. The old files stay in the Windows\Font folder, even when the fonts are updated, replaced, or removed. Updated fonts have a number appended to their filename. I'm guessing GMS2 is loading the wrong files. I know it is indexing the font folder directly. It does not appear to be querying the registry which has the actual filenames currently installed by the OS.
 
Last edited:

DukeSoft

Member
Seems to be backwards compatibility of windows then :D Simple fix then - GMS2 has to always load the latest one :)
 

xot

GMLscripter
GMC Elder
That would still load "deleted" fonts. It should be using the registry.

EDIT:
It's also worth noting that installed fonts are not necessarily in the Windows\Font folder. They may be linked to any directory as a "shortcut". A shortcut is just a path in the registry like any other font has but pointing somewhere else. Installing fonts this way is a user-facing font setting. A font installed this way would never appear in the IDE.
 
Last edited:
T

Talsmic

Guest
Yeah this never got fixed. I should have come back here to update this topic but I was waiting for the bugreport ticket to get resolved (they flagged it as a legit problem) and then that disappeared and I forgot about it. Until I encountered it again.

For anyone who encounters this issue: create a version of your font with a new font name (not file name). That'll get around the issue. It's annoying, sure, but it works.

For any YoYo engineers that read this: You need to use the registry values for indexing fonts, not the contents of the Windows font folder. The windows font folder annoyingly holds every version of a font you've ever had, hidden and undeletable. I didn't even manage to find a way to delete them in my search. If you just use the registry values for fonts this issue will be resolved easily.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Moderator
For any YoYo engineers that read this: You need to use the registry values for indexing fonts, not the contents of the Windows font folder. The windows font folder annoyingly holds every version of a font you've ever had, hidden and undeletable. I didn't even manage to find a way to delete them in my search. If you just use the registry values for fonts this issue will be resolved easily.
Please file a bug report about this. The YYG devs aren't able to see every topic posted here and if the report you previously filed no longer exists (although I have no idea how that would happen), then you should file another.
 

docdef

Member
I just stumbled upon this same issue.

I am guessing GM simply enumerates the fonts directory and picks the first file that corresponds with your font, which happens to be the first version and ignores any newer versions.

I got fed-up exporting my font with a different name each time; so decided upon a different approach. Below is some simplistic powershell code that will scan the Windows fonts directory to help you tidy up obsolete fonts. By default it does not delete anything and simply shows the 'current' and 'obsolete' fonts in your system. If you are happy, you can make it delete the obsolete files.

Warnings:

  • Do not remove the ".ttf" filter as this will show lots of system fonts (.fon) as obsolete. These are not obsolete, they just do not have a corresponding entry in the registry. If you remove these your system will break and Windows will not boot.
  • If you are working with fonts that are not .ttf files, then please do not use this code unless you know what you are doing.
  • There is an additional filter on the delete code (~ line 80) which deletes files if, and only if they start with "MyFont". Remove this at your own risk; however, by all means change this to the name of your font.
  • Please check this code before you run it. I cannot accept any responsibility if things go wrong. In other words, run this at your own risk.
By default this script will enumerate each font in the C:\Windows\Fonts directory and show if the actual font file is mapped to an installed font in the registry. If the file matches it will be listed as CURRENT otherwise it will be listed as OBSOLETE.

E.g.

Code:
[ CURRENT] mvboli.ttf;
[OBSOLETE] MyFont.ttf;
[OBSOLETE] MyFont_1.ttf;
[ CURRENT] MyFont_2.ttf;
[ CURRENT] NIAGSOL.TTF;
If you are happy to let this script delete the obsolete font files, set the $clean parameter to $true in the script or on the command line. You will probably need to 'Run as Administrator' to delete these protected files.

With the old files deleted, GameMaker correctly imports your latest font and you don't need to scroll through all the old versions.

I hope this helps someone.

--code below--

Code:
# You need to enable scripts to run; you can check if you have access by running:
#   > powershell get-executionpolicy
# If it returns restricted you cannot run scripts
# To enable scripts run the following in an administrator powershell
#   $ powershell set-executionpolicy RemoteSigned

#===============================================================================
# Paramters
#-------------------------------------------------------------------------------
param
(
    [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
    [switch][alias('c')]
    $clean = $false,

    [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
    [switch][alias('o', 'obsolete')]
    $showObsoleteOnly = $false
)
begin
{
    $verbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent;

    function Write-Matched([string]$fileName, [string]$fontName)
    {
        Write-Host -NoNewLine "[";
        Write-Host -NoNewLine " CURRENT" -ForegroundColor GREEN;
        Write-Host "] $fileName; $fontName";
    }

    function Write-Unmatched([string]$fileName, [string]$fontName)
    {
        Write-Host -NoNewLine "[";
        Write-Host -NoNewLine "OBSOLETE" -ForegroundColor RED;
        Write-Host "] $fileName; $fontName";
    }

    function Write-Verbose([string]$message, $details)
    {
        if ($verbose -eq $true)
        {
            Write-Host -NoNewLine $message
            Write-Host $details -ForegroundColor YELLOW
        }
    }

    $fontFolder = [environment]::GetFolderPath("Fonts");
    $fontKey = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts";

    Write-Verbose "Checking font directory: " $fontFolder;
    Write-Verbose "Checking font registry key: " $fontKey

    $fontFiles = Get-ChildItem ($fontFolder) | Where { $_.Extension -eq ".ttf" };
    $installedFonts = @{};

    Push-Location;

    $regKey = Get-ItemProperty $fontKey;

    $regKey.PSObject.Properties | ForEach-Object {
        $installedFonts.Add($_.Value, $_.Name);
    }

    Pop-Location;

    foreach($fontFile in $fontFiles)
    {
        $match = $installedFonts[$fontFile.Name];
        if ($match -ne $null)
        {
            if (-not $showObsoleteOnly)
            {
                Write-Matched $fontFile.Name $match.Value;
            }
        }
        else
        {
            Write-Unmatched $fontFile.Name;

            if ($clean -and $fontFile.Name.StartsWith("MyFont"))
            {
                $fullFilePath = "$($fontFolder)\$($fontFile.Name)";
                Write-Verbose "           Deleting font file: " $fullFilePath;
                Remove-Item $fullFilePath -Force;
            }
        }
    }
}
 
U

UriMax

Guest
Hello there,

I'll be opening a separate thread because my issue was a tad different but not by much, and I'm pretty sure that if I have the exact same problem as the OP here, I'll be able to solve it using the exact same method I used.
It worked for me : I'm not assuming it can work for everyone.
And be wary of not deleting any system font....or you'll get a beautiful not loading windows black screen.
Hence, I'm posting that solution here as a possible mean to an end.
You can jump to the second point directly, I'll just be explaining the backstory.

1 - My problem :
It occured after a fresh install on W10, and installing all my fonts manually in the "Windows/fonts" folder. opening a project with custom fonts.
When trying to change the font file used for one of the created font, GMS gave me an error before I could even do anything, just by entering the dialog box.
It could not find the font. As in "does not exist" font. Yet, opening the windows font folder, IT DID exist, and yes, I had installed it (and many more).
Scrolling down the menu, there was actually NO TRACE WHATSOEVER of any of the fonts I had installed before hand, right after my fresh W10 install.

I figured "Might as well try a font manager to see if there's a problem" and went for NexusFont. First time I used that software.
And....SURPRISE it could not find any of my font as well !!!

2 - On to said method.
Let's delete them all one by one !
Went down the scrolling menu, it was the exact same thing as the list from NexusFont for my font folder contents.
Went to said folder, and first, I copied all the fonts not showing in a new folder on my desktop (can be anywhere else, doesn't matter).
Then I manually deleted all these fonts from the windows/font folder.
!!!!!! DO NOT DELETE ANY SYSTEM FONT !!!!!!
I open NexusFont back, and after a quick search on the internet, figured out how to install fonts. Just right click on "Sample group" --> "Add Folder".
Select the folder where you put your custom fonts.
Once in the list, Ctrl+A to select them all, right click ---> "INSTALL" in the windows/font folder.
I did a Windows restart here for good measure.
Back into GMS after the restart......and voila, it worked.

Well....my 2 cents.
 

BoB3k

Member
This problem still exists up to v2.3.0

Here's the quickest way I've found --
1 - shut down GM. -- you have to do this cuz it's holding on to the font file.
2 - in Windows fonts, delete the font. -- this should also delete the file if no one is holding on to it.
3 - reinstall the new version of the font. -- since the old file deleted, this should make a new font file of the same name and not _1.
4 - reopen GM and your project, and be sure to Regenerate your font!

From what I can tell, if you don't delete the fonts correctly, Windows will just nicely make new font files with _0, _1, etc on them that GM then doesn't see. If you get to this point, you can follow steps above, or I used Windows Power Shell in Admin mode to rem -force to delete all the versions of the file
 
Top