1
votes

Fonts don't changes with

GlobalUseDirect2D := false;

and all of them are 'Segoe UI'.

What I can do, that fonts can be customizable with GDI+?

Delphi XE4, Firemonkey HD forms.

1

1 Answers

0
votes

Thanks, I fixed it. One more time about the problem: I turn off GlobalUseDirect2D and all text have FontFamily as 'Tahoma', even it is 'Comic Sans MS', for example.

UPD It's not full fix. Fonts shuffle.

UPD2 Now it's right fixed.

Code of fix in FMX.Canvas.GDIP.pas:

procedure TTextLayoutGDIPlus.DoRenderLayout;
var
  i: Integer;
  LRegion: TRegion;
begin
  if not Assigned(FStringFormat) or not Assigned(FGraphics) then
    Exit;

  FreeAndNil(FGPFont);
  if Assigned(LayoutCanvas) then
  begin
    //FIX BEGIN
    TCanvasGdiPlus(LayoutCanvas).Font.Assign(Font);
    //FIX END
    if not TCanvasGdiPlus(LayoutCanvas).FGPFamily.IsStyleAvailable(vgStyleToGPStyle(Font.Style)) then
    begin
      FGPFont := TGPFont.Create(TCanvasGdiPlus(LayoutCanvas).FGPFamily,
        Font.Size * 0.75 * TCanvasGdiPlus(LayoutCanvas).FFontScale, 0);
      if not Assigned(FGPFont) then
        FGPFont := TGPFont.Create(TCanvasGdiPlus(LayoutCanvas).FGPFamily,
          Font.Size * 0.75 * TCanvasGdiPlus(LayoutCanvas).FFontScale,
          vgStyleToGPStyle(Font.Style));
    end
    else
      FGPFont := TGPFont.Create(TCanvasGdiPlus(LayoutCanvas).FGPFamily,
        Font.Size * 0.75 * TCanvasGdiPlus(LayoutCanvas).FFontScale,
        vgStyleToGPStyle(Font.Style),
        UnitPoint);
  end