Skip to content

Font.setOutline does not work entirely correctly #1621

@BMaxV

Description

@BMaxV

Description

setOutline for text does not work correctly. We talked about it on discord, I'm just writing it down so we can get to it eventually.

Here is a snippet, you should be able to flip the colors with the commented code and "on my machine" it's either yellow with a black out line or black with a black outline.

rdb mentioned there being some conditions necessary, so it may just be a documentation issue, but I didn't find how to do this from the manual/api/code etc.

from direct.showbase import ShowBase
from panda3d.core import TextNode


class Wrapper:
	def __init__(self):
		
		self.b = ShowBase.ShowBase()
		tl = TextNode("name")
		position=(0,0,0)
		
		c1=(1,0.9,0.8,1)
		c2=(0,0,0,1)
		#c1=(1,0,0,1)
		#c2=(0,0,0,1)
		#c1,c2=c2,c1
		
		tl.clear()
		tl.setTextColor(*c1)
		font = tl.getFont()
		font.clear()
		font.setOutline(c2,0.5,0)
		
		tl.set_text("test 123")
		
		print(font.getOutlineColor())
		
		textNodePath = aspect2d.attachNewNode(tl)
		textNodePath.setScale(0.05)
		textNodePath.setPos(position)

def main():
	W = Wrapper()
	while True:
		W.b.taskMgr.step()

if __name__=="__main__":
	main()

Use Case

Use case is obvious. It's not urgent and black outlines work.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions