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
 Writing text to ImageEn Layer and resize text
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

UBeyerAtWork

Switzerland
13 Posts

Posted - Sep 20 2018 :  04:22:05  Show Profile  Reply
Hi together,

im starting to display text on a form (invoice as tiff).
After that I have added some text and can move it to right position.

Now I'm looking to resize text in width and height (seperate)

Load image, add text is already done. Used the source sample of William Miller

fslCold is a Stringlist

fiLayer := ImageEnView1.LayersCreateFromText(fslCold.Text,
                                               'Courier New',
                                               25,
                                               clBlack,
                                               AFontStyle,
                                               False,
                                               0,
                                               0,
                                               0,
                                               True
                                              );


Moving is done inside Keydown event of form (Keydown at imageen is not working im my version)

if (fiLayer <> -1) then begin
    lintMove := 10;
    if (Shift = [ssCtrl]) then lintMove := 1;
    if (Shift = [ssShift]) then lintMove := 100;

    if (Key = 39) then ImageEnView1.Layers[fiLayer].PosX := ImageEnView1.Layers[fiLayer].PosX + lintMove;
    if (Key = 37) then ImageEnView1.Layers[fiLayer].PosX := ImageEnView1.Layers[fiLayer].PosX - lintMove;
    if (Key = 40) then ImageEnView1.Layers[fiLayer].PosY := ImageEnView1.Layers[fiLayer].PosY + lintMove;
    if (Key = 38) then ImageEnView1.Layers[fiLayer].PosY := ImageEnView1.Layers[fiLayer].PosY - lintMove;

    ImageEnView1.Update;
  end;


I'm glad about any tip

Thanks Uwe

Uwe Beyer
Software Engineering / Consulting (Personalsystem/Archivsystem/Web)

IS International Sourcing AG
Stockwiesenstr. 1
CH-8240 Thayngen

xequte

39140 Posts

Posted - Sep 20 2018 :  19:47:31  Show Profile  Reply
Hi Uwe

LayersCreateFromText is an older method that creates an image layer (TIEImageLayer) from text. Now that there are layer methods, you should generally create text layers (TIETextLayer) instead.

ImageEn should now also automatically movement of the selected layer using the cursor keys, or sizing if Ctrl key is pressed. You can force sizing by adding iessCtrl_KeySizing to ImageEnView1.ShiftKeyLock.

https://www.imageen.com/help/TImageEnView.ShiftKeyLock.html

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

UBeyerAtWork

Switzerland
13 Posts

Posted - Sep 21 2018 :  01:56:20  Show Profile  Reply
Hi Nigel,

thanks for that. I have changed to TIETextLayer (below).

My problem is how to change the line spacing between two text rows.
Is there no posibility to set the line spacing? I have tried a solution
to read line by line and make positioning with drawtext into a layer, but it's very slow.

We have text files from our old unix system. The text was printed with dot matrix
printer. And in this time (long ago) we had CPI & LPI. Now we had to show the scaned
print form and put the text onto the form (own archiv system).

Much Greetings
Uwe

// =========================================================================
  // Load Form matching to document

  AFontStyle := [];
  ImageEnView1.LayersClear;
  ImageEnView1.Clear;
  ImageEnView1.MouseInteract := ImageEnView1.MouseInteract + [miSelectZoom];
  ImageEnView1.OnDblClick := imgDblClick;
  ImageEnView1.IO.LoadFromFileTIFF(gstFormular + qrwColdData.FieldByName('Form').AsString);
  ImageEnView1.Zoom := 100;

  fiColdX := qrwColdData.FieldByName('ColdPosX').AsInteger;
  fiColdY := qrwColdData.FieldByName('ColdPosY').AsInteger;
  fiFontSize := qrwColdData.FieldByName('ColdFontSize').AsInteger;

  fiLayer := ImageEnView1.LayersAdd(ielkText, fiColdX, fiColdY, ImageEnView1.IO.Params.Width, ImageEnView1.IO.Params.Height);
  TIETextLayer( ImageEnView1.CurrentLayer ).Font.Name := 'Courier New';
  TIETextLayer( ImageEnView1.CurrentLayer ).Font.Height := fiFontSize;
  TIETextLayer( ImageEnView1.CurrentLayer ).Font.Color := clBlack;
  TIETextLayer( ImageEnView1.CurrentLayer ).Font.Style := AFontStyle;
  TIETextLayer( ImageEnView1.CurrentLayer ).Font.Quality := fqClearType;
  TIETextLayer( ImageEnView1.CurrentLayer ).Text := fslCold.Text;
  TIETextLayer( ImageEnView1.CurrentLayer ).BorderColor := clBlack;
  TIETextLayer( ImageEnView1.CurrentLayer ).BorderWidth := 2;
  ImageEnView1.Update;
  // =========================================================================


Uwe Beyer
Software Engineering / Consulting (Personalsystem/Archivsystem/Web)

IS International Sourcing AG
Stockwiesenstr. 1
CH-8240 Thayngen
Go to Top of Page

xequte

39140 Posts

Posted - Sep 21 2018 :  17:19:16  Show Profile  Reply
Hi Uwe

Unfortunately GDI+ is used to draw the text so the line height cannot be changed.

You say you tried outputting a text layer for each line, but it was too slow. How many lines were there?

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

UBeyerAtWork

Switzerland
13 Posts

Posted - Sep 28 2018 :  02:42:13  Show Profile  Reply
Hi Nigel,

sorry I was offline some days. I want to test using multiple layers.
There are maximum 67 lines of text.

Much Greetings from Germany
Uwe

Uwe Beyer
Software Engineering / Consulting (Personalsystem/Archivsystem/Web)

IS International Sourcing AG
Stockwiesenstr. 1
CH-8240 Thayngen
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: