[NTG-context] Unicode PDF bookmarks and headers

2008-06-22 Thread Khaled Hosny
I can't get Unicode (Arabic) PDF bookmarks or headers (see the attached
file), even after including \input spec-tst after the wiki page
http://wiki.contextgarden.net/PDF_Bookmarks_and_Headers
But I get miss-encoded text instead, am I missing some thing?

Regards,
 Khaled


-- 
 Khaled Hosny
 Arabic localizer and member of Arabeyes.org team
% engine=luatex
\mainlanguage[ar]

% Font
\definefontfeature
   [arabic]
   [mode=node,language=dflt,script=arab,
init=yes,medi=yes,fina=yes,isol=yes,
liga=yes,dlig=yes,rlig=yes,clig=yes,
mark=yes,mkmk=yes,kern=yes,curs=yes]

\starttypescript [serif] [arabic]
 \definefontsynonym [Arabic-Light]   [name:arabtype] [features=arabic]
 \definefontsynonym [Arabic-Bold][name:arabtype] [features=arabic]
 \definefontsynonym [Arabic-Italic]  [name:arabtype] [features=arabic]
 \definefontsynonym [Arabic-Bold-Italic] [name:arabtype] [features=arabic]
 \stoptypescript

\starttypescript [serif] [arabic] [name]
 \usetypescript[serif][fallback]
 \definefontsynonym [Serif]   [Arabic-Light]   [features=arabic]
 \definefontsynonym [SerifItalic] [Arabic-Italic]  [features=arabic]
 \definefontsynonym [SerifBold]   [Arabic-Bold][features=arabic]
 \definefontsynonym [SerifBoldItalic] [Arabic-Bold-Italic] [features=arabic]
\stoptypescript

\starttypescript [Arabic]
  \definetypeface [Arabic] [rm] [serif] [arabic] [default] 
\stoptypescript 

\def\ArabicGlobalDir {\pagedir TRT\bodydir TRT\pardir TRT\textdir TRT}
\def\ArabicParDir{\textdir TRT\pardir TRT}
\def\ArabicTextDir   {\textdir TRT}
\def\LatinParDir {\textdir TLT\pardir TLT}
\def\LatinTextDir{\textdir TLT}
\def\LatinGlobalDir  {\pagedir TLT\bodydir TLT\pardir TLT\textdir TLT}

\definestartstop
  [arabicpar]
  [commands=\Arabic\ArabicParDir]

