From Vladimir Chebaev, fixed handling of outline orientiation
This commit is contained in:
@@ -36,7 +36,8 @@ struct Char3DInfo
|
||||
_maxX(-FLT_MAX),
|
||||
_minX(FLT_MAX),
|
||||
_minY(FLT_MAX),
|
||||
_coord_scale(1.0/64.0)
|
||||
_coord_scale(1.0/64.0),
|
||||
_reverseFill(false)
|
||||
{
|
||||
_geometry->setVertexArray(_verts.get());
|
||||
}
|
||||
@@ -49,6 +50,17 @@ struct Char3DInfo
|
||||
{
|
||||
if (_currentPrimitiveSet.valid() && _currentPrimitiveSet->size()>1)
|
||||
{
|
||||
if (_reverseFill)
|
||||
{
|
||||
for ( int near = 0, far = _currentPrimitiveSet->size() - 1;
|
||||
near < far;
|
||||
near++, far--)
|
||||
{
|
||||
std::swap((*_currentPrimitiveSet)[near],
|
||||
(*_currentPrimitiveSet)[far]);
|
||||
}
|
||||
}
|
||||
|
||||
_geometry->addPrimitiveSet( _currentPrimitiveSet.get() );
|
||||
}
|
||||
_currentPrimitiveSet = 0;
|
||||
@@ -168,7 +180,7 @@ struct Char3DInfo
|
||||
double _minX;
|
||||
double _minY;
|
||||
double _coord_scale;
|
||||
|
||||
bool _reverseFill;
|
||||
};
|
||||
|
||||
|
||||
@@ -461,6 +473,9 @@ osgText::Glyph3D * FreeTypeFont::getGlyph3D(const osgText::FontResolution& fontR
|
||||
funcs.shift = 0;
|
||||
funcs.delta = 0;
|
||||
|
||||
FT_Orientation orientation = FT_Outline_Get_Orientation(&outline);
|
||||
char3d._reverseFill = (orientation == FT_ORIENTATION_POSTSCRIPT);
|
||||
|
||||
// ** record description
|
||||
FT_Error _error = FT_Outline_Decompose(&outline, &funcs, &char3d);
|
||||
if (_error)
|
||||
|
||||
Reference in New Issue
Block a user