Bug 90082 - [syscons] [patch] curses ACS line graphics support for iso15 fonts
Summary: [syscons] [patch] curses ACS line graphics support for iso15 fonts
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-07 18:10 UTC by Oliver Fromme
Modified: 2018-05-20 23:57 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Fromme 2005-12-07 18:10:01 UTC
	Most users in western and central Europe use the
	"iso15" syscons fonts.  Those fonts don't contain
	the line drawing characters which are present in
	e.g. the cp437 fonts and are used by various
	console-based "GUI" programs, including sysinstall,
	the famous midnight commander and others.  Instead,
	simple ASCII characters such as "+" and "-" are
	used, which looks ugly.

	In the past years, a lot of users have complained
	about that problem (e.g. on the German BSD mailing
	lists; note that German requires an iso15 font).
	It was often mentioned that Linux does not suffer
	from the same problem.

	The fix below consists of a script that adds the
	missing characters to the existing iso15-8x*.fnt
	font files.  In conjunction with an appropriate
	termcap entry, the problem is solved.

Fix: 

The following script merges line drawing characters from
the cp437 fonts into the iso15 fonts.  The following
files are modified:

   iso15-8x8.fnt
   iso15-8x14.fnt
   iso15-8x16.fnt

The script must be run in a directory containing the
existing font files, i.e. either in

   /usr/share/syscons/fonts

or in the source tree:

   /usr/src/share/syscons/fonts

The new characters are placed in an unused range of the
iso15 fonts, beginning at position 128 (0x80).  All
existing characters are preserved, so the change should
be without any risk.

The "cons25l1" entry in the termcap must be changed
like this (and don't forget to rebuilt termcap.db with
cap_mkdb(1), and logout+login after the change so the
TERMCAP variable in your environment gets updated):

