[Tex/LaTex] horizontal maya numerals (mathabx)

fontsmathabxmetafont

After researching, mathabx is the only package supporting maya numerals within tex.

For example, typing $\maya{2013}$ results in:
mayan number for 2013

now the problem is… the numerals are rotated sideways (oddly, the conch shell meaning zero is not rotated).

That is.. groups are properly stacked vertically but within each group, the numbers themselves are rotated sideways

Compare with wikipedia's example for 19

I understand the reason is that the font was coded with numbers rotated, but I don't really understand what should I edit in order to get horizontal numbers

I gather the numbers are created in
fonts\source\public\mathabx\maydigit.mf
but opening it shows metafont and not tex, and metafont looks like chinese (mayan?) to me

Could someone help me understand how to rotate back numerals into horizontal mode?


EDIT>

Minimal example:

\documentclass{minimal}
\usepackage{mathabx}

\newcommand\mathbfont{\usefont{U}{mathb}{m}{n}}

\begin{document}

\mayadigit{17}

\[
\maya{2013},
\maya{123},
\maya{45}
\]
\end{document}

It produces: minimal output

What I try to achieve (edited in a graphics program):
desired result

I don't need to fix \maya since it behaves properly.

It selects the correct numeral and puts it on the proepr place. What I need is to rotate "the number symbol"

So I went ahead and tried to edit the source maydigit.mf. I thought I could try fixing "two" (two points) so instead of showing ":" it would show ".."

The relevant code is

beginchar("2",fig_width#+2appr#,fig_height#,0);
  "Maya numeral 2 (ca)";
%  italcorr fig_height#*slant-0.5u#;
  pickup fine.nib;
  adjust_dot1((0.5w,0.25h),dtsz,false,false);
  dot(1,1');
  adjust_dot2((0.5w,0.75h),dtsz,false,false);
  dot(2,2');
endchar;

And I figured swapping those coordinates (0.5w,0.25h) and the other would to the trick.
I did it, saved source, recompiled my .tex sample… and it had no effect (it was as if the fonts had already been "compiled" and changing the source did not update the fonts used themselves).

I'm beginning to see the light. Changing that code to

beginchar("2",fig_width#+2appr#,fig_height#,0);
  "Maya numeral 2 (ca)";
%  italcorr fig_height#*slant-0.5u#;
  pickup fine.nib;
  adjust_dot1((0.25h,0.5w),dtsz,false,false);
  dot(1,1');
  adjust_dot2((0.75h,0.5w),dtsz,false,false);
  dot(2,2');
endchar;

works (spacing is funny, but at least the two dots are now horizontal). Not only I had to swap the coordinates, but also the suffixes (h, w).

Here the result:
enter image description here

I'll keep trying

Best Answer

The following seems to work as expected:

enter image description here

\documentclass{article}
\usepackage{graphicx,mathabx}% http://ctan.org/pkg/{graphicx,mathabx}

\newcommand\mathbfont{\usefont{U}{mathb}{m}{n}}

\begin{document}

\mayadigit{17}

\[
  \maya{2013}, \maya{123}, \maya{45}
\]

\noindent\hrulefill

\def\mayaexpansion{%
    \mayacntc=\mayacnta\mathbfont
    \ifnum\mayacntc=0 0\else
    \rotatebox[origin=c]{-90}{%
    \loop\ifnum\mayacntc>5\advance\mayacntc by -5\repeat
    \the\mayacntc\mayacntc=\mayacnta
    \loop\ifnum\mayacntc>5\advance\mayacntc by -5 5\repeat}%
    \fi}%

\mayadigit{17}

\[
  \maya{2013}, \maya{123}, \maya{45}
\]

\end{document}

The definition of \mayaexpansion is taken from mathabx.dcl. Inserted is a graphicx rotation of -90 degrees around the center of the object. This is only done if the object is not zero.

Related Question