This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
theoriginalbit's profile picture

Ideas Monitor Text Scaling

Started by theoriginalbit, 25 March 2013 - 02:25 AM
theoriginalbit #1
Posted 25 March 2013 - 03:25 AM
Ok so I've made a program for a monitor (some of you know what it is) and I'm wanting it to try fill the monitor no matter the size with the text through text scaling. The total size of the render is 19x4 pixels… All attempts at doing an auto scale has not worked. Anyone got any ideas for a formula to calculate the text scale to set based off the size of the monitor?
Engineer #2
Posted 25 March 2013 - 04:13 AM
Well, it depends on how many characters you have on your monitor.

Then you can do it line based:

chars / width. You will get a number and then you have to round it to the closest scale. I dont have to tell you what scales there available, do I?

:P/>
theoriginalbit #3
Posted 25 March 2013 - 04:18 AM
Well, it depends on how many characters you have on your monitor.

Then you can do it line based:

chars / width. You will get a number and then you have to round it to the closest scale. I dont have to tell you what scales there available, do I?

:P/>
iirc its 0.5 — 5 yeh?

whats the largest screen char width (its been too long since I've actually played)?
Engineer #4
Posted 25 March 2013 - 04:32 AM
Yea thats right.

On max text scale:

I felt like doing that :P/>
theoriginalbit #5
Posted 25 March 2013 - 04:59 AM
hmmm odd. the formula I used before is now working… wonder what I did different this time…
Engineer #6
Posted 25 March 2013 - 05:02 AM
What formula were you using? If you dont want it public, PM :)/>
theoriginalbit #7
Posted 25 March 2013 - 05:22 AM
Just the way you said before

local mw, mh = monitorObj.getSize()
local scale = mw / 19
if scale > 5 then scale = 5 end
if scale < 0.5 then scale = 0.5 end
monitorObj.setTextScale(scale)
Engineer #8
Posted 25 March 2013 - 05:25 AM
:D/>
theoriginalbit #9
Posted 25 March 2013 - 05:43 AM
:D/>
:D/>

API is now released :D/>