Loading ...
Sorry, an error occurred while loading the content.

83[jasspa] ISO accent weirdness (and fix)

Expand Messages
  • Thomas Hundt
    Oct 7, 1999
      ME exhibits some strange behavior surrounding iso-accents-mode.

      Displaying
      ----------
      We all know that not all the ISO (international) characters can be displayed in all the fonts. The TrueType fonts (e.g., Lucida Console) tend to have all the characters; the older system fonts (e.g., Fixedsys) do not. If the ISO characters are in your file, they'll usually appear as solid boxes. That's fine, as long as I know the character is there, I can hit Shift-F3 a couple of times (which I have mapped to a macro that switches fonts) and I'll be able to view it.

      Entry
      -----
      You can, at all times, enter these characters from the keyboard using the Windows keypad codes, e.g., an ö (umlauted o) is typed as Alt-0246 (the numbers must be typed on the numeric keypad, not the top of the keyboard). ß (sz) is typed as Alt-0223.

      ME has nifty features to make it easier to type these characters:

      ; Make accents available. "-a-esc-esc makes an ä
      iso-accents-mode
      !force global-bind-key iso-accents-expand "esc esc"

      This enables typing of the above characters as " o esc esc for the ö and s z esc esc for the ß. (The spaces I put in there for clarity. You're really typing "o and then hitting esc twice.)

      Problem
      -------
      Most of these shortcuts just plain don't work. For example, sz *never* works. "o *always* works. The ones that don't work put in some other strange-valued character.

      The code is in abbrev.emf (not in langutl -- docsbug!). The tables look right to me (lists of the abbreviations and of the replacement characters). Something in the guts of the program is failing to map the proper character.

      After some messing around, I found that you have to comment out the line
      ;; 0 set-char-mask "L" ; FIX
      and everything becomes groovy.

      Perhaps I'm doing something wrong (char-mask? not sure what that is) when I switch fonts. That code is below, after the routine that has the line above.

      These lists could stand to be augmented to include characters like the German quotes that look like << and >> (I'm too lazy to look up the code right now). I'll probably get around to this one of these days.


      -Th


      [from abbrevs.emf]
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ; iso-accents-expand routines

      define-macro iso-accents-expand
      !if ¬ &set #l0 &lfind "|+-|12|14|34|ae|AE|`a|^a|'a|\"a|~a|.a|co|`e|^e|'e|\"e|`i|^i|'i|\"i|~n|oe|`o|^o|'o|\"o|~o|/o|rg|sz|tm|`u|^u|'u|\"u|\"y|'y|`A|^A|'A|\"A|~A|.A|`E|^E|'E|\"E|`I|^I|'I|\"I|~N|OE|`O|^O|'O|\"O|~O|/O|`U|^U|'U|\"U|\"Y|'Y|^!|^?|" &mid @wl &sub $window-col 2 2
      !abort
      !endif
      ;; ml-write &spr "found %s at %s" &mid @wl &sub $window-col 2 2 #l0
      backward-delete-char
      backward-delete-char
      set-variable #l0 &lget "|±|½|¼|¾|æ|Æ|à|â|á|ä|ã|å|©|è|ê|é|ë|ì|î|í|ï|ñ|œ|ò|ô|ó|ö|õ|ø|®|ß|™|ù|û|ú|ü|ÿ|ý|À|Â|Á|Ä|Ã|Å|È|Ê|É|Ë|Ì|Î|Í|Ï|Ñ|Œ|Ò|Ô|Ó|Ö|Õ|Ø|Ù|Û|Ú|Ü|Ÿ|Ý|¡|¿|" #l0
      ;; ml-write &spr "the new char is %d %s" #l0 #l0
      ;; 0 set-char-mask "L" ; FIX
      !if &set #l1 &sin #l0 $result
      0 set-char-mask "U"
      set-variable #l0 &mid $result #l1 1
      !endif
      insert-string #l0
      !emacro




      Here is my code to switch fonts: [thundt.emf]
      ;------------------------------------------------------------
      ; cycle-font: cycles through font sizes
      ;------------------------------------------------------------
      define-macro cycle-font
      !if &seq %os "mswin"
      ; change-font "name" charSet weight width height
      set-variable %font-number &mod &add %font-number 1 7
      !if &equ %font-number 1
      1 change-font "Lucida Console" 1 0 0 15
      ml-write "[font Lucida Console 15]"
      !elif &equ %font-number 2
      1 change-font "Lucida Console" 1 0 0 12
      ml-write "[font Lucida Console 12]"
      !elif &equ %font-number 3
      1 change-font "Lucida Console" 1 0 0 11
      ml-write "[font Lucida Console 11]"
      !elif &equ %font-number 4
      1 change-font "vt100" 1 0 0 16
      ml-write "[font vt100 16]"
      !elif &equ %font-number 5
      1 change-font "vt100" 1 0 0 10
      ml-write "[font vt100 14]"
      !elif &equ %font-number 6
      1 change-font "vt100" 1 0 0 12
      ml-write "[font vt100 12]"
      !else
      1 change-font "Fixedsys" 1 0 0 15 ; used in my mewin
      ml-write "[font Fixedsys]"
      !endif
      !elif &seq %os "unix"
      set-variable %font-number &mod &add %font-number 1 6
      !if &equ %font-number 1
      1 change-font "6x10"
      ml-write "[font 6x10]"
      !elif &equ %font-number 2
      1 change-font "7x13"
      ml-write "[font 7x13]"
      !elif &equ %font-number 3
      1 change-font "8x13"
      ml-write "[font 8x13]"
      !elif &equ %font-number 4
      1 change-font "9x15"
      ml-write "[font 9x15]"
      !elif &equ %font-number 5
      1 change-font "10x20"
      ml-write "[font 10x20]"
      !else
      1 change-font "-b&h-*-bold-r-*-*-14-*-72-72-m-*-*-*"
      ml-write "[font -b&h-*-bold-r-*-*-14-*-72-72-m-*-*-*]"
      !endif
      !else
      ml-write "[No fonts available for this platform]"
      !endif ; unix


      !emacro
      global-bind-key cycle-font S-f3
    • Show all 2 messages in this topic