# Workaround for Unicode Characters from JAVA2D to P2D

**URL:** https://discourse.processing.org/t/workaround-for-unicode-characters-from-java2d-to-p2d/47412
**Category:** Processing
**Created:** [October 21, 2025, 3:36pm UTC](https://discourse.processing.org/t/workaround-for-unicode-characters-from-java2d-to-p2d/47412 "2025-10-21T15:36:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [October 21, 2025, 3:36pm UTC](https://discourse.processing.org/t/workaround-for-unicode-characters-from-java2d-to-p2d/47412/1 "2025-10-21T15:36:21Z")

</div>

Hello folks!

When Windows 10 display scaling is set to 125%, the sketch window rendered with JAVA2D is scaled up, making it appear **larger and pixelated**.  
In contrast, the P2D renderer does not scale the window but may have limited Unicode character support.

JAVA2D renderer (default):  
Scales up 125% on my system and has a **larger and pixelated** output. ☹  
Displays ALL Unicode characters in example.

P2D renderer:  
Does NOT scale up on my system. 🙂  
Does NOT display all Unicode characters in example.

I do not want my JAVA2D sketch windows scaled up 125% and use P2D most of the time.  
_Still looking for a solution for this behaviour._

The solution for generating some Unicode fonts (which require JAVA2D) was to generate the text in a JAVA2D PGraphic and overlay the transparent image on the P2D sketch window.

Code:

```processing
// Display Unicode characters generated in a PGraphics
// Author: glv
// Date: 2025-10-21
// Version: 1.0.0

// JAVA2D renderer (default): 
// Scales up 125% on my system and has a blurry output
// Displays all Unicode characters in example

// P2D renderer: 
// Does NOT scale up on my system
// Does NOT displays all Unicode characters in example

// The solution was to generate the text in a JAVA2D PGraphics 
// and overlay the image on the P2D sketch window.
// :)

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 not valid UNICODE and was removed
  };

int i = 1;

PGraphics pg;

PImage img;

void setup()
  {
  //size(800, 400, JAVA2D); // Windows scales this by 125%
  size(800, 400, P2D); // Preferred

  String urlString = "http://learningprocessing.com/code/assets/sunflower.jpg";
  img = loadImage(urlString);

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

  // reset and rebuild string
  s = ""; // 0x5125A was removed
  for (int cp : symbols)
    {
    s += new String(Character.toChars(cp)) + " ";
    }
    
  pg = createGraphics(width, height/2, JAVA2D);

 // Orange background
 pg.beginDraw();
  //f = createFont(candidateFonts[i], 32);
  pg.textFont(f); // switch to the new font
  pg.clear(); // default is clear and transparent
  //pg.background(200, 128, 0);
  pg.fill(255);
  pg.text(candidateFonts[i], 50, pg.height/3);
  pg.text(s, 50, 2*pg.height/3);
 pg.endDraw();
  
  // Sunflower background
  image (img, 0, 0, width, height);
  
  // Unicode text with transparent bacgkround
  image(pg, 0, 0);
  
  fill(255);
  text(candidateFonts[i], 50, height/2 + height/6);
  text(s, 50, height/2 + 2*height/6);
  
  noLoop();
  }

void draw()
  {
  }

```

Output:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/8/6/8648927ff8c72f00e6826ad272fbae38e5ddd206.jpeg)

Top is the text from the JAVA2D PGraphic and all characters shown.  
Bottom is the text displayed in the P2D sketch and not all characters show.

`:)`