\define[1]\AR
  {\Arabic\ArabicTextDir#1}

\define\setArabic
  {\ArabicGlobalDir%
   \usetypescript[Arabic]%
   \setupbodyfont[Arabic,20pt]}

\definestartstop
  [latinpar]
  [commands=\Arabic\LatinParDir]

\define[1]\LT
  {\LatinTextDir#1}

\define\setLatin
  {\LatinGlobalDir%
   \usetypescript[lm]%
   \setupbodyfont[lm,20pt]}

\setupinteraction[state=start]
\placebookmarks[chapter,section,subsection][chapter,section]
\setupinteractionscreen[option=bookmark]

\input spec-tst.tex

\setupinteraction
   [state=start,
title={كيف تكتب عربي مع كُنْتِكِسْت},
author={خالد حسني},
subtitle={صف الحروف حاسوبيا مع تخ وكنتكست},
keyword={عربي تخ كنتكست صف محارف طباعة}]

%there is a bug
%\setcharactermirroring[1]

\starttext

\setArabic

\startstandardmakeup
  \midaligned{كيف تكتب عربي في كُنْتِكِسْت}
  \midaligned{كتبه}
  \midaligned{خالد حسني}
\stopstandardmakeup

\completecontent

\chapter{مقدمة}
كُنْتِكِسْت (\CONTEXT) هو حزمة ماكرو لنظام تخ (\TeX) لصف المحارف.
\chapter{أول فصل}
\section[firstsection]{أول باب}
... كلام ...
\section{ثاني باب}
... كلام\index{فهرس آخر} ...
\subsection{ثاني مسألة}
... كلام ...
\section{ثالث باب}
... كلام ...
\chapter{فصل آخر}
... كلام ...
\chapter[lastchapter]{آخر فصل}
... كلام ...
\completeindex
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Translaing ConTeXt interface to Arabic

2008-06-22 Thread Khaled Hosny
On Sat, Jun 21, 2008 at 07:38:25PM -0600, Idris Samawi Hamid wrote:
 On Sat, 21 Jun 2008 14:02:24 -0600, Khaled Hosny [EMAIL PROTECTED]  
 wrote:
 
  Well, since we're not using it for long-term historical ranges -- and
  we'll need to be able to advance/reverse it a couple of days no matter  
  the
  algorithm, then I say let's go with whatever is easiest for hans to read
  ;-)
 
  I think Umm al-Qura algorithm is more tested and is the one officially
  used in Saudi Arabia, but I can't find any technical details about it,
  though Arabeyes's ITL implements it
 
 How did you implement it without the technical details? I guess I'm not  
 quite understanding...
 
 Can you find it and pass it alon?
 

The person who wrote that code supposedly had access to such technical
details, but I can't reach him or find such details. Will try searching
for it again.

  and is giving me correct results so
  far (unlike the Hijra algorithm). EMACS one seems to be widely used too,
  but its ITL implementation gives me incorrect dates some times
 
 How incorrect?

One day less than the actual date i.e. it says today is 17/ 6/1429 while
it is, and Umm al-Qura correctly says, 18/ 6/1429.

Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localizer and member of Arabeyes.org team


signature.asc
Description: Digital signature
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Unicode PDF bookmarks and headers

2008-06-22 Thread Idris Samawi Hamid
On Sun, 22 Jun 2008 01:12:38 -0600, Khaled Hosny [EMAIL PROTECTED]  
wrote:

 I can't get Unicode (Arabic) PDF bookmarks or headers (see the attached
 file), even after including \input spec-tst after the wiki page
 http://wiki.contextgarden.net/PDF_Bookmarks_and_Headers
 But I get miss-encoded text instead, am I missing some thing?

You are right, the bookmark text is misencoded, even though I am only  
getting ASCII representation here (Acrobat 8)

Does Acrobat fully support unicode Arabic -- do you have the ME version?

Best wishes
Idris

-- 
Professor Idris Samawi Hamid, Editor-in-Chief
International Journal of Shi`i Studies
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] [Dev-luatex] bug in context/luatex

2008-06-22 Thread Hans Hagen
Yue Wang wrote:
 Hi, Hans:
 
 pdftex and LuaTeX produce different results with the following source
 file. Please check.
 I dont know whether it is a bug in ConTeXt  or LuaTeX.
 
 \usetypescriptfile[type-buy]
 \usetypescript[lucida][texnansi]
 \setupbodyfont[lucida,12pt]
 \starttext
 `hello'
 \stoptext
 
 I use the tfms/map zip you attached in the mailing list together with
 the font bought from TUG.
 If there is something wrong with my installtion, let me know.

these old time hacks are gone in mkiv

the only remapping supported is (replacement feature trep)

tfm.characters[0x0027] = tfm.characters[0x2019]


so, use \quote {...} or otherwise the right unicode characters

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] protruding with luatex mkiv?

2008-06-22 Thread Hans Hagen
Uwe Koloska wrote:
 Hello,
 
 how can I use protruding with mkiv and luatex?  I tried different examples 
 from the different manuals and the garden and found the following piece that 
 works OK with pdftex and mkiv (?):
 
 --
 \setupcolors[state=start]
 \setupfontsynonym [Serif] [handling=normal]
 \definetypeface[palatino][rm][serif][palatino][default]
 \setupbodyfont[palatino]
 
 \starttext
 \startframedtext[width=.5\textwidth,background=screen,
 offset=none,frame=off,align=hanging]
 \input tufte
 \stopframedtext
 \stoptext
 --
 
 Is this the right way to use protruding with mkiv and luatex?

no, the whole handling stuff is gone in mkiv and replaced by features 
(in mkiv font features are not per se bound to open type features)

 And if it works, how do I use it with the otf version of delicious which 
 typescript was presented some days ago on this list?


from hand-ini.mkiv

% \definefontfeature[demo][default][mode=node,expansion=quality]
% \definefontfeature[demo][default][mode=node,protrusion=pure]


i think that i posted something about it some time ago so maybe 
searching the list archive helps

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Unicode PDF bookmarks and headers

2008-06-22 Thread Khaled Hosny
On Sun, Jun 22, 2008 at 07:41:33AM -0600, Idris Samawi Hamid wrote:
 On Sun, 22 Jun 2008 01:12:38 -0600, Khaled Hosny [EMAIL PROTECTED]  
 wrote:
 
  I can't get Unicode (Arabic) PDF bookmarks or headers (see the attached
  file), even after including \input spec-tst after the wiki page
  http://wiki.contextgarden.net/PDF_Bookmarks_and_Headers
  But I get miss-encoded text instead, am I missing some thing?
 
 You are right, the bookmark text is misencoded, even though I am only  
 getting ASCII representation here (Acrobat 8)
 
 Does Acrobat fully support unicode Arabic -- do you have the ME version?
I wasn't testing it with Acrobat but with Evince, I've other PDF files
with Arabic bookmarks and is displayed correctly. I can even make PDFs
with correct Arabic bookmarks using LaTeX and hyperref package.

Regards,
 Khaled


-- 
 Khaled Hosny
 Arabic localizer and member of Arabeyes.org team


signature.asc
Description: Digital signature
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Bigger interline space and grid

2008-06-22 Thread Hans Hagen
Aditya Mahajan wrote:
 Hi,
 
 I cannot figure out how to increase the interline space with grid 
 snapping. The following does not work
 
 \setuplayout[grid=yes]
 
 \setupinterlinespace[auto,big]
 \setupwhitespace  [medium]
 \setupindenting   [medium,yes]
 
 \showgrid
 
 \starttext
 
 \dorecurse{4}{\input knuth \endgraf}
 
 \stoptext
 
 
 What am I missing?

the concept of snapping -)

\setuplayout[grid=yes]

\setupinterlinespace[line=20pt]
\setupwhitespace  [halfline]

\showgrid

\starttext

\dorecurse{4}{\input knuth \endgraf}

\stoptext




-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Translaing ConTeXt interface to Arabic

2008-06-22 Thread Hans Hagen
Khaled Hosny wrote:
 On Fri, Jun 20, 2008 at 08:13:37PM -0600, Idris Samawi Hamid wrote:
 On Fri, 20 Jun 2008 20:03:10 -0600, Idris Samawi Hamid  
 [EMAIL PROTECTED] wrote:

 On Fri, 20 Jun 2008 19:11:57 -0600, Khaled Hosny [EMAIL PROTECTED]
 wrote:

 Not to mention Saudi Arabia, which uses the lunar months...

 But I think this another issue of its own, since SA uses Hijri not
 Georgian calender, do we have support for lunar based hijri calender?
 Good point. I'll try to find a conversion algorithm...
 http://www.codeproject.com/KB/datetime/hijrigregorianclass.aspx
 
 The guy here claims to have a better algorithm than others
 http://ojuba.org/wiki/doku.php/hijra/, it is written completely in
 python. I didn't compare it with others myself, though.

i see this as reference in converter code ...

Calendrical Calculations, by Nachum Dershowitz and
  Edward M. Reingold, Software --- Practice  Experience, p 899--928.




-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Translaing ConTeXt interface to Arabic

2008-06-22 Thread Hartmut Henkel
On Sun, 22 Jun 2008, Hans Hagen wrote:

 Calendrical Calculations, by Nachum Dershowitz and
   Edward M. Reingold, Software --- Practice  Experience, p 899--928.

fwiw, hijra is also mentiond in the Calendar FAQ,
http://www.tondering.dk/claus/calendar.html

