# Re: [NTG-context] fit text to page

```Hallo Adam,

On 07/27/2012 07:01 PM, Reviczky Adam wrote:
```
`Hi list,`
```
I'm trying to scale a text to the textwidth and textheight by keeping
the aspect ratio, using different papersizes.
When the dimensions get too big I get an "Arithmetic overflow".
(I'm trying to do something similar to resizebox in LaTeX:
http://tex.stackexchange.com/questions/55394/perfectly-scale-line-paragraph-image-anything-up-to-textwidth)

Minimal example:
\setuppapersize[A4][A4] %% [A1][A1]
\showframe
\starttext
\scale[factor=max,width=\textwidth,height=\textheight]{\framed[frame=on]{!}}
\stoptext

Error message:
! Arithmetic overflow.

\grph_scale_convert_large_scale ...scratchdimen #3
\relax \fi \scratchdimen -...
\grph_scale_calculations_yes ...grph_scale_temp_y
\xdef \finalscaleboxwidth ...
\grph_scale_calculate ...h_scale_calculations_yes
\fi \fi \fi
\syst_boxes_with_next_box ...grph_scale_calculate
\ifconditional \c_grph_sca...
l.6 ...h,height=\textheight]{\framed[frame=on]{!}}

```
```
```
Not sure where exactly, but likely you have reached a size calculation limit of TeX (seems like a box calculation since more text works fine). Start with the bigger font size if you want to enlarge the box that much:
```
\setuppapersize[A4][A4] %% [A1][A1]
\showframe
\starttext
\definedfont[Serif at 20pt]
\scale[factor=max,width=\textwidth,height=\textheight]{\framed[frame=on]{!}}
\stoptext

Jano

___________________________________________________________________________________