Add files to help manage the (vga) syscons mouse cursor.

To mostly fix distortion of mouse cursors by non-square pixels, I
needed 8 variants of the same cursor shape for large fonts and
another 7 variants for small fonts.  Some variants are shared,
leaving only 13 variants in 26 glyphs altogether.  Keep these in
the BDF source file cursor.bdf.  cursor.bdf has another 5 unused
experimental cursors in 10 glyphs.  cursor.awk is a simple awk
script for converting this and similar bdf files into C declarations
for copying into scvgarndr.c.  syscons doesn't use any of this yet.
This commit is contained in:
Bruce Evans 2017-07-08 15:01:55 +00:00
parent f2c18deb0e
commit aa24f48b36
2 changed files with 935 additions and 0 deletions

View File

@ -0,0 +1,48 @@
# $FreeBSD$
#
# awk script to convert a bdf file to C declarations in a form specialized
# for the mouse cursors in syscons/scvgarndr.c. Usage:
# awk -f thisfile < file.bdf < file.c
# The accompanying syscons mouse cursor bdf file has specialized comments
# which this script converts to details in the C declarations.
# This is not a general conversion utility, but produces reasonable output
# if the input is for a monospaced font of size between 9x16 and 16x16.
/^COMMENT cn.*mouse/ {
gsub("[(),]", "")
i = index($3, "-")
n = substr($3, 1, i - 1)
name[n] = $4
i = index($4, "e")
j = index($4, "x")
k = index($4, "_")
width[n] = substr($4, i + 1, j - i - 1)
height[n] = substr($4, j + 1, k - j - 1)
baspect[n] = $6
iaspect[n] = $8
}
state == 0 && /^STARTCHAR/ {
n = substr($2, 5)
printf("static const struct mousedata %s = { {\n\t", name[n])
state = 1
}
state >= 1 && state < 7 || state >= 7 + 16 && state < 7 + 16 + 7 {
state++
next
}
state >= 7 && state < 7 + 16 || state >= 7 + 16 + 7 && state < 7 + 16 + 7 +16 {
printf("0x%s,", $1)
if (state == 7 + 7 || state == 7 + 16 + 7 + 7)
printf("\n\t")
else if (state == 7 + 15)
printf(" }, {\n\t")
else if (state == 7 + 16 + 7 + 15) {
printf(" },\n\t%s, %s, %s, %s, \"%s\",",
width[n], height[n], baspect[n], iaspect[n], name[n])
printf("\n};\n\n")
state = -1
} else
printf(" ")
state++
next
}

View File

