Einzelnen Beitrag anzeigen

Gruber_Hans_12345

Registriert seit: 14. Aug 2004
1.426 Beiträge
 
Delphi 2007 Professional
 
#67

Re: Vektor Format anzeigen/drucken

  Alt 19. Nov 2007, 20:29
Zitat von Gruber_Hans_12345:
@xaromz: habe noch eine frage

warum ist es eigentlich so, das wenn du einen text ausgibst, diesen immer gleich in einen Pfad umwandelst?
Geht das nur so?
Also geht auch anders, habe es hinbekommen, und sieht schon mal ganz gut aus ...

in der TKerningText.AddToGraphics ist noch ein Fehler drinnen, da muß das PrepareKerning mit dem Faktor verwendet werden, sonst passt der gezeichnete Text mit Kerning nicht ... (ist der abstand falsch)
Delphi-Quellcode:
function TKerningText.AddToGraphics(const Graphics: TGPGraphics;
  const Text: WideString; const Font: TGPFont; Origin: TGPPointF;
  const Format: TGPStringFormat; const Brush: TGPBrush): TStatus;
var
  P1, P2: PWideChar;
  Status: TStatus;
begin
  Status := Ok;
  if Text = 'then
  begin
    Result := Ok;
    Exit;
  end;
  
  PrepareKerning(Font, Graphics, TRUE); <<< hier gehört TRUE
und hier ist meine PaintToGraphics

Delphi-Quellcode:
procedure TSVGText.PaintToGraphics(Graphics: TGPGraphics);
var
  SF: TGPStringFormat;
  f : TGPFont;
  brush : TGPBrush;
  pointF : TGPPointF;
  TGP : TGPMatrix;
  ClipRoot: TSVGBasic;
begin
  if FText = 'then
    Exit;

{$IFDEF DONT_USE_TEXT}
  inherited;
{$ELSE}
  SF := TGPStringFormat.Create(TGPStringFormat.GenericTypographic);
  SF.SetFormatFlags(StringFormatFlagsMeasureTrailingSpaces);

  pointF := MakePoint(X, Y - FFontHeight);

  f := GetFont;
  try
    if Assigned(FClipPath) then
    begin
      if ClipURI <> 'then
      begin
        ClipRoot := TSVGBasic(GetRoot.FindByID(ClipURI));
        if Assigned(ClipRoot) then
        begin
          TGP := GetGPMatrix(ClipRoot.Matrix);
          Graphics.SetTransform(TGP);
          TGP.Free;
        end;
      end;
      try
        Graphics.SetClip(FClipPath);
      except
      end;
      Graphics.ResetTransform;
    end;

    TGP := GetGPMatrix(Matrix);
    Graphics.SetTransform(TGP);
    TGP.Free;

    Brush := GetFillBrush;
    if Assigned(Brush) and (Brush.GetLastStatus = OK) then
    try
        KerningText.AddToGraphics(Graphics, FText, f, pointF, SF, brush);
    finally
      Brush.Free;
    end;
  finally
    Graphics.ResetTransform;
    Graphics.ResetClip;
  end;
  f.Free;
  SF.Free;
{$ENDIF}
end;
Gruss Hans

2B or not 2B, that is FF
  Mit Zitat antworten Zitat