示例#1
0
        /// <summary>
        /// Initialise
        /// </summary>
        public override void Initialise()
        {
            base.Initialise();

            m_Shader.Initialise();

            GL.GenTextures(1, out m_FontTexture);
            GL.GenBuffers(1, out m_CoordBuffer);

            //
            // This is important as we the font bitmaps are not 4 byte aligned. We have to tell GL about that.
            //
            GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);

            // create texture atlas.
            GL.BindTexture(TextureTarget.Texture2D, m_FontTexture);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);

            // Bitmap data is just 1 byte. For OpenGL we could use GL_RED. but in ES we use Luminance.
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Alpha, TEX_WIDTH, TEX_HEIGHT, 0, PixelFormat.Alpha, PixelType.UnsignedByte, IntPtr.Zero);

            // load buffers for displaying a texture.
            LoadBuffers();

            // load a unicode font .
            if (FreeType.TryLoadFont(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "arialuni.ttf"), 250))
            {
                // write some messages.
                LoadFontChars(RenderMode.Glyph, 10, TEX_HEIGHT - 10, "A");
            }
        }
示例#2
0
        /// <summary>
        /// Load characters
        /// </summary>
        private void LoadFontChars(int x, int y, string msg)
        {
            // Loop each character in the message
            foreach (var c in msg)
            {
                // Try and get the data.
                GlyphInfo glyph;
                if (FreeType.TryGetCharBitmap(c, out glyph))
                {
                    // load bitmap data if any available (space doesn't have one of course).
                    if (glyph.BitmapData.Length > 0)
                    {
                        unsafe
                        {
                            fixed(byte *p = glyph.BitmapData)
                            {
                                // Use text sub image 2D to write this bitmap data into our texture.
                                GL.TexSubImage2D(TextureTarget.Texture2D, 0, x + glyph.X, y - glyph.Y, glyph.Width, glyph.Height, PixelFormat.Alpha, PixelType.UnsignedByte, (IntPtr)p);
                            }
                        }
                    }

                    // move on to the next character.
                    x += glyph.AdvanceX;
                    y += glyph.AdvanceY;
                }
            }
        }
示例#3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0L)
            {
                hash ^= Id.GetHashCode();
            }
            if (UserId != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (MallId != 0)
            {
                hash ^= MallId.GetHashCode();
            }
            if (FreeType != 0)
            {
                hash ^= FreeType.GetHashCode();
            }
            if (MaturityTime != 0L)
            {
                hash ^= MaturityTime.GetHashCode();
            }
            return(hash);
        }
示例#4
0
 public FontRepository(GraphicsDevice graphicsDevice)
 {
     this.graphicsDevice = graphicsDevice;
     freeType            = new FreeType();
     faces = new Dictionary <string, FreeTypeFace>();
     fonts = new Dictionary <string, Font>();
 }
示例#5
0
 public void TearDown()
 {
     Font.Dispose();
     FiraSansRegular.Dispose();
     FreeType.Dispose();
     Buffer.Dispose();
 }
示例#6
0
        public FontFace(FontLibrary fontLibrary, string path, uint faceIndex)
        {
            FreeType.ThrowIfNotOk(FreeType.FT_New_Face(fontLibrary.Handle, path, (int)faceIndex, out IntPtr handle));
            _Library = fontLibrary;
            Handle   = handle;

            _AvailableCharacters = new HashSet <Rune>();
        }
示例#7
0
        /// <summary>
        /// Finish
        /// </summary>
        public override void Finish()
        {
            GL.DeleteBuffers(1, ref m_CoordBuffer);
            GL.DeleteTextures(1, ref m_FontTexture);

            // clean up free type.
            FreeType.Finish();
        }
        public static bool VirtualFreeEx(IntPtr handle, IntPtr address, IntPtr size, FreeType freeType)
        {
            uint status = NtFreeVirtualMemory(handle, address, size, freeType);

            if (CaptureErrors)
            {
                LastError = (int)status;
            }

            return(NtSuccess(status));
        }
示例#9
0
        private void Dispose(bool dispose)
        {
            if (_Disposed || !dispose)
            {
                return;
            }

            FreeType.FT_Done_Face(Handle);

            _Disposed = true;
        }
示例#10
0
        /// <summary>
        /// Осводождает ранее выделенный участок памяти.
        /// </summary>
        /// <param name="address">Указатель на выделенный участок памяти.</param>
        /// <param name="freeType">Тип осводождения памяти.</param>
        public void Free(IntPtr address, FreeType freeType = FreeType.Release)
        {
            if (address == IntPtr.Zero)
            {
                throw new ArgumentNullException(nameof(address));
            }

            if (!VirtualFreeEx(Process.Handle, address, 0, freeType))
            {
                throw new Win32Exception();
            }
        }
示例#11
0
        /// <summary>
        /// Initialise
        /// </summary>
        public override void Initialise()
        {
            base.Initialise();

            m_Shader.Initialise();

            GL.GenTextures(1, out m_FontTexture);
            GL.GenBuffers(1, out m_CoordBuffer);

            //
            // This is important as we the font bitmaps are not 4 byte aligned. We have to tell GL about that.
            //
            GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);

            // create texture atlas.
            GL.BindTexture(TextureTarget.Texture2D, m_FontTexture);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);

            // Bitmap data is just 1 byte. For OpenGL we could use GL_RED. but in ES we use Luminance.
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Alpha, 512, 256, 0, PixelFormat.Alpha, PixelType.UnsignedByte, IntPtr.Zero);

            // load buffers for displaying a texture.
            LoadBuffers();

            // load a unicode font .
            if (FreeType.TryLoadFont(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "arialuni.ttf"), 12))
            {
                // write some messages.
                LoadFontChars(10, 50, "Hello there");
                LoadFontChars(10, 75, "This has got some こんにちは unicode characters");
                LoadFontChars(10, 100, "But you have to make sure you use a unicode font set");
                LoadFontChars(10, 125, "We are using arialuni.ttf");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Could not load fonts");
            }
        }
示例#12
0
        public App(GameWindowSettings gws, NativeWindowSettings nws) : base(gws, nws)
        {
            _engine                    = new RenderEngine(nws.Size.X, nws.Size.Y);
            _engine.Camera.Fov         = 90f;
            _engine.Camera.Sensitivity = 0.7f;

            _maxFps = RenderFrequency;
            MaxFPS  = RenderFrequency;

            var _model2 = ModelLoader.LoadFromFile("./Resources/untitled1.obj");

            _model = new ObjModel(_model2.Vertex.ToArray(), _model2.UV.ToArray());

            _freeType     = new FreeType("C:/Windows/Fonts/segoeuisl.ttf");
            _fontRenderer = new FontRenderer(Size.X, Size.Y);

            _pluginLoader = new PluginLoader();
            _pluginLoader.LoadPlugin("SimplePlugin");

            var stringFont = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"!`?'.,;:()[]{}<>|/@\\^$-%+=#_&~* ";

            try
            {
                stringFont = File.ReadAllText("./Resources/stringFont.txt").Replace("\n", string.Empty);
            }
            catch
            {
                Console.WriteLine("stringFont.txt not found. Using default");
            }


            VSync = VSyncMode.Off;

            foreach (var c in stringFont)
            {
                new Character(c.ToString());
            }
        }
示例#13
0
文件: Win32.cs 项目: sq/PETools
 public static extern int VirtualFreeEx(
     IntPtr hProcess, IntPtr lpAddress,
     uint dwSize, FreeType dwFreeType
 );
示例#14
0
 internal static extern bool VirtualFreeEx(
     SafeProcessHandle hProcess,
     IntPtr lpAddress,
     int dwSize,
     FreeType dwFreeType);
示例#15
0
 public static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress,
                                         int dwSize, FreeType dwFreeType);
示例#16
0
 public static extern bool VirtualFree(byte *lpAddress, UIntPtr dwSize,
                                       FreeType dwFreeType);
示例#17
0
 [DllImport("kernel32.dll")][return : MarshalAs(UnmanagedType.Bool)] public static extern bool VirtualFree(IntPtr lpAddress, uint dwSize, FreeType flFreeType);
