#595696 console-setup should be able to select the font size according to SCREEN_WIDTH/HEIGHT, rasterizing one if needed #595696
- Package:
- console-setup
- Source:
- console-setup
- Submitter:
- Samuel Thibault
- Date:
- 2024-04-27 13:18:03 UTC
- Severity:
- wishlist
- Tags:
Hello, Squeeze brings an accessibility regression: with some setups (like kms), the framebuffer console is enabled by default, which thus brings a high-resolution video mode, thus a screen larger than 80 columns. This is a problem for braille users: braille displays are quite often 40 cells wide, thus exactly half the screen width. Having to cope with some more text is a pain. There are also other braille display sizes, like 64, 88, etc. Also, things like 50 lines is not necessarily convenient, depending on users. A nice way to fix the regression and actually provide better support for various display sizes would be to have console-setup tune the screen size according to user's decision, thanks to a combination of proper font size and call to stty rows/cols. The way I see this is to add SCREEN_WIDTH and SCREEN_HEIGHT to /etc/default/console-setup (unset by default): - if only FONTSIZE is set, just load the font and be fine with it. - if FONTSIZE is set as well as SCREEN_WIDTH/HEIGHT, load the specified font, and call stty cols $SCREEN_WIDTH rows $SCREEN_HEIGHT to fix the screen size. - if FONTSIZE is not set but SCREEN_WIDTH/HEIGHT is, look for a font size that is almost big enough to get only the desired width and height. Calling stty cols $SCREEN_WIDTH rows $SCREEN_HEIGHT then helps to get rid of the few extra columns and rows. We could even imagine to rasterize a vector font on the fly for very big sizes. Of course, since Squeeze is frozen, we should probably not care about the 3rd case for now. I however believe that handling the second case would permit to fix the regression nicely and easily enough without bringing any other potential regressions. What do you think? Samuel
Quoting Samuel Thibault (sthibault@debian.org): Seems safe to me, yes.
Hello, Here is a patch proposition. Samuel
Hello Samuel, This looks safe for me too; please commit it.
clone 594817 -1 retitle -1 console-setup should be able to select the font size according to SCREEN_WIDTH/HEIGHT severity -1 wishlist tags 594817 + pending thanks Otavio Salvador, le Sun 05 Sep 2010 14:42:55 -0300, a écrit : Done. I'm cloning this bug to keep the "console-setup should be able to select the font size according to SCREEN_WIDTH/HEIGHT" part. Samuel
In order to do something like this, it would be necessary to make console-setup predepend on fbset (in order to detect the screen resolution). Is this OK? Anton Zinoviev
Anton Zinoviev, le Sun 27 Feb 2011 18:32:28 +0200, a écrit : I don't see any red light with that. Samuel
Why pre-depends? Cheers, Julien
Well, for now I am not exactly sure what to do so I will appreciate any
suggestions. Maybe it won't be necessary to pre-depend after all.
For now this is what I am planning for the configuring script of
console-setup:
1. Try to detect the screen resolution.
1a. If framebuffer is used and fbset is installed, then use "fbset -s".
1b. If framebuffer is used but fbset is not installed, then unknown.
1c. If framebuffer is not used and /proc/cmdline doesn't contain "vga"
option, then assume standard VGA text mode resolution.
1d. If framebuffer is not used and there is an "vga" option, then unknown.
2. If the resolution is unknown, then ask the questions the same way as now.
3. If the resolution is known, then add the screen resolution to the
font size to make the choice easier:
6x12 (213x85) framebuffer only
8x14 (160x64)
8x16 (160x73)
10x20 (128x51) framebuffer only
11x22 (116x46) framebuffer only
12x24 (106x42) framebuffer only
14x28 (91x36) framebuffer only
16x32 (80x32) framebuffer only
4. Propose the user to reduce the number of the columns on the screen
(suggesting 80).
I suppose reducing the number of rows is not that useful, so no need for
a question for SCREEN_HEIGHT.
Anton Zinoviev
Anton Zinoviev, le Mon 28 Feb 2011 18:07:00 +0200, a écrit : Mmm, I believe you can get the actual resolution by using the KDFONTOP's KD_FONT_OP_GET ioctl() to know the current font size. That'd be a good thing, indeed. Ok. Samuel
Samuel Thibault, le Sun 29 Aug 2010 21:08:05 +0200, a écrit :
specifies the width (which will be the most probable use, people usually
don't care how many lines there are, but do care how many characters per
line there are; it's also the most difficult since fonts size is
configured through height, not width):
WIDTH=1024
HEIGHT=768
SCREEN_WIDTH=80
GLYPH_WIDTH=$(($WIDTH / $SCREEN_WIDTH))
GLYPH_HEIGHT=$(($GLYPH_WIDTH * 18 / 10))
otf2bdf -r 72 -p $GLYPH_HEIGHT /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf | sed -e "s/AVERAGE_WIDTH.*/AVERAGE_WIDTH ${GLYPH_WIDTH}0/" > /tmp/font.bdf
bdf2psf --fb /tmp/font.bdf /usr/share/bdf2psf/standard.equivalents /usr/share/bdf2psf/ascii.set 256 /tmp/font.psf
There are just a few issues: bdf2psf wants an average width dividible by
10 and uses it as maximum width. This doesn't really make sense, letter
'i' for instance makes the average way smaller than what is needed for @
or W :) Perhaps bdf2psf could be made to have an option to specify the
width instead. Also, I've here cheated by hardcoding a 18/10 ratio. I
don't know how we could get this from the font file.
Samuel
Anton Zinoviev, le Tue 01 Sep 2015 20:31:33 +0300, a écrit : There is no simple way to autodetect this. Some devices have only 20, while others have 80. 40 is just the most common. People are used to use 80 actually. Some people have 12, and would thus perhaps like 60, 72, etc. There is no simple heuristic, it's better to just ask the user a number. Samuel
Anton Zinoviev, le Tue 01 Sep 2015 20:31:33 +0300, a écrit : Right, that can be enough, indeed. We can add more as screen get more dpi (and make it simple to change in the package build for users to build them easily if they need) Samuel
I am afraid of such automatic conversion. There are too many combinations which can easily lead to many undiscovered bugs... I'd prefer if we use otf2bdf and bdf2psf manually in order to add a few new fonts in the source package of console-setup. BTW, the number of symbols per line is not enough in order to chose the proper font. For example on a wide screen I prefer to use somewhat smaller font (say size 22 or 24) and to limit the number of characters using 'stty cols 80' (that is SCREEN_WIDTH=80 in /etc/default/c-s). Otherwise, there are too few rows on the screen. I am considering a Debconf question about the screen width. In my opinion only the following options are useful: 40 cols: for braile displays (is there a way to autodetect these?) 80 cols: I use this most of the time max: for reading log files Anton Zinoviev
Hello, gofloss gofloss, le mar. 06 juin 2017 13:52:05 -0700, a ecrit: [...] I guess that your computer has a screen with a quite high dpi? This was already reported as bug #816111, and also #595696 mentioned generating rasterized fonts, we definitely need to fix this to have sane console sizes. Samuel
Samuel Thibault, le mar. 01 sept. 2015 19:40:30 +0200, a ecrit: I just did that :) Up to 64b width, the maximum width that will be allowed by linux 6.9. Samuel