From Fedora Project Wiki

 
(8 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
please use the fonttosfnt tool to convert the font.
 
please use the fonttosfnt tool to convert the font.
  
== Take the Terminus font as example ==
+
== Details ==
 +
 
 +
Please install the latest package xorg-x11-font-utils and freetype-demos in Fedora 31.
 +
 
 +
We will use some python script to help the conversion.
 +
 
 +
URL: https://ndim.fedorapeople.org/stuff/bitmapfonts2otb/bitmapfonts2otb.py
 +
 
 +
Here are two ways to convert the fonts:
  
=== Steps ===
+
1. Convert one BDF/PCF font to one OTB font
1. Install fonttosfnt from the below Fedora copr
 
  
URL: https://copr.fedorainfracloud.org/coprs/pwu/fonttosfnt/
+
2. Combine the BDF/PCF fonts into one OTB font with the same family and style name
  
2. Convert the font with fonttosfnt
+
Currently we prefer the second method, but sometimes it will make
 +
the bitmap font not monospaced; if this problem happens,
 +
please try the first method.
  
$ fonttosfnt -b -g 2 -m 1 -o terminusn.otb ../terminus-fonts/ter-*n.pcf.gz
+
== Take the Terminus font as example ==
  
$ fonttosfnt -b -g 2 -m 1 -o terminusb.otb ../terminus-fonts/ter-*b.pcf.gz
+
=== Steps ===
 +
1. Install fonttosfnt and ftdump in Fedora 31
  
3. remove the terminus-fonts package and install the terminusn.otb and terminusb.otb fonts
+
2. Convert the font with bitmapfonts2otb.py
  
4. re-login the desktop and use the "Terminus" font
+
$ python3 bitmapfonts2otb.py ../terminus-fonts/ter-*.pcf.gz
  
=== Commands for the ucs-miscfixed-font font ===
+
3. remove the terminus-fonts package and install the Terminus.otb and Terminus-Bold.otb fonts
  
$ fonttosfnt -b -g 2 -m 1 -o ucs-miscfixed.otb /usr/share/fonts/ucs-miscfixed/[1-9]*[0-9].bdf
+
4. re-login the desktop and use the "Terminus" font
  
$ fonttosfnt -b -g 2 -m 1 -o ucs-miscfixed-bold.otb /usr/share/fonts/ucs-miscfixed/*B.bdf
+
=== Commands for the ucs-miscfixed-fonts font ===
  
$ fonttosfnt -b -g 2 -m 1 -o ucs-miscfixed-oblique.otb /usr/share/fonts/ucs-miscfixed/*O.bdf
+
<nowiki>
 +
$ for i in `ls ../ucs-miscfixed/*.bdf`;
 +
do fonttosfnt -v -b -c -g 2 -m 2 -o ${i%%.bdf}.otb $i;
 +
done
 +
</nowiki>
  
 
=== Commands for the terminus-fonts font ===
 
=== Commands for the terminus-fonts font ===
  
$fonttosfnt -b -g 2 -m 2 -o terminusn.otb /usr/share/fonts/terminus/ter-*n.pcf.gz
+
$ python3 bitmapfonts2otb.py ../terminus-fonts/ter-*.pcf.gz
 
 
$fonttosfnt -b -g 2 -m 2 -o terminusb.otb /usr/share/fonts/terminus/ter-*b.pcf.gz
 
  
 
=== Commands for the bitmap-lucida-typewriter-fonts font ===
 
=== Commands for the bitmap-lucida-typewriter-fonts font ===
  
$ fonttosfnt -b -g 2 -m 2 -o lucidab.otb ../bitmap-lucida-typewriter-fonts/lutBS*.pcf.gz
+
$ python3 bitmapfonts2otb.py ../bitmap-lucida-typewriter-fonts/lut*.pcf.gz
 
 
$ fonttosfnt -b -g 2 -m 2 -o lucidar.otb ../bitmap-lucida-typewriter-fonts/lutRS*.pcf.gz
 

Latest revision as of 03:33, 10 February 2020

How to convert Bitmap Font to OpenType Bitmap Font

In Fedora 31, pango is upgraded to 1.44 and switch to use harfbuzz.

In order to continue to use bitmap font with pango, please use the fonttosfnt tool to convert the font.

Details

Please install the latest package xorg-x11-font-utils and freetype-demos in Fedora 31.

We will use some python script to help the conversion.

URL: https://ndim.fedorapeople.org/stuff/bitmapfonts2otb/bitmapfonts2otb.py

Here are two ways to convert the fonts:

1. Convert one BDF/PCF font to one OTB font

2. Combine the BDF/PCF fonts into one OTB font with the same family and style name

Currently we prefer the second method, but sometimes it will make the bitmap font not monospaced; if this problem happens, please try the first method.

Take the Terminus font as example

Steps

1. Install fonttosfnt and ftdump in Fedora 31

2. Convert the font with bitmapfonts2otb.py

$ python3 bitmapfonts2otb.py ../terminus-fonts/ter-*.pcf.gz

3. remove the terminus-fonts package and install the Terminus.otb and Terminus-Bold.otb fonts

4. re-login the desktop and use the "Terminus" font

Commands for the ucs-miscfixed-fonts font

$ for i in `ls ../ucs-miscfixed/*.bdf`; do fonttosfnt -v -b -c -g 2 -m 2 -o ${i%%.bdf}.otb $i; done

Commands for the terminus-fonts font

$ python3 bitmapfonts2otb.py ../terminus-fonts/ter-*.pcf.gz

Commands for the bitmap-lucida-typewriter-fonts font

$ python3 bitmapfonts2otb.py ../bitmap-lucida-typewriter-fonts/lut*.pcf.gz