static int _CreateFairyGUI_DynamicFont(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { FairyGUI.DynamicFont obj = new FairyGUI.DynamicFont(); ToLua.PushObject(L, obj); return(1); } else if (count == 2) { string arg0 = ToLua.CheckString(L, 1); UnityEngine.Font arg1 = (UnityEngine.Font)ToLua.CheckObject(L, 2, typeof(UnityEngine.Font)); FairyGUI.DynamicFont obj = new FairyGUI.DynamicFont(arg0, arg1); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.DynamicFont.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static BaseFont GetFont(string name) { BaseFont ret; if (!sFontFactory.TryGetValue(name, out ret)) { ret = new DynamicFont(name); sFontFactory.Add(name, ret); } return ret; }
public static BaseFont GetFont(string name) { BaseFont ret; if (!sFontFactory.TryGetValue(name, out ret)) { ret = new DynamicFont(name); sFontFactory.Add(name, ret); } if (ret.packageItem!=null && !ret.packageItem.decoded) ret.packageItem.Load(); return ret; }
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)); } }
static public int PrepareCharacters(IntPtr l) { try { FairyGUI.DynamicFont self = (FairyGUI.DynamicFont)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.PrepareCharacters(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static int Dispose(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)ToLua.CheckObject <FairyGUI.DynamicFont>(L, 1); obj.Dispose(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int constructor(IntPtr l) { try { FairyGUI.DynamicFont o; System.String a1; checkType(l, 2, out a1); o = new FairyGUI.DynamicFont(a1); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
static int PrepareCharacters(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)ToLua.CheckObject <FairyGUI.DynamicFont>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.PrepareCharacters(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int GetGlyph(IntPtr l) { try { FairyGUI.DynamicFont self = (FairyGUI.DynamicFont)checkSelf(l); System.Char a1; checkType(l, 2, out a1); var ret = self.GetGlyph(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static int HasCharacter(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)ToLua.CheckObject <FairyGUI.DynamicFont>(L, 1); char arg0 = (char)LuaDLL.luaL_checknumber(L, 2); bool o = obj.HasCharacter(arg0); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetLineHeight(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)ToLua.CheckObject <FairyGUI.DynamicFont>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int o = obj.GetLineHeight(arg0); LuaDLL.lua_pushinteger(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SetFormat(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)ToLua.CheckObject <FairyGUI.DynamicFont>(L, 1); FairyGUI.TextFormat arg0 = (FairyGUI.TextFormat)ToLua.CheckObject <FairyGUI.TextFormat>(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); obj.SetFormat(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_nativeFont(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)o; UnityEngine.Font ret = obj.nativeFont; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index nativeFont on a nil value")); } }
static int set_nativeFont(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)o; UnityEngine.Font arg0 = (UnityEngine.Font)ToLua.CheckObject(L, 2, typeof(UnityEngine.Font)); obj.nativeFont = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index nativeFont on a nil value")); } }
static int DrawGlyph(IntPtr L) { try { ToLua.CheckArgsCount(L, 7); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)ToLua.CheckObject <FairyGUI.DynamicFont>(L, 1); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); System.Collections.Generic.List <UnityEngine.Vector3> arg2 = (System.Collections.Generic.List <UnityEngine.Vector3>)ToLua.CheckObject(L, 4, typeof(System.Collections.Generic.List <UnityEngine.Vector3>)); System.Collections.Generic.List <UnityEngine.Vector2> arg3 = (System.Collections.Generic.List <UnityEngine.Vector2>)ToLua.CheckObject(L, 5, typeof(System.Collections.Generic.List <UnityEngine.Vector2>)); System.Collections.Generic.List <UnityEngine.Vector2> arg4 = (System.Collections.Generic.List <UnityEngine.Vector2>)ToLua.CheckObject(L, 6, typeof(System.Collections.Generic.List <UnityEngine.Vector2>)); System.Collections.Generic.List <UnityEngine.Color32> arg5 = (System.Collections.Generic.List <UnityEngine.Color32>)ToLua.CheckObject(L, 7, typeof(System.Collections.Generic.List <UnityEngine.Color32>)); int o = obj.DrawGlyph(arg0, arg1, arg2, arg3, arg4, arg5); LuaDLL.lua_pushinteger(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> static public BaseFont GetFont(string name, Font font = null) { BaseFont ret; if (name.StartsWith(UIPackage.URL_PREFIX)) { ret = UIPackage.GetItemAssetByURL(name) as BaseFont; if (ret != null) { return(ret); } } if (!sFontFactory.TryGetValue(name, out ret)) { ret = new DynamicFont(name, font); sFontFactory.Add(name, ret); } return(ret); }
static int GetGlyph(IntPtr L) { try { ToLua.CheckArgsCount(L, 5); FairyGUI.DynamicFont obj = (FairyGUI.DynamicFont)ToLua.CheckObject <FairyGUI.DynamicFont>(L, 1); char arg0 = (char)LuaDLL.luaL_checknumber(L, 2); float arg1; float arg2; float arg3; bool o = obj.GetGlyph(arg0, out arg1, out arg2, out arg3); LuaDLL.lua_pushboolean(L, o); LuaDLL.lua_pushnumber(L, arg1); LuaDLL.lua_pushnumber(L, arg2); LuaDLL.lua_pushnumber(L, arg3); return(4); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> static public BaseFont GetFont(string name) { string url = UIPackage.NormalizeURL(name); if (url != null) { name = url; } BaseFont ret; if (!sFontFactory.TryGetValue(name, out ret)) { ret = new DynamicFont(name); sFontFactory.Add(name, ret); } if (ret.packageItem != null && !ret.packageItem.decoded) { ret.packageItem.Load(); } return(ret); }
void LoadFont() { //Try to load name.ttf in Resources _font = (Font)Resources.Load(name, typeof(Font)); //Try to load name.ttf in Resources/Fonts/ if (_font == null) { _font = (Font)Resources.Load("Fonts/" + name, typeof(Font)); } #if (UNITY_5 || UNITY_5_3_OR_NEWER) //Try to use new API in Uinty5 to load if (_font == null) { if (name.IndexOf(",") != -1) { string[] arr = name.Split(','); int cnt = arr.Length; for (int i = 0; i < cnt; i++) { arr[i] = arr[i].Trim(); } _font = Font.CreateDynamicFontFromOSFont(arr, 16); } else { _font = Font.CreateDynamicFontFromOSFont(name, 16); } } #endif if (_font == null) { if (name != UIConfig.defaultFont) { DynamicFont bf = FontManager.GetFont(UIConfig.defaultFont) as DynamicFont; if (bf != null) { _font = bf._font; } } //Try to use Unity builtin resource if (_font == null) { _font = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf"); } if (_font == null) { throw new Exception("Cant load font '" + name + "'"); } } else { _font.hideFlags = DisplayOptions.hideFlags; _font.material.hideFlags = DisplayOptions.hideFlags; _font.material.mainTexture.hideFlags = DisplayOptions.hideFlags; } #if (UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER) Font.textureRebuilt += textureRebuildCallback; #else _font.textureRebuildCallback += textureRebuildCallback; #endif this.mainTexture = new NTexture(_font.material.mainTexture); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> static public BaseFont GetFont(string name) { BaseFont font; if (name.StartsWith(UIPackage.URL_PREFIX)) { font = UIPackage.GetItemAssetByURL(name) as BaseFont; if (font != null) { return(font); } } if (sFontFactory.TryGetValue(name, out font)) { return(font); } object asset = null; if (Regex.IsMatch(name, ".ttf")) { asset = libx.Assets.LoadAsset("Assets/Res/Fonts/" + name, typeof(UnityEngine.Font)).asset; } else { asset = Resources.Load(name); } if (asset == null) { asset = Resources.Load("Fonts/" + name); } //Try to use new API in Uinty5 to load if (asset == null) { if (name.IndexOf(",") != -1) { string[] arr = name.Split(','); int cnt = arr.Length; for (int i = 0; i < cnt; i++) { arr[i] = arr[i].Trim(); } asset = Font.CreateDynamicFontFromOSFont(arr, 16); } else { asset = Font.CreateDynamicFontFromOSFont(name, 16); } } if (asset == null) { return(Fallback(name)); } if (asset is Font) { font = new DynamicFont(); font.name = name; sFontFactory.Add(name, font); ((DynamicFont)font).nativeFont = (Font)asset; } #if FAIRYGUI_TMPRO else if (asset is TMPro.TMP_FontAsset) { font = new TMPFont(); font.name = name; sFontFactory.Add(name, font); ((TMPFont)font).fontAsset = (TMPro.TMP_FontAsset)asset; } #endif else { if (asset.GetType().Name.Contains("TMP_FontAsset")) { Debug.LogWarning("To enable TextMeshPro support, add script define symbol: FAIRYGUI_TMPRO"); } return(Fallback(name)); } return(font); }