Skip to content

Tools that might help convert USFM/P.SFM into OpenDocument XML

Notifications You must be signed in to change notification settings

Avante-Vangard/AV-Evangard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AV Evangard Publishing Tools

Build a better Libre Office Writer document.

This is zero rev code, or idea collation only.

This project is not ready.

Simplified Flow

1. Write text (text based.. or simplified view. not WYSIWYG)

a. USFM vs. p.sfm

2. Choosing Fonts in LibreOffice Writer.

a. built in or build in smcp, c2sc, onum, lnum.

b. normalize fonts to same em.

3. Build stylesheet in LibreOffice Calc.

Note: supported version of LibreOffice Calc is 6.4.7.2 -- version 7 doesn't work.

a. Shaping

All fonts should be scaled so the height of a capital X matches the Cormorant font.

All fonts used should be scaled for width appropriately. Usually this means matching the width of cormorant for the string "ABCDEFGabcdefg" or a similar short 10-12 character sample. However, The point is the fonts look normal in the final work, so you'll want to vary the x scaling to achieve the correct look.

The webpage (Font drop|https://fontdrop.info/) provides the true Font, Face, and Weight class that LibreOffice needs.

The Weight field is 100-900 defined in the font. However, the text "bold" will cause LibreOffice to generate a bold face from the regular face if the font has no 700 class weight available.

The Skew field is "normal" or "italic". LibreOffice will use an italic face if it exists, or skew the regular face if no italic exists for the font defined.

b. Sizing

The configuration page in the Calc sheet contains 3 main settings: Point size, leading ratio, and scaling ratio. The point size is that of the font's design box, not the height or width of the text. To have 8pt text you should measure the cap height is 8 pts. The scaling and leading ratios are multiples of this design box number. leading ratio is constant for all sizes, The scaling is multiples.

c. Styling

Once you have the fonts and base sizes defined, then you can customize the stylesheet (active styles) and the rest of the configuration page to acheive the look of the work. After each change, you need to manually recalc (f9 in linux), as autocalc causes serious issues in near-endless loops this file has.

The fields on the active style page

Base is the paragraph style to follow when no other style is defined. Valid entries appear in the Tag column (column W as of this writing).

Face is the IDX_ from the Active fonts page describing the text style and weight.

Vert is the DY column from the Base Pts Page describing the vertical size for the style.

Horz is the DX column from the Base Pts Page describing the horizontal attributes for the style.

Extra and X2 is the EX column from the Base Pts Page and describes the other attributes for the style.

_Sort : an Entry of "V" in the Sort Column of Active Styles causes a variable with the tag name to be created in the stylesheet.

d. Save your stylesheet

When you're stylesheet is ready, copy all the text on the LO-Stylesheet pane, and past it into a plain text document. Save that text as yourstyle.fodt, and open that file. You should be able to see your defined page size, and all your styles in the styles pane.

4. Weld text to styles via Jedit.

Vangard Libre uses Jedit for conversion. If you study the process, this process could just as easily be accomplished with a finalchanges file. The intended final solution is an import filter in LibreOffice Writer that does all of this.

The Jedit setup includes 3 things: 1) a syntax file for p.sfm that goes into the jedit /modes folder, 2) a macro for inserting character tags, and 3) the SFM>ODT macro.

a. Concatenation of sfm files.

If you have more than one file that will go into your work, you may wish to concatenate them first. in unix, this is simply $cat *.sfm > myfile.p.sfm

b. Pre-conversion stuff.

p.sfm needs :

header defaults to the tags h and cn. You may want to duplicate toc if your file doesn't have an h tag. Also, the macro is only aware of the h and toc tags inside the file, if you've updated the table in paratext after initial setup, you may need to synchronize the paratext table back into the individual files before proceeding. The tag cn attempts to use the intended chapter number that prints at the chapter boundary, whether this was c, cp or cl in the sfm file. cl tags are only supported in their 'late' form. You need a cl each chapter you want to have a label.

For two column text, the end of each file needs an end marker inserted with the tag \mte9 ~ . Additionally, the h and toc tags should be zeroed a the end of each book (\h ~, \toc ~, etc.)

c. Convert (run the macro.)

d. Import stylesheet.

e. Move End-of-File to bottom.

_5. Prepare Text in LibreOffice Writer.

a. Flow and check. Fix in the source files as much as possible.

b. Fixing in Writer

The tracking field is the primary push/pull tool to fit troublesome text.

d. Finish

This methodology is still in development.

About

Tools that might help convert USFM/P.SFM into OpenDocument XML

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published