On 01/21/2015 12:36 AM, Hans Hagen wrote:
> On 1/20/2015 8:50 PM, Pablo Rodriguez wrote:
>> Dear list,
>>
>> I have a question when dealing with XML.
>>
>> Is there any way to write a conditional based on the number of
>> characters in a given field?
>> [...]
> let tex do the work .. counting is not accurate for this anyway

Many thanks for your reply, Hans.

I don’t need total accuracy with this.

Many thanks for your help again,


Pablo


> \starttexdefinition AutoFontSize #1
>      \begingroup
>          \setbox\scratchbox\hbox{#1}
>          \normalexpanded {
>              \definedfont[Regular*default at
>                  \ifdim\wd\scratchbox>30em 10pt\else
>                  \ifdim\wd\scratchbox>25em 12pt\else
>                  \ifdim\wd\scratchbox>20em 14pt\else
>                  \ifdim\wd\scratchbox>15em 16pt\fi\fi\fi\fi
>              ]
>          }
>          #1
>      \endgroup
> \stoptexdefinition
> 
> \starttext
>      \dostepwiserecurse{30}{80}{2}{\AutoFontSize{\dorecurse{#1}{x}}\par}
> \stoptext

-- 
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to