rasops(9): remove filtering in rasops_list_font_cb()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

rasops(9): remove filtering in rasops_list_font_cb()

Frederic Cambus
Hi tech@,

Here is a diff to modify rasops_list_font_cb() to not filter out fonts
with different sizes than the currently used one. This allows getting a
list of all loaded fonts when using the WSDISPLAYIO_LSFONT ioctl.

Currently, the output of wsfontload -l on my machine is:

 # Name                             Encoding  W  H
 0 Spleen 12x24                          iso 12 24

With the diff applied:

 # Name                             Encoding  W  H
 0 Spleen 8x16                           iso  8 16
 1 Spleen 12x24                          iso 12 24
 2 Spleen 16x32                          iso 16 32
 3 Spleen 32x64                          iso 32 64

On top of allowing to see all fonts which are currently loaded, it
removes the confusion as to why we reach the WSDISPLAY_MAXFONTCOUNT
limit faster than expected when loading more fonts.

It is also a first step towards allowing loading and enabling fonts
of different sizes.

Comments? OK?

Index: sys/dev/rasops/rasops.c
===================================================================
RCS file: /cvs/src/sys/dev/rasops/rasops.c,v
retrieving revision 1.58
diff -u -p -r1.58 rasops.c
--- sys/dev/rasops/rasops.c 9 Jan 2019 11:23:32 -0000 1.58
+++ sys/dev/rasops/rasops.c 15 Mar 2019 22:57:43 -0000
@@ -1899,10 +1899,6 @@ rasops_list_font_cb(void *cbarg, struct
 {
  struct rasops_list_font_ctx *ctx = cbarg;
 
- if (font->fontheight != ctx->ri->ri_font->fontheight ||
-    font->fontwidth != ctx->ri->ri_font->fontwidth)
- return 0;
-
  if (ctx->cnt-- == 0) {
  ctx->font = font;
  return 1;