cons25l1|cons25-iso8859-1:\
	:ac=l\200m\201k\202j\203t\204u\205v\206w\207q\210x\211n\212`\213a\214f\260g\261~\267,\215+\216.\217-\220h\221i\2470\222y\223z\224{\225}\243:\
	:tc=cons25w:

Note:  The termcap source directory is /usr/src/share/termcap.

Here's the script to modify the fonts:

#!/bin/sh -

set -e

ACS_START=128
CP437_SRC="218 192 191 217 195 180 193 194 196 179 197
             4 176  27  26  25  24 177 219 243 242 227"

for H in 8 14 16; do

	CP437="cp437-8x$H"
	ISO15="iso15-8x$H"

	DD_ARGS="if=$CP437 of=$ISO15 bs=$H count=1 conv=notrunc"

	uudecode -p $CP437.fnt > $CP437
	uudecode -p $ISO15.fnt > $ISO15

	DST="$ACS_START"

	for SRC in $CP437_SRC; do
		dd $DD_ARGS skip=$SRC seek=$DST 2>/dev/null
		DST=$(( $DST + 1 ))
	done

	uuencode $ISO15 $ISO15 > $ISO15.fnt

	rm $CP437 $ISO15

done

#END.
How-To-Repeat: 
	Enable one of the "iso15" fonts (vidcontrol -l) and
	set TERM=cons25l1.  Then run sysinstall,midnight
	commander or any other curses based program that
	uses line drawing characters for window borders or
	similar.
Comment 1 olli 2005-12-07 20:47:33 UTC
Just a small addendum ...

1.  If you just want to test that stuff or play with it on
    your own machine:

    a.  Run the provided script as root in this directory:
        /usr/share/syscons/fonts
    b.  Activate the new fonts:
           vidcontrol -f iso15-8x8
           vidcontrol -f iso15-8x14
           vidcontrol -f iso15-8x16
    c.  Modify the "cons25l1" line in /usr/share/misc/termcap
        as explained in the PR above (i.e. update the "ac"
        capability line).
    d.  Update the termcap.db database file:
           cd /usr/share/misc; cap_mkdb termcap
    e.  Make sure that the "ttyv*" lines in /etc/ttys have
        "cons24l1" as the terminal type (the second-to-last
        character is a lower-case L, not the digit one).
        If you need to update /etc/ttys, type "kill -HUP 1"
        afterwards, so the init process will re-read it.
    f.  Log out and log in again (on a virtual terminal).

    Now run a curses-based program which uses line-drawing
    characters for window borders or similar, for example
    sysinstall or midnight commander.  You should see "real"
    graphical lines instead of "-" and "+" characters.
    Also, all ISO8859-15 characters still work, which you
    can easily test by typing "cat /usr/share/misc/latin1".

2.  If you want to incorporate the changes into the official
    FreeBSD repository (if you're a committer):

    a.  Run the provided script as root in this directory:
        /usr/src/share/syscons/fonts
    b.  The new iso15-8x*.fnt files don't contain the CVS ID
        lines.  Copy them from the original files.  Then
        check the modified files into the repository.  These
        are the modified files:
           iso15-8x8.fnt
           iso15-8x14.fnt
           iso15-8x16.fnt
    c.  Modify the "cons25l1" line in the termcap source
        file:  /usr/src/share/termcap/termcap.src, as
        explained in the PR above (i.e. update the "ac"
        capability line).

By the way, the same modification could be made to the
ISO8859-1 fonts (iso-8x*.fnt).  But I'm not sure if it's
worth it, because -1 isn't so widely used anymore, in
favour of -15 because it contains the Euro sign (among
few other changes).

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"And believe me, as a C++ programmer, I don't hesitate to question
the decisions of language designers.  After a decent amount of C++
exposure, Python's flaws seem ridiculously small." -- Ville Vainio
Comment 2 Martin Jakob 2006-01-09 21:35:22 UTC
I tried Olivers suggestions and they work very well. The programs (well,
sysinstall and mc) i tried now show the proper graphic elements.
Since i use the font "iso15-thin-8x16.fnt" i had to slightly change Olivers
script to add the proper chars from the font "cp437-thin-8x16.fnt":

--
#!/bin/sh -

set -e

ACS_START=128
CP437_SRC="218 192 191 217 195 180 193 194 196 179 197
             4 176  27  26  25  24 177 219 243 242 227"

for H in 16; do

        CP437="cp437-thin-8x$H"
        ISO15="iso15-thin-8x$H"

        DD_ARGS="if=$CP437 of=$ISO15 bs=$H count=1 conv=notrunc"

        uudecode -p $CP437.fnt > $CP437
        uudecode -p $ISO15.fnt > $ISO15

        DST="$ACS_START"

        for SRC in $CP437_SRC; do
                dd $DD_ARGS skip=$SRC seek=$DST 2>/dev/null
                DST=$(( $DST + 1 ))
        done

        uuencode $ISO15 $ISO15 > $ISO15.fnt

        rm $CP437 $ISO15

done

#END.
--

The resulting font works for me without a problem to.
It would be great, if these changes were commited, as there are often
questions about the linearts in german forums.

thanks

Martin
Comment 3 Matteo Riondato freebsd_committer 2006-01-29 18:28:17 UTC
Responsible Changed
From-To: freebsd-bugs->matteo

Take this as I'm interested
Comment 4 Matteo Riondato freebsd_committer 2006-04-19 16:11:56 UTC
Oliver,
I will be glad to commit your patches but I need to know what the
patch to termcap does. I see you added some "codes" but removed some
else. Can you please explain this modification a bit, so I can be sure
there are no problems?
Thanks!
Best Regards
-- 
Matteo Riondato
FreeBSD Committer (http://www.freebsd.org)
G.U.F.I. Staff Member (http://www.gufi.org)
FreeSBIE Developer (http://www.freesbie.org)
Comment 5 olli 2006-04-19 17:33:08 UTC
Matteo Riondato wrote:
 > I will be glad to commit your patches but I need to know what the
 > patch to termcap does. I see you added some "codes" but removed some
 > else. Can you please explain this modification a bit, so I can be sure
 > there are no problems?

First of all, thanks for looking at the PR that I submitted!

The termcap patch only changes the "ac" capability of the
cons25l1 entry (and its descendants).  The "ac" capability
specifies the character codes to use when in ACS mode (the
mode used for the frame and line drawing characters).

Unfortunately, the termcap(5) manpage isn't very verbose
on the whole issue -- I had to look up many things in the
source.  Let me try to explain ...

When an application (e.g. a curses-based program) wants to
output line drawing characters (e.g. for a window frame),
it enters ACS mode, then prints characters according to the
"ac" termcap capability, then exits ACS mode, returning to
the standard text font.  The "ac" capability consists of
pairs of characters:  The first character of each pair
means a certain symbol, e.g. "x" means a vertical line.
The second character is the code to output in ACS mode to
print that symbol.  For example, the pair "x\211" specifies
that the character with the decimal ASCII code 137 (that's
octal 211) should be used for vertical lines.

The following table is a complete list of such ACS symbols.

This is the meaning of the columns:

   - curses_name:  name of the symbol in curses/ncurses
                   (also see /usr/include/curses.h).
   - sym:  The ACS symbol name; that's the first character
           of each pair from the "ac" termcap capability.
   - cp437:  code of the symbol in CP437 font.
   - iso15:  code of the symbol in ISO8859-15 font (latin-9).
   - acs15:  code of the symbol in the new fonts that the
             script creates that I submitted with this PR.
             As you can see, if the symbol already exists
             in ISO8859-15, the same code is used.  If it
             doesn't exist, it is copied from the CP437 font
             to an unused position in the range 128-149.
   - description:  well, a description of the symbol.


curses_name    sym   cp437   iso15   acs15   description (* = not in cons25)
-----------    ---   -----   -----   -----   -----------
ACS_ULCORNER   'l'    218       -     128    upper left corner
ACS_LLCORNER   'm'    192       -     129    lower left corner
ACS_URCORNER   'k'    191       -     130    upper right corner
ACS_LRCORNER   'j'    217       -     131    lower right corner
ACS_LTEE       't'    195       -     132    tee pointing right
ACS_RTEE       'u'    180       -     133    tee pointing left
ACS_BTEE       'v'    193       -     134    tee pointing up
ACS_TTEE       'w'    194       -     135    tee pointing down
ACS_HLINE      'q'    196       -     136    horizontal line
ACS_VLINE      'x'    179       -     137    vertical line
ACS_PLUS       'n'    197       -     138    large plus or crossover
ACS_S1         'o'      -       -       -    scan line 1 (*)
ACS_S9         's'      -       -       -    scan line 9 (*)
ACS_DIAMOND    '`'      4       -     139    diamond
ACS_CKBOARD    'a'    176       -     140    checker board (stipple)
ACS_DEGREE     'f'    248     176     176    degree symbol
ACS_PLMINUS    'g'    241     177     177    plus/minus
ACS_BULLET     '~'    249     183     183    bullet
ACS_LARROW     ','     27       -     141    arrow pointing left (*)
ACS_RARROW     '+'     26       -     142    arrow pointing right (*)
ACS_DARROW     '.'     25       -     143    arrow pointing down
ACS_UARROW     '-'     24       -     144    arrow pointing up
ACS_BOARD      'h'    177       -     145    board of squares
ACS_LANTERN    'i'     21     167     167    lantern symbol
ACS_BLOCK      '0'    219       -     146    solid square block
ACS_S3         'p'      -       -       -    scan line 3 (*)
ACS_S7         'r'      -       -       -    scan line 7 (*)
ACS_LEQUAL     'y'    243       -     147    less/equal
ACS_GEQUAL     'z'    242       -     148    greater/equal
ACS_PI         '{'    227       -     149    Pi (*)
ACS_NEQUAL     '|'      -       -       -    not equal (*)
ACS_STERLING   '}'    156     163     163    UK pound sign (*)


Now look again at my termcap patch:

--- termcap.orig	Wed Apr 19 17:43:55 2006
+++ termcap	Wed Apr 19 17:44:22 2006
@@ -2520,7 +2520,7 @@
 	:li#60:tc=cons25l2-m:
 # ISO 8859-1 FreeBSD console with ACS support
 cons25l1|cons25-iso8859-1:\
-	:ac=f\260g\261}\243+\253,\273i\247:\
+       :ac=l\200m\201k\202j\203t\204u\205v\206w\207q\210x\211n\212`\213a\214f\260g\261~\267,\215+\216.\217-\220h\221i\2470\222y\223z\224{\225}\243:\
 	:tc=cons25w:
 cons25l1-m|cons25-iso8859-1-mono:\
 	:pa@:Co@:AF@:AB@:AX@:op@:us=\E[4m:ue=\E[24m:tc=cons25l1:

As you can see, the original cons25l1 entry specifies only
six special characters which are present in ISO8859-1 and
ISO8859-15.  My patch preserves four of them (degree symbol,
plus/minus symbol, pound symbol, and lantern symbol).  It
corrects the other two (arrow left, arrow right) which were
set to the '>>' and '<<' characters in the ISO fonts, but
the CP437 font contains real arrows, so my patch fixes that.

And of course, my patch adds a lot of additional symbols for
line drawing which are taken from the CP437 font.  Almost
all of the ACS symbols are now implemented.

Only five symbols are not implemented (various scan line
characters, and the not-equal symbol).  But they're not
present in any of the standard fonts, and I guess they're
not used by common applications.

If you have any questions, feel free to ask.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
Comment 6 Matteo Riondato freebsd_committer 2006-04-19 18:19:01 UTC
On Wed, Apr 19, 2006 at 06:33:08PM +0200, Oliver Fromme wrote:
> 
> Matteo Riondato wrote:
>  > I will be glad to commit your patches but I need to know what the
>  > patch to termcap does. I see you added some "codes" but removed some
>  > else. Can you please explain this modification a bit, so I can be sure
>  > there are no problems?
> 
> First of all, thanks for looking at the PR that I submitted!
> 
> If you have any questions, feel free to ask.

Now, that was an answer! Thanks for having been so clear. I understood
the changes and will commit the patches as soon as possible.
I'm sorry that it's a bit too late to see them in 6.1-RELEASE, but
I'll MFC then after the RELEASE. thanks!
Best Regards
-- 
Matteo Riondato
FreeBSD Committer (http://www.freebsd.org)
G.U.F.I. Staff Member (http://www.gufi.org)
FreeSBIE Developer (http://www.freesbie.org)
Comment 7 Matteo Riondato freebsd_committer 2006-04-30 10:17:15 UTC
State Changed
From-To: open->suspended

ISO-8859-15 does not specify ACS graphics support, so I cannot apply the patch to iso15-*.fnt . 
ache@ suggested to create a new font, like iso15+acs-*.fnt . I want to discuss this with him a bit, so mark this PR as suspended for the moment.
Comment 8 olli 2009-02-12 08:46:00 UTC
Hello Andrey, Hello Matteo,

I would like to revive PR bin/90082 which is currently
suspended for about 3 years.  The PR is about providing
proper ACS line drawing support for curses applications
on syscons with ISO-8859-15 fonts which are commonly used
in large parts of western and middle Europe.

At that time, the commit was backed out again because of
standards issues.  I understand and clearly accept that.

Still, it would be very good to have proper curses support
for ISO fonts on syscons.  This does work on Linux out of
the box, so FreeBSD looks pretty bad in comparison and is
often subject to laughter and evil remarks by Linux folks.

So, this is my question:  Would it be acceptable to modify
the patch, so it uses a different name for the fonts and
for the termcap entries?  I'm suggesting iso15+acs-*x*.fnt
for the fonts and cons*l1+acs for the termcap entries.

Would that be acceptable?  If not:  Do you have any other
suggestions to solve the problem?

Thank you very much for your help!

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

C++: "an octopus made by nailing extra legs onto a dog"
        -- Steve Taylor, 1998
Comment 9 Mark Linimon freebsd_committer freebsd_triage 2010-06-19 05:42:18 UTC
Responsible Changed
From-To: matteo->freebsd-bugs

Reset PR assigned to inactive committer. 

Hat:	gnats-admin
Comment 10 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:57:10 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"