Author |
Topic |
|
john_siggy@yahoo.com
USA
158 Posts |
Posted - Nov 12 2019 : 21:17:34
|
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
|
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
|
|
|
john_siggy@yahoo.com
USA
158 Posts |
Posted - Nov 13 2019 : 12:08:15
|
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 ??? |
|
|
john_siggy@yahoo.com
USA
158 Posts |
Posted - Nov 13 2019 : 12:18:09
|
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; |
|
|
xequte
38611 Posts |
Posted - Nov 13 2019 : 15:40:00
|
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
|
|
|
john_siggy@yahoo.com
USA
158 Posts |
Posted - Nov 13 2019 : 20:52:44
|
would like to TextOut to a Canvas and need fTextDrawFontH (can't use Font.Size) to render the text in the proper size. |
|
|
xequte
38611 Posts |
Posted - Nov 13 2019 : 21:11:23
|
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
|
|
|
john_siggy@yahoo.com
USA
158 Posts |
Posted - Nov 14 2019 : 13:15:49
|
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.
|
|
|
xequte
38611 Posts |
Posted - Nov 14 2019 : 15:57:26
|
Hi
Are you able to send me a simple demo that reproduces the GDI+ errors?
Nigel Xequte Software www.imageen.com
|
|
|
john_siggy@yahoo.com
USA
158 Posts |
Posted - Nov 16 2019 : 18:10:36
|
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...
|
|
|
xequte
38611 Posts |
Posted - Nov 18 2019 : 20:25:19
|
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
|
|
|
|
Topic |
|