示例#18
0
文件: WinAPI.cs 项目: aghili/nwohack
 public static extern bool VirtualFreeEx( IntPtr hProcess, DWORD_PTR lpAddress, uint dwSize, FreeType dwFreeType );
示例#19
0
 private static extern int VirtualFree(IntPtr lpAddress, IntPtr dwSize, FreeType freeType);
示例#20
0
 private static extern bool VirtualFree(IntPtr lpAddress, UInt32 dwSize, FreeType dwFreeType);
示例#21
0
 public static extern bool VirtualFree(nint lpAddress, nuint dwSize, FreeType dwFreeType);
示例#22
0
文件: Memory.cs 项目: zsybupt/TrimDB
 internal extern static bool VirtualFree(IntPtr lpAddress, UIntPtr dwSize, FreeType dwFreeType);
 private static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, IntPtr dwSize, FreeType dwFreeType);
示例#24
0
    /// <summary>
    /// Draw the UI for this tool.
    /// </summary>

    void OnGUI()
    {
        Object fnt    = NGUISettings.ambigiousFont;
        UIFont uiFont = (fnt as UIFont);

        NGUIEditorTools.SetLabelWidth(80f);
        GUILayout.Space(3f);

        NGUIEditorTools.DrawHeader("Input", true);
        NGUIEditorTools.BeginContents(false);

        GUILayout.BeginHorizontal();
        mType = (FontType)EditorGUILayout.EnumPopup("Type", mType, GUILayout.MinWidth(200f));
        NGUIEditorTools.DrawPadding();
        GUILayout.EndHorizontal();
        Create create = Create.None;

        if (mType == FontType.ImportedBitmap)
        {
            NGUISettings.fontData    = EditorGUILayout.ObjectField("Font Data", NGUISettings.fontData, typeof(TextAsset), false) as TextAsset;
            NGUISettings.fontTexture = EditorGUILayout.ObjectField("Texture", NGUISettings.fontTexture, typeof(Texture2D), false, GUILayout.Width(140f)) as Texture2D;
            NGUIEditorTools.EndContents();

            // Draw the atlas selection only if we have the font data and texture specified, just to make it easier
            EditorGUI.BeginDisabledGroup(NGUISettings.fontData == null || NGUISettings.fontTexture == null);
            {
                NGUIEditorTools.DrawHeader("Output", true);
                NGUIEditorTools.BeginContents(false);
                ComponentSelector.Draw <UIAtlas>(NGUISettings.atlas, OnSelectAtlas, false);
                NGUIEditorTools.EndContents();
            }
            EditorGUI.EndDisabledGroup();

            if (NGUISettings.fontData == null)
            {
                EditorGUILayout.HelpBox("To create a font from a previously exported FNT file, you need to use BMFont on " +
                                        "Windows or your choice of Glyph Designer or the less expensive bmGlyph on the Mac.\n\n" +
                                        "Either of these tools will create a FNT file for you that you will drag & drop into the field above.", MessageType.Info);
            }
            else if (NGUISettings.fontTexture == null)
            {
                EditorGUILayout.HelpBox("When exporting your font, you should get two files: the FNT, and the texture. Only one texture can be used per font.", MessageType.Info);
            }
            else if (NGUISettings.atlas == null)
            {
                EditorGUILayout.HelpBox("You can create a font that doesn't use a texture atlas. This will mean that the text " +
                                        "labels using this font will generate an extra draw call.\n\nIf you do specify an atlas, the font's texture will be added to it automatically.", MessageType.Info);
            }

            EditorGUI.BeginDisabledGroup(NGUISettings.fontData == null || NGUISettings.fontTexture == null);
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(20f);
                if (GUILayout.Button("Create the Font"))
                {
                    create = Create.Import;
                }
                GUILayout.Space(20f);
                GUILayout.EndHorizontal();
            }
            EditorGUI.EndDisabledGroup();
        }
        else
        {
            GUILayout.BeginHorizontal();
            if (NGUIEditorTools.DrawPrefixButton("Source"))
            {
                ComponentSelector.Show <Font>(OnUnityFont, new string[] { ".ttf", ".otf" });
            }

            Font ttf = EditorGUILayout.ObjectField(NGUISettings.ambigiousFont as Font, typeof(Font), false) as Font;
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                NGUISettings.fontSize = EditorGUILayout.IntField("Size", NGUISettings.fontSize, GUILayout.Width(120f));

                if (mType == FontType.Dynamic)
                {
                    NGUISettings.fontStyle = (FontStyle)EditorGUILayout.EnumPopup(NGUISettings.fontStyle);
                    NGUIEditorTools.DrawPadding();
                }
            }
            GUILayout.EndHorizontal();

            // Choose the font style if there are multiple faces present
            if (mType == FontType.GeneratedBitmap)
            {
                if (!FreeType.isPresent)
                {
                    string filename = (Application.platform == RuntimePlatform.WindowsEditor) ? "FreeType.dll" : "FreeType.dylib";

                    EditorGUILayout.HelpBox("Assets/NGUI/Editor/" + filename + " is missing", MessageType.Error);

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(20f);

                    if (GUILayout.Button("Find " + filename))
                    {
                        string path = EditorUtility.OpenFilePanel("Find " + filename, NGUISettings.currentPath,
                                                                  (Application.platform == RuntimePlatform.WindowsEditor) ? "dll" : "dylib");

                        if (!string.IsNullOrEmpty(path))
                        {
                            if (System.IO.Path.GetFileName(path) == filename)
                            {
                                NGUISettings.currentPath    = System.IO.Path.GetDirectoryName(path);
                                NGUISettings.pathToFreeType = path;
                            }
                            else
                            {
                                Debug.LogError("The library must be named '" + filename + "'");
                            }
                        }
                    }
                    GUILayout.Space(20f);
                    GUILayout.EndHorizontal();
                }
                else if (ttf != null)
                {
                    string[] faces = FreeType.GetFaces(ttf);

                    if (faces != null)
                    {
                        if (mFaceIndex >= faces.Length)
                        {
                            mFaceIndex = 0;
                        }

                        if (faces.Length > 1)
                        {
                            GUILayout.Label("Style", EditorStyles.boldLabel);
                            for (int i = 0; i < faces.Length; ++i)
                            {
                                GUILayout.BeginHorizontal();
                                GUILayout.Space(10f);
                                if (DrawOption(i == mFaceIndex, " " + faces[i]))
                                {
                                    mFaceIndex = i;
                                }
                                GUILayout.EndHorizontal();
                            }
                        }
                    }

                    GUILayout.Label("Characters", EditorStyles.boldLabel);

                    CharacterMap cm = characterMap;

                    GUILayout.BeginHorizontal(GUILayout.Width(100f));
                    GUILayout.BeginVertical();
                    GUI.changed = false;
                    if (DrawOption(cm == CharacterMap.Numeric, " Numeric"))
                    {
                        cm = CharacterMap.Numeric;
                    }
                    if (DrawOption(cm == CharacterMap.Ascii, " ASCII"))
                    {
                        cm = CharacterMap.Ascii;
                    }
                    if (DrawOption(cm == CharacterMap.Latin, " Latin"))
                    {
                        cm = CharacterMap.Latin;
                    }
                    if (DrawOption(cm == CharacterMap.Custom, " Custom"))
                    {
                        cm = CharacterMap.Custom;
                    }
                    if (GUI.changed)
                    {
                        characterMap = cm;
                    }
                    GUILayout.EndVertical();

                    EditorGUI.BeginDisabledGroup(cm != CharacterMap.Custom);
                    {
                        if (cm != CharacterMap.Custom)
                        {
                            string chars = "";

                            if (cm == CharacterMap.Ascii)
                            {
                                for (int i = 33; i < 127; ++i)
                                {
                                    chars += System.Convert.ToChar(i);
                                }
                            }
                            else if (cm == CharacterMap.Numeric)
                            {
                                chars = "01234567890";
                            }
                            else if (cm == CharacterMap.Latin)
                            {
                                for (int i = 33; i < 127; ++i)
                                {
                                    chars += System.Convert.ToChar(i);
                                }

                                for (int i = 161; i < 256; ++i)
                                {
                                    chars += System.Convert.ToChar(i);
                                }
                            }

                            NGUISettings.charsToInclude = chars;
                        }

                        GUI.changed = false;

                        string text = NGUISettings.charsToInclude;

                        if (cm == CharacterMap.Custom)
                        {
                            text = EditorGUILayout.TextArea(text, GUI.skin.textArea,
                                                            GUILayout.Height(80f), GUILayout.Width(Screen.width - 100f));
                        }
                        else
                        {
                            GUILayout.Label(text, GUI.skin.textArea,
                                            GUILayout.Height(80f), GUILayout.Width(Screen.width - 100f));
                        }

                        if (GUI.changed)
                        {
                            string final = "";

                            for (int i = 0; i < text.Length; ++i)
                            {
                                char c = text[i];
                                if (c < 33)
                                {
                                    continue;
                                }
                                string s = c.ToString();
                                if (!final.Contains(s))
                                {
                                    final += s;
                                }
                            }

                            if (final.Length > 0)
                            {
                                char[] chars = final.ToCharArray();
                                System.Array.Sort(chars);
                                final = new string(chars);
                            }
                            else
                            {
                                final = "";
                            }

                            NGUISettings.charsToInclude = final;
                        }
                    }
                    EditorGUI.EndDisabledGroup();
                    GUILayout.EndHorizontal();
                }
            }
            NGUIEditorTools.EndContents();

            if (mType == FontType.Dynamic)
            {
                EditorGUI.BeginDisabledGroup(ttf == null);
                GUILayout.BeginHorizontal();
                GUILayout.Space(20f);
                if (GUILayout.Button("Create the Font"))
                {
                    create = Create.Dynamic;
                }
                GUILayout.Space(20f);
                GUILayout.EndHorizontal();
                EditorGUI.EndDisabledGroup();
#if UNITY_3_5
                EditorGUILayout.HelpBox("Dynamic fonts require Unity 4.0 or higher.", MessageType.Error);
#else
                // Helpful info
                if (ttf == null)
                {
                    EditorGUILayout.HelpBox("You don't have to create a UIFont to use dynamic fonts. You can just reference the Unity Font directly on the label.", MessageType.Info);
                }
                EditorGUILayout.HelpBox("Please note that dynamic fonts can't be made a part of an atlas, and using dynamic fonts will result in at least one extra draw call.", MessageType.Warning);
#endif
            }
            else
            {
                bool isBuiltIn = (ttf != null) && string.IsNullOrEmpty(UnityEditor.AssetDatabase.GetAssetPath(ttf));

                // Draw the atlas selection only if we have the font data and texture specified, just to make it easier
                EditorGUI.BeginDisabledGroup(ttf == null || isBuiltIn || !FreeType.isPresent);
                {
                    NGUIEditorTools.DrawHeader("Output", true);
                    NGUIEditorTools.BeginContents(false);
                    ComponentSelector.Draw <UIAtlas>(NGUISettings.atlas, OnSelectAtlas, false);
                    NGUIEditorTools.EndContents();

                    if (ttf == null)
                    {
                        EditorGUILayout.HelpBox("You can create a bitmap font by specifying a dynamic font to use as the source.", MessageType.Info);
                    }
                    else if (isBuiltIn)
                    {
                        EditorGUILayout.HelpBox("You chose an embedded font. You can't create a bitmap font from an embedded resource.", MessageType.Warning);
                    }
                    else if (NGUISettings.atlas == null)
                    {
                        EditorGUILayout.HelpBox("You can create a font that doesn't use a texture atlas. This will mean that the text " +
                                                "labels using this font will generate an extra draw call.\n\nIf you do specify an atlas, the font's texture will be added to it automatically.", MessageType.Info);
                    }

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(20f);
                    if (GUILayout.Button("Create the Font"))
                    {
                        create = Create.Bitmap;
                    }
                    GUILayout.Space(20f);
                    GUILayout.EndHorizontal();
                }
                EditorGUI.EndDisabledGroup();
            }
        }

        if (create == Create.None)
        {
            return;
        }

        // Open the "Save As" file dialog
#if UNITY_3_5
        string prefabPath = EditorUtility.SaveFilePanel("Save As",
                                                        NGUISettings.currentPath, "New Font.prefab", "prefab");
#else
        string prefabPath = EditorUtility.SaveFilePanelInProject("Save As",
                                                                 "New Font.prefab", "prefab", "Save font as...", NGUISettings.currentPath);
#endif
        if (string.IsNullOrEmpty(prefabPath))
        {
            return;
        }
        NGUISettings.currentPath = System.IO.Path.GetDirectoryName(prefabPath);

        // Load the font's prefab
        GameObject go     = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject)) as GameObject;
        Object     prefab = null;
        string     fontName;

        // Font doesn't exist yet
        if (go == null || go.GetComponent <UIFont>() == null)
        {
            // Create a new prefab for the atlas
            prefab = PrefabUtility.CreateEmptyPrefab(prefabPath);

            fontName = prefabPath.Replace(".prefab", "");
            fontName = fontName.Substring(prefabPath.LastIndexOfAny(new char[] { '/', '\\' }) + 1);

            // Create a new game object for the font
            go     = new GameObject(fontName);
            uiFont = go.AddComponent <UIFont>();
        }
        else
        {
            uiFont   = go.GetComponent <UIFont>();
            fontName = go.name;
        }

        if (create == Create.Dynamic)
        {
            uiFont.atlas            = null;
            uiFont.dynamicFont      = NGUISettings.dynamicFont;
            uiFont.dynamicFontStyle = NGUISettings.fontStyle;
            uiFont.defaultSize      = NGUISettings.fontSize;
        }
        else if (create == Create.Import)
        {
            Material mat = null;

            if (NGUISettings.atlas != null)
            {
                // Add the font's texture to the atlas
                UIAtlasMaker.AddOrUpdate(NGUISettings.atlas, NGUISettings.fontTexture);
            }
            else
            {
                // Create a material for the font
                string matPath = prefabPath.Replace(".prefab", ".mat");
                mat = AssetDatabase.LoadAssetAtPath(matPath, typeof(Material)) as Material;

                // If the material doesn't exist, create it
                if (mat == null)
                {
                    Shader shader = Shader.Find("Unlit/Transparent Colored");
                    mat = new Material(shader);

                    // Save the material
                    AssetDatabase.CreateAsset(mat, matPath);
                    AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);

                    // Load the material so it's usable
                    mat = AssetDatabase.LoadAssetAtPath(matPath, typeof(Material)) as Material;
                }

                mat.mainTexture = NGUISettings.fontTexture;
            }

            uiFont.dynamicFont = null;
            BMFontReader.Load(uiFont.bmFont, NGUITools.GetHierarchy(uiFont.gameObject), NGUISettings.fontData.bytes);

            if (NGUISettings.atlas == null)
            {
                uiFont.atlas    = null;
                uiFont.material = mat;
            }
            else
            {
                uiFont.spriteName = NGUISettings.fontTexture.name;
                uiFont.atlas      = NGUISettings.atlas;
            }
            NGUISettings.fontSize = uiFont.defaultSize;
        }
        else if (create == Create.Bitmap)
        {
            // Create the bitmap font
            BMFont    bmFont;
            Texture2D tex;

            if (FreeType.CreateFont(
                    NGUISettings.dynamicFont,
                    NGUISettings.fontSize, mFaceIndex,
                    NGUISettings.charsToInclude, out bmFont, out tex))
            {
                uiFont.bmFont = bmFont;
                tex.name      = fontName;

                if (NGUISettings.atlas != null)
                {
                    // Add this texture to the atlas and destroy it
                    UIAtlasMaker.AddOrUpdate(NGUISettings.atlas, tex);
                    NGUITools.DestroyImmediate(tex);
                    NGUISettings.fontTexture = null;
                    tex = null;

                    uiFont.atlas      = NGUISettings.atlas;
                    uiFont.spriteName = fontName;
                }
                else
                {
                    string texPath = prefabPath.Replace(".prefab", ".png");
                    string matPath = prefabPath.Replace(".prefab", ".mat");

                    byte[]     png = tex.EncodeToPNG();
                    FileStream fs  = File.OpenWrite(texPath);
                    fs.Write(png, 0, png.Length);
                    fs.Close();

                    // See if the material already exists
                    Material mat = AssetDatabase.LoadAssetAtPath(matPath, typeof(Material)) as Material;

                    // If the material doesn't exist, create it
                    if (mat == null)
                    {
                        Shader shader = Shader.Find("Unlit/Transparent Colored");
                        mat = new Material(shader);

                        // Save the material
                        AssetDatabase.CreateAsset(mat, matPath);
                        AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);

                        // Load the material so it's usable
                        mat = AssetDatabase.LoadAssetAtPath(matPath, typeof(Material)) as Material;
                    }
                    else
                    {
                        AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
                    }

                    // Re-load the texture
                    tex = AssetDatabase.LoadAssetAtPath(texPath, typeof(Texture2D)) as Texture2D;

                    // Assign the texture
                    mat.mainTexture          = tex;
                    NGUISettings.fontTexture = tex;

                    uiFont.atlas    = null;
                    uiFont.material = mat;
                }
            }
            else
            {
                return;
            }
        }

        if (prefab != null)
        {
            // Update the prefab
            PrefabUtility.ReplacePrefab(go, prefab);
            DestroyImmediate(go);
            AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);

            // Select the atlas
            go     = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject)) as GameObject;
            uiFont = go.GetComponent <UIFont>();
        }

        if (uiFont != null)
        {
            NGUISettings.ambigiousFont = uiFont;
        }
        MarkAsChanged();
        Selection.activeGameObject = go;
    }
 private static extern bool VirtualFreeEx(SafeMemoryHandle hProcess, IntPtr lpAddress,
                                          UIntPtr dwSize, FreeType dwFreeType);
