Question

labels to lines

  • 3 December 2013
  • 3 replies
  • 1 view

Hi,

 

I want to change labels (which are under different angles) to lines.

 

The line should be the bottom line and its length should correspond to the length of the label.

 

I tried to use TextStroker and then BoundingBoxReplacer (with option: Oriented Bounding Box), but it not give the desired results.

 

Does anyone have any idea?

 

 

Regards

3 replies

Userlevel 2
Badge +17
Hi,

 

 

A series of these transformers creates underline of a text feature, but its length will be longer a little than the text feature. I couldn't find a way to calculate exact length of the text feature.

 

 

1) TextPropertyExtractor   Destination Text Rotation Attribute: _text_rotation 2) CoordinateExtractor   Index: 0   X Attribute: _x   Y Attribute: _y 3) Rotator   Rotation Angle: -@Value(_text_rotation)   X Origin: _x   Y Origin: _y 4) BoundsExtractor   Minimum X Attribute: _xmin   Maximum X Attribute: _xmax 5) 2DPointReplacer   X Value: _x   Y Value: _y 6) 2DPointAdder   X Value: @Value(_x)+@Value(_xmax)-@Value(_xmin)   Y Value: _y 7) Rotator_2   Rotation Angle: _text_rotation   X Origin: _x   Y Origin: _y

 

 

Takashi
Thank you for the tips Takashi.

 

 

Regards

 

Badge +3
Hi all,

 

 

Yeah, the stroker is useless for that.

 

 

I did a similar thing, building a datagrid for my pdf writer.

 

But i made some trial and error parameters to ensure fit.

 

 

It is not easy to extract the size because of the way letters are designed and its history.

 

 

U would need to take into account a lot to even try it.

 

There are some scripts about doing such, very old ones even.

 

 

Basically u need to work with the fontsize, the type, typographical points.

 

To be correct u even should to take into account the pixelsize of your targetmedia (i.e. screen).

 

To eleminate the screenresolution (but not always correct) u can go for the 

 

the postscript size 1/72 of an inch (typographical point)

 

 

So  "Hello!" in Arial 12 would be somewhat 12x1/72*2.54=0.4233.. cm at highest point.

 

The problem is the width then.

 

 

An fme solution would be, assuming the stroker at least keeps the aspect ratio up, is indeed the textstroker.

 

Stroke the text, extract the boundingbox (if its angled u can either rotate first or use a minmalboundingboxextractor). This will give u the aspectratio.

 

As u know the height, u can now calculate a very good aproximation of width.

 

 

 

Now u need to find the insertionpoint of the text.

 

The stroker srokes to the correct x coordinate but not he y.

 

...if have not found any info on  how the textadder or labelpointreplacer decides it insertionlocation.

 

So im stranded at the y coordinate, alas. :(

 

let me know if u do...;)

Reply