Forum Feature requests

Persian and better right to left support

allenb
Hi Mike,
First of all, Thanks for creating such a wonderful tool. This is what we needed for many years.
Although I'm perfectly happy with it, there are some minor problems specially when it comes to right to left languages.

My mother tongue is Persian so every now and then I'm publishing some Persian articles on the web and I want to provide the pdf version too. here are some of the problems I ran into while trying to make a persian article.

1. Persian numbering for lists, pages, footer markers, etc.
Although Persian numbers are very similar to Arabic there are minor differences and that's why they been assigned different ranges of unicode codepoints. Lists Module (http://www.w3.org/TR/css3-lists/#numeric) have a different value for persian numbering (list-style-type: persian;). You can see the difference below.
arabic-indic 	٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩ 	U+0660, U+0661, U+0662, U+0663, U+0664, U+0665, U+0666, U+0667, U+0668, U+0669 
persian,  	۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹ 	U+06F0, U+06F1, U+06F2, U+06F3, U+06F4, U+06F5, U+06F6, U+06F7, U+06F8, U+06F9
different numbers: 
4 (English) ٤ (Arabic) ۴ (Persian)
5 (English) ٥ (Arabic) ۵ (Persian)
6 (English) ٦ (Arabic) ۶ (Persian)


I wish you add support for persian numbering. I guess it shouldn't be difficult for you guys but Persian numbering is the biggest hurdle that prevents me from moving to HTML + Prince and leaving Latex behind.

2. More control over the direction and text-align of the footnotes (SOLVED - Thanks to Jim's)
In a right to left document we often want to add the footnotes in left to right direction ( for the original spelling of a name or phrase in English), so the Prince engine should allow me to define/change the direction and text-align of a footnote based on its, say, lang attribute. To make it clear I have added an image from a latex generated pdf below.


It would also be great if I can change the font of footnotes. I haven't had any luck in changing the font of the footnotes. It would be even better of I can link footnote call-outs to footnote markers and vice versa.
 

Edited by allenb

jim_albright
span.footnote {
font-family: EEE YYYY XXXX ;
direction: rtl ;
dispaly: footnote ;
display: prince-footnote ;
position: footnote ;
font-size: 18pt ;
line-height: 20pt ;
margin: 0 ;

}
span.footnoteEnglish {
font-family: EEE YYYY XXXX ;
direction: ltr ;
dispaly: footnote ;
display: prince-footnote ;
position: footnote ;
font-size: 18pt ;
line-height: 20pt ;
margin: 0 ;

}


Just make the piece that you want to control in the footnote to have
<span class="footnote">aaaaa bbb ccdccd</span> or
<span class="footnoteEnglish">eeee fffff gggg</span>

Jim Albright
Wycliffe Bible Translators

allenb
Thanks Jim, your solution totally solved my second issue. I also added the below code to force the marker for English texts to stay in Arabic form.

.fn-ltr::footnote-marker {
    content: counter(footnote, arabic-indic) ".";  
    font-family: "a good Arabic font";    
    padding-left: 0;
    padding-right:4pt;
    text-align: right;   
}


I wish my first issue could have been solved as easy as this.
mikeday
We can add Persian numbering to a future release of Prince. In the meantime, you can use the symbols counter style to do this manually:
.fn::footnote-call {
    content: counter(footnote, symbols('0', '1', '2', '3', '4'))
}

Just replace the numbers with the appropriate Persian numbers.
allenb
Thanks Mike, that's a great idea and it works. I didn't know prince has support for symbols. The other day I was reading through the "Generated Content for Paged Media CSS3 Module Draft" and I came across the symbols features. I tought to myself I would be great if we can have this feature in prince (it wasn't in the documentation, so I didn't know about it).

Anyhow, now I solved my problem with numbering in Persian but since numbers are used in different sections of the document, e.g. page numbers, heading numbers, footnote call-outs, footnote-markers, ordered lists, etc., my CSS file become kinda bloated. Is there a way to define the symbols list just once and assign it to a variable like what we have in set-string/get-string and then use the variable to refer to the list of symbols?
mikeday
No, not yet. Defining the Persian numbering as a built-in keyword is probably the easiest solution for this issue.
mikeday
Prince 8.0 supports Persian numbering counter styles.