Skip to content
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

Texts are slightly cut on the right on native platforms (NME) #395

Open
clemos opened this issue Jan 17, 2014 · 6 comments
Open

Texts are slightly cut on the right on native platforms (NME) #395

clemos opened this issue Jan 17, 2014 · 6 comments

Comments

@clemos
Copy link
Contributor

clemos commented Jan 17, 2014

I don't really know where to start investigating.
It seems on NME, the dimensions of the texts are not correctly measured, and thus the draw surface is slightly too small.

@yanhick
Copy link
Member

yanhick commented Jan 17, 2014

Rendering and measuring of the text for flash and NME is done here :
https://github.com/silexlabs/Cocktail/blob/master/cocktail/port/platform/flash_player/NativeText.hx

The "getBimap" method draws a native flash/NME TextField onto a flash/NME BitmapData, which is then used to draw text during the document's rendering.

In this same class, you can see "get_width" return the width of the native flash/NME TextField, which seems to be too small for NME, explaining the crop.

I'd suggest measuring "textWidth" for the same word in flash and NME and see if it's different.
If it is, then NME measure is wrong, or at least not consistent with the flash player.
You can either hack something in this class or (better), fix in NME.

I'll also look in 'getBitmap" at the part offsetting flash player "gutter" for the text field (see line 83). Maybe it shouldn't be applied for NME.

@yanhick
Copy link
Member

yanhick commented Jan 17, 2014

There is another class dealing with font measurement but it takes care of vertical measurement and is unlikely to be responsible for your bug :
https://github.com/silexlabs/Cocktail/blob/master/cocktail/port/platform/flash_player/FontBuilder.hx

@clemos
Copy link
Contributor Author

clemos commented Jan 17, 2014

I've tried to change some values here and there, but the crop is still here.
I suspect bitmap.draw() is responsible for the crop...

@yanhick
Copy link
Member

yanhick commented Jan 17, 2014

Ok, I assume you tried to augment the witdth of the BitmapData,
if that's the case, I'm afraid it will need to be fixed in NME.

Maybe its the styling of the text, is it in italic or something like this ?

@clemos
Copy link
Contributor Author

clemos commented Jan 17, 2014

Yes, I've tried to change width, offset (_matrix), etc but it's still cropped.
The text is bold.

@yanhick
Copy link
Member

yanhick commented Jan 17, 2014

Do you have the same bug when the text is regular (not bold) ?

2014/1/17 Clément Charmet [email protected]

Yes, I've tried to change width, offset (_matrix), etc but it's still
cropped.
The text is bold.


Reply to this email directly or view it on GitHubhttps://github.com//issues/395#issuecomment-32614834
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants