mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
[BLUE] Add an IOCTL to directly choose which font to use (instead of codepage)
This commit is contained in:
parent
d5f0b2b160
commit
aaa416d36a
4 changed files with 75 additions and 2 deletions
|
@ -38,6 +38,7 @@ typedef struct _DEVICE_EXTENSION
|
|||
USHORT Rows; /* Number of rows */
|
||||
USHORT Columns; /* Number of columns */
|
||||
USHORT CursorX, CursorY; /* Cursor position */
|
||||
PUCHAR FontBitfield; /* Specifies the font. If NULL, use CodePage */
|
||||
ULONG CodePage; /* Specifies the font associated to this code page */
|
||||
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
||||
|
||||
|
@ -483,8 +484,15 @@ ScrAcquireOwnership(
|
|||
// DeviceExtension->CursorX = min(max(DeviceExtension->CursorX, 0), DeviceExtension->Columns - 1);
|
||||
DeviceExtension->CursorY = min(max(DeviceExtension->CursorY, 0), DeviceExtension->Rows - 1);
|
||||
|
||||
/* Upload a default font for the current codepage */
|
||||
ScrLoadFontTable(DeviceExtension->CodePage);
|
||||
if (DeviceExtension->FontBitfield)
|
||||
{
|
||||
ScrSetFont(DeviceExtension->FontBitfield);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Upload a default font for the current codepage */
|
||||
ScrLoadFontTable(DeviceExtension->CodePage);
|
||||
}
|
||||
|
||||
DPRINT("%d Columns %d Rows %d Scanlines\n",
|
||||
DeviceExtension->Columns,
|
||||
|
@ -511,6 +519,12 @@ ScrResetScreen(
|
|||
DeviceExtension->CursorSize = 5; /* FIXME: value correct?? */
|
||||
DeviceExtension->CursorVisible = TRUE;
|
||||
|
||||
if (DeviceExtension->FontBitfield)
|
||||
{
|
||||
ExFreePoolWithTag(DeviceExtension->FontBitfield, TAG_BLUE);
|
||||
DeviceExtension->FontBitfield = NULL;
|
||||
}
|
||||
|
||||
/* More initialization */
|
||||
DeviceExtension->CharAttribute = BACKGROUND_BLUE | FOREGROUND_LIGHTGRAY;
|
||||
DeviceExtension->Mode = ENABLE_PROCESSED_OUTPUT |
|
||||
|
@ -1496,6 +1510,11 @@ ScrIoControl(
|
|||
}
|
||||
ASSERT(Irp->AssociatedIrp.SystemBuffer);
|
||||
|
||||
if (DeviceExtension->FontBitfield)
|
||||
{
|
||||
ExFreePoolWithTag(DeviceExtension->FontBitfield, TAG_BLUE);
|
||||
DeviceExtension->FontBitfield = NULL;
|
||||
}
|
||||
DeviceExtension->CodePage = *(PULONG)Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
/* Upload a font for the codepage if needed */
|
||||
|
@ -1507,6 +1526,36 @@ ScrIoControl(
|
|||
break;
|
||||
}
|
||||
|
||||
case IOCTL_CONSOLE_SETFONT:
|
||||
{
|
||||
/* Validate input buffer */
|
||||
if (stk->Parameters.DeviceIoControl.InputBufferLength < 256 * 8)
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
ASSERT(Irp->AssociatedIrp.SystemBuffer);
|
||||
|
||||
DeviceExtension->CodePage = 0;
|
||||
if (DeviceExtension->FontBitfield)
|
||||
ExFreePoolWithTag(DeviceExtension->FontBitfield, TAG_BLUE);
|
||||
DeviceExtension->FontBitfield = ExAllocatePoolWithTag(NonPagedPool, 256 * 8, TAG_BLUE);
|
||||
if (!DeviceExtension->FontBitfield)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
RtlCopyMemory(DeviceExtension->FontBitfield, Irp->AssociatedIrp.SystemBuffer, 256 * 8);
|
||||
|
||||
/* Upload the font if needed */
|
||||
if (DeviceExtension->Enabled && DeviceExtension->VideoMemory)
|
||||
ScrSetFont(DeviceExtension->FontBitfield);
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -145,5 +145,6 @@ typedef struct _CFFILE
|
|||
#define PELDATA (PUCHAR)0x3c9
|
||||
|
||||
VOID ScrLoadFontTable(_In_ ULONG CodePage);
|
||||
VOID ScrSetFont(_In_ PUCHAR FontBitfield);
|
||||
|
||||
#endif /* _BLUE_PCH_ */
|
||||
|
|
|
@ -62,6 +62,28 @@ ScrLoadFontTable(
|
|||
CloseBitPlane();
|
||||
}
|
||||
|
||||
VOID
|
||||
ScrSetFont(
|
||||
_In_ PUCHAR FontBitfield)
|
||||
{
|
||||
PHYSICAL_ADDRESS BaseAddress;
|
||||
PUCHAR Bitplane;
|
||||
|
||||
/* open bit plane for font table access */
|
||||
OpenBitPlane();
|
||||
|
||||
/* get pointer to video memory */
|
||||
BaseAddress.QuadPart = BITPLANE_BASE;
|
||||
Bitplane = (PUCHAR)MmMapIoSpace(BaseAddress, 0xFFFF, MmNonCached);
|
||||
|
||||
LoadFont(Bitplane, FontBitfield);
|
||||
|
||||
MmUnmapIoSpace(Bitplane, 0xFFFF);
|
||||
|
||||
/* close bit plane */
|
||||
CloseBitPlane();
|
||||
}
|
||||
|
||||
/* PRIVATE FUNCTIONS *********************************************************/
|
||||
|
||||
NTSTATUS
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define IOCTL_CONSOLE_DRAW CTL_CODE(FILE_DEVICE_SCREEN, 0x830, METHOD_IN_DIRECT, FILE_WRITE_ACCESS)
|
||||
|
||||
#define IOCTL_CONSOLE_LOADFONT CTL_CODE(FILE_DEVICE_SCREEN, 0x840, METHOD_IN_DIRECT, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONSOLE_SETFONT CTL_CODE(FILE_DEVICE_SCREEN, 0x841, METHOD_IN_DIRECT, FILE_WRITE_ACCESS)
|
||||
|
||||
/* TYPEDEFS **************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in a new issue