Skip to content

Commit 5437f06

Browse files
committed
Font : Remove meshGroup() method
This removes the last use of the Group class.
1 parent 64466f3 commit 5437f06

File tree

5 files changed

+1
-67
lines changed

5 files changed

+1
-67
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Breaking Changes
1414

1515
- Renderable : Removed `render()` method.
1616
- CoordinateSystem : Removed transform.
17+
- Font : Removed `meshGroup()` method.
1718
- Options : Removed.
1819
- CurveExtrudeOp, IDXReader : Removed.
1920
- Renderer, AttributeBlock, EditBlock, MotionBlock, TransformBlock, WorldBlock : Removed.

include/IECoreScene/Font.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ namespace IECoreScene
5050
{
5151

5252
IE_CORE_FORWARDDECLARE( MeshPrimitive );
53-
IE_CORE_FORWARDDECLARE( Group );
5453

5554
/// The Font class allows the loading of fonts and their
5655
/// conversion to MeshPrimitives.
@@ -91,9 +90,6 @@ class IECORESCENE_API Font : public IECore::RunTimeTyped
9190
/// Returns a mesh representing the specified string,
9291
/// using the current curve tolerance and kerning.
9392
MeshPrimitivePtr mesh( const std::string &text ) const;
94-
/// Returns a group representing the specified string,
95-
/// using the current curve tolerance and kerning.
96-
GroupPtr meshGroup( const std::string &text ) const;
9793
/// Returns the necessary appropriate offset between the
9894
/// origins of the first and second characters, taking
9995
/// into account the current kerning.

src/IECoreScene/Font.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
#include "IECoreScene/Font.h"
3636

37-
#include "IECoreScene/Group.h"
38-
#include "IECoreScene/MatrixTransform.h"
3937
#include "IECoreScene/MeshAlgo.h"
4038
#include "IECoreScene/MeshPrimitive.h"
4139
#include "IECoreScene/TransformOp.h"
@@ -397,44 +395,6 @@ class Font::Implementation : public IECore::RefCounted
397395
return MeshAlgo::merge( meshes );
398396
}
399397

400-
GroupPtr meshGroup( const std::string &text ) const
401-
{
402-
GroupPtr result = new Group;
403-
404-
if( !text.size() )
405-
{
406-
return result;
407-
}
408-
409-
V3f translate( 0.0f );
410-
for( unsigned i=0; i<text.size(); i++ )
411-
{
412-
if( text[i] == '\n' )
413-
{
414-
translate.x = 0;
415-
translate.y -= bound().size().y * m_lineSpacing;
416-
continue;
417-
}
418-
419-
const Mesh *character = cachedMesh( text[i] );
420-
if( character->primitive->variableSize( PrimitiveVariable::Uniform ) )
421-
{
422-
GroupPtr g = new Group;
423-
g->addChild( character->primitive->copy() );
424-
g->setTransform( new MatrixTransform( M44f().setTranslation( translate ) ) );
425-
result->addChild( g );
426-
}
427-
428-
if( i<text.size()-1 )
429-
{
430-
const V2f a = advance( text[i], text[i+1] );
431-
translate += V3f( a.x, a.y, 0 );
432-
}
433-
}
434-
435-
return result;
436-
}
437-
438398
Imath::V2f advance( char first, char second ) const
439399
{
440400
V2f a = cachedMesh( first )->advance;
@@ -642,11 +602,6 @@ MeshPrimitivePtr Font::mesh( const std::string &text ) const
642602
return m_implementation->mesh( text );
643603
}
644604

645-
GroupPtr Font::meshGroup( const std::string &text ) const
646-
{
647-
return m_implementation->meshGroup( text );
648-
}
649-
650605
Imath::V2f Font::advance( char first, char second ) const
651606
{
652607
return m_implementation->advance( first, second );

src/IECoreScene/bindings/FontBinding.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "FontBinding.h"
4040

4141
#include "IECoreScene/Font.h"
42-
#include "IECoreScene/Group.h"
4342
#include "IECoreScene/MeshPrimitive.h"
4443

4544
#include "IECorePython/RunTimeTypedBinding.h"
@@ -89,7 +88,6 @@ void bindFont()
8988
.def( "getLineSpacing", &Font::getLineSpacing )
9089
.def( "mesh", &mesh1 )
9190
.def( "mesh", &mesh2 )
92-
.def( "meshGroup", &Font::meshGroup )
9391
.def( "advance", &Font::advance )
9492
.def( "bound", (Imath::Box2f (Font::*)( )const)&Font::bound )
9593
.def( "bound", (Imath::Box2f (Font::*)( char )const)&Font::bound )

test/IECoreScene/FontTest.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,9 @@ def testConstructors( self ) :
5050
def test( self ) :
5151

5252
f = IECoreScene.Font( os.path.join( "test", "IECore", "data", "fonts", "Vera.ttf" ) )
53-
54-
g = f.meshGroup( "hello world" )
5553
m = f.mesh( "hello world" )
56-
57-
self.assertTrue( g.isInstanceOf( IECoreScene.Group.staticTypeId() ) )
5854
self.assertTrue( m.isInstanceOf( IECoreScene.MeshPrimitive.staticTypeId() ) )
5955

60-
v = 0
61-
for c in g.children() :
62-
63-
self.assertTrue( c.isInstanceOf( IECoreScene.Group.staticTypeId() ) )
64-
self.assertEqual( len( c.children() ), 1 )
65-
self.assertTrue( c.children()[0].isInstanceOf( IECoreScene.MeshPrimitive.staticTypeId() ) )
66-
self.assertEqual( c.children()[0]["P"].data.getInterpretation(), IECore.GeometricData.Interpretation.Point )
67-
68-
v += c.children()[0]["P"].data.size()
69-
70-
self.assertEqual( v, m["P"].data.size() )
71-
7256
def testCharBound( self ) :
7357

7458
f = IECoreScene.Font( os.path.join( "test", "IECore", "data", "fonts", "Vera.ttf" ) )

0 commit comments

Comments
 (0)