Difference between revisions of "Tibetan Formatting LibreOffice Extension"

From Digital Tibetan
Jump to: navigation, search
Line 1: Line 1:
Here described a OpenOffice Macro that helps to automatically correct most of hte difficulties when one wants to format a longer document in Tibetan. For general formating guidelines [[Style guide for Tibetan text |look here]]
+
Here described a OpenOffice Macro that helps to automatically correct most of the difficulties when one wants to format a longer document in Tibetan. For general formatting guidelines [[Style guide for Tibetan text |look here]]
  
 
==Objective==
 
==Objective==
There are several [[Style_guide_for_Tibetan_text#Difficulties using typesetting software (focus: OpenOffice) | difficulties]] involved in digital formating of Tibetan texts. In order to make things easier and automatize most of the requirements we developed an OpenOffice macro to deal with these problems. It was developed on a Windows platform using OpenOffice 2.4. The reason for using OpenOffice is that it enables easy input of Tibentan text, it is freely available to anyone and is accessible for programing.
+
There are several [[Style_guide_for_Tibetan_text#Difficulties using typesetting software (focus: OpenOffice) | difficulties]] involved in digital formatting of Tibetan texts. In order to make things easier and automatize most of the requirements we developed an OpenOffice macro to deal with these problems. It was developed on a Windows platform using OpenOffice 2.4. The reason for using OpenOffice is that it enables easy input of Tibetan text, it is freely available to anyone and is accessible for programming.
  
 
==Features implemented==
 
==Features implemented==
Line 12: Line 12:
 
* for convenience the macro can be applied to a subset of the text by selecting part/s of it. If part of the text is selected the macro will run from the beginning of the paragraph where the selection starts till the end of the paragraph where the selection ends. It is not possible to run the macro in only part of a paragraph.
 
* for convenience the macro can be applied to a subset of the text by selecting part/s of it. If part of the text is selected the macro will run from the beginning of the paragraph where the selection starts till the end of the paragraph where the selection ends. It is not possible to run the macro in only part of a paragraph.
 
* display the unicode of a chosen character/s (in order to recognize breaking and non-breaking thsegs for example)
 
* display the unicode of a chosen character/s (in order to recognize breaking and non-breaking thsegs for example)
* removing characters used for formating reasons only (zero width spaces)  
+
* removing characters used for formatting reasons only (zero width spaces)  
* the macro now is implemented as an '''OpenOffice Extention'''. Its features are accessible form the main menu.
+
* the macro now is implemented as an '''OpenOffice Extension'''. Its features are accessible form the main menu.
  
 
===Future features===
 
===Future features===
* replacement of formating characters that are frequently mistyped (non-breaking spaces between two shad for example)
+
* replacement of formatting characters that are frequently mistyped (non-breaking spaces between two shad for example)
 
* simple grammar check (no shad after ka or ga for example)
 
* simple grammar check (no shad after ka or ga for example)
  
Line 26: Line 26:
 
In some cases line spacing should be enlarged manually when large stacks are in the line (as in the classical example of the Kalachakra Mantra)
 
In some cases line spacing should be enlarged manually when large stacks are in the line (as in the classical example of the Kalachakra Mantra)
  
==How to install the extention==
+
==How to install the extension==
First download the [[Media:TibetanFormater.zip | extension file]]. Than in OpenOffice choose '''Tools -> Extension Manager'''. Click the ''Add'' button and browse to the downloaded file. You should '''restart OpenOffice''' to see the changes that took place.
+
First download the [[Media:TibetanFormater.zip | extension file]]. Than in OpenOffice choose '''Tools -> Extension Manager'''. Click the ''Add'' button and browse to the downloaded file.
 +
 
 +
'''Note:''' you do not need to unzip the folder. Open office adds the zip file directly in the extension manager.
 +
 
 +
You should '''restart OpenOffice''' to see the changes that took place.
  
 
To uninstall TibetanFormater go to '''Tools -> Extension Manager'''. Under My Extensions select TibetanFormater and click ''Remove''
 
To uninstall TibetanFormater go to '''Tools -> Extension Manager'''. Under My Extensions select TibetanFormater and click ''Remove''

Revision as of 19:33, 21 May 2008

Here described a OpenOffice Macro that helps to automatically correct most of the difficulties when one wants to format a longer document in Tibetan. For general formatting guidelines look here

Objective

There are several difficulties involved in digital formatting of Tibetan texts. In order to make things easier and automatize most of the requirements we developed an OpenOffice macro to deal with these problems. It was developed on a Windows platform using OpenOffice 2.4. The reason for using OpenOffice is that it enables easy input of Tibetan text, it is freely available to anyone and is accessible for programming.

Features implemented

  • automatic replacement of certain characters that enable easier handling, such as non-breaking spaces instead of breaking ones, non-breaking thseg between nga and shad and others.
  • left right justification (by inserting zero width spaces after every thseg)
  • automatic replacement of shed with rinchen soungs shed after first syllable of the line. It is not done in the first and last line of a paragraph.
  • verifying correct breaking of Tibetan syllables at end of line (eg. prevent breaking in the middle of a syllable), and correction if needed by inserting manual line breaks at the correct location.
  • inserted English text are taken into account, so that they are handled differently.
  • for convenience the macro can be applied to a subset of the text by selecting part/s of it. If part of the text is selected the macro will run from the beginning of the paragraph where the selection starts till the end of the paragraph where the selection ends. It is not possible to run the macro in only part of a paragraph.
  • display the unicode of a chosen character/s (in order to recognize breaking and non-breaking thsegs for example)
  • removing characters used for formatting reasons only (zero width spaces)
  • the macro now is implemented as an OpenOffice Extension. Its features are accessible form the main menu.

Future features

  • replacement of formatting characters that are frequently mistyped (non-breaking spaces between two shad for example)
  • simple grammar check (no shad after ka or ga for example)

Things that need manual correction

Sometimes if there are not many syllables in a line (because of using a large font or small page size) the syllables are pulled to much apart when the paragraph is justified. By shrinking white spaces in the line might correct this by enabling one more syllable to "jump up" a line. This should be handled manually.

A similar solution can be applied for a rinchen spungs shad than follows a single stack syllable.

In some cases line spacing should be enlarged manually when large stacks are in the line (as in the classical example of the Kalachakra Mantra)

How to install the extension

First download the extension file. Than in OpenOffice choose Tools -> Extension Manager. Click the Add button and browse to the downloaded file.

Note: you do not need to unzip the folder. Open office adds the zip file directly in the extension manager.

You should restart OpenOffice to see the changes that took place.

To uninstall TibetanFormater go to Tools -> Extension Manager. Under My Extensions select TibetanFormater and click Remove

You can assign a button to run the macros by choosing Tools -> Customize. In the Keyboard tab choose a button you want to run this macro, select TibetanFormater/Module1 in the Category, and the choose a macro in the Function window. Click the Modify button. Now each time you'll click the chosen button (eg. F12) the chosen function will be executed.

Requirements

OpenOffice 2.4 on Windows platform.

Linux users might try to use this macro, but there are some adjustments that should be made. A linux version will be posted later on.

Function Description

If part of the text is selected the functions will run from the beginning of the paragraph where the selection starts till the end of the paragraph where the selection ends. It is not possible to run them for only part of a paragraph. This does not apply for the Display Unicode Character Code which displays the highlighted characters exactly. If nothing is selected the whole document will be formated.

Justify and Apply Rinchen Spungs Shad

This function performs a full formating of the chosen text. It replaces all white spaces with non-breaking spaces, removes formating characters used for justification. Than, if the paragraph is set to be justified it inserts formating characters in the right places. It checks every line to make sure that the line break is inserted in a legal point, if not a manual break is inserted before the last syllable. The first shad of the line is checked for Rinchen Spungs Shad replacement.

Important: In order for the justification to work, you should make sure that the paragraph style is set to justified before you run the macro. In addition you should turn on the 'Expand single word' option. You can find it in the Format -> Paragraph dialog in the Alignment tab. The macro does not justifies paragraphs that are not set up for justification. In this way a mixture of headings and text paragraphs can be formated at the same time. It is recommended to set up style (such as TibetanJustified) for easier handling of formating.

Apply Rinchen Spungs Shad

Every line is checked to make sure that the line break is inserted in a legal point, if not a manual break is inserted before the last syllable. The first shad of the line is checked for Rinchen Spungs Shad replacement.

Undo formating Character insertion

Removes all zero width spaces used for justification. It makes the text a lot more readable on screen, and easily edited.

Display Unicode character code

Runs through a highlighted area of the text and displays each character as well as its Unicode number. With the OK button one can move to the next character. The Cancel button used to exit this function.

Here you can find a list of Tibetan Unicode characters. Please note that the Unicode here is displayed in decimal rather than hexadecimal format.

Download (v1.0.2)

Download TibetanFormater and use the Extension Manager of OpenOffice.org to install it.

Feedback, bug reports and feature requests are welcomed. Please mail eszter<dot>hoffmann<at>rigpa<dot>org

Change Log

Version 1.0.2

An add on version is implemented. A 'Tibetan' menu appears between the 'Tools' and 'Window' menus.

Display Unicode Character code dialog changed.

Acknowledgments

In this project some code from Andrew Pitonyak was used. Thank for the useful collection of guides and examples.

Thanks for the members of the OpenOffice.org Forum, with so many helpful posts.