How to change the size of Georgian language text

I want to change the size of Georgian-language text that I have input from a .txt file in the data folder (.txt file encoded in UTF-8). I can display the Georgian script (this is Georgian language script, not the Georgia text font) in my Processing window. But when I change its size with textSize(), the program displays a series of boxes, one for each letter, but no actual text. This also happens if I input the text directly into the text() line command. It also happens if I specify a font (and size) with PFont. Any ideas? Here’s the code—any help appreciated.

String[] s = loadStrings("Georgian_01.txt");
size(500, 300);

//textSize(100);
textAlign(CENTER);
fill(0);
text(s[0], width/2, height/2);
1 Like

try switching the font to something that supports unicode like calibri

void setup(){
  size(1000,570,P2D);
  String st = "წამებაჲ წმიდისა შუშანიკისი დედოფლისაჲabc";
  fill(0);
  textFont(createFont("Calibri",48));
  text(st,300,300);
}

4 Likes

Brilliant!! Works perfectly. Thanks so much!

1 Like

OK—question #2: Now I can change the size of the font, but for the purposes of my program, I’d like to be able to randomize it. If I insert this,

textSize(random(10, 48));

the result reverts to the little boxes instead of letters. It does randomize the size of the boxes. Also, if I randomize the size in createFont, it does the same thing. I could work around this, but I’d rather not. Ideas appreciated!

There is also a menu entry to make fonts

Menu tools I think. Maybe you can make a better font here prior to using it

OR there are only certain text sizes supported by the font. Use a for loop to find out

3 Likes

Many thanks! Excellent idea about the for loop. I tried it, and it seems that textSize is interfering in some way. So here’s the for loop. Where textSize is 0 (so the command doesn’t do anything), you get actual text. Otherwise just boxes, even at the created size of 80.

String[] s = loadStrings("Georgian_01.txt");
size(1400, 1000);
textFont(createFont("Calibri", 80));
textAlign(CENTER);
fill(0);  

for (int i = 0; i<81; i++) {
  textSize(i);
  fill(255, 0, 0);
  text(i, width/8, 100+i*10);    // NUMBER OF EACH LOOP
  fill(0);
  text(s[0], width/2, 100+i*10);  // OUTPUT OF TEXT
}  

Here’s the result:


However, if you create the font every time through the loop, then you get actual text every time.


String[] s = loadStrings("Georgian_01.txt");
size(1400, 1000);
textAlign(CENTER);
fill(0);  

for (int i = 1; i<81; i++) {
  textSize(i);
  fill(255, 0, 0);
  textFont(createFont("Calibri", i));
  text(i, width/8, 100+i*10);    // NUMBER OF EACH LOOP
  fill(0);
  text(s[0], width/2, 100+i*10);  // OUTPUT OF TEXT
}  

2 Likes

Looks like a bug to me…

I mean…what?!

Why doesn’t textSize work??

I think with Arial font etc. it works - did you try?

So it might be a flaw in this specific font.

Do you have another font for your language or can retrieve it from the internet?

Did you try to male the font using
menu tools | make font?

When you use the font you made there it’s maybe working?

1 Like

you never give the file you have testing with?
so we can use only like

but that works here ( win 10 / english / processing 3.5.3 )

so your file and your system setup might also influence your result?

2 Likes

OK, tried Arial. Same result (little boxes instead of characters) if I create the font dynamically, using this:

textFont(createFont("Arial", 40));

If I use the font selection tool and put ArialMT-80 in my data folder, then I use this code:

PFont f;
f = loadFont("ArialMT-80.vlw");
textFont(f, 80);

Then when I run the program, I get no text at all (see below) and the editor window says, “No glyph found for the [strange symbol here] (\u10D8) character.” The number in parentheses varies. So, creating the font dynamically at least gives me little boxes.

I am jealous! I run the exact same code as you have (see below), using a string instead of reading from a file, and get boxes in place of the Georgian text, except in the 0 loop. Roman alphabet characters are OK.

//String[] s = loadStrings("Georgian_01.txt");
String s = "გამარჯობა მსოფლიოabc";
size(1400, 1000);
textFont(createFont("Calibri", 40));
textAlign(CENTER);
fill(0);  

for (int i = 0; i<81; i+=5) {
  textSize(i);
  fill(255, 0, 0);
  text(i, width/8, 100+i*10);    // NUMBER OF EACH LOOP
  fill(0);
  text(s, width/2, 100+i*10);  // OUTPUT OF TEXT
}  
save("Georgian_testfile_03readtext.png");

I’m using a new-ish MacBook running OS10.14.5 and processing 3.5.3. Maybe the Mac is the problem…

1 Like

one more test:
same code on RPI

Raspbian GNU/Linux 10
DEBIAN buster
Linux version 4.19.66-v7+
Raspberry Pi 3 Model B Plus Rev 1.3

note: win 10 and Raspbian, both are english systems and i get the [X] in the code editor, but it works in the canvas???

Hello @steele ,

Your text:


I had to find a font (Monospaced and some others worked) that displayed “your text” in my IDE:


I scrolled through fonts with “Create Font” and found a font that displayed “your text”:


This did not work:

textFont(createFont(“Calibri”, 48));



Using a “NonExistentFont” worked and it displayed this message:

“NonExistentFont” is not available, so another font will be used. Use PFont.list() to show available fonts.


Which font was used? :slight_smile:


I tried a font that displayed “your text” in “Create Font” and was also in the PFont.list().



Processing 3.5.3
W10 Pro 1809

:slight_smile:

3 Likes

Hi glv—Thanks. The last 2 posts are making me think I should switch to a Windows machine. (I’m running Processing 3.5.3 on a MacBook.) I tried your solution, but when I get to the “Sample Text” window, it’s different from yours. It will let me type into it from the keyboard, but–unbelievably–there’s no way to paste. The Edit function disappears from the IDE function bar when you open Create Font. I can’t type in the Georgian text, so I’m stuck. Ugh.

Hi kll—Thanks. But now I’m envious of the Raspberry Pi. :grin: With that and a Windows machine, maybe I could make this work.