Ver Mensaje Individual
  #10  
Antiguo 23-08-2016
Avatar de cl2raul
cl2raul cl2raul is offline
Miembro
 
Registrado: sep 2008
Ubicación: La Habana, Cuba
Posts: 88
Reputación: 18
cl2raul Va por buen camino
Gracias a todos los involucrador, ya solucione el problema, segui el prosedimiento con el objetivo de eliminar [TFillTextFlag.RightToLeft] que era el responsable de priorizar las letras a los números causando la no esperada respuesta, como en la unidad FMX.Graphics esla que contienes el procedimiento TCanvas.FillText(), cree mi version del procedimiento para ver resultado esperado (100 dias)=(100 dias), a continuacion la unidad, ojo hay q agregar al uses FMX.TextLayout;

Código Delphi [-]
unit main;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
  FMX.StdCtrls, FMX.Controls.Presentation, FMX.Edit, FMX.Layouts;

type
  TTextInImage = class(TForm)
    Image1: TImage;
    Layout1: TLayout;
    Edit1: TEdit;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  TextInImage: TTextInImage;

implementation

{$R *.fmx}

uses FMX.TextLayout;

procedure TextInImg(const ARect: TRectF; const AText: string; LaImagen: TCanvas;
  const WordWrap: Boolean; const AOpacity: Single; const ATextAlign, AVTextAlign: TTextAlign);
var
  Layout: TTextLayout;
begin
  Layout := TTextLayoutManager.TextLayoutByCanvas(LaImagen.ClassType).Create(LaImagen);
  try
    Layout.BeginUpdate;
    Layout.TopLeft:=ARect.TopLeft;
    Layout.MaxSize:=PointF(ARect.Width, ARect.Height);
    Layout.Text:=AText;
    Layout.WordWrap:=WordWrap;
    Layout.Opacity:=AOpacity;
    Layout.HorizontalAlign:=ATextAlign;
    Layout.VerticalAlign:=AVTextAlign;
    Layout.Font:=LaImagen.Font;
    Layout.Color:=LaImagen.Fill.Color;
    //Layout.RightToLeft := TFillTextFlag.RightToLeft in Flags;
    Layout.EndUpdate;
    Layout.RenderLayout(LaImagen);
  finally
    FreeAndNil(Layout);
  end;
end;

procedure TTextInImage.Button1Click(Sender: TObject);
var
  MyRect: TRectF;
  x1, y1, x2, y2, I: integer;
begin
  x1 := 60;
  y1 := 60;
  x2 := Image1.Bitmap.Canvas.Width - 60;
  y2 := Image1.Bitmap.Canvas.Height - 60;

  MyRect := TRectF.Create(x1, y1, x2, y2);

  Image1.Bitmap.Canvas.BeginScene;
  Image1.Bitmap.Canvas.Font.Family:='Arial';
  Image1.Bitmap.Canvas.Font.Size:=48;

  TextInImg(MyRect,Edit1.Text,Image1.Bitmap.Canvas,True,100,TTextAlign.Center,TTextAlign.Center);

  Image1.Bitmap.Canvas.EndScene;
end;

procedure TTextInImage.FormCreate(Sender: TObject);
begin
  Image1.Bitmap.LoadFromFile(GetCurrentDir+'\p10.png');
end;

end.
Responder Con Cita