[PATCH 1/4 v2] server: Add console font table information

Hugh McMaster hugh.mcmaster at outlook.com
Tue Oct 20 19:43:53 CDT 2015


Changes since version 1:
  * Removed an unintentional newline
  * Simplified a few comments

We must use the server because kernel32 does not export a function for this purpose.
The struct font_info can also be expanded to support all elements from CONSOLE_FONT_INFOEX.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 server/console.c    | 19 +++++++++++++++++++
 server/protocol.def |  7 ++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/server/console.c b/server/console.c
index 10b1350..89a0fc4 100644
--- a/server/console.c
+++ b/server/console.c
@@ -121,6 +121,13 @@ static const struct object_ops console_input_events_ops =
     console_input_events_destroy      /* destroy */
 };
 
+struct font_info
+{
+    unsigned int index;
+    short int    width;
+    short int    height;
+};
+
 struct screen_buffer
 {
     struct object         obj;           /* object header */
@@ -139,6 +146,7 @@ struct screen_buffer
     unsigned short        attr;          /* default attribute for screen buffer */
     rectangle_t           win;           /* current visible window on the screen buffer *
 					  * as seen in wineconsole */
+    struct font_info      font;          /* console font information */
     struct fd            *fd;            /* for bare console, attached output fd */
 };
 
@@ -411,6 +419,9 @@ static struct screen_buffer *create_console_output( struct console_input *consol
     screen_buffer->win.top        = 0;
     screen_buffer->win.bottom     = screen_buffer->max_height - 1;
     screen_buffer->data           = NULL;
+    screen_buffer->font.index     = 0;
+    screen_buffer->font.width     = 0;
+    screen_buffer->font.height    = 0;
     list_add_head( &screen_buffer_list, &screen_buffer->entry );
 
     if (fd == -1)
@@ -1020,6 +1031,11 @@ static int set_console_output_info( struct screen_buffer *screen_buffer,
 	screen_buffer->max_width  = req->max_width;
 	screen_buffer->max_height = req->max_height;
     }
+    if (req->mask & SET_CONSOLE_OUTPUT_INFO_FONT)
+    {
+        screen_buffer->font.width  = req->font_width;
+        screen_buffer->font.height = req->font_height;
+    }
 
     return 1;
 }
@@ -1677,6 +1693,9 @@ DECL_HANDLER(get_console_output_info)
         reply->win_bottom     = screen_buffer->win.bottom;
         reply->max_width      = screen_buffer->max_width;
         reply->max_height     = screen_buffer->max_height;
+        reply->font_index     = screen_buffer->font.index;
+        reply->font_width     = screen_buffer->font.width;
+        reply->font_height    = screen_buffer->font.height;
         release_object( screen_buffer );
     }
 }
diff --git a/server/protocol.def b/server/protocol.def
index c313006..00439bb 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1495,6 +1495,8 @@ struct console_renderer_event
     short int    win_bottom;
     short int    max_width;     /* maximum size (width x height) for the window */
     short int    max_height;
+    short int    font_width;    /* font size (width x height) */
+    short int    font_height;
 @END
 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM     0x01
 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS      0x02
@@ -1502,7 +1504,7 @@ struct console_renderer_event
 #define SET_CONSOLE_OUTPUT_INFO_ATTR            0x08
 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW  0x10
 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE        0x20
-
+#define SET_CONSOLE_OUTPUT_INFO_FONT            0x40
 
 /* Get info about a console (output only) */
 @REQ(get_console_output_info)
@@ -1521,6 +1523,9 @@ struct console_renderer_event
     short int    win_bottom;
     short int    max_width;     /* maximum size (width x height) for the window */
     short int    max_height;
+    unsigned int font_index;    /* index of the font in the console font table */
+    short int    font_width;    /* font size (width x height) */
+    short int    font_height;
 @END
 
 /* Add input records to a console input queue */
-- 
1.9.1




More information about the wine-patches mailing list