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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:48:54+00:00 2026-05-23T04:48:54+00:00

I have a Canvas that i draw text on. (this is quite advanced i

  • 0

I have a Canvas that i draw text on.
(this is quite advanced i think hope you can follow me)

See attached image below.

The functionality is that I can tap on the screen to change the textsize.
Tap left screen = smaller Font.
Tap right Screen = bigger Font.
I can then also move the text on the screen.

When textsize is ok and i have moved the text where i want it,
Then I want to save it back to the original Bitmap.

I use options.inSampleSize = 4; to initially load the Bitmap

The ImageView that have the Bitmap is of course smaller then the original Image.
Some kind of calculation is needed.
This tends to be quite difficult to do.

I have the options.inSampleSize = 4 Bitmaps Ratio.
It’s 0.59, 0.69 something depending on Landscape or portrait.

Im playing around with that to somehow change the new BitmapsetTextSize
to look the same as the ImageView smaller Bitmap.

What could i do here?
I have a feeling that since one never know what size an image have.
I have to somehow scale/constrain the Loaded Bitmap Ratio to a fixed Ratio.

Then i need to using percentage or something to transfer the text location
to the bigger image.
I can kind of do that when it comes to initial
(red small ball on picture) location. Hence, the starting point of the text.

But i dont know how long the text is so im stuck so so speak and asking for advice

One way i tried was to divide paint.getTextSize() with the Ratio something like 0.59. That looked like a solution at first. But the image ratio is not fixed and the Font size is not fixed something else is needed.

Here are two pictures showing the problem.

On phone Bitmap:

enter image description here

The saved new Bitmap:

enter image description here

  • 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-23T04:48:55+00:00Added an answer on May 23, 2026 at 4:48 am

    I’m not 100% clear that I understand what you mean, but here’s a go. It sounds like you were close to the right approach. Instead of using a fixed ratio, you need to calculate the ratio that the image is scaled by to fit in the view on the phone, then you can scale the text by the inverse ratio. So in steps:

    • Measure the width of the original image (height would do just as well, but we just need one dimension)
    • Measure the width of the scaled image
    • Calculate ratio (ratio = original / scaled)
    • Let the user type their text
    • You can then get the text size using something like: float paintSize = paint.getTextSize();
    • For rendering on the final image, use paint.setTextSize(paintSize / ratio);.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen this question/answer: How do you draw text on a <canvas> tag
I have a canvas that I am using a javascript function to display text
I have external html5 canvas that you can paint on some lines using your
I have a MyCanvas class that extends JComponent. On this canvas I have drawn
I have a canvas in which I need to draw text on in javascript,
I have a class with a property that can be an Image (i.e. an
I use this example that allow me to draw into the canvas. http://devfiles.myopera.com/articles/649/example2.html However,
I have a SurfaceView that I draw onto, there are no controls, text boxes
I have a canvas that allows people to draw lines an such on the
i have made a canvas and draw an image on canvas i have also

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.