Editor not handling non-standard glyphs, even when the font should be able to #3836

Closed
JobLeonard opened this Issue Sep 20, 2015 · 8 comments

Comments

Projects
None yet
2 participants
@JobLeonard

I was thinking of making a basic ASCII-graphics drawing program using (most of) the character set from code page 437, so I copy/pasted the following string into the processing sketch, to be manipulated by the code:

"�☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~�ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\n"

image

image

With the default font, most of the characters come out as empty "glyph-not-found" boxes. They still display correctly when running the sketch, or printing to the console, and when copied/pasted into other editors I get the original glyphs, not empty boxes. When changing fonts in the editor settings, some fonts do work correctly, further suggesting this is a missing-glyph issue on the font side, and not really Processing's "fault."

But here's the the weird thing: many fonts that I can choose from and have this issue, don't have this issue when used in other editors. For example, Ubuntu Mono, and the default Source Code Pro font handle these glyphs just fine in every other context. Eh?

Anyway, I'll just set the font to one that displays them correctly for now (DejaVu Sans works fine), and I can completely understand that this such a niche use-case that fixing it isn't high priority. But it's still kinda strange.

@JobLeonard JobLeonard changed the title from Editor not handling unusual glyphs, even when the font should be able to to Editor not handling non-standard glyphs, even when the font should be able to Sep 20, 2015

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 20, 2015

Member

I suspect a Window Manager problem, though the JAVA_TOOL_OPTIONS and a reference to /usr/share in your console looks suspiciously like you're using OpenJDK...

Member

benfry commented Sep 20, 2015

I suspect a Window Manager problem, though the JAVA_TOOL_OPTIONS and a reference to /usr/share in your console looks suspiciously like you're using OpenJDK...

@benfry benfry added the linux label Sep 20, 2015

@JobLeonard

This comment has been minimized.

Show comment
Hide comment
@JobLeonard

JobLeonard Sep 20, 2015

Oh right, I'm on Ubuntu, obviously. I should have mentioned that, sorry.

I should be using the Oracle JVM. At least, when I run update-java-alternatives -l it prints java-8-oracle 8 /usr/lib/jvm/java-8-oracle

Oh right, I'm on Ubuntu, obviously. I should have mentioned that, sorry.

I should be using the Oracle JVM. At least, when I run update-java-alternatives -l it prints java-8-oracle 8 /usr/lib/jvm/java-8-oracle

@JobLeonard

This comment has been minimized.

Show comment
Hide comment
@JobLeonard

JobLeonard Sep 20, 2015

Trying to narrow down possible causes, I tried using createFont with one of the fonts that doesn't work in the editor. I get empty boxes in the sketch as well:

image

But when I wanted to use the CreateFont tool to pre-generate the font, to check if that produces the same results, I noticed the font had a different name:

image

So I tried changing the name in the createFont function to reflect that, and it "solved" the issue:

image

... except that I can't select "Source Code Pro Regular" in the drop down menu:

image

I tried manually overriding the settings in preferences.txt, but neither editor.font.family=SourceCodePro-Regular nor editor.font.family=Source Code Pro Regular worked - it resulted in loading the fallback Monospaced option.

Maybe that's indicative of what might cause the problem?

(I also double checked other programs: the fonts work fine when used in a terminal emulator, LibreOffice Writer and Sublime 3)

Trying to narrow down possible causes, I tried using createFont with one of the fonts that doesn't work in the editor. I get empty boxes in the sketch as well:

image

But when I wanted to use the CreateFont tool to pre-generate the font, to check if that produces the same results, I noticed the font had a different name:

image

So I tried changing the name in the createFont function to reflect that, and it "solved" the issue:

image

... except that I can't select "Source Code Pro Regular" in the drop down menu:

image

I tried manually overriding the settings in preferences.txt, but neither editor.font.family=SourceCodePro-Regular nor editor.font.family=Source Code Pro Regular worked - it resulted in loading the fallback Monospaced option.

Maybe that's indicative of what might cause the problem?

(I also double checked other programs: the fonts work fine when used in a terminal emulator, LibreOffice Writer and Sublime 3)

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 20, 2015

Member

Yes, this is very helpful... So at the moment it looks like you have Source Code Pro installed on your machine and either that version, or the version that ships with Processing, is inferior. Can you try removing the version installed on your system (you'll probably need to log out and back in again for it to take) and see what happens?

Member

benfry commented Sep 20, 2015

Yes, this is very helpful... So at the moment it looks like you have Source Code Pro installed on your machine and either that version, or the version that ships with Processing, is inferior. Can you try removing the version installed on your system (you'll probably need to log out and back in again for it to take) and see what happens?

@JobLeonard

This comment has been minimized.

Show comment
Hide comment
@JobLeonard

JobLeonard Sep 20, 2015

Uninstalling the font doesn't change any behaviour inside Processing: the above example works out the exact same way, and he font creation tool still has Source Code Pro available to it, even though the font is no longer available to any other text editor.

Uninstalling the font doesn't change any behaviour inside Processing: the above example works out the exact same way, and he font creation tool still has Source Code Pro available to it, even though the font is no longer available to any other text editor.

@JobLeonard

This comment has been minimized.

Show comment
Hide comment
@JobLeonard

JobLeonard Sep 20, 2015

Another attempt at useful feedback:

image

Re-installing the fonts fixed the issue, provided I chose any variant of Source Code Pro (Light, Medium, Semi-Bold, etc) except the default Source Code Pro option. Note how the console also changes fonts, and how they are now all monospaced except for �. It should be noted that my installed versions of Source Code Pro were from 2014, and that there's been a recent update in July.

As you can see, manually copying the latest version of the font to the data folder and loading that also gave good in-sketch results except for � again, so that glyph is apparently not supported by the font at the moment (for my particular use-case, it was a stand-in for the not-a-character-code of code page 437 anyway, so I'll just replace it with □).

Another attempt at useful feedback:

image

Re-installing the fonts fixed the issue, provided I chose any variant of Source Code Pro (Light, Medium, Semi-Bold, etc) except the default Source Code Pro option. Note how the console also changes fonts, and how they are now all monospaced except for �. It should be noted that my installed versions of Source Code Pro were from 2014, and that there's been a recent update in July.

As you can see, manually copying the latest version of the font to the data folder and loading that also gave good in-sketch results except for � again, so that glyph is apparently not supported by the font at the moment (for my particular use-case, it was a stand-in for the not-a-character-code of code page 437 anyway, so I'll just replace it with □).

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 20, 2015

Member

Great, thanks for the extra details.

Member

benfry commented Sep 20, 2015

Great, thanks for the extra details.

@JobLeonard

This comment has been minimized.

Show comment
Hide comment
@JobLeonard

JobLeonard Sep 20, 2015

No prob. Let me know if there's anything else you'd like me to try.

No prob. Let me know if there's anything else you'd like me to try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment