We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to execute a program where it shows japanese characters in output. However, when I am coding and copy paste the japanese text, it just shows BOXES. I enabled the complex text input in preferences too but it is not helping me either. Can someone please help me through?
CODE:-
PImage[] birds = new PImage[22];
PFont title;
void setup(){
size(720,540);
for (int i = 1; i < birds.length; i ++)
{
birds[i] = loadImage( i +".jpg");
}
frameRate(5);
title=loadFont("07LightNovelPOP-48.vlw");
}
void draw(){
int index=int(random(1,22));
image(birds[index],0,0);
textFont(title);
textAlign(CENTER, CENTER);
textSize(88);
text("何何何何何何何何", 320, 180);
}
ERROR:- No glyph found for the 何 (\u4F55) character
Answers
Did you use createFont and font
https://www.processing.org/reference/createFont_.html
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
https://forum.Processing.org/two/discussion/16894/send-japanese-characters-stored-into-a-string-to-a-byte-array-with-split
https://forum.Processing.org/two/discussion/10107/how-to-detect-no-glyph-char
@GoToLoop
Thanks a lot. I changed my code and it is properly formatted. However, I am still trying to comprehend the other two links you sent related to Japanese characters, it's littler hard to comprehend as I am totally new to programming. I am seeing it right now what it says. I hope i get it. Thanks again.
Hello @GoToLoop I tried to understand that code but it prints the japanese character in console itself. How do I show it sketch output?
Do we have to then create the font and text(char, float, float) to show it in output?
Sorry for poor english I hope I am clear.
https://www.Reddit.com/r/processing/comments/5f6d28/hello_again_i_am_trying_to_show_japanese_text_in/
That 1st example is for converting Java's UTF-16 String to UTF-8.
2nd link example shows that not every font is capable of displaying the full Unicode characters.
@Kaashdivitre -- re:
Look at these two reference pages -- the difference between writing text to the console with
println()
, and drawing it on the screen withtext()
: