You are not logged in.
Hello,
I would like to use your great component to convert EMF content to PDF.
But when the EMF file contains text with the font Calibri and is printed via:
ExtTextout (Preview.Canvas.Handle, nXPos, nYPos, ETO_GLYPH_INDEX, nil, PChar(FontObjects.GR.lpGlyphs), FontObjects.GR.nGlyphs, PInteger(FontObjects.GR.lpDx))
the resulting PDF file "looses" some characters.
So if I print the German word "Auftrag", the PDF contains only "Au rag" ...
Any ideas?
Thanks a lot!
Offline
Hello,
I just set this option - without success :-(.
Unfortunately, I cannot attach the small sample EMF file ...
Offline
Here is the correct link:
Sample EMF file in ZIP format
Offline
The problem seems to be in this line:
R0035: [084] EMR_EXTTEXTOUTW (s=112) { TXT=[?O?AO] [exScale(0.283008) eyScale(0.281890) iGraphicsMode(1), Bounds(88,84,136,102)] TxOPT[fOptions(16|ETO_GLYPH_INDEX), nChars(6), offDx(88), ptlRef(1320,1256), rcl(0,0,-1,-1)] Spacing[139,126,148,79,115,113 => Total(720) =>xPtRefRight(2039)]}
(used EMFexplorer)
I see there is nChar(6). That means the string should be 6 characters. But Auftrag is 7 characters.
Could it be that the tf in Auftraf is one character?
U+FB05 (ſt) – LATIN SMALL LIGATURE LONG S AND T
I'm not sure why the EMFexplorer renders this correctly. Maybe the unicode gets lost in SynPDF (although I do see tmp is WideChar in TPdfEnum.TextOut).
BTW. You say it is printed via ExtTextout. Where do you see that?
Are you using the old deprecated SynPDF or the newer mORMot PDF engine?
Offline
Note for @ab
I did a bit of digging and found that in TPdfWrite.AddGlyphs the TPdfFontTrueType.GetAndMarkGlyphAsUsed is called.
For the unicode character U+FB05 ſt this function returns 0 because it can't find that character in fUsedWide.
Why doesn't it add the (unicode) character to the Glyph map when not found?
There is a FindOrAddUsedWideChar in there but that's only used when the Glyph is found in fUsedWide (in which case the add seems a little pointless).
Offline
Hello,
as you already stated:
The two characters "ft" are transformed into one character. This is called ligature.
I create the EMF files myself - so that is the reason why I know that the content is created via ExtTextout.
The Delphi code looks like this:
ExtTextout (Preview.Canvas.Handle, nXPos, nYPos, ETO_GLYPH_INDEX, nil, PChar(FontObjects.GR.lpGlyphs), FontObjects.GR.nGlyphs, PInteger(FontObjects.GR.lpDx))
I use the current SynPDF version (1.18).
Thanks a lot!
Offline
I use the current SynPDF version (1.18).
The SynPDF version isn't developed actively anymore. For that you need the mormot.ui.pdf.pas in https://github.com/synopse/mORMot2/tree/master/src/ui.
But I do use mORMot2 and here the problem is the same (see previous post to @ab).
So there is indeed a problem with retrieving the Glyph for Unicodes (that ſt) used in the EMF.
Offline