JDW Posted November 20, 2014 Share Posted November 20, 2014 Hello, Thanks to the amazing v2 of PixiJS, managing devicePixelRatio has become a lot easier. However I'm still not very sure of how everything works and I'm wondering how I should deal with my PIXI.Text ? If I have a DisplayObjectContainer, on a retina display (ratio = 2), can I draw a text, let's say 16px height, into a 8px "retina" height ?I know how to do it with PIXI.BitmapText, it's easy because I only have to load a _@2x BitmapFont and it works fine. But what about classic text ? Thanks a lot ! Regards,JDW. Quote Link to comment Share on other sites More sharing options...
JDW Posted November 24, 2014 Author Share Posted November 24, 2014 Can someone help me please ? I tried a lot of things without success. Quote Link to comment Share on other sites More sharing options...
JDW Posted November 28, 2014 Author Share Posted November 28, 2014 I found this pull request in PixiJS github : https://github.com/GoodBoyDigital/pixi.js/pull/1206 But it's not how it should be done. Quote Link to comment Share on other sites More sharing options...
JDW Posted December 15, 2014 Author Share Posted December 15, 2014 Nobody ? I mean, at this time, every text looks blurred on mobile device because of this. Someone should have figured it out, no ? Quote Link to comment Share on other sites More sharing options...
msha Posted December 18, 2014 Share Posted December 18, 2014 "every text looks blurred on mobile device because of this"Maybe that's caused by automatic scaling of canvas element?I use this code to work around that:<head lang="en">...... <meta id="viewport" name="viewport"> <script> var viewportScale = 1 / window.devicePixelRatio; document.getElementById('viewport').setAttribute('content', 'user-scalable=no, initial-scale=' + viewportScale); </script> ..... appWidth = document.body.clientWidth; appHeight = document.body.clientHeight; renderer = new PIXI.CanvasRenderer(appWidth, appHeight); Quote Link to comment Share on other sites More sharing options...
JDW Posted December 19, 2014 Author Share Posted December 19, 2014 Thanks for the help, but no, the "blurry" thing is normal, because PIXI create a texture with a resolution of "1", then scale it to the current resolution. What I need to know is how to create a Text texture with the correct resolution. Quote Link to comment Share on other sites More sharing options...
JDW Posted January 6, 2015 Author Share Posted January 6, 2015 Thanks to jagi on github for helping me : PIXI.Text is the only DisplayObject that I know of with his own "resolution" property. So you need to set the resolution to your actual device pixel ratio everytime you create a new PIXI.Text object. var highDensityText = new PIXI.Text("PIXI's great !");highDensityText.resolution = yourDevicePixelRatio; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.