#1 2018-07-01 22:42:04

ertank
Member
Registered: 2016-03-16
Posts: 163

Script fonts

Hello,

Some script fonts are not printed completely both using SynDGIPlus or regular TBitmap.Canvas.TextOut(). I could not find a solution as to how I should be able to print them and they look fine on the final bitmap file.

Sample image: https://imgur.com/AR7I15t

Code sample:

procedure TForm1.Button1Click(Sender: TObject);
var Bmp: TBitmap;
    MF: TMetaFile;
    MetafileCanvas: TMetafileCanvas;
    DC: HDC;
    ScreenLogPixels: Integer;
begin
  MF := TMetaFile.Create;
  DC := GetDC(0);
  ScreenLogPixels := GetDeviceCaps(DC, LOGPIXELSY);
  MF.Inch := ScreenLogPixels;
  MF.Width := 3400;
  MF.Height := 4200;

  MetafileCanvas := TMetafileCanvas.Create(MF, DC);

  MetafileCanvas.font.Color := clblue;
  MetafileCanvas.font.Name := 'Gentle air2';
  MetafileCanvas.font.Size := 1000;

  MetafileCanvas.TextOut(0, 0, 'Car handle'); // Letters "C" and "h" are not completely printed

  ReleaseDC(0, DC);


  MetafileCanvas.Free;
  MF.Enhanced := FALSE;

  Bmp := TBitmap.Create;
  BMp.Width := 3400;
  Bmp.Height := 4200;

  ExpectGDIPlusFull;

  Bmp := Gdip.DrawAntiAliased(MF,100,100, smAntiAlias);
  Bmp.SaveToFile('deneme2.bmp');

  bmp.Free;
  MF.Destroy;
end;

I have no deep font handling knowledge.

I appreciate any help.

Thanks & regards.

Offline

Board footer

Powered by FluxBB