Hey there,
a few days ago I started suddenly getting
SEHExceptions or
AccessViolationExceptions from within the unmanaged SFML assemblies every time I tried to call
Font.GetGlyph.
Right before the crash, SFML writes the following error message to the console:
Failed to add a new character to the font: the maximum texture size has been reached.
Keep in mind that this happens on the very first glyph with a font size of 16 and a copy of C:\Windows\Fonts\arial.ttf, so under normal circumstances the buffer texture should be tiny (VRAM certainly isn't an issue).
So I decided to create a clean project with a freshly downloaded copy of SFML. This time it didn't crash, but I noticed something odd: The 'Advance' property of any glyph obtained by
Font.GetGlyph is waaay off, somewhere in the single digit billions... I heavily doubt that's the expected behavior.
The generated texture looks normal though.
The issue occurs even if execute the program on another machine.
This is the code I used for the test:
using System;using SFML.Graphics;namespace SFMLtests
{ class Program
{ static void Main
(string[] args
) { var font
= new Font
("arial.ttf"); var a
= font
.GetGlyph('A',
16,
false); var b
= font
.GetGlyph('B',
16,
false); var c
= font
.GetGlyph('C',
16,
false); Console
.WriteLine(a
.Advance); Console
.WriteLine(b
.Advance); Console
.WriteLine(c
.Advance); Console
.WriteLine(); Console
.WriteLine(a
.Bounds); Console
.WriteLine(b
.Bounds); Console
.WriteLine(c
.Bounds); Console
.WriteLine(); Console
.WriteLine(a
.TextureRect); Console
.WriteLine(b
.TextureRect); Console
.WriteLine(c
.TextureRect); font
.GetTexture(16).CopyToImage().SaveToFile("font.png"); Console
.ReadLine(); } }} And this is the output I'm getting:
1093664768
1092616192
1093664768
[FloatRect] Left(-1) Top(-12) Width(12) Height(12)
[FloatRect] Left(0) Top(-12) Width(10) Height(12)
[FloatRect] Left(0) Top(-12) Width(11) Height(12)
[IntRect] Left(1) Top(4) Width(12) Height(12)
[IntRect] Left(15) Top(4) Width(10) Height(12)
[IntRect] Left(27) Top(4) Width(11) Height(12)
Specs (In case that will be relevant)
Windows 10 Professional 64 bit (version 1703)
Intel Core i7-3820 (3.6 GHz)
32 GB memory
NVIDIA GeForce GTX 970 2-way SLI
Cheers, Mario