mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-22 15:23:23 +00:00
完成与Linux兼容的Ntty (#517)
* 已经完成的功能: - 写:printf能够正常在tty输出 - 读:与键盘驱动接上 - 信号: 能够正常通过ctrl向前台进程发送信号 * 支持目前的shell,改动printk使其与新版tty兼容。 * 删除原有tty文件夹,并更改新tty文件名 * 添加clear清屏程序 * 实现tty部分ioctl,更改部分问题
This commit is contained in:
49
kernel/src/libs/font/mod.rs
Normal file
49
kernel/src/libs/font/mod.rs
Normal file
@ -0,0 +1,49 @@
|
||||
use self::font_type::vga8x16::FONT_VGA_8X16;
|
||||
|
||||
pub mod font_type;
|
||||
|
||||
pub struct FontDesc {
|
||||
pub index: usize,
|
||||
pub name: &'static str,
|
||||
pub width: u32,
|
||||
pub height: u32,
|
||||
pub char_count: u32,
|
||||
pub data: &'static [u8],
|
||||
}
|
||||
|
||||
impl FontDesc {
|
||||
pub fn get_default_font(_xres: u32, _yres: u32, _font_w: u32, _font_h: u32) -> &'static Self {
|
||||
// todo: 目前先直接返回一个字体
|
||||
&FONT_VGA_8X16
|
||||
}
|
||||
|
||||
pub const DOUBLE_WIDTH_RANGE: &'static [(u32, u32)] = &[
|
||||
(0x1100, 0x115F),
|
||||
(0x2329, 0x232A),
|
||||
(0x2E80, 0x303E),
|
||||
(0x3040, 0xA4CF),
|
||||
(0xAC00, 0xD7A3),
|
||||
(0xF900, 0xFAFF),
|
||||
(0xFE10, 0xFE19),
|
||||
(0xFE30, 0xFE6F),
|
||||
(0xFF00, 0xFF60),
|
||||
(0xFFE0, 0xFFE6),
|
||||
(0x20000, 0x2FFFD),
|
||||
(0x30000, 0x3FFFD),
|
||||
];
|
||||
pub fn is_double_width(ch: u32) -> bool {
|
||||
if ch < Self::DOUBLE_WIDTH_RANGE.first().unwrap().0
|
||||
|| ch > Self::DOUBLE_WIDTH_RANGE.last().unwrap().1
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (first, last) in Self::DOUBLE_WIDTH_RANGE {
|
||||
if ch > *first && ch < *last {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user