I use algorithms that give me the moon phase, age and illumination (and more) for a given timestamp and location. I am struggling to map that information to a (font) icon of the Moon Phases font. Each icon is an approximation because it ignores the rotation. Still, I'd like to map illumination (I guess?) to icon as precisely as possible.

enter image description here

As you can see above there are 13 characters/icons per half cycle; 26 characters a-z. However, new/full moon are represented by the numbers 0 and 1. Particularly there's a gap between m and n where the new moon is in reality. The font uses a-z and A-Z to distinguish between northern hemisphere and southern hemisphere (again, I guess).

Mental model

Illumination 100%                              0%                              100%

Moon         full                              new                             full


Character     1            a - m                0             n - z              1

Assuming my mental model is correct this means (for the northern hemisphere)

  • 13 characters plus 0/1 to distribute across the 0-100% illumination range
  • pick 0 if the illumination is <= 100/15 i.e. <= ~6.66%
  • pick 1 if the illumination is >= 100 - 100/15 i.e. >= 93.33%
  • if waning (waning gibbous, last quarter, waning crescent)
    • round(illumination/100 * 15) + 97 to find character index for a-m
  • if waxing
    • round(illumination/100 * 15) + 110 to find character index for n-z

Does that sound about correct?

  • $\begingroup$ Maybe belongs to Stack Overflow or something? $\endgroup$
    – WarpPrime
    Nov 7, 2020 at 22:52
  • 1
    $\begingroup$ I don't think so. I can turn the (pseudo-)algorithm into code but I am not sure I understand the science behind this correctly. $\endgroup$ Nov 7, 2020 at 22:54
  • $\begingroup$ I think your question can be well-answered here. Some readers may be off-put by the focus of your post on algorithm implementation but you are simply working to state the problem clearly. For the sake of readers and answerers here, I think it's necessary to emphasize the astronomy aspects of the problem and de-emphasize the algorithmic and coding aspects somewhat. $\endgroup$
    – uhoh
    Nov 8, 2020 at 0:08
  • $\begingroup$ I see that you have selected 28 icons in your complete sequence, and those choices in that order appears to me to be pretty good. A GIF showing them cycle continuously would be a great way to check continuity and smoothness. The challenge you explain here is to select one based on a phase parameter from an algorithm. But you haven' yet explained much about that phase parameter. Does it return 50% for both first quarter and third quarter? If so, how will you decide which icon to show? Please add details about how the phase parameter progresses, this may be a problem. $\endgroup$
    – uhoh
    Nov 8, 2020 at 0:23
  • $\begingroup$ @uhoh believe me your feedback is really appreciated! The thing is, I probably don't know what I don't know. I think all necessary information is weaved into my description. The algorithm I use does give me the moon phase. Hence, I know which icon (sub)set to choose from. In other comments we already discussed whether to use illumination or moon age as the basis for my calculation. It would probably be enough if someone confirmed my mental model sketch to be correct. $\endgroup$ Nov 8, 2020 at 21:38

2 Answers 2


While you have "illumination" it would seem to be easier just to map "moon age" (in days) to a character

The average synodic month is 29.53 days, and you have 28 characters, so calculating age*28/29.53 and then rounding to give a number between 1 and 28 (or 0 and 27). Then it is just a matter of adding 97 if that number is in the range 0-13, or 36 if that number is 14... etc.

Slightly better would be to find out the actual length of the synodic month (if you can calculate moon age and illumination this should be possible) and use it in place of 29.53. The actual length varies from about 29.2 to 29.8 days depending mostly on the position of the Earth's orbit

  • $\begingroup$ Thank you for this feedback! I have little to no clue about astronomy (as you might have guessed). To me calculating based on illumination should yield the same results as based on moon age, no? I initially picked illumination as it's fixed between {0,1} or 0-100% and I can ignore the fact that I don't have the actual length of the synodic month. For the calculation of all of those phase parameters I use algorithms provided by a Spanish scientist. $\endgroup$ Nov 8, 2020 at 11:11
  • $\begingroup$ If you want accurate you'd need to investigate how the person who made the font did the shapes. I suspect they were just drawn by eye to give 28 moon shapes and don't correspond linearly to illumination or age or anything else. I suspect that mapping illumination linearly to a shape will work just as well. I think the whole thing is rather over engineered! The calcuation is an good quartic model of the moon. The font is a rough sketch! If you need accurate, then you'll need to make your own font (which isn't too hard) or get the software to draw the moon (also not impossible) $\endgroup$
    – James K
    Nov 8, 2020 at 11:22

For LaTeX there are the following packages using fonts but they are limited:

  • wasysym (full, new, and quarters)
  • mathabx (same)
  • stix (math astro symbols)
  • china2e (artistic full, new, and quarters)
  • moonphase (similar)

none that I can see with a full range of 28. It would be possible to write some parameterised TikZ to create the shapes within a circle to do this, which would let you add or subtract fine adjustments, but it would be a macro, not a font.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .