/
usr
/
share
/
doc
/
kbd
/
/usr/share/doc/kbd
mkdir
upload
Name
Size
Mode
Actions
ANSI-dvorak.gif
3808
0644
edit
dl
rm
AUTHORS
741
0644
edit
dl
rm
ChangeLog
16581
0644
edit
dl
rm
COPYING
1994
0644
edit
dl
rm
dvorak-l.xmodmap
2333
0644
edit
dl
rm
dvorak-r.xmodmap
2338
0644
edit
dl
rm
dvorak.diffs
1407
0644
edit
dl
rm
dvorak.txt
1164
0644
edit
dl
rm
dvorak.xmodmap
2157
0644
edit
dl
rm
font-formats-1.html
5482
0644
edit
dl
rm
font-formats-2.html
1479
0644
edit
dl
rm
font-formats-3.html
7007
0644
edit
dl
rm
font-formats-4.html
2198
0644
edit
dl
rm
font-formats-5.html
517
0644
edit
dl
rm
font-formats.html
1317
0644
edit
dl
rm
kbd.FAQ-1.html
4184
0644
edit
dl
rm
kbd.FAQ-2.html
2995
0644
edit
dl
rm
kbd.FAQ-3.html
2106
0644
edit
dl
rm
kbd.FAQ-4.html
7861
0644
edit
dl
rm
kbd.FAQ-5.html
17271
0644
edit
dl
rm
kbd.FAQ-6.html
2745
0644
edit
dl
rm
kbd.FAQ-7.html
5710
0644
edit
dl
rm
kbd.FAQ-8.html
9412
0644
edit
dl
rm
kbd.FAQ-9.html
2606
0644
edit
dl
rm
kbd.FAQ-10.html
2644
0644
edit
dl
rm
kbd.FAQ-11.html
2248
0644
edit
dl
rm
kbd.FAQ-12.html
8211
0644
edit
dl
rm
kbd.FAQ-13.html
4493
0644
edit
dl
rm
kbd.FAQ-14.html
3474
0644
edit
dl
rm
kbd.FAQ-15.html
6918
0644
edit
dl
rm
kbd.FAQ-16.html
3019
0644
edit
dl
rm
kbd.FAQ-17.html
1715
0644
edit
dl
rm
kbd.FAQ-18.html
2522
0644
edit
dl
rm
kbd.FAQ-19.html
1349
0644
edit
dl
rm
kbd.FAQ-20.html
1724
0644
edit
dl
rm
kbd.FAQ-21.html
1711
0644
edit
dl
rm
kbd.FAQ-22.html
2433
0644
edit
dl
rm
kbd.FAQ-23.html
965
0644
edit
dl
rm
kbd.FAQ.html
5228
0644
edit
dl
rm
README
830
0644
edit
dl
rm
utfdemo
4250
0644
edit
dl
rm
utflist
25698
0644
edit
dl
rm
Edit:
/usr/share/doc/kbd/font-formats-3.html
(7007B)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>Font-formats recognized by the Linux kbd package: CPI fonts</TITLE> <LINK HREF="font-formats-4.html" REL=next> <LINK HREF="font-formats-2.html" REL=previous> <LINK HREF="font-formats.html#toc3" REL=contents> </HEAD> <BODY> <A HREF="font-formats-4.html">Next</A> <A HREF="font-formats-2.html">Previous</A> <A HREF="font-formats.html#toc3">Contents</A> <HR> <H2><A NAME="s3">3. CPI fonts</A></H2> <P>In the DOS world screen or printer fonts come in <I>Code Page Information</I> format. There are two versions: the MS-DOS/PC-DOS "FONT" format, and the DR-DOS/Novell DOS "DRFONT" compressed format. These <CODE>*.CPI</CODE> files may contain fonts for several code pages, and, given a code page, for several point sizes. MS-DOS files usually have 16x8, 14x8, 8x8 fonts, while DR-DOS files often have 6x8, 8x8, 14x8, 16x8 fonts (in this order). Printer .CPI files have only one font. <P>(One sometimes encounters entirely different <CODE>.cpi</CODE> files, namely Unix <CODE>.cpio</CODE> files moved to a DOS machine with 8.3 filenames. Such files are archives.) <P>The files in "FONT" format have the following layout. First a 23-byte header. <BLOCKQUOTE><CODE> <PRE> struct { char id0; /* 0: 0xff */ char id[7]; /* 1-7: "FONT " */ char reserved[8]; /* 8-15: 0 */ short pnum; /* 16-17: number of pointers: 1 */ char ptyp; /* 18: type of pointers: 1 */ long fih_offset; /* 19-22: file offset of FontInfoHeader: 0x17 */ } FontFileHeader; /* 0-22 */ </PRE> </CODE></BLOCKQUOTE> <P>(Files in "DRFONT compressed format" have 0x7f "DRFONT " in bytes 0-7. After this FontFileHeader they have an extended header <BLOCKQUOTE><CODE> <PRE> struct { char num_fonts_per_codepage; /* 23: N=4 */ char font_height[N]; /* 24-27: height of each font */ long dfd_offset[N]; /* 28-43: file offsets of DisplayFontData */ } DRDOSExtendedFontFileHeader; </PRE> </CODE></BLOCKQUOTE> and consequently <CODE>fih_offset</CODE> will be 44 (0x2c) instead of 23 (0x17).) <P>Next a 2-byte header that tells how many code pages this file contains. <BLOCKQUOTE><CODE> <PRE> struct { short num_codepages; } FontInfoHeader; /* 23-24 */ </PRE> </CODE></BLOCKQUOTE> <P>Next the indicated number of code pages. Each code page has a header and font data. In some files all headers come first and then all font data. In other files headers and font data alternate, that is, data for one code page is kept together. The code page header (the offsets given are for the first occurrence): <BLOCKQUOTE><CODE> <PRE> struct { short cpeh_size; /* 25-26: size of this header: 28 */ long next_cpeh_offset; /* 27-30: offset of next header; 0 or -1 for last */ short device_type; /* 31-32: 1: screen, 2: printer */ char device_name[8]; /* 33-40: e.g. "EGA " */ short codepage; /* 41-42: 0, 437, 737, 85[0257], 86[013569], ... */ char reserved[6]; /* 43-48: 0 */ long cpih_offset; /* 49-52: pointer to CPInfoHeader or 0 */ } CPEntryHeader; /* 25-52 */ </PRE> </CODE></BLOCKQUOTE> <P>MS-DOS and PC-DOS sometimes have 26 instead of 28 for the <CODE>cpeh_size</CODE> field in printer font files; one even meets both 26 and 28 in the same file. Probably there is confusion over whether <CODE>cpih_offset</CODE> is short or long. When headers and fonts are interspersed, <CODE>next_cpeh_offset</CODE> will point past the font, regardless of whether more entries follow. When first all headers are given, <CODE>next_cpeh_offset</CODE> is zero in the last header. It happens that <CODE>next_cpeh_offset</CODE> does not point to the next header, but to the one after that, or that it is zero while still one header follows. In such cases <CODE>num_codepages</CODE> gives the correct number of headers. (In the cases where it is zero while still one header follows, the last header is a dummy one, for codepage 0 and with no associated font.) Early DR-DOS printer font files have 1 instead of 2 in <CODE>device_type</CODE>. Device names include "EGA ", "LCD " for screen, and "4201 ", "4208 ", "5202 ", "1050 ", "EPS ", "PPDS " for printer devices. <P>A code page font starts with a general header: <BLOCKQUOTE><CODE> <PRE> struct { short version; /* 53-54: 1: FONT, 2: DRFONT */ short num_fonts; /* 55-56 */ short size; /* 57-58: length of font data for each font */ } CPInfoHeader; /* 53-58 */ </PRE> </CODE></BLOCKQUOTE> <P>(For printer fonts <CODE>num_fonts</CODE> is 1 or 2, while only a single font follows. For screen fonts <CODE>num_fonts</CODE> is 1, 3 or 4. DRFONT files have in the <CODE>size</CODE> field the size (24) of the DRFONT header without the index table.) <P>And then for each font a header followed by the actual data. For screen fonts <BLOCKQUOTE><CODE> <PRE> struct { char height; /* 59: one of 6, 8, 14, 16 */ char width; /* 60: 8 */ short reserved; /* 61-62: 0 */ short num_chars; /* 63-64: 256 */ } ScreenFontHeader; /* 59-64 */ </PRE> </CODE></BLOCKQUOTE> and for printer fonts <BLOCKQUOTE><CODE> <PRE> struct { short printer_type; /* 59-60: 1=4201/1050/EPS, 2=5202/4208/PPDS */ short seqlength; /* 61-62: length of escape sequences */ } PrinterFontHeader; /* 59-62 */ </PRE> </CODE></BLOCKQUOTE> followed by two escape sequences of the indicated length to select the hardware codepage or the downloaded codepage. <P>However, in DRFONT files the CPInfoHeader is followed by the DRFONT header, consisting first of 4 ScreenFontHeaders, one for each point size, and then an index indicating where in the font bitmap the corresponding characters can be found. <BLOCKQUOTE><CODE> <PRE> struct { struct ScreenFontHeader sfh[4]; short FontIndex[256]; } DRFONTheader; </PRE> </CODE></BLOCKQUOTE> The font index is some integer, in the range 0-400 or so, indicating where in the font this code position can be found. In this way the font data is separated from the code used. <P> <H2><A NAME="ss3.1">3.1 Linux use</A> </H2> <P>Linux does not accept <CODE>.CPI</CODE> files, but the <CODE>codepage</CODE> utility from the kbd package is willing to read <CODE>.CPI</CODE> files of "FONT" type, and output <CODE>.cp</CODE> files suitable for <CODE>setfont</CODE>. For example, the call <CODE>codepage -a iso.cpi</CODE> will create ten font files <CODE>850.cp</CODE>, <CODE>437.cp</CODE>, ..., <CODE>869.cp</CODE> each containing a single font of pointsize 16, and <CODE>codepage -a ega2.cpi</CODE> six font files <CODE>850.cp</CODE>, ..., <CODE>737.cp</CODE> each containing three fonts of pointsizes 8, 14, 16. <P> <HR> <A HREF="font-formats-4.html">Next</A> <A HREF="font-formats-2.html">Previous</A> <A HREF="font-formats.html#toc3">Contents</A> </BODY> </HTML>
Save
cmd:
run