/// <inheritdoc />
        protected override bool IsEqualContent(ContentCreateOptions otherContent)
        {
            FontCreateOptions other = (FontCreateOptions)otherContent;

            if (other != null)
            {
                if (FontSize == other.FontSize)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #2
0
        internal Font(string file, FontCreateOptions createOptions)
        {
            FontSize = createOptions.FontSize;
            if (FontSize > MaxFontSize || FontSize < 0)
            {
                throw new GlaivesException($"Font size must be between 0 and {MaxFontSize}");
            }

            FontFace = new FontFace(File.OpenRead(file));
            Texture  = new Texture(128, 128, Color.Transparent, new TextureCreateOptions(TextureFilterMode.Smooth, TextureWrapMode.ClampToEdge));

            // pixels in the top-left corner is used for strikeout/underlines... :)
            // This has to be the same texture because of the way we do vertex batching
            // more than just 1 because of anti aliasing on the texture
            Texture.Update(Enumerable.Repeat <byte>(255, 4 * (2 * 2)).ToArray(),
                           new IntRect(0, 0, 2, 2));

            // Temp fix for weird first character issue
            LoadGlyph(' ');
        }