//修改单个字符信息 private void button7_Click(object sender, EventArgs e) { if ( textBox5.Text == "" || listBox1.SelectedIndex < 0 ) { return; } var glyphs = from aGlyph in _font.Typefaces[listBox1.SelectedIndex].Glyphs where aGlyph.Character == textBox5.Text[0] select aGlyph; if (!glyphs.Any()) { return; } Glyph glyph = glyphs.First(); glyph.Height = int.Parse(textBox6.Text); glyph.Width = int.Parse(textBox13.Text); glyph.BitmapLeft = float.Parse(textBox14.Text); glyph.BitmapRight = float.Parse(textBox15.Text); glyph.AdvanceX = float.Parse(textBox16.Text); glyph.BitmapTop = float.Parse(textBox17.Text); glyph.Baseline = float.Parse(textBox18.Text); glyph.Baseline = float.Parse(textBox19.Text); glyph.TopMargin = int.Parse(textBox20.Text); glyph.ImageIndex = int.Parse(textBox21.Text); glyph.LeftMargin = int.Parse(textBox22.Text); }
//选择特定文字 private void textBox5_TextChanged(object sender, EventArgs e) { if ( textBox5.Text == "" || listBox1.SelectedIndex < 0 ) { return; } var glyphs = from aGlyph in _font.Typefaces[listBox1.SelectedIndex].Glyphs where aGlyph.Character == textBox5.Text[0] select aGlyph; if (!glyphs.Any()) { return; } Glyph glyph = glyphs.First(); Homeworld2.RCF.Image img = _font.Typefaces[listBox1.SelectedIndex].Images[glyph.ImageIndex]; Bitmap bmp = helper.type2img(img); Rectangle rect = new Rectangle( glyph.LeftMargin, glyph.TopMargin, glyph.Width, glyph.Height ); _form3.pictureBox1.Image = helper.type2img(img).Clone(rect, bmp.PixelFormat); textBox6.Text = glyph.Height.ToString(); textBox13.Text = glyph.Width.ToString(); textBox14.Text = glyph.BitmapLeft.ToString(CultureInfo.InvariantCulture); textBox15.Text = glyph.BitmapRight.ToString(CultureInfo.InvariantCulture); textBox16.Text = glyph.AdvanceX.ToString(CultureInfo.InvariantCulture); textBox17.Text = glyph.BitmapTop.ToString(CultureInfo.InvariantCulture); textBox18.Text = glyph.Baseline.ToString(CultureInfo.InvariantCulture); textBox19.Text = glyph.BitmapBottom.ToString(CultureInfo.InvariantCulture); textBox20.Text = glyph.TopMargin.ToString(); textBox21.Text = glyph.ImageIndex.ToString(); textBox22.Text = glyph.LeftMargin.ToString(); }