bugGNU Octave - Bugs: bug #66953, Font in "doc"...

 
 

bug #66953: Font in "doc" "Search" pane may be un-initialized

Submitter:  Dmitri A. Sergatskov <dasergatskov>
Submitted:  Wed 26 Mar 2025 03:22:37 PM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Works For Me Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Release: 
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 04 Apr 2025 06:16:30 AM UTC, comment #18: 

_event_manager_show_command_history_  Sans
_event_manager_show_community_news_ Mono
_event_manager_show_documentation_ Sans
_event_manager_show_file_browser_ Sans (Bottom Labels -> Mono)
_event_manager_show_preferences_ ??? No window pops up
_event_manager_show_release_notes_ Mono
_event_manager_show_terminal_window_ (Nothing)
_event_manager_show_workspace_ Sans

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 03 Apr 2025 07:34:25 PM UTC, comment #17: 

If you launch other widgets from the CLI by _event_manager_show_XYZ_, do they have the correct fonts or are there mono fonts as well?

Torsten Lilge <ttl>
Group Member
Wed 02 Apr 2025 09:28:35 PM UTC, comment #16: 

I take it back -- I just tried w/o your patch and it is still in Sans. So I do not see any changes from your patch.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 02 Apr 2025 09:17:57 PM UTC, comment #15: 

Sorry, could not get a screenshot of it, had to use a phones camera.
This is what I see when I first type "doc java". Before your patch it was also in Mono font, but now it looks Sans.
This screen replaced after ~1sec with the the links (as previously rendered in Mono font).

(file splash.jpg)

Dmitri.
--



Dmitri A. Sergatskov <dasergatskov>
Wed 02 Apr 2025 08:59:30 PM UTC, comment #14: 

Which splash screen do you mean?

Torsten Lilge <ttl>
Group Member
Wed 02 Apr 2025 05:49:43 AM UTC, comment #13: 

I think it changed the fonts for the spalsh screen ("Please wait until ..") but the tab and widget decorations are still Mono.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 02 Apr 2025 04:58:58 AM UTC, comment #12: 

The desired style that should be used for the GUI is determined in the main window only and not when the widgets are launched from the CLI. In the latter case, the widgets are always shown in a default style and not in the one the GUI is shown (like, e.g., the one, the user selected in the settings).

I have attached a patch that should fix this.

