From Wang Lam,"The changes allow users of OpenSceneGraph to call a new function
readFontStream() to load fonts from a std::istream, rather than from the
local filesystem by name. Such a call may be used, for example, if the
user has a font fetched over a network, or a font available in memory
without a correspondng filename.
The changes implement the new function by following the corresponding code
for readFontFile(). readFontStream() reads a stream into memory, and
holds that memory for FreeType.
As a basic test, I mangled the osgtext example to use
readFontStream(std::ifstream("font")) in lieu of a readFontFile call, and
the modified example ran completely."
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#define OSGTEXT_FONT 1
|
||||
|
||||
#include <string>
|
||||
#include <istream>
|
||||
|
||||
#include <osg/Vec2>
|
||||
#include <osg/Image>
|
||||
@@ -57,6 +58,10 @@ enum KerningType
|
||||
* the file will be searched again in the OS specific directories.
|
||||
*/
|
||||
extern OSGTEXT_EXPORT Font* readFontFile(const std::string& filename);
|
||||
|
||||
/** read a font from specified stream.*/
|
||||
extern OSGTEXT_EXPORT Font* readFontStream(std::istream& stream);
|
||||
|
||||
extern OSGTEXT_EXPORT std::string findFontFile(const std::string& str);
|
||||
|
||||
/** Pure virtual base class for fonts.
|
||||
|
||||
Reference in New Issue
Block a user