[comp.windows.x] Xterm font/character set question

lwv27@CAS.BITNET (Larry W. Virden ext. 2487) (05/23/91)

I am trying to figure out xterm's font handling.  In the various
docs that I have, there is a description of a series of escape
sequences which supposedly switch between various character sets
called G0-G3 .  Are these supposed to correspond to font 1-4 ?

When I run the following script (note that one line is changed from
the literal character 'escape' to a '^[' for mail purposes...)
I do not see what I expect - which is the current screen changing to
the various fonts.  Instead, when Esc(0 is issued the terminal
goes into a line drawing mode of the current window font.  )0, *0 and
+0 as well as all other sequences in the remaining
of the script go to the current alpha mode font.


There DOES appear to be an escape sequence which tells xterm to go
and set the current window to a specific font - Esc ] 50 ; {font name} ^G
but there is a problem - there does not appear to be a sequence to SAVE
OFF the current font name.  Thus, once you go to a font, you cannot
return to the previous without knowing where you were.  This makes
writing general purpose shell scripts who need to change the font
for some purpose rather annoying.

Anyways, anyone know what the G0-G4 stuff is SUPPOSED to do?


#! /bin/ksh

lst="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-|

escape='^['

for i in 0 A B ; do
        echo "$escape(B" ; echo Testing '(' $i
        echo "$escape($i"
        echo $lst
        read a
        echo "$escape(B" ; echo Testing ')' $i
        echo "$escape)$i"
        echo $lst
        read a
        echo "$escape(B" ; echo Testing '*' $i
        echo "$escape*$i"
        echo $lst
        read a
        echo "$escape(B" ; echo Testing '+' $i
        echo "$escape+$i"
        echo $lst
        read a
done

echo "$escape(B" ; echo Done Testing

echo "$escapeN" ; echo Testing N
        echo $lst
echo "$escape(B"
echo "$escapeO" ; echo Testing O
        echo $lst
echo "$escape(B"

echo "$escapen" ; echo Testing n
        echo $lst
echo "$escape(B"
echo "$escapeo" ; echo Testing o
        echo $lst
echo "$escape(B"
exit 1
--
Larry W. Virden                 UUCP: osu-cis!chemabs!lwv27
Same Mbox: BITNET: lwv27@cas    INET: lwv27%cas.BITNET@CUNYVM.CUNY.Edu
Personal: 674 Falls Place,   Reynoldsburg,OH 43068-1614
America Online: lvirden

ojohnbob@there.austin.ibm.com (05/24/91)

In article <9105231045.AA26084@cas.org> lwv27@CAS.BITNET (Larry W. Virden ext. 2487) writes:
>I am trying to figure out xterm's font handling.  In the various
>docs that I have, there is a description of a series of escape
>sequences which supposedly switch between various character sets
>called G0-G3 .  Are these supposed to correspond to font 1-4 ?
nope

>
>When I run the following script (note that one line is changed from
>the literal character 'escape' to a '^[' for mail purposes...)
>I do not see what I expect - which is the current screen changing to
>the various fonts.  Instead, when Esc(0 is issued the terminal
>goes into a line drawing mode of the current window font.  )0, *0 and
>+0 as well as all other sequences in the remaining
>of the script go to the current alpha mode font.
>
>...
>Anyways, anyone know what the G0-G4 stuff is SUPPOSED to do?
>...

One of those escape sequences is supposed to go to line drawing mode
and one of them changes the '#' to a UK pound sign.  If you have the
source to xterm look at dotext() in charproc.c.  ESC ( A = United Kingdom
set, ESC ( B = ASCII, ESC ( 0 = special graphics.

-john

john harvey
johnbob@innerdoor.austin.ibm.com
@cs.utexas.edu:ibmchs!there.austin.ibm.com!johnbob
uunet!cs.utexas.edu!ibmaus!auschs!there.austin.ibm.com!johnbob
I don't represent anyone.  I don't speak for anyone.  This message has not
been approved by U.S., Israeli, or Iraqi censors.
HOW COME YOU THINK SOMEONE IS YELLING AT YOU IF THEY USE ALL UPPER CASE
-- 
john harvey
johnbob@innerdoor.austin.ibm.com
johnbob@there.austin.ibm.com
@cs.utexas.edu:ibmchs!there.austin.ibm.com!johnbob

gildea@expo.lcs.mit.EDU (Stephen Gildea) (05/28/91)

    I am trying to figure out xterm's font handling.  In the various
    docs that I have, there is a description of a series of escape
    sequences which supposedly switch between various character sets
    called G0-G3 .  Are these supposed to correspond to font 1-4 ?
    
No.  Character sets are not the same as fonts.  Character sets specify
what characters are associated with what codes.  For example, ASCII is
the default character set used by xterm.

Fonts specify how the characters look.  For example, "fixed" is the
default font used by xterm.

Xterm supports three character sets and implements escape sequences to
switch between them.  See the document "Xterm Control Sequences."

G0-G3 can be thought of as graphics contexts.  You can select the
character set for Gn and then select which Gn is active.

Xterm also supports a default font and four alternate fonts, but it
does not implement escape sequences to switch between them.

 < Stephen
   MIT X Consortium