lineWidth from TextLine Class issue?

Hi. I have text inside geotext comp, im getting every glyph data using layoutText from geotextCOMP Class For some reason lineWidth always stay on 0.0 Rest of data work fine. What can be issue ? Does lineWidth equal to the glyph horizontal size after formating ?

Acording to the documentation

The width of the format box of this line of text.

Sorry for the confusion there. That member isn’t currently filled in by the Geo Text Class which is why it is always zero. That TextLine class is reused by both the Text TOP and Text SOP which do make use of that member.

I will update the documentation to make that clearer.

Was that value important to you? Is it the glyph size you were looking for?

1 Like

Yep im looking for the way to measure the width of glyph (geotext) but I need to measure this after formating codes applied. I allready used layoutText to grab positions of glyphs to table, that work fine, but cant get they size (after font formation). The only way to grab size is evalTextSize but its not working the way i need because formating applied to the glyphs arent working proper here (its grabbing the size of glyphs but without stretching, scaling and so on that im applying using formating codes inside touch)

Robmc any ideas please?

Hi Tobek,

I was trying out your specific example because I was curious about it.

For me it looks like evalTextSize() does take formatting codes into account:

evalTextSize should take all of the formatting codes into account, but I think Tobek was looking to get the size of each individual glyph. The layoutText function currently returns their positions inside the formatted piece of text, but not their sizes.

I took a look at that code yesterday, but unfortunately the font library that we are using doesn’t seem to make that information readily available.

At the moment, my best suggestion is that you would need to reapply your formatting codes to each glyph/character and then call evalTextSize on that. It is not the most efficient, but should theoretically return the same results.

If you could create one or more additional geo texts with the correct formatting and call evalTextSize using those then you might be able to avoid building and parsing new formatting codes around each glyph.

ok thats some idea… i just checked what both of you wrote… switched text to entire words instead of single glyphs, and now Im able to get evalTextSize working with entire formated words, but now I wonder is it possible to grab words coordination somehow from geotext? previously i grabbed position glyphs by using layout[i].origin.x, but dont think it will work with entire words am I right?

I’m not sure if I’m exactly clear on what you are trying to do, but the layoutText feature always returns the position of every glyph in the given block of text so if you want just the word position then you would need to find the first character of that word in the returned layout data.