olsak / OpTeX

OpTeX - LuaTeX format with extended Plain TeX macros
http://petr.olsak.net/optex/
33 stars 14 forks source link

script and script-script math sizes are not configurable #129

Open cao- opened 1 year ago

cao- commented 1 year ago

We have as default the scale factors of .7 for math script size, and of .5 for math script script size. We can see it in

\_def \_mathfontsize #1{\_if$#1$\_else
 \_tmpdim=#1\_ptunit
 \_edef\_sizemtext{\_ea\_ignorept \_the\_tmpdim \_ptmunit}%
 \_tmpdim=0.7\_tmpdim
 \_edef\_sizemscript{\_ea\_ignorept \_the\_tmpdim \_ptmunit}%
 \_tmpdim=#1\_ptunit \_tmpdim=0.5\_tmpdim
 \_edef\_sizemsscript{\_ea\_ignorept \_the\_tmpdim \_ptmunit}%
 \_fi
 }

and in

\_def\_mathbox#1{{\_mathstyles{\_hbox{%
 \_ifnum\_stylenum<2 \_everymath{\_currstyle}%
 \_else
 \_ifnum\_stylenum=2 \_def\_textmff{ssty=1;}\_fi
 \_ifnum\_stylenum=3 \_def\_textmff{ssty=2;}\_def\_scriptmff{ssty=2;}\_fi
 \_typoscale[\_dobystyle{}{}{700}{500}/]\_fi #1}}}%
}

Could we consider to make those scale factors configurable? We could have for instance two new dimens, called \scalemscript and \scalemsscript, that have defaults of 500 and 700 respectively, and use them both in the definition of \mathfontsize and \mathbox.

olsak commented 1 year ago

You are right that there is inconsistency and we should do things better. In fact, the `\_sizemscript and \_sizemsscript set by \_mathfontsize is used only with 7bit math. When Unicode math font is loaded then the scale factors for script and scriptscript sizes are read from the font itself, i.e. the decision about these values is in hands of a font designer. I have to figure it out how to connect these values from the Unicode math font to the values used in the \_mathbox macro. And, how to re-configure these scale factors when user wants it. It is not trivial task.

cao- commented 1 year ago

I'm pretty sure that some time ago (more than a year ago) I was changing the size of script and scriptscript font by redefining _mathfontsize, with a unicode font (I have a document with that macro redefined). Now indeed it doesn't work anymore. Am I remembering wrong, or has something changed in OpTeX regarding it? Besides, thank you for looking into this issue.

olsak commented 1 year ago

I did the change in 2021-08-16. I thing that if the Unicode font has the information about scale factor then it can be preferred (instead the default .7, .5). But I forgot the \mathbox macro and the user intervention to the scaling factors is more complicated now. I have to think about how to make it better and how to allow the user configuration too.