Java Unicode Chars

Your sketch does not show all the characters:

This will show all the characters:

// Display Unicode characters
// Author: glv
// Date:   2025-10-21
// Version: 1.0.0

// References:
// https://discourse.processing.org/t/use-emoji-in-fonts-in-processing/43685/9
// https://discourse.processing.org/t/java-unicode-chars/34284/5

PFont f;
String s = "";

// List of candidate system fonts covering Unicode symbols
String[] candidateFonts = 
  {
  "SansSerif", //Default
  //"AppleColorEmoji",   // macOS, color emoji
  "Segoe UI Symbol",   // Windows
  "Segoe UI Emoji",    // Windows
  //"NotoColorEmoji",    // Linux / if installed
  //"Apple Symbols",     // macOS alternative
  //"DejaVu Sans",       // Linux alternative
  };

// Unicode Media control symbols from:
// https://discourse.processing.org/t/java-unicode-chars/34284/5
int[] symbols = 
  {
  // 11x 0x2300
  0x23F5, 0x23F8, 0x23EF, 0x23F4, 0x23F9,
  0x23EA, 0x23E9, 0x23EE, 0x23ED, 0x23FA,
  0x23CF,
  // 5x 0x1F000
  0x1F500, 0x1F501, 0x1F502, 0x1F503, 0x1F504,
  // 1x 0x2139
  0x2139
  //0x5125A is outside valid range for Unicode up to 0x10FFFF
  };

int i = 1;

void setup()
  {
  size(800, 200, JAVA2D); // Windows scales this by 125%
  //size(800, 200, P2D);  // Some characters missing!

  f = createFont(candidateFonts[i], 32);
  textFont(f);  // switch to the new font

  // reset and rebuild string
  s = ""; 
  for (int cp : symbols)
    {
    s += new String(Character.toChars(cp)) + " ";
    }
    
  fill(0);
  text(candidateFonts[i], 50, height/3);
  text(s, 50, 2*height/3);
 
  noLoop();
  }

void draw()
  {
  }

JAVA2D shows all characters. Output is larger and pixelated because of 125% Windows scaling:

P2D output does not show all characters and does not scale up 125%:

Note: You have to open images to see the original different sizes!

Reference:
Use emoji in fonts in Processing - #10 by glv

:)

1 Like