gavioto / playn

Automatically exported from code.google.com/p/playn
0 stars 0 forks source link

TextLayout returns wrong width in html #182

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use different TTF
2. Create Font with it
3. Create TextLayout and request width

What is the expected output? What do you see instead?
Expected: Actual width of the layouted text when using different TTF. Seen: In 
HTML you always see same width. It doesn't react on differed TTF used.

What version of the product are you using? On what operating system?
1.3.1 Windows 7 Chrome

Please provide any additional information below.
Attached image shows the differences between java and html. The black squares 
are at the width, the textlayout returns. The last row uses the default font.

The last row in the html collumn is created with fontName "", don't know if it 
should do that. It also doesn't react to size changes like seen by "New Game"

Original issue reported on code.google.com by hadessky...@gmail.com on 20 Jun 2012 at 11:46

Attachments:

GoogleCodeExporter commented 9 years ago
Have you tried to run the showcase sample? That uses TextLayout with custom 
fonts and it seems to work. Without seeing your code, I can't see where the 
problem is, but I don't think the issue is in PlayN.

Original comment by m...@samskivert.com on 20 Jun 2012 at 3:23

GoogleCodeExporter commented 9 years ago
Actually, there is one issue that I've seen with custom fonts on the HTML 
backend. For some reason, the first time you try to use them they don't work, 
but then they work again the second time. For example, if you run the showcase 
sample and go to the text demo page, the custom font won't appear. But if you 
go back to the main menu (press escape) then go back to the text demo, then the 
custom font appears. So maybe that's causing your problem?

I don't know what causes that issue, so if you want to investigate it, feel 
free.

Original comment by m...@samskivert.com on 20 Jun 2012 at 3:25

GoogleCodeExporter commented 9 years ago
Thx for the answer!
There is an odd behavior I observed, when first creating the TextLayout in the 
showcase. When first entered and the text is not showing, the width for the 
very first line, with font Museo-300, is 93, when reentered it is 99. 
My program is updating the layout on every update cycle. On the first cycles 
the width is smaller and then it jumps to the right width. The display of the 
text is fine from the start.
Sadly that’s all I've got.

Original comment by hadessky...@gmail.com on 21 Jun 2012 at 4:19