Monogame Pipeline Tool - SpriteFont doesn't build

I’ve tried for awhile now and I just can’t get it working, and it seems no one else is having this problem so I thought I’d make a topic about it. Basically whenever I create a new SpriteFont using the MonoGame Pipeline Tool and then try to build the project, the font simply fails with this error: (Can’t copy and paste the entire error message it seems)
Does anyone know why this is happening?

It says the path of the file has illégal character.
Can you open Content.mgcb and paste here the part that declares the spritefont?

From MSDN:

Invalid path characters might include ASCII/Unicode characters 1 through 31, as well as quote ("), less than (<), greater than (>), pipe (|), backspace (\b), null (\0) and tab (\t).

Do you mean like this or…?

I noticed that but I’m not exactly sure what path it’s referring too as the font path looks fine: “C:\Users\Adam\Documents\Visual Studio 2015\Projects\PongCSharp\PongCSharp\Content”

I meant opening Content.mgcb file with a text editor like notepad++, and locate the line that declares the spritefont

Oh, Sorry.

Here you go:

I thought the whole path would be in there =)

Just an idea, how about replacing \ by / ?

I have no clue otherwise

That doesn’t work, just breaks it if I do that.

@codelyoko373 Can you share the contents of the .spritefont file and check the registry entry for the font you’re trying to build at ‘SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts’.

I thought about that too, that the font might not be on his system. but the exception message is a bit weird

<?xml version="1.0" encoding="utf-8"?>
Modify this string to change the font that will be imported.
Size is a float value, measured in points. Modify this value to change
the size of the font.
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
<!-- <DefaultCharacter>*</DefaultCharacter> -->
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.

And it would be a bit weird if Arial wasn’t on my system

@codelyoko373 Can you check what running Environment.GetFolderPath(Environment.SpecialFolder.Windows) gives you?

If that doesn’t work:

can you double-check the value for Arial at that location? Maybe it got messed up somehow (probably not, but I’m running out of ideas).

Running that function returns this: “C:\windows” and the Arial font looks fine.

EDIT: Okay so there must be something wrong with Arial as I changed the font and it works now

1 Like

Man spent more than an hour cause the stupid pipe line didn’t work in one project which was working fine, it just stopped working all of sudden, i tried everything including removing the files and make new ones, move them from a working project and just doesn’t want to work, when i changed the font to Cambria it just worked … no reason at all!

Not sure if this helps now, but putting the actual font file in the content directory works too. Really helpful if you don’t want to worry about “is it installed in my operating system” issues, or if sharing the project with others that run on different OSes.