Showing posts with label font. Show all posts
Showing posts with label font. Show all posts

Friday, October 13, 2017

[solved] diacritics/diuresis in linux

In Linux, we need the unicode number, and then convert it to hexidecimal. So for example, for ä, the unicode is 0228. Once converted to hex, it becomes 0e4.

To enter... 1) Ctrl-Shift simultaneously with the letter "u". That leaves an underlined "u" in the text. 2) type the last two or three digits of the hex code, eg...

á = 0e1
é = 0e9
ñ = 0f1
ä = 0e4
ö = 0f6
ü = 0fc
° = 0b0

...and 3) Enter or Spacebar.

chromium

Specific to Chromium, we often find Cyrillic or Chinese symbols are replaced by boxes. In such cases, we have to go to the evil Adobe empire. So, for example, for some of the Chinese fonts...

# pacman -S adobe-source-han-sans-otc-fonts

...but one simply needs to search on "adobe-source" and one will find their language. Close and reopen Chromium once complete.

Friday, November 11, 2016

Rebuilding Fonts

Fonts, printers, scanners, sound, and usb connected items: have a sense a humor if you intend to deal seriously with these in Linux.

Anyway, too often during an Arch update, there will be a conflict in the fonts, sometimes between already installed fonts and one intending to update itself through pacman. When this happens, the entire update of all packages can be scotched when pacman exits, or perhaps the user will be forced to deal with /etc/fonts/fonts.conf in some immediate way.

Arch uses fontconfig, so I sometimes solve these conflicts by deleting everything inside /etc/fonts/. Since /etc/fonts/font.conf is eliminated along with other files, any conflicts in /etc/fonts are eliminated and pacman can complete its update. However, after this nuclear method, fonts will be mangled. They cannot be repaired with a simple # fc-cache -vf. Even that action will spew errors that it can't find a /etc/fonts/font.conf file instead of running a subroutine that simply builds such a file. Programmers.

So, how to rebuild /etc/fonts/font.conf? Turns out there's a lot of information about how to edit /etc/fonts/font.conf , but no information about re-building it. The solution was only obtained via frustration after attempting various manually constructed versions of /etc/fonts/font.conf which failed:
# pacman -S fontconfig
That's right, the only thing that worked for me was to re-install the f**king package. Of course, I'm an idiot, but still. Also, be sure to explicitly update one's fonts after a pacman update, in case pacman left any hanging chads.
# fc-cache -fv
Alternatively, when one runs into a font problem, a person can exit their update noting the name of the font that is causing the problem, and then rerun the update excluding that font until one has determined the conflict.
# pacman -Syu --ignore font-foo

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"

Friday, January 24, 2014

Medieval Cyrillic fonts in LaTeX (or XeLaTeX)

Links: tfm font install :: ttf fonts available :: old bulgarian lcyw
Note: a short note about LibreOffice at bottom

The name of one of the intstalled (2021) LaTeX packages is fonts-churchslavonic. And there's a good explanation of how to implement it here: https://www.ctan.org/tex-archive/fonts/fonts-churchslavonic.Overall however, we'd want to write in Latin fonts, but then convert them in our markup. LaTeX does also contain some TTF utilities.

LaTeX - installed cyrillic fonts

LaTeX font files have an associated .tfm file. Find their directory by following the variable (TEXMFLOCAL) which points to it. The list of directories for various fonts is underneath it...
$ kpsewhich --var-value TEXMFLOCAL
$ ls ~/latex/2013/texmf-dist/fonts/tfm/
$ cd latex/2013/texmf-dist/doc/fonts/
Inside here, we can see most any of the codes we need for the \renewcommand{\sfdefault}{some code}\normalfont command. I don't know of any definitive listing of all of them, but some have Cyrillic characters and some don't, eg Cantarell has Cyrillics and its code is "fca". To switch to Cantarell
\renewcommand{\sfdefault}{fca}\normalfont
For proper line breaks, it's additionally good to point out "\textcyrillic{}", eg.
\textcyrillic{машина}
And of course code is needed at the top of the TEX document:
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}

pdflatex - packages


In a TexLive installation, Old Slavonic text pasted from this posting compiled in pdflatex with the following headers...
\documentclass[letterpaper]{article}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{mathtext}

\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,bulgarian,russian,ukrainian]{babel}
\begin{document}
Russian text block
\end{document}
...however T2A coding is not a solution because it produced mostly Ukrainian versions instead of OCS. Close, but no cigar. Substituting T2C did slightly better, for example with "theta", but otherwise mostly produced Serbian versions. X2 coding provided only one dot over the "I", and so on. So we were left with pieces of success, but mostly failure (with respect to OCS), in each option. Unless I've overlooking something, it's possible one would have to build their own glyphs to properly code the OCS using pdflatex. Further, we'd still have run T1 coding if we have English (latin alphabet) portions in the document.

pdflatex - take two

I decided to seek from an Old Bulgarian angle. A Macro was located here, which included an INS with the DTX.
$ kpsewhich --var-value TEXMFHOME
$ unzip lcwy.zip -d ~/texmf
$ texhash

xelatex - packages


Using xelatex, the following compiled...

\documentclass[letterpaper]{article}

\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}

\setmainfont{DejaVu Sans}

\begin{document}
Russian text block
\end{document}
... but produces a severe, sans-serif Ukrainian.

alphabetum


LibreOffice - ttf

For WYSIWYG, a partial solution is true-type fonts. We can obtain fonts here for some medieval slavic fonts. One researcher particularly liked "dilyan.ttf", and "BukyVede-Regular.ttf"; he said they were accurate except for lacking diacritics. I explained he could place TTF's into LibreOffice /usr/share/fonts or ~/.fonts, directory (I prefer ~./fonts); they were immediately available on his font list the next time he opened LibreOffice.

Saturday, November 23, 2013

fonts -- x11 core or xft?

In this wiki, and in this fellows reflection, we see possible advantages of xft over X11 core fonts. But most installations have a portion of both. So when to use one over the other, what commands are available to both, what is the easier or more reliable configuration path...and so on?