canvas.drawText with pixel perfect text on a canvas
<blockquote>
  <p><strong>THIS IS NOT ABOUT AntiAlias, Please read the question before answering thank you.</strong></p>
</blockquote>

<p>ADDING BOUNTY TO--> <a href="https://stackoverflow.com/q/7429033/1815624">android convert text width (in pixels) to percent of screen width/height</a></p>

<p>Quality info --> <a href="https://stackoverflow.com/a/1016941/1815624">https://stackoverflow.com/a/1016941/1815624</a></p>

<p>I am getting inconsistent results when trying to draw text on a canvas.  Please help, thank you.</p>

<p>I want the text to consume the same amount of scaled space on all devices</p>

<p>I do not care about ANTI_ALIAS and have added the <code>paint.setFlags(Paint.ANTI_ALIAS_FLAG);</code> but the problem is the same... </p>

<p>On 1 screen the text consumes half the width, on another only a 1/3 and even one that uses the full width.</p>

<p><strong>I want them all to use equal amounts of screen real estate.</strong></p>

<p>For Example</p>

<p>1600X900 7inch tablet Kitkat physical:
<a href="https://i.stack.imgur.com/fILPg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fILPg.png" alt="inconsistent results"></a></p>

<p>1920.1080 5.2 kitkat physical
<a href="https://i.stack.imgur.com/6MGI8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6MGI8.png" alt="inconsistent results"></a></p>

<p>1600x900 20in Lollipop emulated
<a href="https://i.stack.imgur.com/ct0N1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ct0N1.png" alt="inconsistent results"></a></p>

<p>1280x720 4.7inch
<a href="https://i.stack.imgur.com/hzzNJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hzzNJ.png" alt="inconsistent results "></a></p>

<p>These have been created using the guide at <a href="http://www.gkproggy.com/2013/01/draw-text-on-canvas-with-font-size.html" rel="nofollow noreferrer">http://www.gkproggy.com/2013/01/draw-text-on-canvas-with-font-size.html</a></p>

<p>where as that tutorial is showing consistent results 
<a href="https://i.stack.imgur.com/gJeQI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gJeQI.png" alt="consistent results "></a></p>

<p>To be thorough here is the source:</p>

<pre><code>public class MainActivity extends Activity
{
    Paint paint;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        paint = new Paint();
        View test = new TestView(this);

        setContentView(test);
    }

    public class TestView extends View
    {

        public TestView(Context context)
        {
            super(context);
            setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        }

        public float pixelsToSp(Context context, float px) {
            float scaledDensity = context.getResources().getDisplayMetrics().scaledDensity;
            return px/scaledDensity;
        }

        public float spToPixels(float sp) {
            Context context = getContext();
            float scaledDensity = context.getResources().getDisplayMetrics().scaledDensity;
            return scaledDensity*sp;
        }

        @Override
        protected void onDraw(Canvas canvas)
        {
            int size = getResources().getDimensionPixelSize(R.dimen.sp20);
            int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics());
            Log.v("intSize", Integer.toString(size));
            Log.v("intSize", Integer.toString(px));
            Log.v("intSize", Float.toString(spToPixels(20f)));
            if(true) {
                Typeface myTypeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/Ultra.ttf");
                paint.setTypeface(myTypeface);
            }
            paint.setColor(Color.BLACK);
            paint.setTextSize(size);
            paint.setFlags(Paint.ANTI_ALIAS_FLAG);
            canvas.drawText("HELLOOOOOOOOOOOOOO!", 0, size, paint);
            super.onDraw(canvas);
        }
    }
}
</code></pre>

<p>I have tried suggestion from 
<a href="https://stackoverflow.com/a/5369766/1815624">https://stackoverflow.com/a/5369766/1815624</a></p>

<p>Looking into this</p>

<p><a href="https://stackoverflow.com/a/21895626/1815624">https://stackoverflow.com/a/21895626/1815624</a></p>

<p><a href="https://stackoverflow.com/a/14753968/1815624">https://stackoverflow.com/a/14753968/1815624</a></p>

<p><a href="https://stackoverflow.com/a/21895626/1815624">https://stackoverflow.com/a/21895626/1815624</a> &lt;-- trying now</p>