FairyGUI.DynamicFont.SetFormat C# (CSharp) Method

SetFormat() public method

public SetFormat ( TextFormat format, float fontSizeScale ) : void
format TextFormat
fontSizeScale float
return void
        public override void SetFormat(TextFormat format, float fontSizeScale)
        {
            if (fontSizeScale == 1)
                _size = format.size;
            else
                _size = Mathf.FloorToInt((float)format.size * fontSizeScale);
            if (keepCrisp)
                _size = Mathf.FloorToInt(_size * UIContentScaler.scaleFactor);

            if (format.bold && !customBold)
            {
                if (format.italic)
                {
                    if (customBoldAndItalic)
                        _style = FontStyle.Italic;
                    else
                        _style = FontStyle.BoldAndItalic;
                }
                else
                    _style = FontStyle.Bold;
            }
            else
            {
                if (format.italic)
                    _style = FontStyle.Italic;
                else
                    _style = FontStyle.Normal;
            }
        }

Usage Example

 static public int SetFormat(IntPtr l)
 {
     try {
         FairyGUI.DynamicFont self = (FairyGUI.DynamicFont)checkSelf(l);
         FairyGUI.TextFormat  a1;
         checkType(l, 2, out a1);
         self.SetFormat(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
All Usage Examples Of FairyGUI.DynamicFont::SetFormat