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

unclear error with possibly non BMP character #1629

Closed
BMaxV opened this issue Mar 12, 2024 · 3 comments
Closed

unclear error with possibly non BMP character #1629

BMaxV opened this issue Mar 12, 2024 · 3 comments
Labels
Milestone

Comments

@BMaxV
Copy link
Contributor

BMaxV commented Mar 12, 2024

Description

cuneiform, e.g. π’€™ is cool and I would like to use it in panda. Unfortunately, something with the font loading or rendering or something else goes wrong, so that even a font that should support it, doesn't display the symbol correctly.

So the code below should display "hello [2x strange box for missing character] world" instead of "hello π’€™ world"

Needs a font to display the symbol, to be loaded, I used this one:
https://fonts.google.com/noto/specimen/Noto+Sans+Cuneiform

Steps to Reproduce

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)
		
		font=self.b.loader.loadFont('NotoSansCuneiform-Regular.ttf')
		font.setPixelsPerUnit(150)
		
		tl.setFont(font)
		font = tl.getFont()
		font.clear()
		
		tl.set_text("hello π’€™ there ")
				
		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()

Environment

  • Operating system: Windows 10
  • System architecture: 64
  • Panda3D version: 1.10.13
  • Installation method: sdk
  • Python version (if using Python): 3.8.2
  • Compiler (if using C++):
@rdb
Copy link
Member

rdb commented Mar 27, 2024

This renders fine for me on macOS:
image
Going to assume this is a Windows-specific bug

@rdb rdb added this to the 1.10.15 milestone Mar 27, 2024
@rdb rdb added the windows label Mar 27, 2024
@BMaxV
Copy link
Contributor Author

BMaxV commented Apr 1, 2024

I can confirm this works out of the box with linux as well. Didn't even need to install the font.

@rdb
Copy link
Member

rdb commented Apr 8, 2024

Surrogate pairs weren't handled on platforms with UTF-16 in wchar_t, that is to say, Windows.

Try this build: http://buildbot.panda3d.org/downloads/5da013e2e9a991c993532cc6886c53e4c38bccc0/

@rdb rdb closed this as completed in 5da013e May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants