OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Compute line numbers for Glyphs in Text class


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Ferran Pallarès
Guest





PostPosted: Wed Oct 24, 2018 5:58 pm    Post subject:
Compute line numbers for Glyphs in Text class
Reply with quote

Hi all,



I'm currently trying to port an application based on OpenSceneGraph 3.4 to its latest release 3.6.3 and I have encountered some problems in the process. I thought that, perhaps, you could give me some hints on how to overcome them, as I'm not familiarized with the OSG code.


The application I'm trying to port wraps osgText::Text class into a TextLine class. This class considers only the Glyphs in a given line, by installing some iterators pointing to the first and last Glyphs in such line. In order to install those iterators, the application code uses the GlyphQuads::LineNumbers vector in the text->_textureGlyphQuadMap, which used to store the line number for each Glyph.


However, this information was removed in commit cefecaec103 February last year because it was unused. I've been trying to recompute this information by other means and I've checked the available functions in Text and TextBase, but I'm not really sure about how to do it. My best guess is to use Text::computeLastCharacterOnLine on the line, and take the last character on the previous line + 1 as the first character on the current line. However, I'm really not very sure about that, as I have a very superficial knowledge on what this class is actually doing and how cursors work.


Any hint on how I could achieve this in the latest release?



Thank you!,
Ferran

------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Thu Oct 25, 2018 8:06 am    Post subject:
Compute line numbers for Glyphs in Text class
Reply with quote

Hi Ferran,

On Wed, 24 Oct 2018 at 18:58, Ferran Pallarès < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
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.

 

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Ferran Pallarès
Guest





PostPosted: Sat Oct 27, 2018 5:07 pm    Post subject:
Compute line numbers for Glyphs in Text class
Reply with quote

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 < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Ferran,

On Wed, 24 Oct 2018 at 18:58, Ferran Pallarès < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
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
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts strange behaviour with osgText::Text christoph General 0 Wed Jul 18, 2018 12:06 pm View latest post
No new posts massive text rendering OmegaDoom General 3 Mon Jul 09, 2018 12:14 pm View latest post
No new posts Why is osgText::Text very slow when i... OmegaDoom General 1 Wed Jul 04, 2018 5:31 am View latest post
No new posts setAxisAlignment(osgText::Text::SCREE... OmegaDoom General 1 Tue Jun 26, 2018 9:40 pm View latest post
No new posts Antialising for text OmegaDoom General 3 Tue Jun 26, 2018 8:06 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP