New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling textSize() breaks katakana rendering #4956

Open
KevinWorkman opened this Issue Mar 12, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@KevinWorkman

KevinWorkman commented Mar 12, 2017

From this Stack Overflow question, here's an example sketch that shows the problem:

background(0);
char c = (char)(0x30A0 + random(96));
text(c, 20, 20);
textSize(12);
text(c, 50, 50);

bad katakana rendering

The first call to text() works as expected and draws a katakana character. But the second call draws the white square that usually means the font doesn't support the character. But that doesn't make sense, since the first call draws the character just fine.

It doesn't seem to matter what value is passed into the textSize() function. Even passing the default value of 12 seems to break. If the textSize() call is removed, the program works as expected and draws the character twice.

@rijuldhir

This comment has been minimized.

Show comment
Hide comment
@rijuldhir

rijuldhir Mar 12, 2017

If nobody is already on it. I would like to work on this

rijuldhir commented Mar 12, 2017

If nobody is already on it. I would like to work on this

benfry added a commit that referenced this issue Mar 12, 2017

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Mar 12, 2017

Member

Interesting… So for @rijuldhir or anyone else looking into it, there are likely two things going on here (This is all inside handleTextSize() in PGraphicsJava2D)

  1. The internal deriveFont() call seems to be not including that part of the character set properly. Might just need to include additional attributes/properties or something on those lines.
  2. We shouldn't be calling deriveFont() again on a font that's already the same size.

I've just fixed the second item, but it's not clear why deriveFont() is killing off those characters. Though it may be that deriving the font causes it to go from the "logical" SansSerif font that Java uses, to a "physical" font that's a specific sans serif face, and doesn't include the necessary code points. More about fonts here.

Member

benfry commented Mar 12, 2017

Interesting… So for @rijuldhir or anyone else looking into it, there are likely two things going on here (This is all inside handleTextSize() in PGraphicsJava2D)

  1. The internal deriveFont() call seems to be not including that part of the character set properly. Might just need to include additional attributes/properties or something on those lines.
  2. We shouldn't be calling deriveFont() again on a font that's already the same size.

I've just fixed the second item, but it's not clear why deriveFont() is killing off those characters. Though it may be that deriving the font causes it to go from the "logical" SansSerif font that Java uses, to a "physical" font that's a specific sans serif face, and doesn't include the necessary code points. More about fonts here.

@rijuldhir

This comment has been minimized.

Show comment
Hide comment
@rijuldhir

rijuldhir Mar 13, 2017

@benfry I new to open source can you explain me a bit. What i need to do to solve this?

rijuldhir commented Mar 13, 2017

@benfry I new to open source can you explain me a bit. What i need to do to solve this?

@KevinWorkman

This comment has been minimized.

Show comment
Hide comment
@KevinWorkman

KevinWorkman Mar 13, 2017

@rijuldhir If you have no idea where to start, maybe it's best to let somebody more experienced handle it?

But Ben already outlined what you would look into. I'd start by trying to confirm whether his suspicions are true. Can you trace through the code to see if we're not including part of the character set? Can you find exactly where that happens?

KevinWorkman commented Mar 13, 2017

@rijuldhir If you have no idea where to start, maybe it's best to let somebody more experienced handle it?

But Ben already outlined what you would look into. I'd start by trying to confirm whether his suspicions are true. Can you trace through the code to see if we're not including part of the character set? Can you find exactly where that happens?

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