Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7910611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:55:36+00:00 2026-06-03T12:55:36+00:00

I’m trying to draw text without antialiasing on a canvas in Android. The font

  • 0

I’m trying to draw text without antialiasing on a canvas in Android. The font I want to use is a file cour.ttf, which I’ve copied from my PC’s C:\windows\fonts directory to my app’s assets directory.

I’m using this code:

paint.setColor(Color.BLACK);
paint.setTypeface(Typeface.createFromAsset(getAssets(),"cour.ttf"));
paint.setTextSize(20);
paint.setAntiAlias(false);
canvas.drawText("ABCDE abcde 12345 -+/#.",100,100,paint);

The setAntiAlias function doesn’t appear to have any effect though.
This picture shows my results:
http://oi47.tinypic.com/35253wo.png

The first line is a screenshot from the app, with antialiasing set to false.
The second line is a screenshot from the app with antialiasing set to true.
The third line is what I would expect to get, it’s a screenshot made from my PC in notepad.exe with the same font.

Am I doing something wrong or is this the expected output with antialiasing off? What I’m trying to achieve here is to have pixelated unblurred text.

Any help is much appreciated.

EDIT:
I haven’t quite found the solution yet, but I did find something interesting:
adding android:hardwareAccelerated="false" to my Activity cleared it up quite a bit. Apperently this is turned on by default on Android 4. There’s still a (very light) shadow visible that I’d like to remove though.

Screenshot with hardware acceleration disabled:
http://oi49.tinypic.com/aayypj.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:55:39+00:00Added an answer on June 3, 2026 at 12:55 pm

    The pixels densities on PC and phone seem to be different, that is why the difference in appearance of text. You can’t compare the phone rendered text with the one rendered on your PC. I think the pixel density on your phone is high, so you not able to see the effect of anti-aliasing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
I have a text area in my form which accepts all possible characters from
i want to parse a xhtml file and display in UITableView. what is the
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a reasonable size flat file database of text documents mostly saved in
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.