ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Get Font Height from TIETextLayer Overflow=shrink
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

john_siggy@yahoo.com

USA
158 Posts

Posted - Nov 12 2019 :  21:17:34  Show Profile  Reply
Trying to get the font Size/Height from a TIETextLayer where Overflow=shrink.

As the text layer is resized the font size/height changes. What is the new value of font size/height? TIETextLayer.Font.Height gives the max font value not the currently scaled down value. Not sure what fTextDrawFontH does but it does not seem to get the new scaled down value.

Regards,

xequte

38611 Posts

Posted - Nov 12 2019 :  21:50:39  Show Profile  Reply
Hi

Yes, you can use fTextDrawFontH. It is the height value of the drawn font (i.e. Font.Height).



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

john_siggy@yahoo.com

USA
158 Posts

Posted - Nov 13 2019 :  12:08:15  Show Profile  Reply
For some reason neither fTextDrawFontH nor Tag seem to persist after the textlayer is saved/reloaded from a db blob. Others variable like Font and Name work just file. Any clue ???
Go to Top of Page

john_siggy@yahoo.com

USA
158 Posts

Posted - Nov 13 2019 :  12:18:09  Show Profile  Reply
Clarification:

TImageEnView works fine in saving/restoring from a blob. Judging from results, fTextDrawFontH is indeed being saved correctly into the blob. For some reason I always get 0 values for fTextDrawFontH and tag using ImageEnView1.LayersImport and
LayersExport;
Go to Top of Page

xequte

38611 Posts

Posted - Nov 13 2019 :  15:40:00  Show Profile  Reply
Hi John

fTextDrawFontH is not stored. It is only updated after drawing the Text Layer. Can you tell me how you are using the information. Perhaps I need a public property.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

john_siggy@yahoo.com

USA
158 Posts

Posted - Nov 13 2019 :  20:52:44  Show Profile  Reply
would like to TextOut to a Canvas and need fTextDrawFontH (can't use Font.Size) to render the text in the proper size.
Go to Top of Page

xequte

38611 Posts

Posted - Nov 13 2019 :  21:11:23  Show Profile  Reply
Hi John

Why not uses the layers own drawing, e.g.

var
  bmp: TIEBitmap;
begin
  bmp := TIEBitmap.Create();
  try
    CopyToBitmap( bmp, DrawWidth, DrawHeight, True, UseDisplayAR );
    bmp.DrawToCanvas( DestCanvas, 0, 0 );
  finally
    bmp.Free;
  end;
end;



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

john_siggy@yahoo.com

USA
158 Posts

Posted - Nov 14 2019 :  13:15:49  Show Profile  Reply
Thanks for the feedback. Get GDI+ errors with layers drawing as I access it too frequently per second. Would be nice to have fTextDrawFontH availiable.

Go to Top of Page

xequte

38611 Posts

Posted - Nov 14 2019 :  15:57:26  Show Profile  Reply
Hi

Are you able to send me a simple demo that reproduces the GDI+ errors?



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

john_siggy@yahoo.com

USA
158 Posts

Posted - Nov 16 2019 :  18:10:36  Show Profile  Reply
Hey Nigel,
Below please find my troubled code. This code is running in a thread and I need to Synchronize the CopyToBitmap procedure. If I don't synchronize, I get:

Access Violation at address X in module 'gdiplus.dll'. Read of address FFFFFFFFFFFFFFFF


for i := 1 to AnnotationImageEn.LayersCount - 1 do
begin
  //
  bmp := TIEBitmap.create;
  TIETextLayer(layers[i]).Text := 'Just a Test';
  //
  // Why need it be synchronized ???
  synchronize(procedure begin
     AnnotationImageEn.Layers[i].CopyToBitmap( bmp);
  end);
  bmp.DrawToCanvasWithAlpha(DestCanvas, PosX, PosY, 127, 1);
  bmp.Free;
  //
end;

Thanks again...
Go to Top of Page

xequte

38611 Posts

Posted - Nov 18 2019 :  20:25:19  Show Profile  Reply
Hi John

Synchronize is necessary because calls to the Layer bitmap may require access to the user interface.

I will expose fTextDrawFontH as the property TextDrawFontHeight in v8.7.6. If it is null you will need to draw the layer to initialize it (or call CopyToBitmap for example).



Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: