MCPcopy Create free account
hub / github.com/ImageEngine/cortex / TextPrimitive

Method TextPrimitive

src/IECoreGL/TextPrimitive.cpp:56–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54IE_CORE_DEFINERUNTIMETYPED( TextPrimitive );
55
56TextPrimitive::TextPrimitive( const std::string &text, FontPtr font )
57 : m_font( font ), m_text( text )
58{
59 if( m_text.size() )
60 {
61 Box2f b;
62 V2f advanceSum( 0 );
63 for( unsigned i=0; i<m_text.size(); i++ )
64 {
65 Box2f characterB = m_font->coreFont()->bound( m_text[i] );
66 characterB.min += advanceSum;
67 characterB.max += advanceSum;
68 b.extendBy( characterB );
69 if( i<m_text.size() - 1 )
70 {
71 V2f a = m_font->coreFont()->advance( m_text[i], m_text[i+1] );
72 advanceSum += a;
73 }
74 }
75 m_bound.min = V3f( b.min.x, b.min.y, 0 );
76 m_bound.max = V3f( b.max.x, b.max.y, 0 );
77 }
78
79}
80
81TextPrimitive::~TextPrimitive()
82{

Callers

nothing calls this directly

Calls 4

coreFontMethod · 0.80
sizeMethod · 0.45
boundMethod · 0.45
advanceMethod · 0.45

Tested by

no test coverage detected