Regards, Hartmut
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Translaing ConTeXt interface to Arabic

2008-06-22 Thread Hans Hagen
Hartmut Henkel wrote:
 On Sun, 22 Jun 2008, Hans Hagen wrote:
 
 Calendrical Calculations, by Nachum Dershowitz and
   Edward M. Reingold, Software --- Practice  Experience, p 899--928.
 
 fwiw, hijra is also mentiond in the Calendar FAQ,
 http://www.tondering.dk/claus/calendar.html

ah, thanks. i also found a dutch site

http://www.phys.uu.nl/~vgent/islam/islam_nl.htm

btw, writing a lunar based calendar converter in lua ...

Hans

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Translaing ConTeXt interface to Arabic

2008-06-22 Thread Arthur Reutenauer
 btw, writing a lunar based calendar converter in lua ...

  Glad to know I'm not the only Lua addict whose first thought was to do
that ;-)

Arthur

P-S: If we're going to implement calendar localization we have to make
sure we take the famous Swedish February 30th, 1712 in account :-)
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Translaing ConTeXt interface to Arabic

2008-06-22 Thread Hans Hagen
Arthur Reutenauer wrote:
 btw, writing a lunar based calendar converter in lua ...
 
   Glad to know I'm not the only Lua addict whose first thought was to do
 that ;-)
 
   Arthur
 
 P-S: If we're going to implement calendar localization we have to make
 sure we take the famous Swedish February 30th, 1712 in account :-)

yeah, and i noticed several such days in the NL list ... even skipping a 
day depending on the province you lived in, i knew of some anomalities 
but not that it was that bad

Hans

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Calendar resources

2008-06-22 Thread Charles P. Schaum
Some calendar links, FYI:

http://astro.nmsu.edu/~lhuber/leaphist.html
http://www.smart.net/~mmontes/ec-cal.html
http://www.tondering.dk/claus/calendar.html
http://tycho.usno.navy.mil/vphase.html

I would be happy to make available the C code for an Easter date
calculator that I implemented on the Palm III. I used the complex
algorithm that figures the age of the moon at New Year's. It
originally came from Bell Labs, I think.

CPS

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Calendar resources

2008-06-22 Thread Hans Hagen
Charles P. Schaum wrote:
 Some calendar links, FYI:
 
 http://astro.nmsu.edu/~lhuber/leaphist.html
 http://www.smart.net/~mmontes/ec-cal.html
 http://www.tondering.dk/claus/calendar.html
 http://tycho.usno.navy.mil/vphase.html
 
 I would be happy to make available the C code for an Easter date
 calculator that I implemented on the Palm III. I used the complex
 algorithm that figures the age of the moon at New Year's. It
 originally came from Bell Labs, I think.

well, we can make a nice l-calendar.lua module together

just provide me the calculations (i can implement to lua code but i have 
no time to figure out all the logic)


Hans

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Translaing ConTeXt interface to Arabic

2008-06-22 Thread Henning Hraban Ramm
Am 2008-06-22 um 19:23 schrieb Hans Hagen:

 P-S: If we're going to implement calendar localization we have to  
 make
 sure we take the famous Swedish February 30th, 1712 in account :-)

 yeah, and i noticed several such days in the NL list ... even  
 skipping a
 day depending on the province you lived in, i knew of some anomalities
 but not that it was that bad


In Switzerland, some cantons (states) stayed with the Julian calendar  
far longer than others, so there are different missing days depending  
on canton between 1584 and 1812
see (in German): http://de.wikipedia.org/wiki/Gregorianischer_Kalender


Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Calendar resources

2008-06-22 Thread Charles P. Schaum
Here's the main bit of code; the two documents from which I derived it
are over the 40k limit. One is the calendar FAQ text version. The other
is a file easter_date.txt that is a thread from:

Newsgroups: soc.religion.christian
From: [EMAIL PROTECTED] (Mike Siemon)
Subject: Easter algorithms I
Organization: ATT Bell Laboratories
Approved: [EMAIL PROTECTED]

