Code Monkey home page Code Monkey logo

ftml-sile's Introduction

ftml-sile

A SILE class for typesetting FTML format data. See https://github.com/silnrsi/ftml for details on FTML (Font Test Markup Language).

Installation

This repository contains the files needed to implement a SILE class named "ftml". You will need SILE to use it. You will need at least SILE v0.9.5.

The simplest way to install this class is to install SILE and verify it's working, then run:

sile -e 'installPackage("ftmlsile");os.exit()'

This will automatically grab the latest ftml-sile files and install them.

You can instead install the class manually. Copy the classes folder from this repository to your working folder, then SILE will look in that folder for the files it needs. If you run all your SILE FTML files from that working folder, everything should work fine.

If you want to process FTML files in different folders, then you will need to

  • Find your SILE installation folder
  • Copy the contents of the classes folder from this repository to the sile/classes folder in your SILE installation

These latter steps are unnecessary if you use the installPackage command.

Usage

sile -I ftml test.xml

where "ftml" is the SILE class (defined by ftml.lua and ftml.sil from the classes folder) and "test.xml" is the FTML input file. In this case the font used in the test is specified by the fontsrc element in the FTML input. Output is to a PDF file "test.pdf".

sile -e "SILE.scratch.ftmlfontlist={'Andika New Basic Italic','Andika New Basic Bold'}" -I ftml AndikaSample.xml

In this case -e is used to execute Lua code to initialize the list of fonts. Because there is no "." in the names, they are assumed to be installed fonts.

NB: When running this sample, you may get a message such as "! Error loading language vi: no support for this language". SILE is warning you that it doesn't have language support information (such as hyphenation rules) for Vietnamese (which is used in this example). The PDF output is created correctly and shows the way that multiple diacritics are displayed in Vietnamese text.

sile -e "SILE.scratch.ftmlfontlist={'Scheherazade-Regular.ttf'}" -I ftml ScheherazadeSample.xml

In this case -e is used to execute Lua code to initialize the list of fonts. Because there is a "." in the name, it is assumed to be the name of a font file.

Samples

The samples folder contains sample FTML files which can be processed with the command lines in the preceding section, assuming (for the first) that 'Andika New Basic Italic' and 'Andika New Basic Bold' fonts are installed and (for the second) that the file 'Scheherazade-Regular.ttf' (version 2.100) is present in the same folder as the FTML input. These fonts are available from https://software.sil.org/andika/download/ and https://software.sil.org/scheherazade/download/ respectively.

Known issues

The FTML background attribute, for both the testgroup and test elements, intended to change the background color, is not implemented.

The FTML em element is intended to allow a portion of the test string to be emphasized. This may not produce the desired result when used with a script such as Arabic.

At the moment Arabic script (and probably other right-to-left scripts) do not render correctly.

ftml-sile's People

Contributors

davidlrowe avatar mhosken avatar jvgaultney avatar

Stargazers

Caleb Maclennan avatar

Watchers

James Cloos avatar  avatar Alan Ward avatar Nicolas Spalinger avatar Tim Eves avatar  avatar  avatar  avatar Bob Hallissy avatar Lorna Evans avatar  avatar  avatar  avatar Jon Coblentz avatar Steven Dyk avatar  avatar

ftml-sile's Issues

Arabic rendering broken

Before being moved to the ftml-sile repository, this "ftml" sile class was originally in the github.com/silnrsi/ftml repository. The list of commits in that repository for branch master (https://github.com/silnrsi/ftml/commits/master) includes:

Commit bae34e0 (silnrsi/ftml@bae34e0)
Using the ftml.lua and ftml.sil files from this commit, page breaking doesn't work,
but the first line of Arabic text in ScheherazadeSample.xml displays correctly:
image
This line contains U+062A,space,U+062A,U+062A,U+062A to test the isolated, initial, medial and final forms of the Arabic character 'teh'.

To reproduce

  • use SILE 0.9.5.1
  • place the file ScheherazadeSample.xml (from the samples folder) in a working folder
  • place the file Scheherazade-Regular.ttf (downloaded from software.sil.org/scheherazade/download) in that working folder
  • create a subfolder named "classes"
  • place ftml.lua and ftml.sil in the "classes" subfolder
  • from a command prompt in the working folder, type sile -e "SILE.scratch.ftmlfontlist={'Scheherazade-Regular.ttf'}" -I ftml ScheherazadeSample.xml

Commit c3f751a (silnrsi/ftml@c3f751a)
The only file modified in this commit was ftml.lua. Using that file, page breaking works, but rendering of Arabic fails. The first line of Arabic text in ScheherazadeSample.xml displays incorrectly as:
image
The correct glyphs are chosen based on context (isolated, initial, medial, final) but they are output in left-to-right order rather than right-to-left order.

To reproduce, use the procedure above, but substitute the ftml.lua file from this commit for the one from the previous commit.

emphasized text breaks Arabic rendering

FTML supports the use of <em> element within a <string> element to mark a portion of the string to be emphasized. Currently if the <em> element is used in a string of Arabic characters (as in the third test in ScheherazadeSample.xml from the samples folder) the flow of text is interrupted and the isolated form is used (rather than initial, medial or final) as in the second line in this image. The text should instead appear as in the first line of the image, with the characters all joined, except that the one outlined in red should be emphasized.
image
(The first line in this image is from the second test in Scheherazade.xml, with no <em> element and shows the characters correctly joined. But currently this rendering is broken -- see #1.)

background attribute not implemented

The background attribute of the <test> element is not implemented.

NB: There is a background attribute for the <testgroup> element so that a default background can be specified for all the tests in a test group (unless individual tests override it with their own background attribute). This also is not implemented.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.