• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

rectangles instead of characters in jtextarea

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I have a simple panel with text area (actually - licence agreement).
All text is English
But on shine (Redhat 7) instead of text rectangles are displayed.
I do not see any difference at this machine from point of view of localesm or installed fonts or environment.
What can be areason for such behaviour?
 
Marshal
Posts: 64638
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Where are you reading the text from? Is it a text file? How are you reading it? What is the file's encoding? We need lots more details before we can help, please.
Are you still using RedHat 7? Isn't that severely out of date?
 
Bartender
Posts: 20833
125
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Are you still using RedHat 7? Isn't that severely out of date?



No, RHEL 7 is the current production release. RHEL 8 just came into Beta within about the last month.

Rectangles in a GUI display are an indication that the font being used to display the text data does not have graphics (glyphs) defined for those characters. The most common cause of this is that the wrong code page being used by the displaying program.

Unfortunarely, one scrollable textarea looks pretty much like another, so we can't tell what app is giving you trouble.
 
Moshe Zuisman
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch

Where are you reading the text from? Is it a text file? How are you reading it? What is the file's encoding? We need lots more details before we can help, please.
Are you still using RedHat 7? Isn't that severely out of date?



Hi. Source is txt file in ANSI encoding.Pure English text.
It happens at our installation program - written on Java (8) with GUI on swing (actually we use improved version of IzPack installer).
It happen on one of our customers site.
sincerely - I can not find any difference in environment, installed locales ore something else between their machine and our RH7 machines at which it works with no problem...
 
Tim Holloway
Bartender
Posts: 20833
125
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, this is a Swing app. A very good possibility is that the app is requesting a font that is not installed on the client's system. The actual mechanism for obtaining a font to render in Java/Linux is by building a font definition that outlines the properties of the desired font, including name, point size, style, and so forth. The font manager will then rummage through the set of installed fonts to find what it considers the best match. For example, an app that asks for Microsoft Arial font on a Linux system might actually end up using the Linux FreeSans font, since it's a sans-serif font that resembles Arial. A different machine might actually have a downloaded set of the Microsoft FreeType fonts, which includes the Arial and Times New Roman fonts. Linux can handle FreeType.

So apparently the best match for the font on this particular machine wasn't a very good match.
 
Campbell Ritchie
Marshal
Posts: 64638
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:. . . RHEL 7 is the current production release. . . .

RHEL, is it? Aaaaaaaaaaaaaaaaaaaaaaa! And I thought that meant ordinary red hat, which has been superseded by Fedora.
What's ANSI encoding? From this SO post, it would appear to be Windows‑1252. I am surprised that you are getting everything appearing as a square; most fonts should be able to display such text. I still think we need more information, please. As you know, Java® Strings use UTF‑16. That changed slightly with Java11, but I think they still behave as if they used UTF‑16.
 
Moshe Zuisman
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

Tim Holloway wrote:. . . RHEL 7 is the current production release. . . .

RHEL, is it? Aaaaaaaaaaaaaaaaaaaaaaa! And I thought that meant ordinary red hat, which has been superseded by Fedora.
What's ANSI encoding? From this SO post, it would appear to be Windows‑1252. I am surprised that you are getting everything appearing as a square; most fonts should be able to display such text. I still think we need more information, please. As you know, Java® Strings use UTF‑16. That changed slightly with Java11, but I think they still behave as if they used UTF‑16.


Yes - it is Windows‑1252.
Which more info could be helpfull?
Is there some way to trace - how font manager choose a font to display my frame?
 
Campbell Ritchie
Marshal
Posts: 64638
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set a font for any text on Swing.
 
Tim Holloway
Bartender
Posts: 20833
125
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

Tim Holloway wrote:. . . RHEL 7 is the current production release. . . .

RHEL, is it? Aaaaaaaaaaaaaaaaaaaaaaa! And I thought that meant ordinary red hat, which has been superseded by Fedora.
What's ANSI encoding? From this SO post, it would appear to be Windows‑1252. I am surprised that you are getting everything appearing as a square; most fonts should be able to display such text. I still think we need more information, please. As you know, Java® Strings use UTF‑16. That changed slightly with Java11, but I think they still behave as if they used UTF‑16.



The Great Schism happened over a decade ago. The last "pure" Red Hat Linux release was Red Hat 7. I still have the discs. Up to that point, you could buy Red Hat for under $100 at your friendly neighborhood computer store. After that, they switched to Red Hat Enterprise Linux (RHEL), and reset the release numbers (which admittedly got confusing). RHEL ran about $450 per-machine license. Fedora spun off, and became the hobby/test version of the Red Hat world, although I'm not sure if the Fedora Foundation is actually owned by Red Hat. Also spun off at that time were several free versions of RHEL, of which I think only CentOS remains. And CentOS was actually acquired by Red Hat Inc., about a year or so ago - but it's still free.

It's really quite incredible that Red Hat is one of the most profitable software companies around despite the fact that you can obtain most of their products (but not the support) for nothing. This breaks all the things that economic experts and ideologues "know" about how humans are supposed to respond to free stuff. Obviously that support is valued quite highly. And as a shareholder, I'm cackling all the way to the bank. I'm really going to hate it when IBM takes it over.



Back to our regularly-scheduled program:

I've seen this sort of weirdness before. Most common fonts have the basic ASCII character glyphs in them, but some of the symbolic fonts don't, and thus they display even plain English text as all boxes. Or, it's possible that the original text isn't actually ASCII and somehow the Arabic version of the content was presented using a font that doesn't have Arabic characters. Mis-matches between straight ASCII, UniCode and UTF-8 are more likely to display at least some readable text.

The only way to really know is to build a copy of the app that displays what font is being pulled in there and have them run that.
 
Campbell Ritchie
Marshal
Posts: 64638
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:. . . Red Hat is one of the most profitable software companies around despite the fact that you can obtain most of their products (but not the support) for nothing. . . .

Yes, it is all paid for by the support; I don't think I have paid a penny for Linux in the twelve years I have been using it.
 
Tim Holloway
Bartender
Posts: 20833
125
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I spent about $4.50 back around 1994 when I picked up a CD at a Ham Radio convention. Bought the "Dr. Linux" book, which had a Red Hat 2 disc in the back pocket. At the end I was paying $65 for RH6. RHEL was too expensive, though, so these days I run free distros. I don't need Enterprise support - I am Enterprise support.
 
Campbell Ritchie
Marshal
Posts: 64638
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have paid for books too.
 
Moshe Zuisman
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:
Back to our regularly-scheduled program:

I've seen this sort of weirdness before. Most common fonts have the basic ASCII character glyphs in them, but some of the symbolic fonts don't, and thus they display even plain English text as all boxes. Or, it's possible that the original text isn't actually ASCII and somehow the Arabic version of the content was presented using a font that doesn't have Arabic characters. Mis-matches between straight ASCII, UniCode and UTF-8 are more likely to display at least some readable text.

The only way to really know is to build a copy of the app that displays what font is being pulled in there and have them run that.


Ok. 10x. I will check if this file was not somehow corrupted when they copied install kit to their site. I will also try to prepare for them test binary that will query and print which font was finally used by panel.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!