示例#1
0
    /// <summary>
    /// Font selection function.
    /// </summary>

    void OnSelectFont(Object obj)
    {
        Font   trueFont = obj as Font;
        UIFont font     = UIFont.CreateInstance <UIFont>();

        font.TrueTypeFont = trueFont;
        UISettings.font   = font;
        Repaint();
    }
示例#2
0
    /// <summary>
    /// Legacy functionality support.
    /// </summary>

    protected override void OnStart()
    {
        if (font == null)
        {
            font = UIFont.CreateInstance <UIFont>();
        }

        if (mLineWidth > 0f)
        {
            mMaxLineWidth = Mathf.RoundToInt(mLineWidth);
            mLineWidth    = 0f;
        }

        font.RefreshText(mText, FontSize, mFontStyle, TrueTypeFont);
    }
示例#3
0
    /// <summary>
    /// Font selection callback.
    /// </summary>

    void OnSelectFont(UnityEngine.Object obj)
    {
        if (mLabel != null)
        {
            NGUIEditorTools.RegisterUndo("Font Selection", mLabel);
            bool resize = (mLabel.font == null);
            mLabel.font = mLabel.font == null?UIFont.CreateInstance <UIFont>() : mLabel.font;

            mLabel.TrueTypeFont = obj as Font;
            if (resize)
            {
                mLabel.MakePixelPerfect();
            }
        }
    }
示例#4
0
 void OnSelectFont(Object obj)
 {
     RegisterUndo();
     mList.font = UIFont.CreateInstance <UIFont>();
     mList.font.TrueTypeFont = obj as Font;
 }