SFML community forums

Help => Graphics => Topic started by: aferents on August 04, 2014, 08:05:55 am

Title: Glyph problems
Post by: aferents on August 04, 2014, 08:05:55 am
Hello people!
I have issue with Text drawing. Main reason is that app crashes when i try to get bounds from glyph as it shows following code

Text class, method EnsureGeometry()
 // Extract the current glyph's description
                var glyph = Font.GetGlyph(curChar, CharacterSize, bold);

                var bounds = glyph.GetCBox(GlyphBBoxMode.Pixels);

                var left = bounds.Left;
                var tvop = bounds.Top;
                var right = bounds.Right;
                var bvottom = bounds.Bottom;
 

i use SharpFont.Glyp class
Font class method LoadGlyph()
 SharpFont.Glyph glyph = new SharpFont.Glyph((IntPtr)glyphRecPtr, LibraryInstance);

i noticed that in  source code of sfml using class Glyph with Bound property and method GetCBox doesn't use
 const Glyph& glyph = m_font->getGlyph(curChar, m_characterSize, bold);

        int left   = glyph.bounds.left;
        int top    = glyph.bounds.top;
        int right  = glyph.bounds.left + glyph.bounds.width;
        int bottom = glyph.bounds.top  + glyph.bounds.height;
Finally, what kind of Glyph class uses in sources? because SharpFont.Glyph doesn't have property Bounds (we can get it uses only GetCBox method that crashes app :()
Title: Re: Glyph problems
Post by: Laurent on August 04, 2014, 09:55:45 am
SFML defines its own Glyph class, which has nothing to do with SharpFont. I'm afraid you're on the wrong forum.
Title: Re: Glyph problems
Post by: aferents on August 04, 2014, 10:04:32 am
Thanks, it is that i needed