#1 Re: PDF Engine » Chinese Font bold style does not work, when EmbeddedTTF is true » 2021-02-02 19:22:48

Alalaki wrote:

I can't see your photo, and the site is unavailable. Can you describe it in words?

It's just the result of executing your code.

I can't help you specifically, but I think only the fonts shown below apply the style properly.

// SynPdf.pas

const // see PDF ref 9.6.2.2: Standard Type 1 Fonts
...
  STANDARDFONTS: array[0..11] of record
    Name: PDFString;
    Widths: PSmallIntArray;
  end = (
    (Name: 'Times-Roman'; Widths: @TIMES_ROMAN_W_ARRAY),
    (Name: 'Times-Bold'; Widths: @TIMES_BOLD_W_ARRAY),
    (Name: 'Times-Italic'; Widths: @TIMES_ITALIC_W_ARRAY),
    (Name: 'Times-BoldItalic'; Widths: @TIMES_BOLDITALIC_W_ARRAY),
    (Name: 'Helvetica'; Widths: @ARIAL_W_ARRAY),
    (Name: 'Helvetica-Bold'; Widths: @ARIAL_BOLD_W_ARRAY),
    (Name: 'Helvetica-Oblique'; Widths: @ARIAL_ITALIC_W_ARRAY),
    (Name: 'Helvetica-BoldOblique'; Widths: @ARIAL_BOLDITALIC_W_ARRAY),
    (Name: 'Courier'; Widths: nil), // Widths:nil -> set all widths to 600
    (Name: 'Courier-Bold'; Widths: nil),
    (Name: 'Courier-Oblique'; Widths: nil),
    (Name: 'Courier-BoldOblique'; Widths: nil));

...

const
  STAND_FONTS_PDF: array[TPdfFontStandard] of RawUTF8 = ('Times','Helvetica','Courier');
  STAND_FONTS_WIN: array[TPdfFontStandard] of RawUTF8 = ('Times New Roman','Arial','Courier New');

#2 Re: PDF Engine » Font Styles not rendered properly » 2021-02-01 21:19:28

Related to
Chinese Font bold style does not work, when EmbeddedTTF is true (Page 1) / PDF Engine / mORMot Open Source
https://synopse.info/forum/viewtopic.ph … 270#p34270

#4 Re: PDF Engine » Chinese symbols and fonts are incorrectly displayed » 2018-08-10 04:49:56

XE3:
synpdf_chinese_TextOut_XE3.png

var
  lPdf: TPdfDocumentGDI;
begin
  lPdf := TPdfDocumentGDI.Create;
  try
    //lPdf.UseUniscribe := True;
    lPdf.ScreenLogPixels := 96;
    lPdf.DefaultPaperSize := psA4;
    lPDF.AddPage;
    lPdf.VCLCanvas.Brush.Style := bsClear;
    lPdf.VCLCanvas.Font.Name := 'SimSun'; // 宋体
    lPdf.VCLCanvas.TextOut( 20, 20, '发现双引号不正确“问题”' );
    lPdf.SaveToFile('%TEMP%\SynPdfTest.pdf');
  finally
    lPdf.Free;
  end;
end;

D7:
synpdf_chinese_TextOut_D7.png

var
  lStr: WideString;
  lLen: integer;
  lPdf: TPdfDocumentGDI;
begin
  lStr := TntEdit1.Text; // Tnt Delphi Unicode Controls
  lLen := Length('TextOutW: ' + lStr);
  lPdf := TPdfDocumentGDI.Create;
  try
    //lPdf.UseUniscribe := True;
    lPdf.ScreenLogPixels := 96;
    lPdf.DefaultPaperSize := psA4;
    lPDF.AddPage;
    lPdf.VCLCanvas.Brush.Style := bsClear;
    lPdf.VCLCanvas.Font.Name := 'SimSun'; // 宋体
    lPdf.VCLCanvas.TextOut( 20, 20, 'TextOutA: ' + lStr );
    TextOutW( lPdf.VCLCanvas.Handle, 20, 40, PWideChar('TextOutW: ' + lStr), lLen );
    lPdf.SaveToFile( '%TEMP%\SynPdfTest.pdf' );
  finally
    lPdf.Free;
  end;
end;

#5 Re: mORMot 1 » about IdemPChar function » 2018-08-09 19:17:34

songshuang wrote:

if IdemPChar(pointer(Ctxt.URL),'abc') then
.....
but always return false?
same response  on windows both linux .

function IdemPChar(p: PUTF8Char; up: PAnsiChar): boolean;
// if the beginning of p^ is same as up^ (ignore case - up^ must be already Upper)
var
  lStr: string;
begin
  lStr := 'ABC';
  ShowMessage( BoolToStr( IdemPChar(Pointer(lStr), 'abc' ), True ) );
  // False
  ShowMessage( BoolToStr( IdemPChar(Pointer(lStr), 'ABC' ), True ) );
  // True
  ShowMessage( BoolToStr( IdemPChar(Pointer(lStr), 'Abc' ), True ) );
  // False
  ShowMessage( BoolToStr( IdemPChar(Pointer(lStr), PAnsiChar(UpperCase('Abc')) ), True ) );
  // True
end;

#6 Re: mORMot 1 » Persist a TDocVariant object » 2018-07-04 18:22:02

wai-kit wrote:

Hi all,

Can anybody help me with this?
How do I persist a TDocVariant object to a file?
Let's say I have this code:

aTemplate:variant;

TDocVariant.New(aTemplate);

aTemplate.Subject := 'some Subject';
aTemplate.Description := 'some Description';

// Persist aTemplate to file ...something like SaveToFile(someFileName);

Any help in the right direction much appreciated.

Cheers,
Wai

procedure TForm1.Button1Click(Sender: TObject);
var
  aTemplate: Variant;
begin
  TDocVariant.New(aTemplate);
  aTemplate.Subject := 'some Subject';
  aTemplate.Description := 'some Description';

  Memo1.Lines.Add( aTemplate );
  // {"Subject":"some Subject","Description":"some Description"}
  Memo1.Lines.Add( aTemplate.Subject );
  // some Subject
  Memo1.Lines.Add( aTemplate.Description );
  // some Description

  FileFromString( aTemplate, 'test.txt' );
  // {"Subject":"some Subject","Description":"some Description"}
end;

#8 Re: PDF Engine » Having trouble displaying Chinese Characters » 2013-03-23 16:59:34

wywong wrote:

I downloaded and installed Arial Unicode MS.ttf and the generated pdf displays OK on my computer. However, when the PDF file is sent to another computer, chances are high that the latter doesn't have Arial Unicode MS.ttf installed, and all the unicode characters, including Greek, Arabic, etc. will not be displayed. All my Windows XP, Windows 7 & Windows 8 computers don't have that font preinstalled.

ab wrote:

You can include the font subset to the file.

with TPdfDocument.Create do
try
  EmbeddedTTF := True;
  ...

#10 Re: PDF Engine » Having trouble displaying Chinese Characters » 2013-03-22 18:57:08

synpdfunicode_project1.png

synpdfunicode_testunicode.png

synpdfunicode_test.rar (broken)

Check-in [25426a6933]
Date: 2013-03-21 14:50:03

D7(SynopseRTL), XE3-UP2,
WinXP-SP3(Korean),

Board footer

Powered by FluxBB