fFontGen.pas 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. unit fFontGen;
  2. interface
  3. uses
  4. Winapi.OpenGL,
  5. System.SysUtils,
  6. System.Classes,
  7. Vcl.Graphics,
  8. Vcl.Controls,
  9. Vcl.Forms,
  10. Vcl.Dialogs,
  11. Vcl.StdCtrls,
  12. Vcl.ExtCtrls,
  13. GLS.BitmapFont,
  14. GLS.WindowsFont;
  15. type
  16. TFormFontGen = class(TForm)
  17. GroupBox1: TGroupBox;
  18. Panel1: TPanel;
  19. Button1: TButton;
  20. FontDialog1: TFontDialog;
  21. GroupBox2: TGroupBox;
  22. Image1: TImage;
  23. GroupBox3: TGroupBox;
  24. SaveDialog1: TSaveDialog;
  25. Button2: TButton;
  26. procedure Button1Click(Sender: TObject);
  27. procedure FormCreate(Sender: TObject);
  28. procedure Button2Click(Sender: TObject);
  29. public
  30. FFont: TGLWindowsBitmapFont;
  31. end;
  32. var
  33. FormFontGen: TFormFontGen;
  34. implementation
  35. {$R *.dfm}
  36. procedure TFormFontGen.Button1Click(Sender: TObject);
  37. begin
  38. FontDialog1.Font := Panel1.Font;
  39. if FontDialog1.Execute then
  40. begin
  41. Panel1.Font := FontDialog1.Font;
  42. FFont.Font := FontDialog1.Font;
  43. Image1.Picture.Assign(FFont.Glyphs);
  44. end;
  45. end;
  46. procedure TFormFontGen.FormCreate(Sender: TObject);
  47. begin
  48. FFont := TGLWindowsBitmapFont.Create(Self);
  49. end;
  50. procedure TFormFontGen.Button2Click(Sender: TObject);
  51. begin
  52. if SaveDialog1.Execute then
  53. begin
  54. FFont.Glyphs.SaveToFile(SaveDialog1.FileName);
  55. end;
  56. end;
  57. end.