#1 Re: PDF Engine » Extended RTF formatting not saved with SynPDF » 2015-05-05 05:32:09

Hi

I checked the issue with a sample EMF containing text with BkColor. As mentioned in this post, the background is not rendered in PDF.

It seems that (at least in a sample EMF) text's BkColor is not represented by brush color. In TPdfEnum.TextOut, OPAQUE processing is dependent to brush - and does not work properly. Also, font.BkMode is not necessarily set in EMFs. I am not sure if this is the case in all EMFs and all use cases, bit some minor changes worked for me (and the text backgrounds appeared in PDF):

procedure TPdfEnum.TextOut(var R: TEMRExtTextOut);
:
:
    bOpaque := (not brush.null) and (brush.Color<>clWhite) and
       ((R.emrtext.fOptions and ETO_OPAQUE<>0) or
        ((font.BkMode=OPAQUE) and (font.BkColor=brush.color)));

    bOpaque := (R.emrtext.fOptions and ETO_OPAQUE<>0);
:
:
      if bOpaque then begin
        FillRectangle(backRect,false);
        FillTextBk(backRect,false);
        bOpaque := False; //do not handle more
        :
:
    if bOpaque then
      // don't handle BkMode, since global to the page, but only specific text
      // don't handle rotation here, since should not be used much
      FillRectangle(backRect,true);
      FillTextBk(backRect,true);
:
:

FillTextBk is a new method which I wrote by copying FillRectangle and using font.BkColor instead of brush.color:

procedure TPdfEnum.FillTextBk(const Rect: TRect; ResetNewPath: boolean);
begin
  Canvas.NewPath;
  FillColor := DC[nDC].font.BkColor;
  with Canvas.BoxI(Rect,true) do
    Canvas.Rectangle(Left,Top,Width,Height);
  Canvas.Fill;
  if ResetNewPath then
    Canvas.FNewPath := false;
end;

As mentioned before, I am not sure if this fix is complete or covers all of use cases. It's just a work around for a specific problem in hand.

Cheers

#2 Re: PDF Engine » Suggestions for EMF complex script processing » 2015-04-18 12:44:52

Hi again

I was reviewing the changes you made in the final patch. Two points grab my attention

1. FillChar(AScriptState... should be done before calling ScriptApplyDigitSubstitution (which may effect AScriptState). Setting BidiLevel is OK and should be done after method call.

2. In AddGlyphs, we should avoid ZeroWidth glyphs "and not avoid" Diacritics. In your code, they are considered equal. Diacritics are dropped in this way.

Sorry for trouble and thanks again

Mehrdad

#3 Re: PDF Engine » Suggestions for EMF complex script processing » 2015-04-17 17:09:59

It was absolutely my pleasure.

I am honored...

Thanks

#4 PDF Engine » Suggestions for EMF complex script processing » 2015-04-16 12:23:27

nosa
Replies: 4

Hi

I have recently begun using your beautiful library.

Respect

I have some suggestions regarding Uniscribe - which can be seen in

http://sharesend.com/uomr94jw

They worked very well for me. I hope they are useful.

Regards

Mehrdad

Board footer

Powered by FluxBB