Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GafferImage::Text : Fixed vertical alignment issue #2291

Merged
merged 1 commit into from Oct 25, 2017

Conversation

danieldresser-ie
Copy link
Contributor

A possible solution to the issue we were discussing is just to fix this bug.

pen.y was being updated before checking whether this would put pen.y out of bounds. Checking before moving pen.y gets rid of the weird offset.

@johnhaddon
Copy link
Member

This causes another problem where the text now extends above the top of the text area. See example below :

import Gaffer
import GafferImage
import IECore

Gaffer.Metadata.registerNodeValue( parent, "serialiser:milestoneVersion", 0, persistent=False )
Gaffer.Metadata.registerNodeValue( parent, "serialiser:majorVersion", 41, persistent=False )
Gaffer.Metadata.registerNodeValue( parent, "serialiser:minorVersion", 0, persistent=False )
Gaffer.Metadata.registerNodeValue( parent, "serialiser:patchVersion", 0, persistent=False )

__children = {}

__children["Text"] = GafferImage.Text( "Text" )
parent.addChild( __children["Text"] )
__children["Text"]["text"].setValue( 'A\nB\nC\nD\nE\nF\nG\nH' )
__children["Text"]["area"].setValue( IECore.Box2i( IECore.V2i( 0, 0 ), IECore.V2i( 1920, 100 ) ) )
__children["Text"]["area"]["min"]["x"].setValue( 0 )
__children["Text"]["area"]["min"]["y"].setValue( 0 )
__children["Text"]["area"]["max"]["x"].setValue( 1920 )
__children["Text"]["area"]["max"]["y"].setValue( 100 )
__children["Text"]["verticalAlignment"].setValue( 0 )
__children["Text"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = IECore.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Text"]["__uiPosition"].setValue( IECore.V2f( -15.5, 2.5999999 ) )
__children["Text"]["out"].setInput( __children["Text"]["__merge"]["out"] )


del __children

@danieldresser-ie
Copy link
Contributor Author

Ah, good catch. How does this change look to you now?

@johnhaddon johnhaddon merged commit 82fc61f into GafferHQ:master Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants