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 

TrueType collection subfont index


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Submission
View previous topic :: View next topic  
Author Message
ravidavi
User


Joined: 06 Nov 2015
Posts: 44

PostPosted: Sun Jan 28, 2018 9:52 am    Post subject:
TrueType collection subfont index
Reply with quote

Hi Robert,

The freetype plugin currently forces the use of the first font within a truetype collection (.ttc index 0). I made a slight modification such that users can specify any font index via the userOptions input to osgText::readFontFile(). Specifically, the freetype plugin now accepts a new string option of the format "index=< unsigned int >". Example usage:

Code:
// Chooses the second font within the Menlo font collection
osg::ref_ptr<osgDB::Options> fontOptions = new osgDB::Options;
fontOptions->setObjectCacheHint(osgDB::Options::CACHE_OBJECTS);
fontOptions->setOptionString("index=1");
text->setFont(osgText::readFontFile("Menlo.ttc", fontOptions));


The updated freetype/ReaderWriterFreeType.cpp file is attached to this forum post. I hope it is helpful to others, and let me know if I should modify it in any way.

Ravi
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11908

PostPosted: Wed Feb 07, 2018 6:34 pm    Post subject:
TrueType collection subfont index
Reply with quote

Thanks Ravi, changes merged and submitted to master. I wonder if it
might be useful to have a osgText::readFontFile(const std::string
name, int index, Option*);

On 28 January 2018 at 09:52, Ravi Mathur <> wrote:
Quote:
Hi Robert,

The freetype plugin currently forces the use of the first font within a truetype collection (.ttc index 0). I made a slight modification such that users can specify any font index via the userOptions input to osgText::readFontFile(). Specifically, the freetype plugin now accepts a new string option of the format "index=< unsigned int >". Example usage:


Code:
// Chooses the second font within the Menlo font collection
osg::ref_ptr<osgDB::Options> fontOptions = new osgDB::Options;
fontOptions->setObjectCacheHint(osgDB::Options::CACHE_OBJECTS);
fontOptions->setOptionString("index=1");
text->setFont(osgText::readFontFile("Menlo.ttc", fontOptions));




The updated freetype/ReaderWriterFreeType.cpp file is attached to this forum post. I hope it is helpful to others, and let me know if I should modify it in any way.

Ravi

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72880#72880








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Submission 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 Adding OGRFeatures to the global Index aukedirk@horus.nu General 1 Wed May 11, 2016 7:51 am View latest post
No new posts Geometry of Generic 3D Surface from C... ehensens General 9 Mon Aug 17, 2015 1:21 am View latest post
No new posts How to avoid Javas Garbage Collection... Christian Kehl General 3 Thu Jul 30, 2015 6:26 pm View latest post
No new posts Obsolete osg-users archive search index? Émeric MASCHINO General 4 Thu May 01, 2014 1:53 pm View latest post
No new posts fix for index mesh and vertex pretran... Pjotr Submission 1 Wed Jun 26, 2013 8:49 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