FairyGUI.DynamicFont.GetBaseLine C# (CSharp) Method

GetBaseLine() private method

private GetBaseLine ( int size ) : int
size int
return int
        int GetBaseLine(int size)
        {
            int result;
            if (!_cachedBaseline.TryGetValue(size, out result))
            {
                CharacterInfo charInfo;
                _font.RequestCharactersInTexture("f|体_j", size, FontStyle.Normal);

            #if UNITY_5
                float y0 = float.MinValue;
                if (_font.GetCharacterInfo('f', out charInfo, size, FontStyle.Normal))
                    y0 = Mathf.Max(y0, charInfo.maxY);
                if (_font.GetCharacterInfo('|', out charInfo, size, FontStyle.Normal))
                    y0 = Mathf.Max(y0, charInfo.maxY);
                if (_font.GetCharacterInfo('体', out charInfo, size, FontStyle.Normal))
                    y0 = Mathf.Max(y0, charInfo.maxY);

                //find the most bottom position
                float y1 = float.MaxValue;
                if (_font.GetCharacterInfo('_', out charInfo, size, FontStyle.Normal))
                    y1 = Mathf.Min(y1, charInfo.minY);
                if (_font.GetCharacterInfo('|', out charInfo, size, FontStyle.Normal))
                    y1 = Mathf.Min(y1, charInfo.minY);
                if (_font.GetCharacterInfo('j', out charInfo, size, FontStyle.Normal))
                    y1 = Mathf.Min(y1, charInfo.minY);
            #else
                float y0 = float.MinValue;
                if (_font.GetCharacterInfo('f', out charInfo, size, FontStyle.Normal))
                    y0 = Mathf.Max(y0, charInfo.vert.yMin);
                if (_font.GetCharacterInfo('|', out charInfo, size, FontStyle.Normal))
                    y0 = Mathf.Max(y0, charInfo.vert.yMin);
                if (_font.GetCharacterInfo('体', out charInfo, size, FontStyle.Normal))
                    y0 = Mathf.Max(y0, charInfo.vert.yMin);

                //find the most bottom position
                float y1 = float.MaxValue;
                if (_font.GetCharacterInfo('_', out charInfo, size, FontStyle.Normal))
                    y1 = Mathf.Min(y1, charInfo.vert.yMax);
                if (_font.GetCharacterInfo('|', out charInfo, size, FontStyle.Normal))
                    y1 = Mathf.Min(y1, charInfo.vert.yMax);
                if (_font.GetCharacterInfo('j', out charInfo, size, FontStyle.Normal))
                    y1 = Mathf.Min(y1, charInfo.vert.yMax);
            #endif
                float dh = y0 - y1 - size;
                if (dh > 3) //5.4版本后部分字体的渲染位置开始偏低
                {
                    y0 -= Mathf.Floor(dh / 2);
                    dh = y0 - y1 - size;
                }
                result = (int)(y0 + (int)(dh * 0.5f));
                _cachedBaseline.Add(size, result);
            }

            return result;
        }