#1 PDF Engine » Some little mod » 2013-05-11 15:32:50

vmkng
Replies: 1

Hi,
  first of all thanks for your great product.

I have made some changes to your code related to the RenderMetaFile procedure:

1. for the problem decribed here: http://synopse.info/forum/viewtopic.php?id=1253

8024,8026c8024,8044
<   EMR_SETBKCOLOR:
<     font.BkColor := PEMRSetBkColor(R)^.crColor;
<   EMR_SETTEXTCOLOR:
<     font.Color := PEMRSetTextColor(R)^.crColor;
---
>   EMR_SETBKCOLOR:
>   begin
>     if PEMRSetBkColor(R)^.crColor = $1fffffff then
>     begin
>       font.BkColor := 0;
>     end
>     else
>     begin
>       font.BkColor := PEMRSetBkColor(R)^.crColor;
>     end;
>   end;
>   EMR_SETTEXTCOLOR:
>   begin
>     if PEMRSetTextColor(R)^.crColor = $1fffffff then
>     begin
>       font.Color := 0;
>     end
>     else
>     begin
>       font.Color := PEMRSetTextColor(R)^.crColor;
>     end;
>   end;

seems like the color $1fffffff (clNone) was interpreted like $00ffffff (clWhite)

2. for the character spacing:

9097c9115
<     wW, measW, W,H,hscale: Single;
---
>     wW, measW, W,H,hscale, CharOffX: Single;
9105a9123
>     tmpCh:array of WideChar;
9250,9251c9269,9296
<       Canvas.ShowGlyph(pointer(tmp),R.emrtext.nChars) else
<       Canvas.ShowText(pointer(tmp));
---
>     begin
>       Canvas.ShowGlyph(pointer(tmp),R.emrtext.nChars);
>     end
>     else
>     begin
>       if PtrUInt(@R)+R.emrtext.offDx = 0 then
>       begin
>         Canvas.ShowText(pointer(tmp));
>       end
>       else
>       begin
>         CharOffX:=R.emrtext.ptlReference.X - W;
>         SetLength(tmpCh,2);
>         for i:=0 to R.emrText.nChars - 1 do
>         begin
>           move(pointer(PtrUInt(@R)+R.emrtext.offString + i * 2)^,tmpCh[0],2);
> 
>           Canvas.ShowText(pointer(tmpCh));
> 
>           if i < R.emrText.nChars - 1 then
>           begin
>             Canvas.BeginText;
>             CharOffX:=CharOffX + DX^[i];
>             Canvas.MoveTextPoint(Canvas.I2X(CharOffX),Canvas.I2Y(R.emrtext.ptlReference.Y-H));
>           end;
>         end;
>       end;
>     end;  

In this way the character as spaced in the same way as the emf.

P.S.: sorry for may bad english.

bye vmkng.

Board footer

Powered by FluxBB