浏览代码

o another linux console patch by Nikolay Nikolov:
* disabled linux VCSA output in UTF-8 mode, because it does not do any translation
and assumes that the font is cp437, or similar, which looks horrible on fonts
(like fedora's default latarcyrheb-sun16), which are designed only for unicode
support and have no similarity at all to cp437. We already can display all the
cp437 characters in UTF-8 mode (including the low 32 characters), in case the
font is cp437, and the UTF-8 translation provides better approximation (e.g.
for the line drawing characters) if the font is not cp437.
* do not "restore" the linux system font in SysDoneVideo in UTF-8 mode,
since we didn't change the font on startup
* added try_grab_vcsa to try harder to open VCSA in the linux IDE user
screen restore code. While VCSA is no longer needed in the video unit on
UTF-8 systems, the IDE still needs it, because it's the only way to provide
the "restore user screen" functionality on the linux virtual console.

git-svn-id: trunk@13726 -

florian 16 年之前
父节点
当前提交
07ef0c33df
共有 2 个文件被更改,包括 19 次插入3 次删除
  1. 10 0
      ide/fpusrscr.pas
  2. 9 3
      rtl/unix/video.pp

+ 10 - 0
ide/fpusrscr.pas

@@ -24,6 +24,9 @@ uses
 {$ifdef Unix}
   baseunix,
   termio,
+{$ifdef linux}
+  linuxvcs,
+{$endif}
 {$endif}
   video,Objects;
 
@@ -755,10 +758,17 @@ begin
           Case ThisTTY[9] of
             '0'..'9' :
               begin { running Linux on native console or native-emulation }
+{$ifdef linux}
                 FName:='/dev/vcsa' + ThisTTY[9];
                 TTYFd:=fpOpen(FName, &666, O_RdWr); { open console }
+                if TTYFd = -1 then
+                begin
+                  if try_grab_vcsa then
+                    TTYFd:=fpOpen(FName, &666, O_RdWr); { try again }
+                end;
                 If TTYFd <>-1 Then
                   Console:=ttyLinux;
+{$endif}
               end;
          'v'  :  { check for (Free?)BSD native}
                 If (ThisTTY[10]>='0') and (ThisTTY[10]<='9') Then

+ 9 - 3
rtl/unix/video.pp

@@ -1078,7 +1078,7 @@ begin
      if UTF8Enabled then
        external_codepage:=utf8;
    {$ifdef linux}
-     if vcs_device>=0 then
+     if (vcs_device>=0) and (external_codepage<>utf8) then
        begin
          str(vcs_device,s);
          fname:='/dev/vcsa'+s;
@@ -1231,8 +1231,14 @@ begin
        begin
          {Executed in case ttylinux is false (i.e. no vcsa), but
           TERM=linux.}
-         {Enable the character set set through setfont}
-         fpwrite(stdoutputhandle,font_custom,3);
+
+         { if we're in utf8 mode, we didn't change the font, so
+           no need to restore anything }
+         if external_codepage<>utf8 then
+         begin
+           {Enable the character set set through setfont}
+           fpwrite(stdoutputhandle,font_custom,3);
+         end;
        end;
 {$ifdef linux}
    end;