Monday 1 August 2022

Make 6x13 -Misc-Fixed font working on Ubuntu 22.04

This post is about installing and using the X windows font 6x13 -Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1 on Ubuntu 20.04

 In Ubuntu 22.04 jammy a new problem appeared, Pango insert a 2 pixels space between the lines, making the terminal windows height increase of 48 pixels (24 lines). I don't know if it is a problem in Pango  or a problem in the font definition. Anyway I was lucky to found a workaround, here it is.

The procedure is close to the one I found for Ubuntu 20.04 at https://super-unix.com/ubuntu/ubuntu-how-to-activate-bitmap-fonts-on-20-04/ that worked great for 18.04 and 20.04 but showed this 2pixel gap in 22.04.

At that time we had to enable bitmap font and convert the font into OpenType Bitmap (otb) format. For 22.04 we must also tweak the font definition by moving all the characters 2 pixels up, at the level of the baseline. There is no more part of the character, like for the letter "g" below the baseline. This could be a problem when mixing the font with other fonts, but this is never happening in a terminal!

First enable the bitmap font in Ubuntu:

sudo rm /etc/fonts/conf.d/70-no-bitmaps.conf
sudo ln -s ../conf.avail/70-force-bitmaps.conf /etc/fonts/conf.d/
sudo dpkg-reconfigure fontconfig-config
sudo dpkg-reconfigure fontconfig

Download the font in BDF format :

wget https://opensource.apple.com/source/X11fonts/X11fonts-14/font-misc-misc/font-misc-misc-1.1.2/6x13.bdf

Then you must tweak the font, first by modifying its font name and then by moving character above the baseline.

sed -i 's/FAMILY_NAME.*/FAMILY_NAME "MyFixedTwo"/' 6x13.bdf
sed -i 's/FONT_DESCENT 2/FONT_DESCENT 0/g' 6x13.bdf
sed -i 's/FONT_ASCENT 11/FONT_ASCENT 13/g' 6x13.bdf
sed -i 's/FONTBOUNDINGBOX 6 13 0 -2/FONTBOUNDINGBOX 6 13 0 0/g' 6x13.bdf
sed -i 's/BBX 6 13 0 -2/BBX 6 13 0 0/g' 6x13.bdf

Finally we must convert the BDF font into the OTB format using fonttosfnt. Unfortunately the version provided with Ubuntu 22.04 is buggy, we need to install the last version from github and compile it.

sudo apt-get install build-essential xfonts-utils pkg-config libfreetype-dev libfontenc-dev x11proto-core-dev
git clone https://gitlab.freedesktop.org/xorg/app/fonttosfnt.git
cd fonttosfnt
./autogen.sh
./configure
make
cd ..
fonttosfnt/fonttosfnt -b -c -g 2 -m 2 -o myfixedtwo.otb 6x13.bdf

Install the new otb font:

sudo cp myfixedtwo.otb /usr/local/share/fonts
sudo dpkg-reconfigure fontconfig-config
sudo dpkg-reconfigure fontconfig
fc-list | grep otb


Start app, choose font, search for "myfixedtwo".

Monday 20 June 2022

Make your Viewranger last on android

 The last version of Viewranger 10.11.72 force you to move to Outdoor Active.

It is possible to continue to use a bit longer your Viewranger account and maybe use your offline stuff forever.

  • First uninstall Viewranger (don't remove your data)
  • Install a older version of Viewranger. Look on google for "apkmirror viewranger 10.11.50" and try do download the 14.54 MB apk file. You have to agree with some warning ....
  • Install the apk. If you have some problem maybe the apkmirror app could help you
  • Don't start viewranger yet!
  • Open Google play store, search for viewanger, when you are on the page of viewranger, you must click on the viewranger icon on the left to go deeper in the viewranger page and get the menu button (the 3 dots) on the right. Click on it and disable automatic update.
After that I was able to start viewranger, sign in and does everything as before.
I expect to not be able to sign-in anymore in the future .