#1 2019-02-08 11:18:54

fradicom
Member
Registered: 2019-02-08
Posts: 2

font bug with "Times New Roman" if StandardFontsReplace is true

When Arial is used and StandardFontsReplace is true, it is replaced by Helvetica. Good !
However, when it's "Time New Roman", Acrobat Reader tell me that the Times font as a bad bbox :-/
The reason is that there is no Times in the 14 base pdf fonts : it's called Times-Roman.
So I've changed :

in TPdfDocument.CreateEmbeddedFont()

    (Name: 'Times'; Widths: @TIMES_ROMAN_W_ARRAY),

to

    (Name: 'Times-Roman'; Widths: @TIMES_ROMAN_W_ARRAY),

and in StandardFontName(), I've added the last two lines

function StandardFontName(const AName: RawUTF8; AStyle: TPdfFontStyles): RawUTF8;
begin
  result := AName;
  if pfsItalic in AStyle then
    if pfsBold in AStyle then
      result := result+'-BoldOblique' else
      result := result+'-Oblique' else
    if pfsBold in AStyle then
      result := result+'-Bold' else
      if AName='Times' then
      result:='Times-Roman';
end;

Of course, it worked well with bold, italic (or both) "Times New Roman" before.

Offline

#2 2019-02-08 14:23:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: font bug with "Times New Roman" if StandardFontsReplace is true

Also the pfsItalic was not correct - it is "Italic", not "Oblique" for Times...

See https://synopse.info/fossil/info/1746f37be6

Offline

#3 2019-02-08 16:53:29

fradicom
Member
Registered: 2019-02-08
Posts: 2

Re: font bug with "Times New Roman" if StandardFontsReplace is true

ab wrote:

Also the pfsItalic was not correct - it is "Italic", not "Oblique" for Times...

See https://synopse.info/fossil/info/1746f37be6

Yes, I didn't try italic. But the correction is even better. I've searched for the StandardFontName function. But since a trick permited to get rid of it, it's no longer there.

Offline

Board footer

Powered by FluxBB