QuickFont.QFontData.CalculateMaxHeight C# (CSharp) Метод

CalculateMaxHeight() публичный Метод

public CalculateMaxHeight ( ) : void
Результат void
        public void CalculateMaxHeight()
        {
            maxGlyphHeight = 0;
            foreach (var glyph in CharSetMapping)
                maxGlyphHeight = Math.Max(glyph.Value.rect.Height, maxGlyphHeight);

        }

Usage Example

Пример #1
0
        private static QFont BuildDropShadow(List <QBitmap> sourceFontSheets, QFontGlyph[] sourceFontGlyphs, QFontShadowConfiguration shadowConfig, char[] charSet, byte alphaTolerance)
        {
            QFontGlyph[] newGlyphs;

            var sourceBitmapData = new List <BitmapData>();

            foreach (var sourceSheet in sourceFontSheets)
            {
                sourceBitmapData.Add(sourceSheet.bitmapData);
            }

            //GenerateBitmapSheetsAndRepack(QFontGlyph[] sourceGlyphs, BitmapData[] sourceBitmaps, int destSheetWidth, int destSheetHeight, out QFontGlyph[] destGlyphs, int destMargin, bool usePowerOfTwo)

            var bitmapSheets = GenerateBitmapSheetsAndRepack(sourceFontGlyphs, sourceBitmapData.ToArray(), shadowConfig.PageWidth, shadowConfig.PageHeight, out newGlyphs, shadowConfig.GlyphMargin + shadowConfig.blurRadius * 3, shadowConfig.ForcePowerOfTwo);

            //scale up in case we wanted bigger/smaller shadows
            if (shadowConfig.Scale != 1.0f)
            {
                ScaleSheetsAndGlyphs(bitmapSheets, newGlyphs, shadowConfig.Scale); //no point in retargeting yet, since we will do it after blur
            }
            //blacken and blur
            foreach (var bitmapSheet in bitmapSheets)
            {
                bitmapSheet.Colour32(0, 0, 0);
                bitmapSheet.BlurAlpha(shadowConfig.blurRadius, shadowConfig.blurPasses);
            }

            //retarget after blur and scale
            RetargetAllGlyphs(bitmapSheets, newGlyphs, alphaTolerance);

            //create list of texture pages
            var newTextureSheets = new List <TexturePage>();

            foreach (var page in bitmapSheets)
            {
                newTextureSheets.Add(new TexturePage(page.bitmapData));
            }

            var fontData = new QFontData();

            fontData.CharSetMapping = new Dictionary <char, QFontGlyph>();
            for (int i = 0; i < charSet.Length; i++)
            {
                fontData.CharSetMapping.Add(charSet[i], newGlyphs[i]);
            }

            fontData.Pages = newTextureSheets.ToArray();
            fontData.CalculateMeanWidth();
            fontData.CalculateMaxHeight();

            foreach (var sheet in bitmapSheets)
            {
                sheet.Free();
            }

            return(new QFont(fontData));
        }
All Usage Examples Of QuickFont.QFontData::CalculateMaxHeight