FFXIVAPP.Hooker.Engine.DXFont.GetCharHeight C# (CSharp) Method

GetCharHeight() public method

public GetCharHeight ( ) : int
return int
        public int GetCharHeight()
        {
            Debug.Assert(_initialized);

            return _charHeight;
        }

Usage Example

コード例 #1
0
        public void DrawString(int X, int Y, string text, int R, int G, int B, int A, DXFont F)
        {
            var blendFactor = new Color4(1.0f);
            Color4 backupBlendFactor;
            int backupMask;
            var backupBlendState = _deviceContext.OutputMerger.GetBlendState(out backupBlendFactor, out backupMask);
            _deviceContext.OutputMerger.SetBlendState(_transparentBS, blendFactor);

            BeginBatch(F.GetFontSheetSRV());

            var length = text.Length;

            var posX = X;
            var posY = Y;

            var vec = new Vector4(R > 0 ? (float) (R / 255.0f) : 0.0f, G > 0 ? (float) (G / 255.0f) : 0.0f, B > 0 ? (float) (B / 255.0f) : 0.0f, A > 0 ? (float) (A / 255.0f) : 0.0f);
            var color = new Color4(vec);

            for (var i = 0; i < length; ++i)
            {
                var character = text[i];

                switch (character)
                {
                    case ' ':
                        posX += F.GetSpaceWidth();
                        break;
                    case '\n':
                        posX = X;
                        posY += F.GetCharHeight();
                        break;
                    default:
                        var charRect = F.GetCharRect(character);

                        var width = charRect.Right - charRect.Left;
                        var height = charRect.Bottom - charRect.Top;

                        Draw(new Rectangle(posX, posY, posX + width, posY + height), charRect, color);

                        posX += width + 1;
                        break;
                }
            }

            EndBatch();
            _deviceContext.OutputMerger.SetBlendState(backupBlendState, backupBlendFactor, backupMask);
        }