Esempio n. 1
0
 public void OpenFont(FileStructure.FNT.FNT FNT)
 {
     try
     {
         ReadFONT(FNT);
         var a = List.Find(x => x.Index == 32);
         if (a != null)
         {
             a.Cut = new VerticalCut(10, 20);
         }
     }
     catch (Exception e)
     {
         Logging.Write("PersonaEditorLib", e);
     }
     Update();
 }
Esempio n. 2
0
        private void ReadFONT(FileStructure.FNT.FNT FNT)
        {
            Height  = FNT.Header.Glyphs.Size1;
            Width   = FNT.Header.Glyphs.Size2;
            Palette = FNT.Palette.Pallete;
            if (FNT.Header.Glyphs.BitsPerPixel == 4)
            {
                PixelFormat = PixelFormats.Indexed4;
            }
            else if (FNT.Header.Glyphs.BitsPerPixel == 8)
            {
                PixelFormat = PixelFormats.Indexed8;
            }
            else
            {
                throw new Exception("ReadFONT Error: unknown PixelFormat");
            }

            var DecList = FNT.Compressed.GetDecompressedData();

            if (FNT.Header.Glyphs.BitsPerPixel == 4)
            {
                Util.ReverseByteInList(DecList);
            }

            for (int i = 0; i < DecList.Count; i++)
            {
                FnMpData fnmp = List.FirstOrDefault(x => x.Index == i + 32);
                if (fnmp == null)
                {
                    List.Add(new FnMpData {
                        Index = i + 32, Char = "", Cut = FNT.WidthTable[i] == null ? new VerticalCut(0, (byte)Width) : FNT.WidthTable[i].Value, Image_data = DecList[i]
                    });
                }
                else
                {
                    fnmp.Cut        = FNT.WidthTable[i] == null ? new VerticalCut(0, (byte)Width) : FNT.WidthTable[i].Value;
                    fnmp.Image_data = DecList[i];
                }
            }
        }
Esempio n. 3
0
 public CharList(string FontMap, FileStructure.FNT.FNT FNT)
 {
     OpenFont(FNT);
     OpenFontMap(FontMap);
 }