(file #57094)

Torsten Lilge <ttl>
Group Member
Mon 31 Mar 2025 09:52:59 AM UTC, comment #11: 

Yep. If I start octave as :

$ QT_QPA_PLATFORMTHEME="qt6ct" ./run-octave


then everythink looks OK. Not sure who supposed to set this var.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Mon 31 Mar 2025 09:41:24 AM UTC, comment #10: 

Not sure I understand the questions -- the fonts are all wrong as long as doc windows got called from CLI.
You can start with say "doc sin" and then click to Search and it is all Mono. My latest guess is that there is a global Qt settings that set default font to Mono for some reason instead of Sans (may be it is a bug in Fedora 42). Most windows get explicit settings through preferences and they look OK.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Mon 31 Mar 2025 09:29:13 AM UTC, comment #9: 

Even the tabs ("index", "Bookmarks", etc.) are in Mono. There is definitely something wrong. Does this happen to the tabs if you call the documentation window without search expression with _event_manager_show_documentation_?

Torsten Lilge <ttl>
Group Member
Mon 31 Mar 2025 09:20:13 AM UTC, comment #8: 

If I used the following patch:

diff -r 4e561014e35c libgui/src/documentation.cc
--- a/libgui/src/documentation.cc       Sat Mar 29 07:24:49 2025 -0700
+++ b/libgui/src/documentation.cc       Mon Mar 31 05:12:39 2025 -0400
@@ -274,6 +274,23 @@
       QHelpSearchEngine *search_engine = m_help_engine->searchEngine ();
       QHelpSearchQueryWidget *search = search_engine->queryWidget ();
       QHelpSearchResultWidget *result = search_engine->resultWidget ();
+
+      // Force a sans-serif font on the search result widget
+      // and its internal QTextBrowser to fix font issues when launched from CLI
+      QTimer::singleShot (0, this, [result]()
+        {
+          if (result)
+            {
+              // Create a sans-serif font that matches the rest of the GUI
+              QFont sans_font = QApplication::font();
+              sans_font.setFamily("Sans");  // Explicitly set to Sans family
+              result->setFont(sans_font);
+              // Also apply to the internal QTextBrowser that actually displays the results
+              for (QTextBrowser *browser : result->findChildren<QTextBrowser*>())
+                browser->setFont(sans_font);
+            }
+          });
+
       QWidget *search_all = new QWidget (navi);
       QVBoxLayout *v_box_search = new QVBoxLayout (search_all);
       v_box_search->addWidget (search);


It sets the "Sans" font to the "Search" tab. Notice that the font used in "Search: " and "Find:" small entry widgets (the ones that have "java" and java) are still Mono.

I do not claim it to be a fix, it just demonstrate that the fonts are not set correctly.

Dmitri.
--



Dmitri A. Sergatskov <dasergatskov>
Mon 31 Mar 2025 07:13:51 AM UTC, comment #7: 

In reply to comment #5: The general application font (menus etc.) are selected by Qt and the system.

Torsten Lilge <ttl>
Group Member
Sun 30 Mar 2025 02:27:55 PM UTC, comment #6: 

Yes, the font in the screenshot I posted is obviously mono.
I suspect this is "Aptos Mono" and it is picked up because it is at the top of fonts list. This font is also different from fonts in other tabs (in the same pane) which are all proportional as they should be. Also, launching the same "doc java" from GUI command windows result in normal font being used. That why I suspect that the font is probably initialized somewhere in the gui and the initialization is skipped if the doc called from cli.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 30 Mar 2025 02:20:55 PM UTC, comment #5: 

Okay, there is a difference in fonts between the documentation and the font used for the Search pane.  But isn't that correct?  I think the Search pane is using the font associated with the GUI application itself (something in the Sans Serif family, maybe a Mono font).

@Torsten: I see in the Preferences window that I can set a font for the Command Window.  Is there a way to set the font for the application itself?  Or is that done through a different mechanism depending on the operating system?

Rik <rik5>
Group administrator
Sun 30 Mar 2025 03:03:30 AM UTC, comment #4: 

I am seeing the correct font even when launching the doc viewer from the CLI. When launched for the very first time, it just takes some time before the search results are shown.

Torsten Lilge <ttl>
Group Member
Sun 30 Mar 2025 02:45:00 AM UTC, comment #3: 

I am talking about the "Search" pain on the left side of the windows not the main document pane.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 30 Mar 2025 01:31:01 AM UTC, comment #2: 

This works for me.  I wanted to make it very obvious what the fonts were so I changed the default to "Comic Sans MS".


diff --git a/doc/interpreter/octave.css b/doc/interpreter/octave.css
--- a/doc/interpreter/octave.css
+++ b/doc/interpreter/octave.css
@@ -110,10 +110,10 @@ code, kbd, samp, tt {
   font-style: italic;
   padding: 0 0.1ex; /* slightly increase margin to surrounding text */ }

-body, .sansserif { font-family: 'Roboto Condensed', sans-serif; }
+body, .sansserif { font-family: 'Comic Sans MS', sans-serif; }

 h1, h2, h3, h4, h5, .menu-comment, .roman, .menu-preformatted {
-  font-family: 'Roboto Condensed', serif; }
+  font-family: 'Comic Sans MS', serif; }

 /* Use colors from the solarized color theme (sparsely), the main text
    will remain in default colors for optimal readability (black on white).  */


When I launch Octave and type


doc repmat


I get the correct result.




(file #57081,

Rik <rik5>
Group administrator
Wed 26 Mar 2025 03:24:07 PM UTC, comment #1: 

(file doc_fonts.png)


Dmitri A. Sergatskov <dasergatskov>
Wed 26 Mar 2025 03:22:37 PM UTC, original submission:  

When "doc" gui is launched from CLI, the fonts in its "Search" pane look wrong (Mono rather than Sans). They look OK in octave GUI. E.g. doing (in CLI):

octave:2> doc java


I see the attached (file doc_fonts.png)

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #57096:  splash.jpg added by dasergatskov (308KiB - image/jpeg)
file #57094:  bug66953_v01.patch added by ttl (10KiB - text/x-patch)
file #57082:  repmat_screenshot.png added by rik5 (50KiB - image/png)
file #57081:  comic.patch added by rik5 (717B - text/x-patch)
file #57068:  doc_fonts.png added by dasergatskov (99KiB - image/png)
file #57067:  doc_fonts.png added by dasergatskov (99KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by dasergatskov (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-04-02 dasergatskov Attached File- Added splash.jpg, #57096
    2025-04-02 ttl Attached File- Added bug66953_v01.patch, #57094
    2025-03-31 dasergatskov Attached File- Added doc_search_fixed.png, #57086
    2025-03-30 rik5 Attached File- Added repmat_screenshot.png, #57082
        Item GroupNone Other
        StatusNone Works For Me
    2025-03-30 rik5 Attached File- Added comic.patch, #57081
    2025-03-26 dasergatskov Attached File- Added doc_fonts.png, #57068
    2025-03-26 dasergatskov Attached File- Added doc_fonts.png, #57067

    Back to the top

    Powered by Savane 3.14-962f.
    Corresponding source code