Пример #1
0
        public override InfoBlock GetInfoBlock()
        {
            TextLine line = reader.ReadLine();

            if (line.Id != "info")
            {
                throw new Exception("Failed to load angel bmp file, unexpected block '" + line.Id + "'");
            }

            InfoBlock block = new InfoBlock();

            block.FontName  = line.GetString("face") ?? "";
            block.FontSize  = line.GetInt("size") ?? 0;
            block.IsBold    = line.GetBool("bold") ?? false;
            block.IsItalic  = line.GetBool("italic") ?? false;
            block.CharSet   = line.GetUInt("charset") ?? 0;
            block.IsUnicode = line.GetBool("unicode") ?? false;
            block.StretchH  = line.GetUInt("stretchH") ?? 0;
            block.IsSmooth  = line.GetBool("smooth") ?? false;
            block.AA        = line.GetUInt("aa") ?? 0;
            Vector4i padding = line.GetVector4i("padding") ?? Vector4i.Zero;

            block.PaddingUp    = (uint)padding.X;
            block.PaddingRight = (uint)padding.Y;
            block.PaddingDown  = (uint)padding.Z;
            block.PaddingLeft  = (uint)padding.W;
            Vector2i spacing = line.GetVector2i("spacing") ?? Vector2i.Zero;

            block.SpacingHoriz = spacing.X;
            block.SpacingVert  = spacing.Y;
            block.Outline      = line.GetInt("outline") ?? 0;

            return(block);
        }
Пример #2
0
        public override CommonBlock GetCommonBlock()
        {
            TextLine line = reader.ReadLine();

            if (line.Id != "common")
            {
                throw new Exception("Failed to load angel bmp file, unexpected block '" + line.Id + "'");
            }

            CommonBlock block = new CommonBlock();

            block.LineHeight   = line.GetUInt("lineHeight") ?? 0;
            block.Base         = line.GetUInt("base") ?? 0;
            block.ScaleW       = line.GetUInt("scaleW") ?? 0;
            block.ScaleH       = line.GetUInt("scaleH") ?? 0;
            block.Pages        = line.GetUInt("pages") ?? 0;
            block.IsPacked     = line.GetBool("packed") ?? false;
            block.AlphaChannel = line.GetUInt("alphaChnl") ?? 4;
            block.RedChannel   = line.GetUInt("redChnl") ?? 4;
            block.GreenChannel = line.GetUInt("greenChnl") ?? 4;
            block.BlueChannel  = line.GetUInt("blueChnl") ?? 4;

            common = block;
            return(block);
        }