Unexpected Transparent Text

The Graphics class in the GHIElectronics.TinyCLR.Drawing assembly contains this method:

    public void DrawString(string s, Font font, Brush brush, float x, float y)
    {
        if (brush is SolidBrush solidBrush)
        {
            if (solidBrush.Color.A != byte.MaxValue)
            {
                throw new NotSupportedException("Alpha not supported.");
            }

            surface.DrawText(s, font, (uint)(solidBrush.Color.value & 0xFFFFFF), (int)x, (int)y);
            return;
        }

        throw new NotSupportedException();
    }

I am calling this method in two programs in identical (as far as i can tell) ways, namely with a white (255, 255, 255, 255) color. In one program the text is drawn on my screen with a nice white color. In the other program the text has an off white color. I suspect the text is being drawn with some transparency though I cant pinpoint how this is happening, or really what is happening. Like i said the method is being called with the same arguments in both cases. its all of the same hardware.

Has anyone had this problem before or one like it?

Thanks for any help that can be offered.

hard to answer without seeing sample code or screenshot of the issue.

I had the same issue using white color text looked transparent. Clearing the bitmap with a solid color like black before drawing fixed it. Might be worth trying.

Thanks. I’ll give it a try. I’ve been a bit busy but i still hope to put together a proper reply to Dat’s request for some sample code.

For those of you that were waiting with bated breath at how my issue would be resolved I think i figured it out.

Some of my .tinyfnt files were generated with anti-aliasing enabled, and it seems that the the graphics class (as far as i can tell) can’t not make all of the pixels semi-transparent when anti-aliasing is enabled. Well maybe I’m wrong about that. Here is the fontdef file i used to publish my tinyfnt. Let me know if any of you think something other than anti-aliasing is the problem here.

Verbosity 0
SelectFont “FN:MyriadPro-Regular,WE:700,HE:34,IT:0,UN:0”
AntiAlias 8
SetDefaultCharacter
ImportRange 32 592
Verbosity 1

Here is a screen shot of white text with anti-aliasing off (I believe) and some white text with anti-aliasing enabled: