jcsnider Posted August 15, 2016 Share Posted August 15, 2016 Replace Fonts/Adding Font Characters in Intersect! Date: Oct. 2nd 2019 Guide written for Intersect Beta 6+   Summary: This guide will show you how to re-generate the fonts (.xnb) files distributed with the Intersect engine. This will allow you to change the font, some styling options and add/remove characters from in-game fonts. This guide only covers the client not the editor or server.  Requirements: Before getting started you should visit http://www.monogame.net/downloads/ and download/install the MonoGame 3.7 (as of Beta 6) package. This should install tools on your computer that are required to generate the new font files.  I /recommend/ that you download and install Notepad++. You will need a good text editor for this guide. I use Notepad++ on a daily basis and it is really good software. Other software like vim and even standard notepad should work but I make no guarantees.  The source files you will need can be found in the sources branch of the Intersect Assets repo. Download Zip.  Table Of Contents: 1. Download/Open the Content Pipeline 1.1 Download the Content Pipeline 1.2 Open the Content Pipeline 1.3 Content Pipeline Layout 2. Edit the Font Files 2.1 Opening Font Files 2.1.1 Explanation of Options 2.2 Adding Character Ranges 2.2.1 Character Map Tool 3. Building the Content 3.1 How to Compile Everything 3.2 Installing the New Fonts   hra, Ikelos, Vus and 4 others 5 2 Link to comment Share on other sites More sharing options...
jcsnider Posted August 15, 2016 Author Share Posted August 15, 2016 1. Download/Open the Content Pipeline  1.1 Download the Content Pipeline This is the MonoGame Content pipeline for Intersect. This allows us to compile fonts and shaders for Intersect. In this guide we are only going to discuss shaders. Go ahead and download the content project and font source files by clicking here. After you download that zip go ahead and extract it anywhere on your machine.   1.2 Open the Content Project After you extract this double click the Content.mgcb file. That should open the content pipeline.  1.3 Content Pipeline Layout in the Fonts and Shaders folders you will find the raw shader and font information. This information is used to generate .xnb files which the engine actually reads. In section 3 I will go over all of the options in the spritefont files. hra and Zerinho 2 Link to comment Share on other sites More sharing options...
jcsnider Posted August 15, 2016 Author Share Posted August 15, 2016 2. Edit the Font Files  2.1 Opening Font Files In the Content Pipeline expand the Fonts folder and double click on any of the sprite font files. We have a different spritefont for every text size, so any changes you make to one you will want to make to all the others. When asked I recommend telling windows to open the .spritefont files with Notepad++.  2.1.1 Explanation of Options This should be pretty self explanatory. Going to show the first part of the spritefont file along with the comments provided by the MonoGame team.   2.2 Adding Character Regions Character regions are defined at the bottom of the .spritefont files. You can define as many regions as you like. In each region you can type in the character the region starts at and the ending character. You can enter characters literally or as their unicode values. You can find unicode ranges to use in these files at this site: http://jrgraphix.net/r/Unicode/ Example below:  2.2.1 The Character Map Tool There is a really nice tool on Windows called the Character map tool. You can find it by clicking start and typing Character Map.  You can use this tool to retrieve character values for your spritefonts. Please note, you should not try to enter a range covering every Unicode value. There are simply too many characters. Your spritefonts would be massive and they wouldn't even generate successfully.  Link to comment Share on other sites More sharing options...
jcsnider Posted August 15, 2016 Author Share Posted August 15, 2016 3. Building the Content  3.1 How to Compile Everything This part is easy. When you are done modifying your spritefonts you can save them and then go back to your content pipeline. To compile new fonts for your game just click Build > Rebuild.  The pipeline will tell you how compiling goes and if there are problems the status window will tell you more.   3.2 Installing the New Fonts After everything is compiled you can find your new fonts in the Content/bin/Windows/Fonts/ folder. You can copy those font files over the existing ones in the Client/Resources/Fonts directory. Overwriting those files and restarting the client is all you should have to do.   Vio, Zerinho, Xeno and 1 other 3 1 Link to comment Share on other sites More sharing options...
jcsnider Posted August 15, 2016 Author Share Posted August 15, 2016 That's basically it. This is very standard for MonoGame projects. I referenced this stackoverflow post when making this one - http://stackoverflow.com/questions/13243130/how-to-draw-special-characters-in-xna  With this you can go as far as adding non-latin characters to your games. You can change the font-faces (but don't rename the files, they are hard coded for now) and you can change font sizes.  After multi-language support is in and the source is released you will be able to take this a few steps further but that is a guide for another day. Henry 1 Link to comment Share on other sites More sharing options...
merilwen91 Posted September 1, 2017 Share Posted September 1, 2017 I am trying to put in a font that i like and i changed them all but the rebuild isn't working and I don't understand what it is that i'm doing wrong. I fixed where the error codes were but I'm still not getting the rebuild correct. Link to comment Share on other sites More sharing options...
Refur Posted September 1, 2017 Share Posted September 1, 2017 2 minutes ago, merilwen91 said: I am trying to put in a font that i like and i changed them all but the rebuild isn't working and I don't understand what it is that i'm doing wrong. I fixed where the error codes were but I'm still not getting the rebuild correct. Â What's the error message? Link to comment Share on other sites More sharing options...
merilwen91 Posted September 1, 2017 Share Posted September 1, 2017 Just now, Refur said: Â What's the error message? font description has unexpected error Link to comment Share on other sites More sharing options...
Refur Posted September 1, 2017 Share Posted September 1, 2017 1 minute ago, merilwen91 said: font description has unexpected error  Make sure you have written the font name correctly, did you try with others fonts? If you can, would be good to know what font are you trying to rebuild, the name who appear in the Windows font folder Link to comment Share on other sites More sharing options...
merilwen91 Posted September 1, 2017 Share Posted September 1, 2017 15 minutes ago, Refur said:  Make sure you have written the font name correctly, did you try with others fonts? If you can, would be good to know what font are you trying to rebuild, the name who appear in the Windows font folder I found a game font online Alagard. Free to use but as I try and get the font to work it wont. I've tried other ones Bradley Hand ITC it worked. But for some reason this one wont. Is it just because I found it online?  UPDATE: Ok so I got the build to work. BUT now I cant get the fonts to load in the game error log keeps saying No Fonts! Link to comment Share on other sites More sharing options...
Refur Posted September 1, 2017 Share Posted September 1, 2017 11 minutes ago, merilwen91 said: I found a game font online Alagard. Free to use but as I try and get the font to work it wont. I've tried other ones Bradley Hand ITC it worked. But for some reason this one wont. Is it just because I found it online? Â Did you install the font in your computer? Link to comment Share on other sites More sharing options...
merilwen91 Posted September 1, 2017 Share Posted September 1, 2017 12 minutes ago, Refur said: Â Did you install the font in your computer? Yes the rebuild finally worked. However now I cant get the fonts to work in game. Refur 1 Link to comment Share on other sites More sharing options...
jcsnider Posted September 3, 2017 Author Share Posted September 3, 2017 56 minutes ago, Gravelord said: Why is there such a run around for something so simple as adding/replacing a font? Is there a technical reason as to why one cannot simply use a font file type and drag/drop?  The short answer is that the MonoGame library we use dictates how we load content. There are easy workarounds for graphics and audio to not use their content system but not for shaders or fonts. (This isn't necessarily a bad thing.)  What this content app basically does, is it takes the font files and creates an image with all of the letters on it along with a map for Intersect to read on where each letter exists. All of this is loaded onto the graphics card when the engine starts.  Depending on how many characters your game allows these images and maps can get really really large so trying to create them every time the engine is ran would be unbearable.  We can't simply draw from font files themselves because we'd have to load the characters into memory every single time we use them, that would destroy our fps because sending graphics from the cpu to the graphic card takes way too much time.  This isn't to say that we're incapable of creating easier/better ways of doing this but there are far more important tasks at hand -- we don't have time to replace working systems at the moment.  Hope this helps!  Link to comment Share on other sites More sharing options...
jcsnider Posted September 3, 2017 Author Share Posted September 3, 2017 Assuming you're talking about the client/resources/config.xml you'd still be required to use the MonoGame content manager to actually create the font files. The MonoGame fonts have to exist in the games /resources/fonts folder. The fonts installed in the system folders of your players do not matter whatsoever. Â If you're talking about the config files included in the download with the content manager (arial12.xml or whatever) then yes you can change the font name in there to whatever and it will work. Gravelord 1 Link to comment Share on other sites More sharing options...
Xeno Posted March 21, 2019 Share Posted March 21, 2019 How would I go about changing the chat, and character window font? I was able to change the others no problem, but am having a hard time finding where to set these.. Link to comment Share on other sites More sharing options...
jcsnider Posted March 21, 2019 Author Share Posted March 21, 2019 You have to type in the font name and size for each UI element in the client/Resources/GUI/layouts/ json files. I can be more specific if need be later. (On Mobile atm) Link to comment Share on other sites More sharing options...
Beefy Kasplant Posted March 21, 2019 Share Posted March 21, 2019 Does this mean I can make custom damage counters without messing up the numbers displayed in other parts of the game? Link to comment Share on other sites More sharing options...
Zerinho Posted October 1, 2019 Share Posted October 1, 2019 how do i add (♥) symbol in sourcesansproblack? since the beta 6 doesn't change the sourcesansproblack font from the UI, even changing the config.json @edit ok after 12 hours i got it, i won the tutorial now why i can't change the game ui font? only chat text Link to comment Share on other sites More sharing options...
jcsnider Posted October 2, 2019 Author Share Posted October 2, 2019 That is unicode character U2665: Â Â The source files for the Beta 6 fonts are here. Â You need to add the following character range to each font file and then rebuild using the content program as described above: <!-- Heart Symbol --> <CharacterRegion> <Start>♥</Start> <End>♥</End> </CharacterRegion> Â Then overwrite your fonts with the new ones generated. Â Edit: Updated the OP with a link to the Intersect-Assets sources branch which contains the sourcesanspro font source files. Zerinho 1 Link to comment Share on other sites More sharing options...
Zerinho Posted October 2, 2019 Share Posted October 2, 2019 i did everything but only that i write on the chat changed, the event box text doesn't change only with source maybe? @edit ok trying to change the sourcesanspro got stuck what im doing wrong? the problack work normally, but only the problack version still doesn't show a heart symbol on the game... @edit2 i found the issue, i have to install the sans pro font then change the name from the spritefont files GG Link to comment Share on other sites More sharing options...
jcsnider Posted October 2, 2019 Author Share Posted October 2, 2019 Fonts for individual UI elements are set in the client/resources/gui/layouts/*.json files.  Open any of the client/resources/gui/layouts/game/event jsons and search for sourcesanspro to see what I mean. The font you want to use must be put in there. Zerinho 1 Link to comment Share on other sites More sharing options...
Zerinho Posted October 2, 2019 Share Posted October 2, 2019 On 10/2/2019 at 9:06 AM, jcsnider said: Fonts for individual UI elements are set in the client/resources/gui/layouts/*.json files.  Open any of the client/resources/gui/layouts/game/event jsons and search for sourcesanspro to see what I mean. The font you want to use must be put in there. i get it, json files can edit the UI elements... thank you <3 @edit 10/03/19 even with that <!-- Heart Symbol --> <CharacterRegion> <Start>♥</Start> <End>♥</End> </CharacterRegion> <<(i put that line on every font file then rebuild all ok, put on the folder then replaced) it seens not changed, it can't appear the heart ♥ in the opened client...gg  maybe when source comes out i can make that i even tried to change the holl font with one named 'Cloud' that have that heart symbol ♥ in vanilla, like Arial, but even with that, in game client appears only that strange square sad Link to comment Share on other sites More sharing options...
Xiphoid Posted April 5, 2021 Share Posted April 5, 2021 Download links are dead... Link to comment Share on other sites More sharing options...
Justn Posted April 12, 2021 Share Posted April 12, 2021 Do these steps still apply? Haven't changed the font in over a year and need to do so again =)  just noticed the MGCB download is gone. Link to comment Share on other sites More sharing options...
Lunam Posted April 12, 2021 Share Posted April 12, 2021 7 hours ago, Justn said: Do these steps still apply? Haven't changed the font in over a year and need to do so again =)  just noticed the MGCB download is gone. Same, it'd be nice if they could update the engine to accept standard "plug-n-play" font-types(OpenType, TrueType) without the need for recompiling or editing source at all. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now