Does anyone want such files?

Anyway, the implemented formulas are below. The header files are just
for keeping track of Palm-specific variables for different modules.

/*
 *
 * Created with Falch.net DeveloperStudio
 * http://www.falch.net/
 * 
 * Created : 4/11/01 12:18:42 AM
 * Creator : (Unknown)
 *

/
#include Pilot.h
#include Easter.h
#include Easter_res.h   

extern Boolean England;
extern UInt16 YearAD;
Char Orthodox_Julian[20], Orthodox_Gregorian[20], Western[20];

typedef enum {Julian,Gregorian} calendar;

/*  The Golden Number is the order of the year in the 19-year lunar
cycle.
 *  It is the same in Julian or Gregorian calendars, and is listed in the
 *  output of this program under the heading GN.
 */

int GoldenNumber(int year)
{
return ((year % 19) + 1);
}

/*  All dates in this program are referred to March 1st; so 32 means
 *  April 1 and 0 means February 28th or 29th.  Leap years are needed
 *  for printing February dates (and for dominical letters).
 */

int Leap(int year, calendar style)
{
if (year % 4)
return 0;
else switch(style) {
case Julian:return 1;
case Gregorian: return (year % 100 || year % 400 == 0);
}
}

#define century (year/100)

/*  Gregorian solar correction -- this is the number of days difference
 *  between Julian and Gregorian civil dates, in effect the number of
 *  excess leap years in the Julian calendar since the time of Nicea.
 *  This correction derives from the Gregorian introduction of non-leap
 *  century years, giving mean tropical year = 365.2425 days.
 */

int Solar(int year)
{
return (century - century/4 - 2);
}

/*  Gregorian lunar correction -- this is only used for the computation
of
 *  the paschal new moon (via epact), but might as well be pulled out on
 *  its own.  I give the pedantically correct version.
 *  This correction derives from the mean lunar month being 29.53059 days
 *  instead of the 6939.75/235 assumed in the Julian calendar.  It is one
 *  days in (roughly) 312.5 years, or 8 days in 2500 years.
 */

int Lunar(int year)
{
return ((century - 15 - (century-17)/25)/3);
}

/*  Epact is the age of the moon on March 1st (same as January 1st);
 *  It (may have) derived from Greek methods of calculating the extra
 *  (epagomenal) months intercalated into the regular 12 at 7 points
 *  of the 19-year Metonic cycle.  However, it is not used in Julian
 *  easter calculations and is provided here only for Gregorian NewMoon.
 */

int Epact(int year)
{
int epact;

epact = (11*GoldenNumber(year) - Solar(year) + Lunar(year)) % 30;
if (epact  0)
epact += 30;
return epact;
}

/*  Here's the hard one.  Keep in mind that there are several artificial
 *  conventions -- the equinox is ALWAYS March 21; new moon is ALWAYS the
 *  date on which a fictitious average moon is one day old, and the
full
 *  moon is 13 days later, on the 14th of the month.  In the Julian
version
 *  (and MOSTLY in the Gregorian) the pre-paschal month has 30 days.  All
 *  of this works out keeping fairly close to astronomical reality in the
 *  Gregorian case, but it is not necessarily exact.
 */

int NewMoon(int year, calendar style)
{
int new_moon, epact;

switch (style) {
case Julian:
new_moon = (4 - 11*GoldenNumber(year)) % 30;
while (new_moon  8)
new_moon += 30;
return new_moon;
case Gregorian:
epact = Epact(year);
new_moon = 31-epact;
if (new_moon  8) {
new_moon += 30;
if (epact == 24 || epact == 25  year%19  10)
new_moon--;
}
return new_moon;
}
}

int WeekDay(int date, int year, calendar style)
{
int d;

d = date + year + year/4;
if (style == Gregorian)
d -= Solar(year);
return  (d % 7);
}

/*  Given the Paschal full moon, we just step to the next Sunday ...
 */

int Easter(int year, calendar style)
{
int paschal_moon;