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
 TextOut issue
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Fábio Nascimento

Brazil
72 Posts

Posted - Jul 26 2023 :  20:37:03  Show Profile  Reply
Hi

I use ImageEn_CNM.Proc.TextOut to place a "stamp" on multipage TIFF's with "Align_Text_Right".

I ran a script that placed the text over 70.000 mutipage files and they were all placed ate the same place. I used this code:

ImageEn_CNM.Proc.TextOut(Align_Text_Right,5,'CNM nº ' + CNM,'Arial',28,clBlack,fsBold,fsUnderline]);

descricao_ficha := ' [FICHA ' + completar_com(IntToStr(numero_ficha),'0',3) + '-VERSO]';
ImageEn_CNM.Proc.TextOut(Align_Text_Right,48,descricao_ficha,'Courier New',20,clBlack,fsBold]);

But some files are updated everyday, and today the stamp started to be placed a little more to the left causing the text to overlay each other.

I wonder how can I resolve that, I tought using Align_Text_Right should place the stamp on the exact same spot everytime, so they dont overlay.

I tried to make the text have a white "background", so if they overlay, at least the last one would be readable, but I couldnt find a way to do that, the text is always stamped with a transparent backgorund.

I'm attacking some prints to demonstrate!

Thanks!






xequte

38183 Posts

Posted - Jul 26 2023 :  23:26:00  Show Profile  Reply
Hi Fabio

Align_Text_Right will always place the text on the right of the image, however its actual draw position is calculated by the width of the text. If the text and font is the same then you would expect the position to also always be the same, so the question is why Windows (GDI+) is returning a different width for the text. I can't think why this could be, other than some Windows update that affects font handling??

At any rate, more importantly, you should avoid drawing text where there is already text present. Touch the document in some way so that you know whether text already exists (e.g. by setting a TIFF metavalue such as TIFF_DocumentName or TIFF_ImageDescription).

If you must redraw the text, then draw a white background behind, e.g. using the new TextOutEx method:

http://www.imageen.com/help/TImageEnProc.TextOutEx.html

Or in the upcoming 12.2.0 you can get the draw rect from TImageEnProc.TextOut to easily draw a background color



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

Fábio Nascimento

Brazil
72 Posts

Posted - Jul 27 2023 :  05:46:47  Show Profile  Reply
Hi xequte

I bought the License Extension, I'll wait untill I have it working to continue, because the 6.3 version does not have the TextOutEx function!

You said I can check the document to see if there's text at a defined area, do you have any sample code for that matter?

Thanks
Go to Top of Page

xequte

38183 Posts

Posted - Jul 27 2023 :  21:16:44  Show Profile  Reply
Hi Fabio

TextOutEx() in 12.0.0 already supports background area drawing. Support for getting the defined area of TextOut() requires the latest beta. If you want that version email me for the source code.

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