Beispiel #1
0
        public void SetSDFData(UIForiaData data, StructList <Matrix4x4> matrices)
        {
            Array.Copy(matrices.array, 0, transformData, 0, matrices.size);
            Array.Copy(data.colors.array, 0, colorData, 0, data.colors.size);
            Array.Copy(data.objectData0.array, 0, objectData, 0, data.objectData0.size);

            matBlock.SetMatrixArray(s_TransformDataKey, transformData);
            matBlock.SetVectorArray(s_ColorDataKey, colorData);
            matBlock.SetVectorArray(s_ObjectDataKey, objectData);
            if (data.mainTexture != null)
            {
                material.SetTexture(s_MainTextureKey, data.mainTexture);
            }

            if (data.clipTexture != null)
            {
                material.SetTexture(s_ClipTextureKey, data.clipTexture);
            }

            if (data.fontData.fontAsset != null)
            {
                FontData fontData = data.fontData;
                matBlock.SetVector(s_FontDataScales, new Vector4(fontData.gradientScale, fontData.scaleRatioA, fontData.scaleRatioB, fontData.scaleRatioC));
                matBlock.SetVector(s_FontTextureSize, new Vector4(fontData.textureWidth, fontData.textureHeight, 0, 0));
                matBlock.SetTexture(s_FontTexture, fontData.fontAsset.atlas);
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // ExStart:RuleBasedFontsReplacement
            // Load presentation
            Presentation presentation = new Presentation(dataDir + "Fonts.pptx");

            // Load source font to be replaced
            IFontData sourceFont = new FontData("SomeRareFont");

            // Load the replacing font
            IFontData destFont = new FontData("Arial");

            // Add font rule for font replacement
            IFontSubstRule fontSubstRule = new FontSubstRule(sourceFont, destFont, FontSubstCondition.WhenInaccessible);

            // Add rule to font substitute rules collection
            IFontSubstRuleCollection fontSubstRuleCollection = new FontSubstRuleCollection();
            fontSubstRuleCollection.Add(fontSubstRule);

            // Add font rule collection to rule list
            presentation.FontsManager.FontSubstRuleList = fontSubstRuleCollection;

            // Arial font will be used instead of SomeRareFont when inaccessible
            Bitmap bmp = presentation.Slides[0].GetThumbnail(1f, 1f);

            // ExEnd:RuleBasedFontsReplacement
            // Save the image to disk in JPEG format
            bmp.Save(dataDir + "Thumbnail_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
        }
        public static void UpdateFont()
        {
            if (RandomTweaks.settings.FontIndex == 0)
            {
                return;
            }
            var gameObjects = SceneManager.GetActiveScene().GetRootGameObjects();

            foreach (var i in gameObjects)
            {
                foreach (var j in i.GetComponentsInChildren <Text>())
                {
                    FontData fnt = Settings.GetFontData();
                    if (j.name == "txtLevelName")
                    {
                        j.font = fnt.font;
                        j.resizeTextMaxSize = Mathf.RoundToInt(fnt.fontScale * 68);
                        j.GetComponent <Text>().lineSpacing = fnt.lineSpacing;
                    }
                    if (j.name == "txtDescription")
                    {
                        j.resizeTextMaxSize = Mathf.RoundToInt(40 * fnt.fontScale);
                        j.GetComponent <Text>().lineSpacing = fnt.lineSpacing;
                    }
                    if (j.name.StartsWith("Help"))
                    {
                        j.resizeTextMaxSize = Mathf.RoundToInt(6.4f * fnt.fontScale);
                        j.GetComponent <Text>().lineSpacing = fnt.lineSpacing;
                    }
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// control.FontをfontDataのFontに置換する。
        ///
        /// control == nullなら何もせず帰る。(ことを保証する)
        /// </summary>
        /// <param name="control"></param>
        public static void ReplaceFont(Control control, FontData fontData)
        {
            if (control == null)
            {
                return;
            }

            // まず、Control本体のフォントだけ置換する。
            var newFontSize = fontData.FontSize <= 0 ? 9 : fontData.FontSize;
            var newFont     = fontData.CreateFont();

            control.Font = newFont;

            // 子コントロールに対して、UserControl絡みだけ置換する。
            ReplaceUserControlFont(control, newFont);

#if MONO
            // Linux(Monoでメインメニューのフォントが途中から置換されない。Monoのbugくさい。自前で置換する。
            if (control is MenuStrip)
            {
                // そこにぶら下がっているToolStripMenuItemに対してFontの置換を実施する。
                var menu = control as MenuStrip;
                foreach (var item in menu.Items)
                {
                    if (item is ToolStripMenuItem)
                    {
                        (item as ToolStripMenuItem).Font = newFont;
                    }
                }
            }
#endif
        }
Beispiel #5
0
    void Start()
    {
        Object.DontDestroyOnLoad(this);
        universalPrefab         = Resources.Load <GameObject>("Prefabs/Tile_NoCollider");
        universalPrefabCollider = Resources.Load <GameObject>("Prefabs/Tile");
        Object.DontDestroyOnLoad(universalPrefab);
        Texture2D t = Resources.Load <Texture2D>(SpritePaths.MouseCursor);

        Cursor.SetCursor(t, Vector2.zero, CursorMode.ForceSoftware);
        prevMainMenuLocationX = -1;
        prevMainMenuLocationY = 4;
        p1Char            = C.Null;
        p2Char            = C.Null;
        usingGamepad1     = false;
        usingGamepad2     = false;
        initialDifficulty = 4;
        difficulty        = 4;
        unlockNew         = 0;
        isDemo            = false;
        dontFade          = false;
        isTransitioning   = false;
        mostCommonFont    = new FontData(TextAnchor.UpperCenter, TextAlignment.Center, 0.03f);
        SetupFadeVars();
        LoadGeemu();
        StartCoroutine(SameScreenSave(false, true));
        KEY_DELAY = saveInfo.savedOptions["keydelay"];
        SetRes();
        override2P = false;
    }
Beispiel #6
0
        public static void Run()
        {
            // ExStart:AddEmbeddedFonts
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // ExStart:ReplaceFontsExplicitly
            // Load presentation
            Presentation presentation = new Presentation(dataDir + "Fonts.pptx");

            // Load source font to be replaced
            IFontData sourceFont = new FontData("Arial");


            IFontData[] allFonts      = presentation.FontsManager.GetFonts();
            IFontData[] embeddedFonts = presentation.FontsManager.GetEmbeddedFonts();
            foreach (IFontData font in allFonts)
            {
                if (!embeddedFonts.Contains(font))
                {
                    presentation.FontsManager.AddEmbeddedFont(font, EmbedFontCharacters.All);
                }
            }

            // Save the presentation
            presentation.Save(dataDir + "AddEmbeddedFont_out.pptx", SaveFormat.Pptx);
            // ExEnd:AddEmbeddedFonts
        }
Beispiel #7
0
    private static SizeF MeasureString(IDeviceContext g, char chr, Font font, FontData data)
    {
        var chrValue = (int)chr;

        if ((font.Bold && font.Italic) || font.Bold)
        {
            if (chrValue > 255 && data.BoldCharacter[chrValue].Width == 0)
            {
                data.BoldCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
            }
            return(data.BoldCharacter[chrValue]);
        }
        if (font.Italic)
        {
            if (chrValue > 255 && data.ItalicCharacter[chrValue].Width == 0)
            {
                data.ItalicCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
            }
            return(data.ItalicCharacter[chrValue]);
        }
        if (chrValue > 255 && data.NormalCharacter[chrValue].Width == 0)
        {
            data.NormalCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
        }
        return(data.NormalCharacter[chrValue]);
    }
Beispiel #8
0
 private static SizeF MeasureString(IDeviceContext g, char chr, Font font, FontData data)
 {
     var chrValue = (int)chr;
         if ((font.Bold && font.Italic) || font.Bold)
         {
             if (chrValue > 255 && data.BoldCharacter[chrValue].Width == 0)
             {
                 data.BoldCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
             }
             return data.BoldCharacter[chrValue];
         }
         if (font.Italic)
         {
             if (chrValue > 255 && data.ItalicCharacter[chrValue].Width == 0)
             {
                 data.ItalicCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
             }
             return data.ItalicCharacter[chrValue];
         }
         if (chrValue > 255 && data.NormalCharacter[chrValue].Width == 0)
         {
             data.NormalCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
         }
         return data.NormalCharacter[chrValue];
 }
        public FontData GetFontData(string fontFamilyName, bool isItalic, bool isBold)
        {
            FontData data = new FontData()
            {
                IsValid = false,
                Bytes = null,
                FontFamilyName = fontFamilyName,
                IsItalic = isItalic,
                IsBold = isBold
            };

            FontFamily fontFamily = new FontFamily(fontFamilyName);
            FontStyle fontStyle = isItalic ? FontStyles.Italic : FontStyles.Normal;
            FontWeight fontWeight = isBold ? FontWeights.Bold : FontWeights.Normal;
            Typeface typeface = new Typeface(fontFamily, fontStyle, fontWeight, FontStretches.Normal);
            GlyphTypeface glyphTypeface;
            if (typeface.TryGetGlyphTypeface(out glyphTypeface))
            {
                using (var memoryStream = new MemoryStream())
                {
                    glyphTypeface.GetFontStream().CopyTo(memoryStream);
                    data.Bytes = memoryStream.ToArray();
                    data.IsValid = true;
                }
            }

            return data;
        }
Beispiel #10
0
 private void TextChanged()
 {
     if (FontData != null && !string.IsNullOrEmpty(FontName) && !string.IsNullOrEmpty(Text))
     {
         OnTextChanged(FontData.GetText(FontName, Text));
     }
 }
Beispiel #11
0
        private void ApplyFontCollection()
        {
            TextMeshProUGUICustom textMeshProComponent = m_textMeshProComponent;

            if (null == m_fontCollection)
            {
                textMeshProComponent.set_font(TMP_FontAsset.get_defaultFontAsset());
                return;
            }
            textMeshProComponent.set_font(m_fontCollection.fontAsset);
            Material styleMaterial = m_fontCollection.styleMaterial;

            if (null != styleMaterial)
            {
                textMeshProComponent.set_fontSharedMaterial(m_fontCollection.styleMaterial);
            }
            else
            {
                textMeshProComponent.set_fontSharedMaterial(textMeshProComponent.get_font().material);
            }
            FontData fontData = m_fontCollection.fontData;

            if (fontData != null)
            {
                textMeshProComponent.set_fontSize(fontData.fontSize);
                textMeshProComponent.set_characterSpacing(fontData.characterSpacing);
                textMeshProComponent.set_wordSpacing(fontData.wordSpacing);
                textMeshProComponent.set_lineSpacing(fontData.lineSpacing);
                textMeshProComponent.set_paragraphSpacing(fontData.paragraphSpacing);
            }
        }
        public static void Run()
        {
            //ExStart:RuleBasedFontsReplacement
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Load presentation
            Presentation presentation = new Presentation(dataDir + "Fonts.pptx");

            // Load source font to be replaced
            IFontData sourceFont = new FontData("SomeRareFont");

            // Load the replacing font
            IFontData destFont = new FontData("Arial");

            // Add font rule for font replacement
            IFontSubstRule fontSubstRule = new FontSubstRule(sourceFont, destFont, FontSubstCondition.WhenInaccessible);

            // Add rule to font substitute rules collection
            IFontSubstRuleCollection fontSubstRuleCollection = new FontSubstRuleCollection();

            fontSubstRuleCollection.Add(fontSubstRule);

            // Add font rule collection to rule list
            presentation.FontsManager.FontSubstRuleList = fontSubstRuleCollection;

            // Arial font will be used instead of SomeRareFont when inaccessible
            Bitmap bmp = presentation.Slides[0].GetThumbnail(1f, 1f);

            // Save the image to disk in JPEG format
            bmp.Save(dataDir + "Thumbnail_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
            //ExEnd:RuleBasedFontsReplacement
        }
Beispiel #13
0
    override protected void AdditionalSetup(Sprite tile, int players, Vector3 offset, System.Xml.XmlNode top, int additionalInfo)
    {
        GetPersistData();
        SetupFromPuzzleLevel(additionalInfo);
        float   x   = PD.IsLeftAlignedHUD() ? -1.2f : 0.6f;
        Vector3 pos = new Vector3(x, 1.03f);

        AddDamageReferenceKey();
        FontData f = new FontData(TextAnchor.MiddleLeft, TextAlignment.Left, 0.03f);

        switch (puzzleType)
        {
        case 0:
            GetMeshText(pos, GetXmlValue(top, "lockedrow"), f);
            AddRowLocks();
            break;

        case 1:
            GetMeshText(pos, GetXmlValue(top, "rotations"), f);
            break;

        case 2:
            GetMeshText(pos, GetXmlValue(top, "launches"), f);
            break;
        }
        remainingText = GetMeshText(new Vector3(x + 0.6f, 0.84f), initRemainingMoves.ToString(), new FontData(TextAnchor.MiddleRight, TextAlignment.Right, 0.045f));
    }
    public void Start()
    {
        StateControllerInit();
        PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + "022", 0);
        p1_delay = 0; p2_delay = 0; p1eggState = 0;
        conf1    = false; conf1options = false; conf2 = true;
        int    completionPercent = PD.GetSaveData().CalculateGameCompletionPercent();
        string spPath = SpritePaths.CharSelSheet, crPath = SpritePaths.CharSelCursors;
        int    crNum = 10; dX = 0.71f; initX = -3.2f;

        if (completionPercent == 100)
        {
            spPath = SpritePaths.CharSelSheetAll;
            crPath = SpritePaths.CharSelCursorsAll;
            crNum  = 12;
            initX  = -3.25f;
            dX     = 0.591f;
        }
        else if (completionPercent >= 50)
        {
            spPath = SpritePaths.CharSelSheetWhite;
            crPath = SpritePaths.CharSelCursorsWhite;
            crNum  = 11;
            initX  = -3.21f;
            dX     = 0.6455f;
        }
        charactersel = GetGameObject(new Vector3(0.0f, -0.99f), "Character Select", Resources.Load <Sprite>(spPath), true, "HUD");
        cursor       = GetMenuCursor(crNum, 1, crPath, initX, -0.99f, dX, 0.0f, 0, 0, 1, 0, 0.2f);

        beginSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons);
        begin      = GetGameObject(new Vector3(0.0f, 0.3f), "Begin", beginSheet[0], true, "HUD");
        FontData f   = PD.mostCommonFont.Clone(); f.scale = 0.045f;
        XmlNode  top = GetXMLHead();

        beginText = GetMeshText(new Vector3(0.0f, 0.45f), GetXmlValue(top, "begin"), f).gameObject;

        f.color    = Color.white; f.scale = 0.035f;
        chooseText = GetMeshText(new Vector3(0.0f, 1.11f), GetXmlValue(top, "chooseyourcharacter"), f).gameObject;

        int yMax = InitOptionsTextAndReturnValueCount();

        cursorOp        = GetOptionsCursor(1, yMax + 1, null, -0.2f, 0.45f, 0.0f, 0.25f, 0, yMax, 1);
        cursorOpDisplay = gameObject.AddComponent <OptionsSelector>();
        cursorOpDisplay.Setup(0.2f, 0.45f, 0.25f);
        cursorOpDisplay.SetVisibility(false);
        cursorOpDisplay.SetWidth(PD.gameType == PersistData.GT.Training?0.85f:0.6f);
        InitPlayer1Select();
        SetupBackgrounds();
        ToggleDisplayOptions(false);
        if (PD.gameType == PersistData.GT.Arcade)
        {
            AddVictoryIcons();
        }
        else if (PD.gameType == PersistData.GT.Versus)
        {
            SetupP2StartText(top, f);
            conf2 = false;
        }
    }
Beispiel #15
0
        private FontData GetFontDimensions(Font myFont, string Text)
        {
            FontData myData   = new FontData();
            int      x        = 0;
            int      y        = 0;
            Graphics myG      = null;
            SizeF    textSize = CreateGraphics().MeasureString(Text, myFont);

            if (string.IsNullOrEmpty(Text))
            {
                return(new FontData());
            }

            Bitmap mybitmap = new Bitmap(Convert.ToInt16(textSize.Width), Convert.ToInt16(textSize.Height));

            myG = Graphics.FromImage(mybitmap);
            myG.SmoothingMode   = SmoothingMode.AntiAlias;
            myG.PixelOffsetMode = PixelOffsetMode.HighQuality;

            myG.DrawString(Text, myFont, Brushes.Black, 0, 0);

            myData.Left   = mybitmap.Width;
            myData.Top    = mybitmap.Height;
            myData.Bottom = 0;
            myData.Right  = 0;

            for (x = 0; x <= mybitmap.Width - 1; x++)
            {
                for (y = 0; y <= mybitmap.Height - 1; y++)
                {
                    if (mybitmap.GetPixel(x, y).ToArgb() != Color.Black.ToArgb())
                    {
                        continue;
                    }

                    if (myData.Left > x)
                    {
                        myData.Left = x;
                    }
                    if (myData.Top > y)
                    {
                        myData.Top = y;
                    }
                    if (myData.Right < x)
                    {
                        myData.Right = x;
                    }
                    if (myData.Bottom < y)
                    {
                        myData.Bottom = y;
                    }
                }
            }

            myData.Height = myData.Bottom - myData.Top;
            myData.Width  = myData.Right - myData.Left;

            return(myData);
        }
Beispiel #16
0
    public override void Start()
    {
        defaultFont = new FontData(Raylib.GetFontDefault(), 16);
        rect        = new CenteredRectangle(new Vector2(width / 2, height / 2), new Vector2(100, 100));

        // CenteredText Showcase
        centeredText = new CenteredText(new Vector2(width / 2, height / 2), new FontData(Raylib.GetFontDefault(), 16f), Color.WHITE, "PaperSDL");
    }
Beispiel #17
0
 public void AddSpriteFont(string fontName, string texture)
 {
     var fd = new FontData {
         Name = fontName,
         Texture = texture
     };
     m_addedFonts.Add (fd);
 }
Beispiel #18
0
    public FontData Clone()
    {
        FontData n = new FontData(anchor, align, scale);

        n.color     = color;
        n.layerName = layerName;
        return(n);
    }
Beispiel #19
0
    public TextObject(Vector2 pos, FontData fd, Color color) : base(pos)
    {
        this.position = pos;
        this.fontData = fd;
        this.color    = color;

        Center();
    }
    private OptionInfo CreateOnlineOptionSpot(FontData f, float y, string text, OptionType type)
    {
        f.anchor = TextAnchor.MiddleCenter; f.align = TextAlignment.Center;
        TextMesh   g   = GetMeshText(new Vector3(0.0f, y), GetXmlValue(top, text), f);
        GameObject col = GetCollider("SpecCol", new Vector3(0.6f, y), 0.5555f, 1.15f);

        return(new OptionInfo(g, g.gameObject, col, type, 0));
    }
Beispiel #21
0
    public TextObject(Vector2 pos, FontData fontData, Color color, string text) : base(pos)
    {
        this.position = pos;
        this.fontData = fontData;
        this.color    = color;
        this.text     = text;

        Center();
    }
Beispiel #22
0
        /// <summary>
        /// 构造函数
        /// </summary>
        protected QuestionText()
        {
            // 反射获取基类的 fontData
            fontData = typeof(Text).GetField("m_FontData",
                                             System.Reflection.BindingFlags.NonPublic |
                                             System.Reflection.BindingFlags.Instance).GetValue(this) as FontData;

            //createParser();
        }
 public static bool Prefix(SystemLanguage language, ref FontData __result)
 {
     if (RandomTweaks.settings.FontIndex == 0)
     {
         return(true);
     }
     __result = Settings.GetFontData();
     return(false);
 }
Beispiel #24
0
        private static GameAsset LoadFont(FontData font_data)
        {
            var font = new Font(font_data.ImageData, font_data.ImageWidth, font_data.ImageHeight, font_data.GlyphSize)
            {
                Id = font_data.Id
            };

            return(font);
        }
Beispiel #25
0
 public FormattedText(string rawText, FontData fontData, Color foreColor, HAlign hAlign, VAlign vAlign)
     : this()
 {
     _rawText    = rawText;
     _fontData   = fontData;
     _foreColor  = foreColor;
     _hAlignment = hAlign;
     _vAlignment = vAlign;
 }
Beispiel #26
0
    public void Start()
    {
        StateControllerInit(false);
        usingTouchControls = PD.GetSaveData().savedOptions["touchcontrols"] == 1;
        firstLaunch        = true;
        player1Human       = !PD.isDemo; player2Human = (PD.gameType == PersistData.GT.Versus);
        bh           = new BlockHandler(PD, PD.GetPuzzleLevel());
        zaps         = new List <ZappyGun>();
        zapsToDelete = new List <ZappyGun>();
        SetupCountdown();
        SetupActors();
        SetupRoundDisplay();
        SetupEasterEgg();
        specialMode = PD.useSpecial;
        height      = PD.isTutorial?6:PD.rowCount; width = 8;
        float p1Xoffset = (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? -10.1f : (PD.IsLeftAlignedHUD()?-1.5f:-5.5f), p2Xoffset = 3.0f;

        CreateBoards(p1Xoffset, p2Xoffset);
        SetUpHUDAndScores();
        if (PD.gameType == PersistData.GT.Challenge)
        {
            (board1 as BoardWarPuzzlePlayer).unlockedRow = (hud as PuzzleHUD).GetUnlockedRow();
        }
        cursor1 = CreatePlayerCursor(player1Human, p1Xoffset, 1, board1, board2);
        cursor2 = CreatePlayerCursor(player2Human || PD.override2P, p2Xoffset, 2, board2, board1, PD.override2P);
        board1.Setup(cursor1, th, bh, (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? new Vector2(-0.2f, -0.6f) : new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), player2Human || (PD.isDemo && PD.demoPlayers == 2), true, player1Human && usingTouchControls);
        board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, player2Human || (PD.isDemo && PD.demoPlayers == 2));
        board1.RefreshGraphics();
        board2.RefreshGraphics();
        CreateMirrors(p1Xoffset, p2Xoffset);
        mirror1.RefreshGraphics();
        mirror2.RefreshGraphics();
        SetupMouseControls(p1Xoffset);

        if (!PD.isDemo)
        {
            if (PD.gameType == PersistData.GT.Campaign)
            {
                campaign = new CampaignHandler(PD, board1 as BoardWarSpecial, board2 as BoardWarCampaign,
                                               mirror2 as BoardMirrorSpecial, cursor1 as BoardCursorWar, cursor2 as BoardCursorBot, hud as CampaignHUD, GetXMLHead());
            }
            pauseButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons);
            pauseButton      = GetGameObject(player2Human ? (new Vector3(0.0f, -0.1f)):(new Vector3(2.5f, 0.7f)), "Pause Button", pauseButtonSheet[0], true, "HUD");
            pauseButton.SetActive(PD.usingMouse);
            pauseButton.transform.localScale = new Vector3(0.75f, 0.75f);
            FontData f = PD.mostCommonFont.Clone(); f.scale = 0.035f;
            pauseText = GetMeshText(player2Human ? (new Vector3(0.0f, 0.0f)):(new Vector3(2.5f, 0.8f)), GetXmlValue(GetXMLHead(), "pause"), f).gameObject;
            pauseText.SetActive(PD.usingMouse);
            pauseTimer = 0;
            mouseObjects.Add(pauseButton);
            mouseObjects.Add(pauseText);
        }
        else
        {
            demoCountdown = 1800;
        }
    }
Beispiel #27
0
 /// <summary>
 /// Copies Font Styles from font to data.
 /// </summary>
 /// <param name="data">The data.</param>
 /// <param name="font">The font.</param>
 public static void CopyFromFont(FontData data, Font font)
 {
     data.Bold         = ConvertToDefaultableBoolean(font.Bold);
     data.Italic       = ConvertToDefaultableBoolean(font.Italic);
     data.Name         = font.Name;
     data.SizeInPoints = font.SizeInPoints;
     data.Strikeout    = ConvertToDefaultableBoolean(font.Strikeout);
     data.Underline    = ConvertToDefaultableBoolean(font.Underline);
 }
Beispiel #28
0
    private void AddAdditionalCredit(XmlNode credit, float x, float y)
    {
        FontData f = new FontData(TextAnchor.UpperCenter, TextAlignment.Center, 0.02f);

        f.color = Color.white;
        objects.Add(GetMeshText(new Vector3(x, y - 0.6f), credit.SelectSingleNode("for").InnerText, f).gameObject);
        f.scale = 0.04f;
        objects.Add(GetMeshText(new Vector3(x, y - 0.4f), credit.SelectSingleNode("name").InnerText, f).gameObject);
    }
Beispiel #29
0
        /// <summary>
        /// Prepares the object to get saved.
        /// </summary>
        internal override void PrepareForSave()
        {
            base.PrepareForSave();

            if (FontEmbedding == PdfFontEmbedding.Always || FontEmbedding == PdfFontEmbedding.Automatic)
            {
                FontData subSet   = this.fontDescriptor.descriptor.fontData.CreateFontSubSet(this.cmapInfo.GlyphIndices, false);
                byte[]   fontData = subSet.Data;

#if DEBUG_
                TrueTypeFontSubSet fss        = new TrueTypeFontSubSet("", this.cmapInfo.descriptor.fontData, this.cmapInfo.GlyphIndices, 0, true, false);
                byte[]             fontSubSet = fss.Process();
                fss.CompareBytes(fontSubSet, fontProgram);
#endif
                PdfDictionary fontStream = new PdfDictionary(this.Owner);
                this.Owner.Internals.AddObject(fontStream);
                this.fontDescriptor.Elements[PdfFontDescriptor.Keys.FontFile2] = fontStream.Reference;

                fontStream.Elements["/Length1"] = new PdfInteger(fontData.Length);
                if (!this.Owner.Options.NoCompression)
                {
                    fontData = Filtering.FlateDecode.Encode(fontData);
                    fontStream.Elements["/Filter"] = new PdfName("/FlateDecode");
                }
                fontStream.Elements["/Length"] = new PdfInteger(fontData.Length);
                fontStream.CreateStream(fontData);
            }

            //if (this.cmapInfo == null)
            //{
            FirstChar = 0;
            LastChar  = 255;
            PdfArray width = Widths;
            //width.Elements.Clear();
            for (int idx = 0; idx < 256; idx++)
            {
                width.Elements.Add(new PdfInteger(this.fontDescriptor.descriptor.widths[idx]));
            }
            //}
            //else
            //{
            //  FirstChar = (char)Math.Min(this.cmapInfo.MinChar, 255u);
            //  LastChar = (char)Math.Min(this.cmapInfo.MaxChar, 255u);

            //  PdfArray width = Widths;
            //  Debug.Assert(width.Elements.Count == 0);
            //  //width.Elements.Clear();
            //  for (int idx = FirstChar; idx <= LastChar; idx++)
            //  {
            //    int charWidth = 0;
            //    if (this.cmapInfo.Contains((char)idx))
            //      charWidth = this.fontDescriptor.descriptor.widths[idx];
            //    width.Elements.Add(new PdfInteger(charWidth));
            //  }
            //}
        }
Beispiel #30
0
 private void DrawLetter(SpriteBatch spriteBatch, FontData currentFont, Point position, Point start, Color color, float layerDepth, bool drawLine)
 {
     spriteBatch.Draw(
         texture: currentFont.Texture,
         destinationRectangle: new Rectangle(position, currentFont.CharDim),
         sourceRectangle: new Rectangle(start, currentFont.CharDim),
         color: color,
         layerDepth: layerDepth
     );
 }
Beispiel #31
0
    private void OnFontTextureRebuilt(Font font)
    {
        FontData fontData = null;

        if (this.fontData.TryGetValue(font, out fontData))
        {
            Debug.Log("Found a rebuilt font : " + font.ToString());
            fontData.ComputeFontData();
        }
    }
        /// <summary>
        /// このControlにBindする。
        /// </summary>
        /// <param name="font"></param>
        public void Bind(FontData font)
        {
            ViewModel.FontName  = font.FontName;
            ViewModel.FontSize  = font.FontSize;
            ViewModel.FontStyle = font.FontStyle;

            ViewModel.AddPropertyChangedHandler("FontName", (args) => { font.FontName = args.value as string; });
            ViewModel.AddPropertyChangedHandler("FontSize", (args) => { font.FontSize = (float)args.value; });
            ViewModel.AddPropertyChangedHandler("FontStyle", (args) => { font.FontStyle = (FontStyle)args.value; });
        }
Beispiel #33
0
        public static Font LoadFont(FontData font_data)
        {
            var texture = LoadTexture(font_data.FontSheet);

            var font = new Font(texture, font_data);

            font.Id = font_data.Id;

            return(font);
        }
Beispiel #34
0
 private static SizeF MeasureString(IDeviceContext g, IList text, Font font, FontData data)
 {
     SizeF ans = new SizeF();
     foreach (char chr in text)
     {
         SizeF temp = MeasureString(g, chr, font, data);
         ans = new SizeF(ans.Width + temp.Width, temp.Height);
     }
     return ans;
 }
Beispiel #35
0
    private GameObject AddHeadingCredit(XmlNode credit, float x, float y, float fontSize = 0.07f)
    {
        FontData f = new FontData(TextAnchor.UpperCenter, TextAlignment.Center, fontSize);

        f.color = Color.white;
        GameObject g = GetMeshText(new Vector3(x, y), credit.SelectSingleNode("text").InnerText, f).gameObject;

        objects.Add(g);
        return(g);
    }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Instantiate PresentationEx 
            using (Presentation presentation = new Presentation(dataDir + "DefaultFonts.pptx"))
            {
                // ExStart:ManagParagraphFontProperties

                // Accessing a slide using its slide position
                ISlide slide = presentation.Slides[0];
                
                // Accessing the first and second placeholder in the slide and typecasting it as AutoShape
                ITextFrame tf1 = ((IAutoShape)slide.Shapes[0]).TextFrame;
                ITextFrame tf2 = ((IAutoShape)slide.Shapes[1]).TextFrame;
                
                // Accessing the first Paragraph
                IParagraph para1 = tf1.Paragraphs[0];
                IParagraph para2 = tf2.Paragraphs[0];

                // Justify the paragraph
                para2.ParagraphFormat.Alignment = TextAlignment.JustifyLow;

                // Accessing the first portion
                IPortion port1 = para1.Portions[0];
                IPortion port2 = para2.Portions[0];

                // Define new fonts
                FontData fd1 = new FontData("Elephant");
                FontData fd2 = new FontData("Castellar");

                // Assign new fonts to portion
                port1.PortionFormat.LatinFont = fd1;
                port2.PortionFormat.LatinFont = fd2;

                // Set font to Bold
                port1.PortionFormat.FontBold = NullableBool.True;
                port2.PortionFormat.FontBold = NullableBool.True;

                // Set font to Italic
                port1.PortionFormat.FontItalic = NullableBool.True;
                port2.PortionFormat.FontItalic = NullableBool.True;

                // Set font color
                port1.PortionFormat.FillFormat.FillType = FillType.Solid;
                port1.PortionFormat.FillFormat.SolidFillColor.Color = Color.Purple;
                port2.PortionFormat.FillFormat.FillType = FillType.Solid;
                port2.PortionFormat.FillFormat.SolidFillColor.Color = Color.Peru;

                // ExEnd:ManagParagraphFontProperties
                // Write the PPTX to disk 
                presentation.Save(dataDir + "ManagParagraphFontProperties_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
            }
        }
Beispiel #37
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Instantiate PresentationEx
            using (Presentation presentation = new Presentation(dataDir + "DefaultFonts.pptx"))
            {
                // ExStart:ManagParagraphFontProperties

                // Accessing a slide using its slide position
                ISlide slide = presentation.Slides[0];

                // Accessing the first and second placeholder in the slide and typecasting it as AutoShape
                ITextFrame tf1 = ((IAutoShape)slide.Shapes[0]).TextFrame;
                ITextFrame tf2 = ((IAutoShape)slide.Shapes[1]).TextFrame;

                // Accessing the first Paragraph
                IParagraph para1 = tf1.Paragraphs[0];
                IParagraph para2 = tf2.Paragraphs[0];

                // Justify the paragraph
                para2.ParagraphFormat.Alignment = TextAlignment.JustifyLow;

                // Accessing the first portion
                IPortion port1 = para1.Portions[0];
                IPortion port2 = para2.Portions[0];

                // Define new fonts
                FontData fd1 = new FontData("Elephant");
                FontData fd2 = new FontData("Castellar");

                // Assign new fonts to portion
                port1.PortionFormat.LatinFont = fd1;
                port2.PortionFormat.LatinFont = fd2;

                // Set font to Bold
                port1.PortionFormat.FontBold = NullableBool.True;
                port2.PortionFormat.FontBold = NullableBool.True;

                // Set font to Italic
                port1.PortionFormat.FontItalic = NullableBool.True;
                port2.PortionFormat.FontItalic = NullableBool.True;

                // Set font color
                port1.PortionFormat.FillFormat.FillType             = FillType.Solid;
                port1.PortionFormat.FillFormat.SolidFillColor.Color = Color.Purple;
                port2.PortionFormat.FillFormat.FillType             = FillType.Solid;
                port2.PortionFormat.FillFormat.SolidFillColor.Color = Color.Peru;

                // ExEnd:ManagParagraphFontProperties
                // Write the PPTX to disk
                presentation.Save(dataDir + "ManagParagraphFontProperties_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
            }
        }
Beispiel #38
0
 private void Display_EditFont()
 {
     TR_AddEditFont.Visible = true;
         if (!(Request.QueryString["id"] == null))
         {
             m_intFontId = Convert.ToInt64( Request.QueryString["id"]);
         }
         font_data = m_refContApi.GetFontById(m_intFontId);
         FontFace.Value = font_data.Face;
         FontID.Value = Convert.ToString( font_data.Id);
         EditFontToolBar();
 }
        public StyleBrowserDialog(FontData currentFont)
        {
            InitializeComponent();

            foreach (KeyValuePair<string, FontData> pair in FontParser.Fonts)
            {
                LBList.Items.Add(pair.Value);
            }

            LBList.SelectedItem = currentFont;
            graphicsControl1.DisableMouseControl = true;
            graphicsControl1.SetDialogData(new DialogData());
        }
Beispiel #40
0
        public static SizeF MeasureString(IDeviceContext g, Font font, string text)
        {
            FontData data;
            if (!Fonts.ContainsKey(font))
            {
                data = new FontData(g, font);
                Fonts.Add(font, data);
            }
            else
            {
                data = Fonts[font];
            }

            return MeasureString(g, text.ToCharArray(), font, data);
        }
Beispiel #41
0
        private void CheckLetter(SpriteBatch spriteBatch, FontData currentFont, char letter, Vector2 position, Color color, float layerDepth, bool drawLine)
        {
            int offset = 0;

            if (letter >= 33 && letter <= 126) {
                offset = (letter - 32) * (int)currentFont.CharDimentions.X;
                if (drawLine) {
                    for (int X = -1; X < 2; X++) {
                        for (int Y = -1; Y < 2; Y++) {
                            if (X == 0 && Y == 0) continue;
                            DrawLetter(spriteBatch, currentFont, new Point((int)position.X + X, (int)position.Y + Y), new Point(offset, 0), Color.Black, layerDepth, drawLine);
                        }
                    }
                }
                DrawLetter(spriteBatch, currentFont, new Point((int)position.X, (int)position.Y), new Point(offset, 0), color, layerDepth - 0.01f, drawLine);
            }
        }
Beispiel #42
0
        public void TestIsSmallText()
        {
            FontData fontData = new FontData();
            fontData.FontSize = 4;
            Assert.IsTrue(fontData.IsSmallText());

            fontData.FontSize = 5;
            Assert.IsTrue(fontData.IsSmallText());

            fontData.FontSize = 6;
            Assert.IsFalse(fontData.IsSmallText());

            fontData.FontSize = 8;
            Assert.IsFalse(fontData.IsSmallText());

            fontData.FontSize = 108;
            Assert.IsFalse(fontData.IsSmallText());
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();
           
            // ExStart:ReplaceFontsExplicitly
            // Load presentation
            Presentation presentation = new Presentation(dataDir + "Fonts.pptx");

            // Load source font to be replaced
            IFontData sourceFont = new FontData("Arial");

            // Load the replacing font
            IFontData destFont = new FontData("Times New Roman");

            // Replace the fonts
            presentation.FontsManager.ReplaceFont(sourceFont, destFont);

            // ExEnd:ReplaceFontsExplicitly
            // Save the presentation
            presentation.Save(dataDir + "UpdatedFont_out.pptx", SaveFormat.Pptx);
        }
Beispiel #44
0
 public static FontData LoadFontFromTextFile(TextAsset fontLayout)
 {
     FontData font = new FontData();
     string[] lines = fontLayout.text.Split('\n');
     font.Pages.Clear();
     font.Chars.Clear();
     font.Kernings.Clear();
     foreach (string line in lines)
     {
         Dictionary<string, string> table = ParseLine(line);
         if (table.Count == 0)
         {
             continue;
         }
         switch (table["section"])
         {
             case "info":
                 font.Info.Face = ParseString(table, "face");
                 font.Info.Size = ParseInt(table, "size");
                 font.Info.Bold = ParseBool(table, "bold");
                 font.Info.Italic = ParseBool(table, "italic");
                 font.Info.Charset = ParseString(table, "charset");
                 font.Info.Unicode = ParseBool(table, "unicode");
                 font.Info.StretchHeight = ParseInt(table, "stretchH");
                 font.Info.Smooth = ParseBool(table, "smooth");
                 font.Info.SuperSampling = ParseInt(table, "aa");
                 font.Info.Padding = ParseRect(table, "padding");
                 font.Info.Spacing = ParseVector2(table, "spacing");
                 font.Info.Outline = ParseInt(table, "outline");
                 break;
             case "common":
                 font.Common.LineHeight = ParseInt(table, "lineHeight");
                 font.Common.Base = ParseInt(table, "base");
                 font.Common.ScaleW = ParseInt(table, "scaleW");
                 font.Common.ScaleH = ParseInt(table, "scaleW");
                 font.Common.Pages = ParseInt(table, "pages");
                 font.Common.Packed = ParseBool(table, "packed");
                 font.Common.AlphaChannel = ParseInt(table, "alphaChnl");
                 font.Common.RedChannel = ParseInt(table, "redChnl");
                 font.Common.GreenChannel = ParseInt(table, "greenChnl");
                 font.Common.BlueChannel = ParseInt(table, "blueChnl");
                 break;
             case "page":
                 FontPage page = new FontPage();
                 page.Id = ParseInt(table, "id");
                 page.File = ParseString(table, "file");
                 font.Pages.Add(page);
                 break;
             case "char":
                 FontChar ch = new FontChar();
                 ch.Id = ParseInt(table, "id");
                 ch.X = ParseInt(table, "x");
                 ch.Y = ParseInt(table, "y");
                 ch.Width = ParseInt(table, "width");
                 ch.Height = ParseInt(table, "height");
                 ch.XOffset = ParseInt(table, "xoffset");
                 ch.YOffset = ParseInt(table, "yoffset");
                 ch.XAdvance = ParseInt(table, "xadvance");
                 ch.Page = ParseInt(table, "page");
                 ch.Channel = ParseInt(table, "chnl");
                 ch.Description = string.Format("Char: [{0}]; Code: [{1}]", (char)ch.Id, ch.Id);
                 font.Chars.Add(ch);
                 break;
             case "kerning":
                 FontKerning key = new FontKerning();
                 key.First = ParseInt(table, "first");
                 key.Second = ParseInt(table, "second");
                 key.Amount = ParseInt(table, "amount");
                 key.Description = string.Format("[{0}] [{1}] Amout: [{2}]", (char)key.First, (char)key.Second, key.Amount);
                 font.Kernings.Add(key);
                 break;
         }
     }
     return font;
 }
        private FontData getFontFromText(string text)
        {
            var font = new FontData(null, null, null);

            var ary = text.Split(';');
            if (ary.Length > 0)
                font.Name = ary[0];
            if (ary.Length > 1)
            {
                float size;
                if(float.TryParse(ary[1], out size))
                    font.Size = size;
            }
            if (ary.Length == 3)
                font.Style = ary[2];

            return font;
        }
Beispiel #46
0
 private void Display_ViewFont()
 {
     TR_ViewFont.Visible = true;
         if (!(Request.QueryString["id"] == null))
         {
             m_intFontId = Convert.ToInt64( Request.QueryString["id"]);
         }
         font_data = m_refContApi.GetFontById(m_intFontId);
         TD_FontFace.InnerHtml = font_data.Face;
         ViewFontToolBar();
 }
 private void FormatFontDialogFromFontData(FontData fontData)
 {
     if (fdFont != null)
     {
         fdFont.Dispose();
         fdFont = null;
     }
     fdFont = new Font(fontData.FontName, fontData.FontSize, fontData.FontStyle);
     fontdlg.Font = fdFont;
     fontdlg.Color = Color.FromName(fontData.FontColorName);
 }
        private void DoRestoreTextValuesToLoadedValues()
        {
            // Initialize Values, in case there are no saved values
            metaFontData = new FontData();

            // Now overwrite those values with saved values
            SetFontDataFromConfigData();
            pbMain.Invalidate();
        }
Beispiel #49
0
 private void LoadFontData(FontData fontData)
 {
     m_fonts.Add (fontData.Name, Game.Content.Load<SpriteFont> (fontData.Texture));
 }
 private static SpriteFont GetFont(FontData data)
 {
     return Fonts[data.FontRef][data.Size];
 }
        private Color shadowBrushColor = Color.Black; // color always used by text "shadowing"

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor for the ScreenSaverForm, which is the primary display for our screen saver.
        /// </summary>
        /// <param name="Bounds">Size of the rectangle in which to draw form.</param>
        public ScreenSaverForm(Rectangle Bounds)
        {
            // set state flags
            fFormConstructorIsRunning = true;

            // This method is auto-generated by the VS Designer; it adds all of
            // the controls it knows about to the Form, and then binds event
            // handlers to those controls. Ignore, but do not remove.
            this.InitializeComponent();

            SettingsInfo.InitializeAndLoadConfigSettingsFromStorage();  // Load configutation data from disk
            metaFontData = new FontData();                              // Build a default fontData block
            SetFontDataFromConfigData();                                // Update the fontData with saved data

            this.Bounds = Bounds;           // Sets the size of our screen saver window to the passed in value

            // set state flags
            fFormConstructorIsRunning = false;
            fFormConstructorHasCompleted = true;
        }
        private void DrawString(string s, Rectangle rect, FontData fontData, Color tintColor)
        {
            if (fontData == null)
                return;
            Vector4 cl1 = fontData.TextColor.ToVector4();
            Vector4 cl2 = tintColor.ToVector4();
            Color cl = new Color(cl1.X*cl2.X, cl1.Y*cl2.Y, cl1.Z*cl2.Z, cl1.W*cl2.W);

            float textScale = 0.7f;
            Vector2 position = new Vector2();
            Vector2 origin = new Vector2();
            SpriteFont font = GetFont(fontData);
            Vector2 size = font.MeasureString(s);
            size.X *= textScale;
            size.Y *= textScale;
            if (fontData.Anchor == Enums.Anchor.TopLeft || fontData.Anchor == Enums.Anchor.Left || fontData.Anchor == Enums.Anchor.BottomLeft)
                position.X = rect.X;
            else if (fontData.Anchor == Enums.Anchor.Top || fontData.Anchor == Enums.Anchor.Center || fontData.Anchor == Enums.Anchor.Bottom)
                position.X = rect.X + (rect.Width - size.X)/2;
            else if (fontData.Anchor == Enums.Anchor.TopRight || fontData.Anchor == Enums.Anchor.Right || fontData.Anchor == Enums.Anchor.BottomRight)
                position.X = rect.X + rect.Width - size.X;
            if (fontData.Anchor == Enums.Anchor.TopLeft || fontData.Anchor == Enums.Anchor.Top || fontData.Anchor == Enums.Anchor.TopRight)
                position.Y = rect.Y;
            else if (fontData.Anchor == Enums.Anchor.Left || fontData.Anchor == Enums.Anchor.Center || fontData.Anchor == Enums.Anchor.Right)
                position.Y = rect.Y + (rect.Height - size.Y) / 2;
            else if (fontData.Anchor == Enums.Anchor.BottomLeft || fontData.Anchor == Enums.Anchor.Bottom || fontData.Anchor == Enums.Anchor.BottomRight)
                position.Y = rect.Y + rect.Height - size.Y;
            origin.X = (position.X - rect.X) / (rect.Width - size.X);
            origin.X = (position.X - rect.Y) / (rect.Width - size.Y);
            SpriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
            SpriteBatch.DrawString(font, s, position, cl, 0, origin, textScale, SpriteEffects.None, 0);
            SpriteBatch.End();
        }
Beispiel #53
0
 /// <summary>
 /// DefineFont4 supports only the new Flash Text Engine. The storage of font data for embedded fonts is in CFF format.
 /// </summary>
 /// <param name="InitialVersion">The version of the Swf file using this object.</param>
 public DefineFont4(byte InitialVersion)
     : base(InitialVersion)
 {
     this._fontData = new FontData(this._SwfVersion);
 }
Beispiel #54
0
    /*
    ============================================================================
    Init functions
    ============================================================================
    */
    public void Init()
    {
        // first init languages
        languages = new LanguageData();

        statusValues = new  StatusValueData();
        elements = new  ElementData();
        races = new RaceData();
        sizes = new SizeData();
        areaNames = new AreaNameData();
        armors = new ArmorData();
        cameraPositions = new  CameraPositionData();
        attacks = new BaseAttackData();
        characters = new  CharacterData();
        classes = new  ClassData();
        colors = new  ColorData();
        dialoguePositions = new  DialoguePositionData();
        battleAIs = new  BattleAIData();
        enemies = new  EnemyData();
        equipParts = new  EquipmentPartData();
        formulas = new  FormulaData();
        gameSettings = new  GameSettingsData();
        items = new  ItemData();
        itemTypes = new  ItemTypeData();
        loadSaveHUD = new LoadSaveHUDData();
        mainMenu = new MainMenuData();
        skillTypes = new  SkillTypeData();
        effects = new  StatusEffectData();
        skills = new  SkillData();
        weapons = new  WeaponData();
        music = new MusicData();
        huds = new HUDData();
        recipes = new ItemRecipeData();
        fonts = new FontData();
        globalEvents = new GlobalEventData();
        teleports = new TeleportData();
        difficulties = new DifficultyData();

        // battle system
        battleAnimations = new BattleAnimationData();
        battleSystem = new BattleSystemData();
    }
Beispiel #55
0
    public static FontData LoadFontFromXmlFile(TextAsset fontLayout)
    {
        FontData font = new FontData();
        XmlDocument document = new XmlDocument();
        document.LoadXml(fontLayout.text);
        XmlNode root = document.DocumentElement;

        // load the basic attributes
        XmlNode secton = root.SelectSingleNode("info");
        font.Info.Face = ParseString(secton, "face");
        font.Info.Size = ParseInt(secton, "size");
        font.Info.Bold = ParseBool(secton, "bold");
        font.Info.Italic = ParseBool(secton, "italic");
        font.Info.Unicode = ParseBool(secton, "unicode");
        font.Info.StretchHeight = ParseInt(secton, "stretchH");
        font.Info.Charset = ParseString(secton, "charset");
        font.Info.Smooth = ParseBool(secton, "smooth");
        font.Info.SuperSampling = ParseInt(secton, "aa");
        font.Info.Padding = ParseRect(secton, "padding");
        font.Info.Spacing = ParseVector2(secton, "spacing");
        font.Info.Outline = ParseInt(secton, "outline");

        // common attributes
        secton = root.SelectSingleNode("common");
        font.Common.LineHeight = ParseInt(secton, "lineHeight");
        font.Common.Base = ParseInt(secton, "base");
        font.Common.ScaleW = ParseInt(secton, "scaleW");
        font.Common.ScaleH = ParseInt(secton, "scaleH");
        font.Common.Pages = ParseInt(secton, "pages");
        font.Common.Packed = ParseBool(secton, "packed");
        font.Common.AlphaChannel = ParseInt(secton, "alphaChnl");
        font.Common.RedChannel = ParseInt(secton, "redChnl");
        font.Common.GreenChannel = ParseInt(secton, "greenChnl");
        font.Common.BlueChannel = ParseInt(secton, "blueChnl");

        // load texture information
        font.Pages.Clear();
        foreach (XmlNode node in root.SelectNodes("pages/page"))
        {
            FontPage page = new FontPage();
            page.Id = ParseInt(node, "id");
            page.File = ParseString(node, "file");
            font.Pages.Add(page);
        }

        // load character information
        font.Chars.Clear();
        foreach (XmlNode node in root.SelectNodes("chars/char"))
        {
            FontChar ch = new FontChar();
            ch.Id = ParseInt(node, "id");
            ch.X = ParseInt(node, "x");
            ch.Y = ParseInt(node, "y");
            ch.Width = ParseInt(node, "width");
            ch.Height = ParseInt(node, "height");
            ch.XOffset = ParseInt(node, "xoffset");
            ch.YOffset = ParseInt(node, "yoffset");
            ch.XAdvance = ParseInt(node, "xadvance");
            ch.Page = ParseInt(node, "page");
            ch.Channel = ParseInt(node, "chnl");
            ch.Description = string.Format("Char: [{0}]; Code: [{1}]", (char)ch.Id, ch.Id);
            font.Chars.Add(ch);
        }

        // loading kerning information
        font.Kernings.Clear();
        foreach (XmlNode node in root.SelectNodes("kernings/kerning"))
        {
            FontKerning key = new FontKerning();
            key.First = ParseInt(node, "first");
            key.Second = ParseInt(node, "second");
            key.Amount = ParseInt(node, "amount");
            key.Description = string.Format("[{0}] [{1}] Amout: [{2}]", (char)key.First, (char)key.Second, key.Amount);
            font.Kernings.Add(key);
        }
        return font;
    }