jdf / Processing.py-Bugs

A home for all bugs and feature requests about Python Mode for the Processing Development Environment.
41 stars 8 forks source link

text("💙",x,y) displays the unicode value instead of actual emoji,but same works fine with p5.js mode #254

Closed nasirbashak closed 5 years ago

nasirbashak commented 5 years ago

I was able to display emoji with "text("💙",x,y)" in p5.js mode but same is not working with python mode

villares commented 5 years ago

Hi @nasirbashak !

Be sure to choose or load a font that has the Unicode emoji you want, and as Processing Python Mode is based on Python 2 (Jython) you'll have to indicate a Unicode string like this:

text(u"💙", 100, 100) # x, y = 100, 100 test

Or, at the start of your sketch, ask for "Unicode literals" as in Python 3:

from __future__ import unicode_literals

text("💙", 100, 100)  # x, y = 100, 100 test