[kbd] Please support narrow no-break space (U+202F)

Nicolas Delvaux nicolas.delvaux at gmx.com
Thu Sep 2 23:50:03 UTC 2010



>  As a side-note to the request, you can change your local psfu fonts
> using psftools (from freshmeat if your distro doesn't supply it):
> txt2psf to reproduce the font in a text form ('-' for blank pixels,
> '#' for lit pixels),
> 
>  edit it to add more characters to the space glyph - e.g.
> 
> Unicode: [00000020];[000000a0];[0000202f];
> 
>  (to add U+202f to an existing U+00a0).
> 
>  and then txt2psf to convert the altered file to a psfu font.


I wrote a simple script from this which update all fonts.
This fix this bug for me and, as an extra bonus, it also implement most
Unicode spaces.

In the process I noticed that "Lat2-Terminus16.psfu" already supported
all spaces, except narrow no-break space.
I also noticed that some fonts have some duplicate mapping (eg.
"UniCyrExt_8x16.psf" have "Unicode: [00000020];[000000a0];[000000a0];")
My script cleans all those things.

You have to execute this script in the font directory (so from
"$KBD-SOURCE-DIR/data/consolefonts") and then you will find updated
fonts in "/tmp/psf".
Then you just have to replace old ones in the src-dir and make/make
install.


Here his the script: 

########################################
#!/usr/bin/env bash

DIR=/tmp/psf/txt
rm -rf /tmp/psf
mkdir -p $DIR

## For each font in the current folder...
for i in $( find . -regex '.*psfu?' -not -name "README*" | cut -c3- );
do
    ## Convert to txt
    psf2txt $i >> $DIR/$i.txt

## Match the Unicode line of the space glyph and replace it to support
all kind of Unicode spaces.
## Store the result in a '.edit' file.
    sed "/\[00000020\];/c\Unicode:
[00000020];[000000a0];[00002000];[00002001];[00002002];[00002003];[00002004];[00002005];[00002006];[00002007];[00002008];[00002009];[0000200a];[0000202f];" $DIR/$i.txt > $DIR/$i.edit

    ## Convert back to psf
    txt2psf $DIR/$i.edit > /tmp/psf/$i
done
## We did it! \o/
########################################

What are your thoughts?

Cheers,
Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.altlinux.org/pipermail/kbd/attachments/20100903/49783d74/attachment.html>


More information about the kbd mailing list