@ -0,0 +1,887 @@
STARTFONT 2.1
COMMENT
COMMENT $FreeBSD$
COMMENT
COMMENT Mouse cursors for syscons. All except some unused ones are the
COMMENT main 10x16 one scaled down to 9x13 and/or scaled to minimize
COMMENT distortion with non-square pixels. Details of the scaling are
COMMENT given in the comments. E.g., for the main pair of glyphs cn 66-67,
COMMENT "mouse10x16_100 9++:13 (96), 8:11 (106)" says that:
COMMENT - the name of the glyph pair is mouse10x16_100 (it is more
COMMENT convenient to put the name in a comment than in STARTCHAR)
COMMENT - the size of the glyph pair is 10x16 (this is only used as part
COMMENT of the name, and is also in standard bdf info)
COMMENT - this glyph pair is designed for a pixel aspect ratio
COMMENT (ysize:xsize) of 100:100 (also just part of the name)
COMMENT - the arrowhead of the border glyph is in a rectangle of 9x13
COMMENT pixels, but values 2 fudges larger than 9 should be tried in
COMMENT calculations of (diagonal) side lengths
COMMENT - the arrowhead of the border glyph has equal side lengths iff
COMMENT the aspect ratio is 96:100. Syscons makes choices based on
COMMENT this precise ratio for each half of the pair.
COMMENT - 8:11 (106) gives the arrowhead rectangle and preferred aspect
COMMENT ratio for the interior glyph.
COMMENT
COMMENT cn 0-1 mouse10x16_50 7++:16 (49), 6:13 (52)
COMMENT cn 16-17 mouse8x14_67 7++:13 (64), 6:11 (65) (360x400 0.675; also 320x350 24:35 = 0.686 and 320x400 3:5 = 0.600)
COMMENT cn 32-33 mouse8x13_75 6++:10 (75), 5:8 (80)
COMMENT cn 34-35 mouse10x16_75 7++:12 (72), 6:10 (75)
COMMENT cn 40-41 mouse9x16_84 8++:13 (78), 7:11 (82) (not used)
COMMENT cn 48-49 mouse9x13_90 8+:12 (89), 6:9 (89)
COMMENT cn 50-51 mouse10x16_90 10++:15 (89), 8:12 (89)
COMMENT cn 64-65 mouse9x13_100 8:11 (106), 6:8 (113)
COMMENT cn 66-67 mouse10x16_100 9++:13 (96), 8:11 (106) (640x480 and 1920x1080, also 1280x1024 15:16 = 0.9375, 640x400 6:5 = 1.2, 720x480 9:8 = 1.125)
COMMENT cn 72-73 mouse10x16_100large 10:14 (102), 7:10 (98) (use later)
COMMENT cn 74-75 mouse11x16_100 11++:16 (95), 10:14 (102) (use later)
COMMENT cn 80-81 mouse10x14_120 10+:13 (120), 7:9 (124)
COMMENT cn 82-83 mouse10x16_120 10+:13 (120), 7:9 (124) (720x400 1.35; also 640x350 48:35 = 1.371)
COMMENT cn 96-97 mouse9x13_133 9++:11 (142), 7:9 (124)
COMMENT cn 98-99 mouse10x16_133 10+:13 (120), 8:10 (133) (720x400 1.35; also 640x350 48:35 = 1.371)
COMMENT cn 112-113 mouse14x10_240 12+:9 (189), 8:6- (189) (640x200)
COMMENT cn 120-121 mouse9x9 (not used)
COMMENT cn 122-123 mouse11x11thick (not used)
FONT cursor-16x16
SIZE 1 60 44
FONTBOUNDINGBOX 16 16 0 0
STARTPROPERTIES 10
PIXEL_SIZE 16
POINT_SIZE 11
RESOLUTION_X 60
RESOLUTION_Y 44
FONT_ASCENT 12
FONT_DESCENT 4
AVERAGE_WIDTH 90
SPACING "C"
DEFAULT_CHAR 32
_XMBDFED_INFO "Edited with xmbdfed 4.7."
ENDPROPERTIES
CHARS 38
STARTCHAR char0
ENCODING 0
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8200
8400
8400
8400
9200
B200
A900
C900
8600
ENDCHAR
STARTCHAR char1
ENCODING 1
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7C00
7800
7800
7800
6C00
4C00
4600
0600
0000
ENDCHAR
STARTCHAR char16
ENCODING 16
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8700
8400
9200
B200
A900
C900
0600
0000
0000
ENDCHAR
STARTCHAR char17
ENCODING 17
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7800
7800
6C00
4C00
4600
0600
0000
0000
0000
ENDCHAR
STARTCHAR char32
ENCODING 32
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8600
8400
B200
D200
0900
0900
0600
0000
0000
0000
ENDCHAR
STARTCHAR char33
ENCODING 33
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7800
7800
4C00
0C00
0600
0600
0000
0000
0000
0000
ENDCHAR
STARTCHAR char34
ENCODING 34
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8700
8400
9200
B200
C900
0900
0480
0480
0300
ENDCHAR
STARTCHAR char35
ENCODING 35
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7800
7800
6C00
4C00
0600
0600
0300
0300
0000
ENDCHAR
STARTCHAR char40
ENCODING 40
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8080
8780
8200
9200
B900
C900
0480
0480
0300
ENDCHAR
STARTCHAR char41
ENCODING 41
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
7800
7C00
6C00
4600
0600
0300
0300
0000
ENDCHAR
STARTCHAR char48
ENCODING 48
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8780
9200
B200
D900
8900
0600
0000
0000
0000
ENDCHAR
STARTCHAR char49
ENCODING 49
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7800
6C00
4C00
0600
0600
0000
0000
0000
0000
ENDCHAR
STARTCHAR char50
ENCODING 50
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8080
8040
83E0
8200
9900
A900
C480
8480
0300
ENDCHAR
STARTCHAR char51
ENCODING 51
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
7F80
7C00
7C00
6600
4600
0300
0300
0000
ENDCHAR
STARTCHAR char64
ENCODING 64
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8780
B200
D200
8900
0900
0600
0000
0000
0000
ENDCHAR
STARTCHAR char65
ENCODING 65
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7800
4C00
0C00
0600
0600
0000
0000
0000
0000
ENDCHAR
STARTCHAR char66
ENCODING 66
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8080
8040
83C0
9200
A900
C900
0480
0480
0300
ENDCHAR
STARTCHAR char67
ENCODING 67
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
7F80
7C00
6C00
4600
0600
0300
0300
0000
ENDCHAR
STARTCHAR char72
ENCODING 72
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
8000
C000
A000
9000
8800
8400
8200
8100
8080
87C0
9200
A900
C900
8480
0480
0300
ENDCHAR
STARTCHAR char73
ENCODING 73
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
7800
6C00
4600
0600
0300
0300
0000
0000
ENDCHAR
STARTCHAR char74
ENCODING 74
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8080
8040
8020
8010
81F0
8900
9480
A480
C240
ENDCHAR
STARTCHAR char75
ENCODING 75
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
7F80
7FC0
7FE0
7E00
7600
6300
4300
0180
ENDCHAR
STARTCHAR char80
ENCODING 80
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8080
97C0
B200
F200
C900
8900
0600
0000
0000
ENDCHAR
STARTCHAR char81
ENCODING 81
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
6800
4C00
0C00
0600
0600
0000
0000
0000
ENDCHAR
STARTCHAR char82
ENCODING 82
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8080
97C0
B200
F200
C900
8900
0480
0480
0300
ENDCHAR
STARTCHAR char83
ENCODING 83
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
6800
4C00
0C00
0600
0600
0300
0300
0000
ENDCHAR
STARTCHAR char96
ENCODING 96
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8080
9780
B200
C900
0900
0600
0000
0000
0000
ENDCHAR
STARTCHAR char97
ENCODING 97
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
6800
4C00
0600
0600
0000
0000
0000
0000
ENDCHAR
STARTCHAR char98
ENCODING 98
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
C000
A000
9000
8800
8400
8200
8100
8080
8040
93E0
B200
C900
8900
0480
0480
0300
ENDCHAR
STARTCHAR char99
ENCODING 99
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
4000
6000
7000
7800
7C00
7E00
7F00
7F80
6C00
4C00
0600
0600
0300
0300
0000
ENDCHAR
STARTCHAR char112
ENCODING 112
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
F800
CE00
C380
C0E0
C038
C1FC
DCC0
F660
C330
01E0
0000
0000
0000
0000
0000
0000
ENDCHAR
STARTCHAR char113
ENCODING 113
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
3000
3C00
3F00
3FC0
3E00
2300
0180
00C0
0000
0000
0000
0000
0000
0000
0000
ENDCHAR
STARTCHAR char120
ENCODING 120
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
FF80
8080
8300
8400
8200
9100
A880
A500
C200
0000
0000
0000
0000
0000
0000
0000
ENDCHAR
STARTCHAR char121
ENCODING 121
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
7F00
7C00
7800
7C00
6E00
4700
4200
0000
0000
0000
0000
0000
0000
0000
0000
ENDCHAR
STARTCHAR char122
ENCODING 122
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
FFE0
80C0
8180
8300
8300
8180
98C0
BC60
E630
C360
81C0
0080
0000
0000
0000
0000
ENDCHAR
STARTCHAR char123
ENCODING 123
SWIDTH 19200 0
DWIDTH 16 0
BBX 16 16 0 0
BITMAP
0000
7F00
7E00
7C00
7C00
7E00
6700
4380
01C0
0080
0000
0000
0000
0000
0000
0000
ENDCHAR
ENDFONT