示例#26
0
 internal static extern bool VirtualFreeEx(
     [In] IntPtr hProcess,
     [In] IntPtr lpAddress,
     [In] int dwSize,
     [In] FreeType dwFreeType);
示例#27
0
 private static extern void DnsRecordListFree([In] IntPtr ptrRecords, [In] FreeType freeType);
示例#28
0
 internal static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr address, UIntPtr size, FreeType freeType);
示例#29
0
 public static extern bool VirtualFree(IntPtr Addr, uint Size = 0, FreeType FType = FreeType.Release);
示例#30
0
文件: WinApi.cs 项目: Lamael/tools
 public static extern bool VirtualFree(Int32 lpAddress, Int32 dwSize, FreeType dwFreeType);
示例#31
0
 private static extern bool VirtualFree(IntPtr lpAddress, UInt32 dwSize, FreeType dwFreeType);
示例#32
0
 private static extern bool VirtualFree(IntPtr baseAddress, IntPtr size, FreeType freeType);
示例#33
0
 static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, FreeType dwFreeType);
示例#34
0
 internal static extern bool VirtualFreeEx(SafeProcessHandle processHandle, IntPtr address, nint size, FreeType freeType);
示例#35
0
文件: Opcode.cs 项目: adamsp/beastmon
     public static extern bool VirtualFree(IntPtr lpAddress, UIntPtr dwSize,
 FreeType dwFreeType);
示例#36
0
 public static extern bool VirtualFree(IntPtr lp_address, int dwSize, FreeType dwFreeType);
示例#37
0
 internal static extern bool VirtualFree(
     IntPtr lpAddress,
     int dwSize,
     FreeType dwFreeType);
示例#38
0
 public static extern bool VirtualFree(IntPtr address, uint size, FreeType freeType);
示例#39
0
 internal static extern bool VirtualFree(IntPtr startAddress, uint stackSize, FreeType freeType);
示例#40
0
 public static extern bool VirtualFree(IntPtr address, uint size, FreeType freeType);