Author: cfinck Date: Tue Feb 5 22:31:05 2008 New Revision: 32145
URL: http://svn.reactos.org/svn/reactos?rev=32145&view=rev Log: - Move each VGA font file to a new "media/vgafonts" directory and convert all PSF fonts to BIN files. - Add a line to the autogenerated Makefile for Boot-CDs, which creates a "vgafonts.cab" file from the binary fonts at build time. - Change blue.sys to read the fonts from the "vgafonts.cab" file instead of the "vgafont.bin" (ZIP format) file. I dropped support for PSF fonts in blue.sys, because with the vgafontedit app, we can easily convert PSF fonts to BIN fonts now. If someone still needs this format in blue.sys, I can reimplement it.
Added: trunk/reactos/media/vgafonts/ trunk/reactos/media/vgafonts/737-8x8.bin (with props) trunk/reactos/media/vgafonts/775-8x8.bin (with props) trunk/reactos/media/vgafonts/850-8x8.bin (with props) trunk/reactos/media/vgafonts/852-8x8.bin (with props) trunk/reactos/media/vgafonts/865-8x8.bin (with props) trunk/reactos/media/vgafonts/866-8x8.bin (with props) trunk/reactos/media/vgafonts/readme.txt - copied unchanged from r32136, trunk/reactos/media/vgafont/readme.txt Removed: trunk/reactos/media/vgafont/ Modified: trunk/reactos/drivers/setup/blue/blue.h trunk/reactos/drivers/setup/blue/font.c trunk/reactos/media/media.rbuild trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: trunk/reactos/drivers/setup/blue/blue.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/setup/blue/blue.h?r... ============================================================================== --- trunk/reactos/drivers/setup/blue/blue.h (original) +++ trunk/reactos/drivers/setup/blue/blue.h Tue Feb 5 22:31:05 2008 @@ -7,8 +7,6 @@ */
/* DEFINITIONS ***************************************************************/ - -#define BUFFER_SIZE 260
#include <string.h> #include <stdio.h> @@ -20,20 +18,34 @@
#define TAG_BLUE TAG('B', 'L', 'U', 'E')
-#include <pshpack1.h> -typedef struct { - short Version; - short GeneralPurposeBitFlag; - short CompressionMethod; - short LastModFileTime; - short LastModFileDate; - int CRC32; - int CompressedSize; - int UncompressedSize; - short FileNameLength; - short ExtraFieldLength; -} ZIP_LOCAL_HEADER; -#include <poppack.h> +typedef struct _CFHEADER +{ + ULONG Signature; // File signature 'MSCF' (CAB_SIGNATURE) + ULONG Reserved1; // Reserved field + ULONG CabinetSize; // Cabinet file size + ULONG Reserved2; // Reserved field + ULONG FileTableOffset; // Offset of first CFFILE + ULONG Reserved3; // Reserved field + USHORT Version; // Cabinet version (CAB_VERSION) + USHORT FolderCount; // Number of folders + USHORT FileCount; // Number of files + USHORT Flags; // Cabinet flags (CAB_FLAG_*) + USHORT SetID; // Cabinet set id + USHORT CabinetNumber; // Zero-based cabinet number +} CFHEADER, *PCFHEADER; + +typedef struct _CFFILE +{ + ULONG FileSize; // Uncompressed file size in bytes + ULONG FileOffset; // Uncompressed offset of file in the folder + USHORT FileControlID; // File control ID (CAB_FILE_*) + USHORT FileDate; // File date stamp, as used by DOS + USHORT FileTime; // File time stamp, as used by DOS + USHORT Attributes; // File attributes (CAB_ATTRIB_*) + /* After this is the NULL terminated filename */ +} CFFILE, *PCFFILE; + +#define CAB_SIGNATURE 0x4643534D // "MSCF"
#define VIDMEM_BASE 0xb8000 #define BITPLANE_BASE 0xa0000
Modified: trunk/reactos/drivers/setup/blue/font.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/setup/blue/font.c?r... ============================================================================== --- trunk/reactos/drivers/setup/blue/font.c (original) +++ trunk/reactos/drivers/setup/blue/font.c Tue Feb 5 22:31:05 2008 @@ -43,7 +43,7 @@ Status = ExtractFont(CodePage, FontBitfield); if (NT_SUCCESS(Status)) LoadFont(Bitplane, FontBitfield); - + MmUnmapIoSpace(Bitplane, 0xFFFF); ExFreePool(FontBitfield);
@@ -56,27 +56,22 @@
NTSTATUS ExtractFont(UINT CodePage, PUCHAR FontBitField) { + BOOLEAN bFoundFile = FALSE; HANDLE Handle; - NTSTATUS Status = STATUS_SUCCESS; - CHAR FileHeader[5]; - CHAR Header[5]; - CHAR PsfHeader[3]; - CHAR FileName[BUFFER_SIZE]; - ULONG Length; + NTSTATUS Status; + CHAR FileName[20]; IO_STATUS_BLOCK IoStatusBlock; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING LinkName; UNICODE_STRING SourceName; - ZIP_LOCAL_HEADER LocalHeader; + CFHEADER CabFileHeader; + CFFILE CabFile; + ULONG CabFileOffset = 0; LARGE_INTEGER ByteOffset; WCHAR SourceBuffer[MAX_PATH] = {L'\0'};
if(KeGetCurrentIrql() != PASSIVE_LEVEL) - return STATUS_INVALID_DEVICE_STATE; - - RtlZeroMemory(FileHeader, sizeof(FileHeader)); - RtlZeroMemory(Header, sizeof(Header)); - RtlZeroMemory(PsfHeader, sizeof(PsfHeader)); + return STATUS_INVALID_DEVICE_STATE;
RtlInitUnicodeString(&LinkName, L"\SystemRoot"); @@ -100,10 +95,10 @@
Status = ZwQuerySymbolicLinkObject(Handle, &SourceName, - &Length); + NULL); ZwClose(Handle);
- Status = RtlAppendUnicodeToString(&SourceName, L"\vgafont.bin"); + Status = RtlAppendUnicodeToString(&SourceName, L"\vgafonts.cab"); InitializeObjectAttributes(&ObjectAttributes, &SourceName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL); @@ -118,82 +113,78 @@ NULL, 0);
ByteOffset.LowPart = ByteOffset.HighPart = 0; + if(NT_SUCCESS(Status)) { - sprintf(Header, "PK%c%c", 3, 4); Status = ZwReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, - FileHeader, 4, &ByteOffset, NULL); - ByteOffset.LowPart += 4; + &CabFileHeader, sizeof(CabFileHeader), &ByteOffset, NULL); + if(NT_SUCCESS(Status)) { - while(strcmp(FileHeader, Header) == 0) + if(CabFileHeader.Signature == CAB_SIGNATURE) { - Status = ZwReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, - &LocalHeader, sizeof(ZIP_LOCAL_HEADER), &ByteOffset, NULL); - ByteOffset.LowPart += sizeof(ZIP_LOCAL_HEADER); - /* DbgPrint("%ld\n", LocalHeader.FileNameLength); */ - if (LocalHeader.FileNameLength < BUFFER_SIZE) + // We have a valid CAB file! + // Read the file table now and decrement the file count on every file. When it's zero, we read the complete table. + ByteOffset.LowPart = CabFileHeader.FileTableOffset; + + while(CabFileHeader.FileCount) { - RtlZeroMemory(FileName, BUFFER_SIZE); Status = ZwReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, - FileName, LocalHeader.FileNameLength, &ByteOffset, NULL); - } - ByteOffset.LowPart += LocalHeader.FileNameLength; - /* DbgPrint("%s\n", FileName); */ - if (LocalHeader.ExtraFieldLength > 0) - ByteOffset.LowPart += LocalHeader.ExtraFieldLength; - if (atoi(FileName) == CodePage) - { - if (LocalHeader.CompressedSize == 2048) + &CabFile, sizeof(CabFile), &ByteOffset, NULL); + + if(NT_SUCCESS(Status)) { - /* we got it, raw font */ + ByteOffset.LowPart += sizeof(CabFile); + + // We assume here that the file name is max. 19 characters (+ 1 NULL character) long. + // This should be enough for our purpose. Status = ZwReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, - FontBitField, LocalHeader.CompressedSize, &ByteOffset, NULL); - ZwClose(Handle); - return STATUS_SUCCESS; - } - else if (LocalHeader.CompressedSize > 2048) - { - sprintf(PsfHeader, "%c%c", 0x36, 0x04); - /* maybe linux psf format */ - Status = ZwReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, - FileHeader, 4, &ByteOffset, NULL); - ByteOffset.LowPart += 4; - if(strncmp(FileHeader, PsfHeader, 2) == 0) + FileName, sizeof(FileName), &ByteOffset, NULL); + + if(NT_SUCCESS(Status)) { - /* only load fonts with a size of 8 - and filemode 0 (256 characters, no unicode_data) - or filemode 2 (256 characters, unicode_data is skipped) */ - if ((FileHeader[3] == 8) && ((FileHeader[4] == 0) || (FileHeader[4] == 2))) + if(!bFoundFile && atoi(FileName) == CodePage) { - Status = ZwReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, - FontBitField, 2048, &ByteOffset, NULL); - ZwClose(Handle); - return STATUS_SUCCESS; + // We got the correct file. + // Save the offset and loop through the rest of the file table to find the position, where the actual data starts. + CabFileOffset = CabFile.FileOffset; + bFoundFile = TRUE; } - else - DbgPrint("Wrong fontsize or too many characters"); + + ByteOffset.LowPart += strlen(FileName) + 1; } } - /* invalid data */ - ZwClose(Handle); - return STATUS_NO_MATCH; + + CabFileHeader.FileCount--; } - ByteOffset.LowPart += LocalHeader.CompressedSize; + + // 8 = Size of a CFFOLDER structure (see cabman). As we don't need the values of that structure, just increase the offset here. + ByteOffset.LowPart += 8; + ByteOffset.LowPart += CabFileOffset; + + // ByteOffset now contains the offset of the actual data, so we can read the RAW font Status = ZwReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, - FileHeader, 4, &ByteOffset, NULL); - ByteOffset.LowPart += 4; - /* DbgPrint("%s\n", FileHeader); */ + FontBitField, 2048, &ByteOffset, NULL); + ZwClose(Handle); + return STATUS_SUCCESS; + } + else + { + DPRINT1("Error: CAB signature is missing!\n"); + Status = STATUS_UNSUCCESSFUL; } } + else + DPRINT1("Error: Cannot read from file\n"); + ZwClose(Handle); + return Status; } else { - DbgPrint("Error: Can not open vgafont.bin\n"); + DPRINT1("Error: Cannot open vgafonts.cab\n"); return Status; } - return STATUS_NO_MATCH; }
/* Font-load specific funcs */
Modified: trunk/reactos/media/media.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/media.rbuild?rev=3214... ============================================================================== --- trunk/reactos/media/media.rbuild (original) +++ trunk/reactos/media/media.rbuild Tue Feb 5 22:31:05 2008 @@ -13,7 +13,4 @@ <directory name="nls"> <xi:include href="nls/nls.rbuild" /> </directory> - <directory name="vgafont"> - <xi:include href="vgafont/vgafont.rbuild" /> - </directory> </group>
Added: trunk/reactos/media/vgafonts/737-8x8.bin URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/vgafonts/737-8x8.bin?... ============================================================================== Binary file - no diff available.
Propchange: trunk/reactos/media/vgafonts/737-8x8.bin ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Added: trunk/reactos/media/vgafonts/775-8x8.bin URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/vgafonts/775-8x8.bin?... ============================================================================== Binary file - no diff available.
Propchange: trunk/reactos/media/vgafonts/775-8x8.bin ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Added: trunk/reactos/media/vgafonts/850-8x8.bin URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/vgafonts/850-8x8.bin?... ============================================================================== Binary file - no diff available.
Propchange: trunk/reactos/media/vgafonts/850-8x8.bin ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Added: trunk/reactos/media/vgafonts/852-8x8.bin URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/vgafonts/852-8x8.bin?... ============================================================================== Binary file - no diff available.
Propchange: trunk/reactos/media/vgafonts/852-8x8.bin ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Added: trunk/reactos/media/vgafonts/865-8x8.bin URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/vgafonts/865-8x8.bin?... ============================================================================== Binary file - no diff available.
Propchange: trunk/reactos/media/vgafonts/865-8x8.bin ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Added: trunk/reactos/media/vgafonts/866-8x8.bin URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/vgafonts/866-8x8.bin?... ============================================================================== Binary file - no diff available.
Propchange: trunk/reactos/media/vgafonts/866-8x8.bin ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/... ============================================================================== --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original) +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Tue Feb 5 22:31:05 2008 @@ -3851,6 +3851,13 @@ FileLocation reactosInf ( bootcdReactos.directory, bootcdReactos.relative_path, "reactos.inf" ); + FileLocation vgafontsCab( bootcdReactos.directory, + bootcdReactos.relative_path, + "vgafonts.cab"); + FileLocation vgafontsDir( SourceDirectory, + "media" + sSep + "vgafonts", + "" ); + vSourceFiles.push_back ( reactosDff );
string IsoName; @@ -3879,6 +3886,10 @@ cdFiles.c_str (), cdDirectories.c_str () ); fprintf ( fMakefile, "\t$(ECHO_CABMAN)\n" ); + fprintf ( fMakefile, + "\t$(Q)$(CABMAN_TARGET) -M raw -S %s %s\*.bin\n", // Escape the asterisk for Make + backend->GetFullName ( vgafontsCab ).c_str (), + backend->GetFullName ( vgafontsDir ).c_str ()); fprintf ( fMakefile, "\t$(Q)$(CABMAN_TARGET) -C %s -L %s -I -P $(OUTPUT)\n", backend->GetFullName ( reactosDff ).c_str (),