[osg-users] Compute line numbers for Glyphs in Text class

Ferran Pallarès pallares.ferran at gmail.com
Sat Oct 27 10:06:19 PDT 2018


Hi Robert,

Thank you for your answer.

I couldn't find GlyphQuads::_coords, parhaps you meant TextBase::_coords?
If that's the case, is each character represented by a single element (Vec3)
in the TextBase::_coords vector? (maybe the coordinates of the top-left
corner?)

Regarding the Text::CharacterSize, I understand you were referring to
TextBase::getCharacterHeight (as the height is what it's actually set by
the TestBase::setCharacterSize function). Is TextBase::getCharacterHeight
function equivalent to Glyph::getHeight function? If not, what are the
differences?

If I've understood correctly, I should be able to obtain the line number
for a given glyph i just by dividing it's vertical coordinate
(*_coords)[i].y() by the character/glyph height
_quads->_glyphs[i]->getHeight. Is this correct?

Thank you!,
Ferran

On Thu, 25 Oct 2018 at 10:06, Robert Osfield <robert.osfield at gmail.com>
wrote:

> Hi Ferran,
>
> On Wed, 24 Oct 2018 at 18:58, Ferran Pallarès <pallares.ferran at gmail.com>
> wrote:
>
>> Any hint on how I could achieve this in the latest release?
>>
>
> It should be possible to use GlyphQuads::_coords to work out where the
> glyphs are.  They will be aligned on the XY plane, and the
> Text::CharacterSize should enable you to work out the line number.  I don't
> know the exact way to do it, but this is the direction I'd look in.
>
> Robert.
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20181027/47982483/attachment.html>


More information about the osg-users mailing list