Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to draw large sized text on a canvas?
    primarykey
    data
    text
    <p>I want to draw on canvas month's text vertical along screen height.</p> <p>Paint init:</p> <pre class="lang-java prettyprint-override"><code> this.paint = new Paint(); this.paint.setAntiAlias(true); this.paint.setDither(true); this.paint.setSubpixelText(true); this.paint.setColor(color_text_dark); this.paint.setTextAlign(Align.RIGHT); </code></pre> <p>Drawing:</p> <pre class="lang-java prettyprint-override"><code> // Set the scale to the widest month float scale = getHeight() / this.max_month_width; String month_string = FULL_MONTH_NAME_FORMATTER. format(active_month_calendar.getTime()); canvas.save(); canvas.translate(getWidth(), 0); canvas.rotate(-90); canvas.scale(scale, scale); canvas.drawText(month_string, 0, 0, this.paint); canvas.restore(); </code></pre> <p><s>Result looks good on <em>hdpi</em> screen, but very ugly and pixelated on <em>xhdpi</em> one.</s></p> <p>I did more test on various devices, and understood what result depends on Android version, not screen density and resolution.</p> <p>Code works fine on 2.x platform, but doesn't work on 4.0.3+. Suppose, Android draw implementation was changed here. Full code you can see <a href="https://github.com/openintents/openintents/blob/master/calendarpicker/CalendarPicker/src/org/openintents/calendarpicker/view/FlingableMonthView.java" rel="nofollow noreferrer">here</a>.</p> <p><s><strong>hdpi</strong></s> version <strong>2.3.5</strong> (also tested <strong>2.2</strong>)</p> <p><img src="https://i.stack.imgur.com/v4FpY.png" alt="hdpi"></p> <p><s><strong>xhdpi</strong></s> version <strong>4.2</strong> (also tested <strong>4.1</strong>, <strong>4.0.3</strong>)</p> <p><img src="https://i.stack.imgur.com/hZ09G.png" alt="xhdpi"></p> <p>Trying different variations for paint antialias, subpixel text has no effect. How can I fix this issue?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload