Very jagged text with TGpGraphics.DrawString

Hi, I have purchased TMS components and find them useful. However, I have the following problem with TGpGraphics.DrawString.

I have created a component based on TAdvSmoothCalculator. Instead of LED display, I use TGpGraphics.DrawString. But the text is very jagged and aliased. See the attached picture.
 
What's wrong? Could anybody advise me?

Here's the code snippet:


  gpFont := g.MakeFont(CalculatorLook.DisplayAppearance.Font);
  try
    solidBrush := TGPSolidBrush.Create(ColorToARGB(CalculatorLook.DisplayAppearance.Font.Color));
    try
      stringFormat := TGPStringFormat.Create(0);
      try
        stringFormat.SetAlignment(StringAlignmentFar);
        stringFormat.SetLineAlignment(StringAlignmentCenter);
        stringFormat.SetTrimming(StringTrimmingNone);
        stringFormat.SetFormatFlags(stringFormat.GetFormatFlags or StringFormatFlagsMeasureTrailingSpaces);
        Assert(DisplayLines.Count <= cn_DisplayLines);
        for I := DisplayLines.Count - 1 downto 0 do
        begin
          S := DisplayLines.AsString(Precision);
          r := MakeRect(2, 2 + (RectHeight div cn_DisplayLines) * I, Width - 4, RectHeight div cn_DisplayLines);
          g.DrawString(S, 0, gpFont, r, stringFormat, solidBrush);
        end;
      finally
        FreeAndNil(StringFormat);
      end;
    finally
      FreeAndNil(solidBrush);
    end;
  finally
    FreeAndNil(gpFont);
  end;



Hi, 


Can you test with g.setTextRenderingHint to antialiasing?

Kind Regards, 
Pieter

Thank you for your quick reply, Pieter. It solved the problem!

I set TextRenderingHint just after TGPGraphics.Create, but it didn't change anything. However, if I set it just before DrawString, it seems to work. Probably TextRenderingHint got somehow lost between Create and DrawString.

Thanks again and have a nice day