Sunday, December 21, 2014

Medieval Cyrllic (aka "Old Church Slavonic", "Old Bulgarian") fonts in LibreOffice

The only way I've seen this work is to take the TTF fonts created for Microsoft Word and adapt them. LibreOffice appears to require not only the TTF files, but also the associated AFM and PFB files. These cannot be created perfectly, but with font-forge, it's possible to produce versions of AFM and PFB which are reasonably close.
  1. Copy the TTF files into /home/foo/.fonts
  2. Open one of the TTF's in Font Forge
  3. Select "Generate Font", using the PFB option. An AFM will automatically be created
  4. Make sure all three versions of the file, TTF, AFM, and PFB files are in the /home/foo/.fonts
  5. Restart X
  6. Open LibreOffice -- the font should be in the font list
  7. Profit

locale issue

Full implementation of these fonts requires multi-byte encoding -- there are more than 256 glyphs available. This means of course dealing with locales. I don't like to use UTF-8 because, when encoding, it's inefficient. The best possible solution for a locale with these fonts appears to be "C". I checked my locale with the following (reports according to information in /etc/profile.d/locale.sh ). PAM (which I hate), apparently however stats /etc/environment. Plenty more can be read here.

$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
Or, one by one...
$ echo $LANG
C
$ echo $LC_CTYPE
C
The LC_ALL variable is one I've wanted to investigate more fully. For example, I was reading on Stack Exchange that LC_ALL can override the settings of the other variable settings.

manually updating locale variables
There are several programs which update locale settings. I prefer to hand edit configurations. The primary Arch file to customize these settings is /etc/locale.conf, which generally must be created. Other distros use /etc/default/locale. Alternatively, suppose I just wanted to set one or two of these variables? I'd likely export them to the kernel directly from ~.bashrc (as I do my TexLive path). Using LC_ALL as an example, and assuming a more intelligent user...
$ nano .bashrc
export LC_ALL="C"
Masochists or less intelligent users might want to use...
$ nano .bashrc
export LC_ALL="en_US.UTF-8"

No comments: