diff --git a/source/MonoGame.Extended/BitmapFonts/BitmapFont.cs b/source/MonoGame.Extended/BitmapFonts/BitmapFont.cs index d39372f3..b982c571 100644 --- a/source/MonoGame.Extended/BitmapFonts/BitmapFont.cs +++ b/source/MonoGame.Extended/BitmapFonts/BitmapFont.cs @@ -38,7 +38,7 @@ public sealed class BitmapFont } } - public BitmapFontCharacter GetCharacter(int character) => _characters[character]; + public BitmapFontCharacter GetCharacter(int character) => _characters.TryGetValue(character, out BitmapFontCharacter fontCharacter) ? fontCharacter : null;/* _characters[character];*/ public bool TryGetCharacter(int character, out BitmapFontCharacter value) => _characters.TryGetValue(character, out value); public SizeF MeasureString(string text) @@ -378,7 +378,7 @@ public sealed class BitmapFont { if (!pages.ContainsKey(bmfFile.Pages[i])) { - string texturePath = Path.Combine(bmfFile.Path, bmfFile.Pages[i]); + string texturePath = Path.Combine(Path.GetDirectoryName(bmfFile.Path), bmfFile.Pages[i]); using (Stream textureStream = File.OpenRead(texturePath)) { Texture2D texture = Texture2D.FromStream(graphicsDevice, textureStream); diff --git a/source/MonoGame.Extended/Content/BitmapFonts/BitmapFontFileReader.cs b/source/MonoGame.Extended/Content/BitmapFonts/BitmapFontFileReader.cs index acc77246..6f578477 100644 --- a/source/MonoGame.Extended/Content/BitmapFonts/BitmapFontFileReader.cs +++ b/source/MonoGame.Extended/Content/BitmapFonts/BitmapFontFileReader.cs @@ -60,6 +60,8 @@ public static class BitmapFontFileReader _ => throw new InvalidOperationException("This does not appear to be a valid BMFont file!") }; + bmfFile.Path = stream.Name; + return bmfFile; }