public Bitmap UpdateSingleCharacter(int CharacterID) { try { int scale = (int)numericUpDownTileNumber.Value; DRFontChar c = FontInfo.GetCharViaId(CharacterID); System.Drawing.Bitmap img = new System.Drawing.Bitmap(c.Width * scale, c.Height * scale); for (int x = 0; x < c.Width; x++) { for (int y = 0; y < c.Height; y++) { Color px = Texture.GetPixel(x + c.XOffset, y + c.YOffset); if (px.R <= 10 && px.G <= 10 && px.B <= 10) { px = bgcolor; } for (int sx = 0; sx < scale; ++sx) { for (int sy = 0; sy < scale; ++sy) { img.SetPixel(x * scale + sx, y * scale + sy, px); } } } } return(img); } catch (Exception) { return(null); } }
public void UpdateAny() { int CharacterID = (int)numericUpDownCharacterId.Value; DRFontChar c = FontInfo.GetCharViaId(CharacterID); guiCharWidth.Value = c.Width; guiCharHeight.Value = c.Height; guiCharX.Value = c.XOffset; guiCharY.Value = c.YOffset; char ch = (char)c.Character; labelCharacterDisplayer.Text = ch.ToString(); pictureBox2.SizeMode = PictureBoxSizeMode.AutoSize; if (textBoxDisplayDelay.Text == "") { pictureBox2.Image = UpdateSingleCharacter((int)numericUpDownCharacterId.Value); } else { List <Bitmap> bmplist = new List <Bitmap>(); for (int i = 0; i <= (int)numericUpDownCharacterId.Value; ++i) { bmplist.Add(UpdateSingleCharacter(i)); } pictureBox2.Image = CombineBitmaps(bmplist.ToArray()); } }
private void guiCharHeight_ValueChanged(object sender, EventArgs e) { int CharacterID = (int)numericUpDownCharacterId.Value; DRFontChar c = FontInfo.GetCharViaId(CharacterID); c.Height = (ushort)guiCharHeight.Value; UpdateAny(); }
private void numUpDownCharLength_ValueChanged(object sender, EventArgs e) { int CharacterID = (int)numericUpDownCharacterId.Value; DRFontChar c = FontInfo.GetCharViaId(CharacterID); c.Width = (ushort)guiCharWidth.Value; UpdateAny(); }
private void buttonCopyFrom_Click(object sender, EventArgs e) { char ch = textBoxCopyFrom.Text[0]; DRFontChar other = FontInfo.GetCharViaCharacter((ushort)ch); DRFontChar mine = FontInfo.GetCharViaId((int)numericUpDownCharacterId.Value); DRFontInfo.CopyCharInfo(other, mine); UpdateAny(); }
public static int Execute(List <string> args) { if (args.Count != 2) { PrintUsage(); return(-1); } string Filepath = args[1]; string ImagePath = args[0]; //string Filepath2 = args[2]; FontViewer form; try { byte[] File = System.IO.File.ReadAllBytes(Filepath); DRFontInfo f = new DRFontInfo(File); //DRFontInfo f2 = new DRFontInfo( System.IO.File.ReadAllBytes( Filepath2 ) ); //f.CopyInfoFrom( f2 ); DRFontChar apos = f.GetCharViaCharacter((ushort)'\''); DRFontChar quot = f.GetCharViaCharacter((ushort)'"'); DRFontChar fontch = new DRFontChar(); fontch.Character = (ushort)'’'; DRFontInfo.CopyCharInfo(apos, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'‘'; DRFontInfo.CopyCharInfo(apos, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'‛'; DRFontInfo.CopyCharInfo(apos, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'“'; DRFontInfo.CopyCharInfo(quot, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'”'; DRFontInfo.CopyCharInfo(quot, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'‟'; DRFontInfo.CopyCharInfo(quot, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'〝'; DRFontInfo.CopyCharInfo(quot, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'〞'; DRFontInfo.CopyCharInfo(quot, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'"'; DRFontInfo.CopyCharInfo(quot, fontch); f.ImportExternalCharacter(fontch); fontch = new DRFontChar(); fontch.Character = (ushort)'''; DRFontInfo.CopyCharInfo(apos, fontch); f.ImportExternalCharacter(fontch); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); form = new FontViewer(f, new System.Drawing.Bitmap(ImagePath)); form.Filepath = Filepath; } catch (Exception ex) { Console.WriteLine(ex.ToString()); PrintUsage(); return(-1); } Application.Run(form); return(0); }
public static int Execute( List<string> args ) { string Filepath = args[1]; string ImagePath = args[0]; //string Filepath2 = @"d:\_svn\GraceNote\GraceNote\DanganRonpaBestOfRebuild\assets\i"; FontViewer form; try { byte[] File = System.IO.File.ReadAllBytes( Filepath ); DRFontInfo f = new DRFontInfo( File ); //DRFontInfo f2 = new DRFontInfo( System.IO.File.ReadAllBytes( Filepath2 ) ); //f.CopyInfoFrom( f2 ); DRFontChar apos = f.GetCharViaCharacter( (ushort)'\'' ); DRFontChar quot = f.GetCharViaCharacter( (ushort)'"' ); DRFontChar fontch = new DRFontChar(); fontch.Character = (ushort)'’'; DRFontInfo.CopyCharInfo( apos, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'‘'; DRFontInfo.CopyCharInfo( apos, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'‛'; DRFontInfo.CopyCharInfo( apos, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'“'; DRFontInfo.CopyCharInfo( quot, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'”'; DRFontInfo.CopyCharInfo( quot, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'‟'; DRFontInfo.CopyCharInfo( quot, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'〝'; DRFontInfo.CopyCharInfo( quot, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'〞'; DRFontInfo.CopyCharInfo( quot, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'"'; DRFontInfo.CopyCharInfo( quot, fontch ); f.ImportExternalCharacter( fontch ); fontch = new DRFontChar(); fontch.Character = (ushort)'''; DRFontInfo.CopyCharInfo( apos, fontch ); f.ImportExternalCharacter( fontch ); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault( false ); form = new FontViewer( f, new System.Drawing.Bitmap( ImagePath ) ); form.Filepath = Filepath; } catch ( Exception ex ) { Console.WriteLine( ex.ToString() ); PrintUsage(); return -1; } Application.Run( form ); return 0; }