Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2007-06-13 06:49:48

4fingers
Member
Registered: 2007-06-13
Posts: 1

Scaling problems

Hi,
I have recently come across a rather annoying mathematical problem. I am currently making a computer program that will scale text to fit inside a 5 pixels wide by 7 pixels high box. (Pixels are dots on the screen)

At first it seemed easy since I was able to get the width and height of the character. For example if the characters size was 7 by 8 I could simply do this
5/7 = x (0.71428571428571428571428571428571)
7/8 = y (0.875)
Then I just say I want the image scaled by x and y which should give the character back as 5 by 7

When that wasn’t working I saw that there was an invisible box round the character that was used instead by the computer so its perceived width and height was wrong.

For example if the width counted by me is 7
And the computer thinks its 9 (No way to change this)
And I want the character to fit inside 5

I can no longer do 5/7 because it will be multiplied by 9 and I can’t do 5/9 because that will make the invisible box 5 and the actual width of the character counted by me to be smaller than 5

What maths can I use so that I can fit the character inside the 5 by 7 grid?
Thanks for your time

Offline

#2 2007-08-14 00:41:11

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: Scaling problems

You might want to learn to make your own font with these specs and then distribute the font with your software.


igloo myrtilles fourmis

Offline

#3 2007-08-14 01:22:19

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Scaling problems

I think John's solution is the best. Even if you did manage to scale them correctly, the characters would look blurred and possibly be illegible.


Why did the vector cross the road?
It wanted to be normal.

Offline

Board footer

Powered by FluxBB