On 07/13/2011 04:15 PM, Ulrike Fischer wrote:

Did my version not work for you? I had no problems to compare your
two fonts with it?

With a bit of hacking (mostly adjusting for unicode-math versions),
I managed to get it working, but I decided to generalize it a bit.

So here's the version I came up with, with takes a certain argument
to specify the name of the math version (instead of hard-wired UFtest).

\DeclareDocumentCommand \setmathfontversion { O{} mm } {
  \um_init:
  \csname S@\f@size\endcsname
  \tl_set:Nn \l_um_mversion_tf {#3}
  \DeclareMathVersion{\l_um_mversion_tf}
  \tl_set:Nn \l_um_script_features_tl  {ScriptStyle}
  \tl_set:Nn \l_um_sscript_features_tl {ScriptScriptStyle}
  \tl_set:Nn \l_um_script_font_tl      {#2}
  \tl_set:Nn \l_um_sscript_font_tl     {#2}
  \keys_set:nn {unicode-math} {#1}
  \um_fontspec_select_font:n {#2}
  \group_begin:
    \fontfamily{\zf@family}\selectfont
    \fontspec_if_script:nTF {math}
      {\bool_gset_true:N  \l_um_ot_math_bool}
      {\bool_gset_false:N \l_um_ot_math_bool}
  \group_end:
  \bool_if:NTF \l_um_init_bool {
    \tl_set:Nn \um_symfont_tl {um_allsym}
    \msg_trace:nnx {unicode-math} {default-math-font} {#2}
    \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_noparse:nnn
    \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_noparse:Nnn
    \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_noparse:nnn
    \cs_set_eq:NN \um_maybe_init_alphabet:n \um_init_alphabet:n
    \cs_set_eq:NN \um_map_char_single:nn \um_map_char_noparse:nn
    \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_noparse:nn
  }{
    \int_incr:N \g_um_fam_int
    \tl_set:Nx \um_symfont_tl {um_fam\int_use:N\g_um_fam_int}
    \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_parse:nnn
    \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_parse:Nnn
    \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_parse:nnn
    \cs_set_eq:NN \um_maybe_init_alphabet:n \use_none:n
    \cs_set_eq:NN \um_map_char_single:nn \um_map_char_parse:nn
    \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_parse:nn
  }
  \SetSymbolFont{\um_symfont_tl}{#3}
    {\encodingdefault}{\zf@family}{\mddefault}{\updefault}

  \bool_if:nT {\l_um_ot_math_bool && !\g_um_mainfont_already_set_bool} {
    \bool_set_true:N \g_um_mainfont_already_set_bool
    \dim_compare:nF { \fontdimen 10 \l_um_font == 0pt } {
      \DeclareMathSizes { \f@size } { \f@size }
{ \um_fontdimen_to_percent:nn{10}{\l_um_font}\dimexpr \f@size pt\relax } { \um_fontdimen_to_percent:nn{11}{\l_um_font}\dimexpr \f@size pt\relax }
    }
    \fontspec_select:xn {\l_um_font_keyval_tl,
      Scale=1.00001,
      FontAdjustment={
\fontdimen8\font= \um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax \fontdimen9\font= \um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax
        \fontdimen10\font=\um_get_fontparam:nn {32} {StackTopShiftUp}\relax
\fontdimen11\font=\um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax \fontdimen12\font=\um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax \fontdimen13\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax \fontdimen14\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax \fontdimen15\font=\um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax \fontdimen16\font=\um_get_fontparam:nn {18} {SubscriptShiftDown}\relax \fontdimen17\font=\um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax \fontdimen18\font=\um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax \fontdimen19\font=\um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax
        \fontdimen20\font=0pt\relax % delim1 = FractionDelimiterDisplaySize
        \fontdimen21\font=0pt\relax % delim2 = FractionDelimiterSize
        \fontdimen22\font=\um_get_fontparam:nn {15} {AxisHeight}\relax
      }
    } {#2}
    \SetSymbolFont{symbols}{#3}
      {\encodingdefault}{\zf@family}{\mddefault}{\updefault}
    \fontspec_select:xn {\l_um_font_keyval_tl,
      Scale=0.99999,
      FontAdjustment={
\fontdimen8\font= \um_get_fontparam:nn {48} {FractionRuleThickness}\relax \fontdimen9\font= \um_get_fontparam:nn {28} {UpperLimitGapMin}\relax \fontdimen10\font=\um_get_fontparam:nn {30} {LowerLimitGapMin}\relax \fontdimen11\font=\um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax \fontdimen12\font=\um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax
        \fontdimen13\font=0pt\relax
      }
    } {#2}
    \SetSymbolFont{largesymbols}{#3}
      {\encodingdefault}{\zf@family}{\mddefault}{\updefault}
  }
  \um_input_math_symbol_table:
  \um_remap_symbols:
  \um_setup_mathactives:
  \um_setup_accents:
  \um_setup_delcodes:
  \um_setup_alphabets:
  \ignorespaces
}

With this version, I can even compare multiple fonts side-by-side:

\setmathfont[math-style=literal,bold-style=literal,
    vargreek-shape=unicode,SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}}]{XITS Math}

\setmathfontversion[math-style=literal,bold-style=literal,
    vargreek-shape=unicode,SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}}]{Asana Math}{asana}

\setmathfontversion[math-style=literal,bold-style=literal,
    vargreek-shape=unicode,SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}}]{Cambria Math}{cambria}

\def\SYMB#1#2{\mathversion{#2}$\displaystyle #1$}

See the full source of my test file attached.

Regards, Ulrik
%%%%%%%%%%%%%%%%%%%%%%%
% SYMBOLS DEFINED BY UNICODE-MATH
%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{article}
\makeatletter

\usepackage{booktabs,longtable,shortvrb,geometry,varwidth,textcomp,hyperref}

\geometry{margin=3cm}
\hypersetup{colorlinks,linkcolor=black}

\def\cmd#1{\texttt{\textbackslash\expandafter\@gobble\string#1}}

\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Numbers={Monospaced}]{TeX Gyre Pagella}
\usepackage{unicode-math}

\ExplSyntaxOn\makeatletter
\DeclareDocumentCommand \setmathfontversion { O{} mm } {
  \um_init:
  \csname S@\f@size\endcsname
  \tl_set:Nn \l_um_mversion_tf {#3}
  \DeclareMathVersion{\l_um_mversion_tf}
  \tl_set:Nn \l_um_script_features_tl  {ScriptStyle}
  \tl_set:Nn \l_um_sscript_features_tl {ScriptScriptStyle}
  \tl_set:Nn \l_um_script_font_tl      {#2}
  \tl_set:Nn \l_um_sscript_font_tl     {#2}
  \keys_set:nn {unicode-math} {#1}
  \um_fontspec_select_font:n {#2}
  \group_begin:
    \fontfamily{\zf@family}\selectfont
    \fontspec_if_script:nTF {math}
      {\bool_gset_true:N  \l_um_ot_math_bool}
      {\bool_gset_false:N \l_um_ot_math_bool}
  \group_end:
  \bool_if:NTF \l_um_init_bool {
    \tl_set:Nn \um_symfont_tl {um_allsym}
    \msg_trace:nnx {unicode-math} {default-math-font} {#2}
    \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_noparse:nnn
    \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_noparse:Nnn
    \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_noparse:nnn
    \cs_set_eq:NN \um_maybe_init_alphabet:n \um_init_alphabet:n
    \cs_set_eq:NN \um_map_char_single:nn \um_map_char_noparse:nn
    \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_noparse:nn
  }{
    \int_incr:N \g_um_fam_int
    \tl_set:Nx \um_symfont_tl {um_fam\int_use:N\g_um_fam_int}
    \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_parse:nnn
    \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_parse:Nnn
    \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_parse:nnn
    \cs_set_eq:NN \um_maybe_init_alphabet:n \use_none:n
    \cs_set_eq:NN \um_map_char_single:nn \um_map_char_parse:nn
    \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_parse:nn
  }
  \SetSymbolFont{\um_symfont_tl}{#3}
    {\encodingdefault}{\zf@family}{\mddefault}{\updefault}

  \bool_if:nT {\l_um_ot_math_bool && !\g_um_mainfont_already_set_bool} {
    \bool_set_true:N \g_um_mainfont_already_set_bool
    \dim_compare:nF { \fontdimen 10 \l_um_font == 0pt } {
      \DeclareMathSizes { \f@size } { \f@size }
      { \um_fontdimen_to_percent:nn{10}{\l_um_font}\dimexpr \f@size pt\relax }
      { \um_fontdimen_to_percent:nn{11}{\l_um_font}\dimexpr \f@size pt\relax }
    }
    \fontspec_select:xn {\l_um_font_keyval_tl,
      Scale=1.00001,
      FontAdjustment={
        \fontdimen8\font= \um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax
        \fontdimen9\font= \um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax
        \fontdimen10\font=\um_get_fontparam:nn {32} {StackTopShiftUp}\relax
        \fontdimen11\font=\um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax
        \fontdimen12\font=\um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax
        \fontdimen13\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax
        \fontdimen14\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax
        \fontdimen15\font=\um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax
        \fontdimen16\font=\um_get_fontparam:nn {18} {SubscriptShiftDown}\relax
        \fontdimen17\font=\um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax
        \fontdimen18\font=\um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax
        \fontdimen19\font=\um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax
        \fontdimen20\font=0pt\relax % delim1 = FractionDelimiterDisplaySize
        \fontdimen21\font=0pt\relax % delim2 = FractionDelimiterSize
        \fontdimen22\font=\um_get_fontparam:nn {15} {AxisHeight}\relax
      }
    } {#2}
    \SetSymbolFont{symbols}{#3}
      {\encodingdefault}{\zf@family}{\mddefault}{\updefault}
    \fontspec_select:xn {\l_um_font_keyval_tl,
      Scale=0.99999,
      FontAdjustment={
        \fontdimen8\font= \um_get_fontparam:nn {48} {FractionRuleThickness}\relax
        \fontdimen9\font= \um_get_fontparam:nn {28} {UpperLimitGapMin}\relax
        \fontdimen10\font=\um_get_fontparam:nn {30} {LowerLimitGapMin}\relax
        \fontdimen11\font=\um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax
        \fontdimen12\font=\um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax
        \fontdimen13\font=0pt\relax
      }
    } {#2}
    \SetSymbolFont{largesymbols}{#3}
      {\encodingdefault}{\zf@family}{\mddefault}{\updefault}
  }
  \um_input_math_symbol_table:
  \um_remap_symbols:
  \um_setup_mathactives:
  \um_setup_accents:
  \um_setup_delcodes:
  \um_setup_alphabets:
  \ignorespaces
}
\ExplSyntaxOff
\makeatletter

%\setmathfont{Asana Math}

\setmathfont[math-style=literal,bold-style=literal,
    vargreek-shape=unicode,
    SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}}]{XITS Math}

\setmathfontversion[math-style=literal,bold-style=literal,
    vargreek-shape=unicode,
    SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}}]{Asana Math}{asana}

\setmathfontversion[math-style=literal,bold-style=literal,
    vargreek-shape=unicode,
    SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}}]{Cambria Math}{cambria}

\setmathfontversion[math-style=literal,bold-style=literal,
    vargreek-shape=unicode,
    SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}},Scale=0.9]{Lucida Math}{lucida}

\setmathfontversion[math-style=literal,bold-style=literal,
    vargreek-shape=unicode,
    SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}}]{Latin Modern Math}{lm}

\setmathfontversion[math-style=upright,bold-style=upright,
    vargreek-shape=unicode,
    SizeFeatures={
    {Size=-10, Colour=888888},
    {Size=10-, Colour=FF0000}}]{Neo Euler}{euler}


\def\TABLE{%
\begin{longtable}[l]{@{}lccccccll@{}}
\toprule
\textsc{usv} & XITS & Asa & Cmbr & Luc & LM & Euler & Macro & Description \\
\midrule
\input unicode-math-table.tex\relax\\
\bottomrule
\end{longtable}
}
\def\USV#1{\small\scshape\MakeLowercase{U+\@gobble#1}}
\def\CMD#1{\small\cmd#1}
\def\DESC#1{%
  \begin{varwidth}[t]{10cm}
    \raggedright\linespread{0.6}\scshape#1%
  \end{varwidth}
}

\newcommand\SHOW[1]{%
\def\UnicodeMathSymbol##1##2##3##4{%
  \def\1{#1}\def\2{##3}%
  \ifx\1\2%
    \def\tempa{%
      \USV{##1} &
      \SYMB{##2}{normal} &
      \SYMB{##2}{asana} & 
      \SYMB{##2}{cambria} & 
      \SYMB{##2}{lucida} &
      \SYMB{##2}{lm} &
      \SYMB{##2}{euler} &
      \CMD{##2} & 
      \DESC{##4}\\
    }%
    \expandafter\tempa
  \fi
}
\TABLE
}

\def\SYMB#1#2{\mathversion{#2}$\displaystyle #1$}

\begin{document}
\MakeShortVerb\|
\title{Every symbol defined by \textsf{unicode-math}}
\author{Will Robertson\\\texttt{wsp...@gmail.com}}
\maketitle

This document uses the file \texttt{unicode-math-table.tex}
to print every symbol defined by the \textsf{unicode-math}
package. Use this document to find the command name or the Unicode glyph slot for a symbol that you wish to use.

\tableofcontents

\clearpage
\section{Opening symbols, \cmd\mathopen}
\begingroup
\let\sqrtold\sqrt
\def\sqrt{\sqrtold{}}
\SHOW\mathopen
\endgroup

\clearpage
\section{Closing symbols, \cmd\mathclose}
\SHOW\mathclose

\clearpage
\section{Fence symbols, \cmd\mathfence}
\SHOW\mathfence

\section{Punctuation symbols, \cmd\mathpunct}
\SHOW\mathpunct

\clearpage
\section{Accents, \cmd\mathaccent}

Note that accents will only be properly placed if used with an OpenType font with the necessary information.

\begingroup
\def\SYMB#1#2{\mathversion{#2}$\displaystyle #1 \mitx$}
\SHOW\mathaccent
\endgroup

\clearpage
\section{Big operators, \cmd\mathop}

Of the operators shown below, a subset need to be flagged by \textsf{unicode-math} for \cmd\nolimits\ adjustments.
The limits behaviour as specified by \textsf{unicode-math} are shown with grey subscripts and superscripts.
\begingroup
\def\SYMB#1#2{\mathversion{#2}$\displaystyle #1_0^1$}
\SHOW\mathop
\endgroup

\clearpage
\section{Binary relations, \cmd\mathbin}
\SHOW\mathbin

\clearpage
\section{Ordinary symbols, \cmd\mathord}
\SHOW\mathord

\clearpage
\section{Relation symbols, \cmd\mathrel}
\SHOW\mathrel

\clearpage
\section{Alphabetical symbols, \cmd\mathalpha}
\SHOW\mathalpha



\end{document}

--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to