latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
276 stars 34 forks source link

Scale* or Rescale #350

Closed wspr closed 5 years ago

wspr commented 5 years ago

Description

For unicode-math we need a way for multiple Scale options to be multiplicative. E.g.,

Scale*=1.1,Scale*=1.1

should be equivalent to

Scale = 1.21

I could overload Scale but I'm a little worried about backwards compatibility.

RuixiZhang42 commented 5 years ago

I am copying my comment in https://github.com/wspr/unicode-math/issues/287 here:

If a new key were to be introduced, I would suggest CompoundScale as in “compound interest”, which [also] implies that the operation is multiplicative.

A new key is better for sure when it comes to backwards compatibility.

RuixiZhang42 commented 5 years ago

Here is an idea: How about an “overwrite”-style Scale (as is now) and a “multiplicative”-style CompoundScale? So that

Scale=1.1,Scale=1.2,CompoundScale=1.3,CompoundScale=1.4

produces an overall scaling of 1.2 × 1.3 × 1.4 = 2.184, and unicode-math could issue CompoundScale=1.00001 and CompoundScale=0.99999 for families 2 and 3, respectively.

wspr commented 5 years ago

I like it a lot! I think as a general feature the name “CompoundScale” is good as it shouldn’t be that useful that often. If (for some reason) people find it very useful I can add the less description but terse name Scale* as a synonym at a later date.

RuixiZhang42 commented 5 years ago

I’m glad you like it! I was hoping that a long key would discourage its use ;-)

RuixiZhang42 commented 5 years ago

Need a check on whether Scale is empty or not:

\fontspec[Scale=1,ScaleAgain=1.1]{texgyreheros-regular.otf}%% <- This works

\fontspec[ScaleAgain=1.1]{texgyreheros-regular.otf}%%%%%%%%%% <- This produces error

since unicode-math may pass only ScaleAgain=1.00001 under the assumption of an implicit Scale=1.


Also, I was wondering if the fontspec messages can be made more concise. Right now:

\fontspec[Scale=1.1,ScaleAgain=1.2]{texgyreheros-regular.otf}

%%% produces three identical messages in the log:

Package fontspec Info: texgyreheros-regular scale = 1.32.
Package fontspec Info: texgyreheros-regular scale = 1.32.
Package fontspec Info: texgyreheros-regular scale = 1.32.

\fontspec[Scale=1.1,ScaleAgain=1.2,Scale=0.8]{texgyreheros-regular.otf}

%%% produces three identical messages despite that 0.8 is used:

Package fontspec Info: texgyreheros-regular scale = 1.32.
...

\fontspec[Scale=1.1,ScaleAgain=1.2,Scale=0.8,ScaleAgain=1.3]{texgyreheros-regular.otf}

%%% produces six messages in an alternating style:

Package fontspec Info: texgyreheros-regular scale = 1.32.
Package fontspec Info: texgyreheros-regular scale = 1.04.
Package fontspec Info: texgyreheros-regular scale = 1.32.
Package fontspec Info: texgyreheros-regular scale = 1.04.
Package fontspec Info: texgyreheros-regular scale = 1.32.
Package fontspec Info: texgyreheros-regular scale = 1.04.
wspr commented 5 years ago

Yes indeed, good catch!