#1 2014-10-04 17:08:22

krzbor
Member
Registered: 2014-10-03
Posts: 2

Problem with HorizontalScaling

I noticed that the printed text (from QRP) contains errors. Some of texts are wrong stretched. I changed the code. I moved
    case Positioning of
    tpSetTextJustification:
      if nspace>0 then
        Canvas.SetWordSpace(0);
    tpKerningFromAveragePosition:
      if hscale<>100 then
        Canvas.SetHorizontalScaling(100); //reset hor. scaling
    end;
to a new position:

   Canvas.EndText;
{    case Positioning of                                        //  <<<< I removed it from this position
    tpSetTextJustification:
      if nspace>0 then
        Canvas.SetWordSpace(0);
    tpKerningFromAveragePosition:
      if hscale<>100 then
        Canvas.SetHorizontalScaling(100); //reset hor. scaling
    end;}
    // handle underline or strike out styles (direct draw PDF lines on canvas)
    if font.LogFont.lfUnderline<>0 then
      DrawLine(Posi, aSize / 8 / Canvas.GetWorldFactorX / Canvas.FDevScale);
    if font.LogFont.lfStrikeOut<>0 then
      DrawLine(Posi, - aSize / 3 / Canvas.GetWorldFactorX / Canvas.FDevScale);
    // end any pending clipped TextRect() region
    if WithClip or (not DC[nDC].ClipRgnNull) then begin
      Canvas.GRestore;
      fFillColor := -1; // force set drawing color
    end;

    case Positioning of                                        // <<<< and I moved here (after Canvas.GRestore)
    tpSetTextJustification:
      if nspace>0 then
        Canvas.SetWordSpace(0);
    tpKerningFromAveragePosition:
      if hscale<>100 then
        Canvas.SetHorizontalScaling(100); //reset hor. scaling
    end;
   
    if (not Canvas.FNewPath) then begin


Is this a good solution?

Offline

Board footer

Powered by FluxBB