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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:05:36+00:00 2026-05-29T07:05:36+00:00

Now I am having a code which counts the height and width of a

  • 0

Now I am having a code which counts the height and width of a paragraph and sets it accordingly. However I have been having this strange problems whenever a break line(\n) passes through my paragraph I use this code to calculate my Height. I also calculate the width and make sure a line is properly fit.

float textSize = t.getTextSize();
Paint paint = new Paint();
paint.setTextSize(textSize);

However for some reason a break line couldn’t have the height calculated which would mean me missing a few lines or show me half a line cause of the break lines during my performed calculations.

My question is, how would I undergo the calculation of the height of a break line of the space it occupies?

  • 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-05-29T07:05:36+00:00Added an answer on May 29, 2026 at 7:05 am

    I wasn’t able to solve this issue. However I did try to just delete 3 more extra characters at the edge of the end point of the width. It worked. However the real problem lies more in the character width. If a character is not registered with android a calculation vs the actual out come can be very different if you have letters that are completely different that off the regular alphabet.

    Using this code you can determine the edge of the endpoint.

    totalCurrentWidth = t.getPaint().measureText(s.substring(start, end));
    

    However characters not registered in the system may have a different end or no end at all(Chinese or taiwan for example).

    During each individual characters used in verdana it produces a different spacing compared to the actual outcome of the text.

    If anyone find something wrong with my logic feel free to comment me. I only strive to improve after all.

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

Sidebar

Related Questions

I've been going at this problem for a solid couple hours now and having
I have written code which performs a specific task; now when I will run
I'm having troubles with the order of my code in my program. right now
Having been spoiled by ruby for so long, I now find myself having to
We are having this problem with a controller right now; the controller looks like
Having been an imperative developer for some years now, I had never had the
I've this TcpClient code which works fine. It connects to perl server on linux
A client is having an issue running java2ws on some of their code, which
I have the following code which works just fine when the method is POST,
I'm having some issues because I'm trying to re-use code (which can be used)

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.