You are not logged in.
Pages: 1
So the saga continues and I understood where the problem might be.
I found some scary errors in TPdfEnum.TextOut around the TA_BASELINE. The values for H were completly messed up.
I did the following very dirty fix that places my texts surprisingly accurate:
wW := W; // right x
if (font.Align and TA_CENTER)=TA_CENTER then
W := W/2 // center x
else if (font.Align and TA_CENTER)=TA_RIGHT then
W := W // right x
else
W := 0; // left x
// V Align mask = TA_BASELINE or TA_BOTTOM or TA_TOP = TA_BASELINE
if (font.Align and TA_BASELINE) = TA_BASELINE then
H := -Abs(font.spec.cell) else
if (font.Align and TA_BASELINE )= TA_BOTTOM then
H := 0 // bottom y
else
H := - 2 *abs(font.spec.cell) * sin(DegToRad(font.spec.angle));
if ASignY<0 then //inverted coordinates
H := Abs(font.spec.cell) + H;
But I am sure this is not the ultimate solution. I still can‘t understand what is going on in all the 11k+ lines. But if someone of the main contributors is willing to explain me some stuff we can together find a working solution.
Thanks in advance
Hello everyone,
I have two ugly metafiles coming from a statistical program that I need to export as PDF and I assume the ARC DIRECTION property is not handled correctly.
I have the following problems:
- The vertical labels are rotated at 180 degree.
- Some other labels (not the vertical ones) are placed either lower or upper (not consistent)
- When using FastReport Exporter the vertical labels are also misplaces.
I spent days investigating what might be wrong as also none of the commercial exporter and also some metafile editors stuck there.
I think the ARC DIRECTION is the root of the problem. If I pass the arc direction as a parameter to CreateFont like
procedure TPdfEnum.CreateFont(aLogFont: PEMRExtCreateFontIndirect; counterClockwise: Boolean);
and add the following line
if not counterClockwise then FontSpec.angle := FontSpec.angle * -1;
then the vertical labels are shown correctly. But I could not figure out what might be wrong with the other labels and why the FastReport exporter still misplaces them.
But I doubt this will be enough. Because what if the ARC DIRECTION changes after the font is created? Do we need to create all the fonts with rotaiton again?
Here are the the problematic metafiles
Note: The program I get the files from have two option for export: EMF and WMF. Although the WMF is simpler and compacter it can’t be loaded in Delphi directly because of the buggy VCL. I needed to use low level APIs to convert it to EMF.
I would be happy if someone shows me the right place in the code where to dig further.
Thanks in advance
Pages: 1