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 8882205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:31:06+00:00 2026-06-14T20:31:06+00:00

Is it possible to check what family a Typeface object is using in Android

  • 0

Is it possible to check what family a Typeface object is using in Android API 8?

I am creating the Typeface on a Paint object like so

//Simplified code, the user actually selects the family and style from a list
Paint paint = new Paint();
paint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD));

I would later like to be able to check the family like so

Typeface tf= paint.getTypeface();

if (tf.equals(Typeface.DEFAULT) || tf.equals(Typeface.DEFAULT_BOLD)) {
    //do something
} else if (...) {
    //do something else
} 

This does not work as they are not the same object, I have also tried tf == value but again the same result. The Typeface object does not appear to expose anything useful to help with family detection, is there a workaround for this? I only need to detect the basic Android Typefaces (SERIF, SANS-SERIF, DEFAULT, MONOSPACE etc)

  • 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-14T20:31:08+00:00Added an answer on June 14, 2026 at 8:31 pm

    Not readily. The key to the family is a native_instance int, which is package-private and is not directly exposed, as you can see in the source code.

    There are various nasty ways of getting at that information, which may or may not work on all devices and all past/present/future versions of Android.

    Perhaps you could create your own wrapper object around Typeface that tracks this information.

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

Sidebar

Related Questions

Possible Duplicate: Check if user is logged in New Facebook API ive implemented facebook
Possible Duplicate: Check whether $_POST-value is empty I am using this code to validate
Is it possible to check on startup of an Android app whether the user
Possible Duplicate: Check if object is a jQuery object I need something like: function
Possible Duplicate: Check status of services that run in a remote computer using C#
Possible Duplicate: Check if user is offline I'm building a community website. Users will
Is it possible to check if the current user is administrator or not /
Possible Duplicate: Check checkbox checked property using jQuery I am having an issue picking
Possible Duplicates: Check if Ruby object is a Boolean How can I avoid truthiness
Possible Duplicate: Check if inputs are empty using jQuery I have form and textboxes,

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.