Use emoji in fonts in Processing

Hello @Noodlybanan

I am using Windows 10 and Processing 4.3.

Update to my previous topic:

// Display unicode emojis
// glv
// 2024-01-13
// v1.0.0

//Reference:
// https://stackoverflow.com/questions/5585919/creating-unicode-character-from-its-number

PFont myFont;
import java.lang.Character.*;

int fontStart;

void setup() 
  {
  size(1100, 900);
  background(244);

  // Uncomment the following two lines to see the available fonts 
  //String[] fontList = PFont.list();
  //printArray(fontList);
 
  myFont = createFont("Segoe UI Emoji", 36);
  textFont(myFont);
  textAlign(CENTER, BOTTOM);
  fill(0);
  fontStart = 0x1F300;
  println(hex(fontStart));
  }
   
void draw()
  {
  background(244); 
  
  if (frameCount%60 == 0)
    {
    fontStart += 200;
    if (fontStart>0x1FA95) fontStart = 0x1F300;
    println(hex(fontStart));
    }

  for(int i=0; i<200; i++)
    {
    int cp = fontStart+i;  
      
    // Works:  
    //char [] uc = Character.toChars(cp);
    //String s = new String (uc);
    
    // Works:
    //String s = new String(Character.toChars(cp)); // Above in one line
      
    // Works:
    String s = Character.toString(cp);
    
    text(s, i%20*50+70, (i/20)*80+100);  // display grid
    }
  }

Output:

References:

:)

1 Like