bugGNU Octave - Bugs: bug #59128, Bad default font choices on macOS...

 
 

bug #59128: Bad default font choices on macOS 10.15 Catalina

Submitter:  Andrew Janke <apjanke>
Submitted:  Fri 18 Sep 2020 08:13:41 AM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 6.0.90 Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 23 Sep 2020 04:54:48 AM UTC, comment #20: 

Very good. Thanks for grafting, Rik. I did not see your question in comment #17 until now.

Torsten Lilge <ttl>
Group Member
Tue 22 Sep 2020 09:12:01 PM UTC, comment #19: 

Thanks for testing.  I grafted the changeset from dev back to stable as well so this will be available for the 6.1 release.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Tue 22 Sep 2020 08:49:26 PM UTC, comment #18: 

I think we've got a winner here. I built and ran octave default on a fresh Catalina install, and it popped up with Monaco as the default font for both Editor and Command Window, and the text looks fine.

Andrew Janke <apjanke>
Tue 22 Sep 2020 06:06:11 PM UTC, comment #17: 

The bug was reported against the release candidate.  Would it be okay to 'hg graft' your changeset to the stable branch as well?

Rik <rik5>
Group administrator
Tue 22 Sep 2020 03:14:55 PM UTC, comment #16: 

Okay, looks like a hard coded font like "Monaco" as suggested in comment #9 und comment #10 is the best solution by now. I have pushed cset http://hg.savannah.gnu.org/hgweb/octave/rev/b075aa252ca7 which uses Monaca for macOS or uses QFontDatabase if Monaco is not available and on other platforms than macOS.

Torsten Lilge <ttl>
Group Member
Mon 21 Sep 2020 10:07:38 PM UTC, comment #15: 


> Is "American Typewriter" the first font in an alphabetically sorted list of fonts on your system?


No. Al Bayan, Al Nile, and Al Tarikh all come before it. But then it's American Typewriter. It may well be the first "Western script" font, or however you categorize those things; the "Als" are all Arabic script fonts.

> are you building against a Qt version less than 5.14.1?


Nope; Qt 5.15.1.

Andrew Janke <apjanke>
Mon 21 Sep 2020 09:03:00 PM UTC, comment #14: 

I just found this one:
https://bugreports.qt.io/browse/QTBUG-79900

Andrew, are you building against a Qt version less than 5.14.1?

Torsten Lilge <ttl>
Group Member
Mon 21 Sep 2020 08:29:41 PM UTC, comment #13: 

Yes, that sounds reasonable since the terminal only uses fixed width fonts. Is "American Typewriter" the first font in an alphabetically sorted list of fonts on your system?

Torsten Lilge <ttl>
Group Member
Mon 21 Sep 2020 07:59:05 PM UTC, comment #12: 

Octave did show the welcome wizard at startup.

After closing Octave, without making any Preferences changes, I see the following values:


[Scintilla]
...
Octave\defaultfont=American Typewriter, 10, 0, 0, 0

[terminal]
...
[terminal]
cursorType=ibeam
fontName=American Typewriter
fontSize=10


I don't see Andale Mono in the preferences file anywhere.

Perhaps it's getting rejected as a font for the Terminal widget because it's not a monospaced font, and so it's falling back to the alphabetically-first monospaced font it does find?

Andrew Janke <apjanke>
Mon 21 Sep 2020 07:47:33 PM UTC, comment #11: 

This brings me to the question why Octave has chosen different fonts for console and editor window.

Andrew, did Octave showed the welcome wizard at startup? And what are the values of the following entries in the preferences file directly after the first start?


[Scintilla]
...
Octave/defaultfont

[terminal]
...
fontName



Torsten Lilge <ttl>
Group Member
Mon 21 Sep 2020 07:18:10 PM UTC, comment #10: 

I think that's sensible.

IMHO, Monaco or Menlo would be good choices on Mac: they have shipped with the system for ages, so should be available on every modern Mac system. (Monaco goes back to the pre-OSX days; I'm not sure how far back Menlo goes.) Monaco seems to be the default font of choice for most terminal applications, including Mac's own Terminal.app. And it (imho) is suitable for code and terminal-like stuff.

Andrew Janke <apjanke>
Mon 21 Sep 2020 06:51:58 PM UTC, comment #9: 

According to the Wikipedia entry for "American Typewriter" (https://en.wikipedia.org/wiki/American_Typewriter):

"American Typewriter is a slab serif typeface created in 1974 by Joel Kaden and Tony Stan for International Typeface Corporation.[4] It is based on the slab serif style of typewriters; however, unlike most true typewriter fonts, it is a proportional design: the characters do not all have the same width."

So, it looks cool but is not an appropriate font for code.  It could be bad hinting in the font information which Qt then relies on.  Or Qt may only be taking the StyleHint as a hint, and not a directive.  Or the Qt match algorithm may be taking the hint "QFont::TypeWriter" and finding "Typewriter" in the name of the font assumes it is a match.

Given that Mac & Windows platforms are a little different from Linux (they ship a guaranteed set of fonts) it might be easiest to resolve this by picking a font of the appropriate class and availability for those platforms.

There was a thread about default fonts way back in 2013 which also featured Torsten (https://octave.1599824.n4.nabble.com/Default-editor-fonts-td4659463.html).


Rik <rik5>
Group administrator
Mon 21 Sep 2020 06:04:30 PM UTC, comment #8: 

Looking better, but I don't know if we're all there yet.

Here's a fresh build of octave-default with this patch applied, running on a fresh macOS 10.15.6 Catalina VM.

According to the Preferences, it selected Andale Mono for the Command Window, and American Typewriter for the Editor.

American Typewriter looks old-fashionedy and kind of cool, but I think that's actually a proportional font and not a monospaced one. And Andale Mono has some spacing issues. See attached screenshot. Note how far over the cursor at the command line is after the "3" - there are no actual space characters in there! That's just where the cursor is hanging out for some reason.


Andrew Janke <apjanke>
Mon 21 Sep 2020 04:21:45 PM UTC, comment #7: 

I'm swamped at work right now, but I may be able to get a build off this evening...

Andrew Janke <apjanke>
Mon 21 Sep 2020 04:05:05 PM UTC, comment #6: 

@Andrew: Can you test Torsten's patch?  I looked it over, but there's just not that many Mac developers to actually try compiling these things.

Rik <rik5>
Group administrator
Sat 19 Sep 2020 08:05:11 PM UTC, comment #5: 

I totally agree that a "lib-based" solution is preferable to an external tool.

Torsten Lilge <ttl>
Group Member
Sat 19 Sep 2020 07:49:45 PM UTC, comment #4: 

Yes, I believe fc-match is compiled and shipped as part of the MXE distribution.  But, I do like trying to use Qt first since it is already cross-platform.

Rik <rik5>
Group administrator
Sat 19 Sep 2020 05:46:03 PM UTC, comment #3: 

Please find attached a second patch (instead of the first one), which uses QFontDatabase (requires Qt 5.2) for the systems standard fixed width font. I think this should be more reliable than the previously implemented method.

@Rik: Would fc-match be available for the mxe-build on windows, too?








(file #49821)

Torsten Lilge <ttl>
Group Member
Fri 18 Sep 2020 07:58:09 PM UTC, comment #2: 

Defaulting to the first entry sounds like the naive solution so that was the one that was probably implemented.  Assuming we have the fc-XXX family of functions installed, maybe we should use fc-match to find something better.  I'm on a Linux machine and I tried the following:


fc-match "Monaco"
DejaVuSans.ttf: "DejaVu Sans" "Book"
fc-match "Helvetica"
Arial.ttf: "Arial" "Regular"
fc-match "Mono"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"


Rik <rik5>
Group administrator
Fri 18 Sep 2020 07:44:15 PM UTC, comment #1: 

The default font is determined via


QFont::setStyleHint (QFont::Monospace)


which should give the default monospace font of the system. Please find attached a patch that uses "Monaco" on macOS instead.

The settings file should be located at
$HOME/.config/octave/octave-gui.ini
Does Octave show the welcome wizard after you have removed the config directory?


(file #49814)

Torsten Lilge <ttl>
Group Member
Fri 18 Sep 2020 08:13:41 AM UTC, original submission:  

Hi folks!

I've started testing things out on macOS 10.15 Catalina, using Octave.app.

When I (and another user) run Octave.app for the first time, it comes up with unusual, hard-to-read fonts for the Editor and Command Window. Instead of Monaco (the usual default font on other macOS versions), it has "Al Bayan" for the Editor and "Andale Mono" for the Command Window. Both of these fonts are unsuitable for code, especially Al Bayan; they have bad spacing and punctuation sizing issues in this context.

I suspect that Octave is not finding or choosing Monaco for some reason, and is just falling back to the first fonts from the list of all fonts and monospace fonts, respectively: Al Bayan and Andale Mono are first in my lists of fonts.

Monaco does show up in the list of available fonts in the Font dropdowns in preferences. If I select Monaco in preferences, it works and looks fine.

Seems to happen to both Octave 4.4.1 and 6.0.90.

Original user report here: https://github.com/octave-app/octave-app/issues/195. (I think the fc-cache error also reported there is a red herring and actually unrelated to this default font selection.)

BTW, where does Octave even store these font preferences? I can't seem to reset Octave to the defaults once I've selected an alternate prompt, even if I `rm -rf ~/.config/octave ~/Library/Application\ Support/Octave.app`.

Andrew Janke <apjanke>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #49821:  bug_59128_v02.patch added by ttl (2KiB - text/x-patch)
file #49814:  bug_59128_v01.patch added by ttl (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by ttl (Updated the item)
  • -email is unavailable- added by apjanke (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-09-22 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-09-22 ttl StatusPatch Submitted Ready For Test
    2020-09-21 apjanke Attached File- Added Octave@with@patch@49821@on@macOS@Catalina.png, #49831
    2020-09-21 rik5 StatusNone Patch Submitted
    2020-09-19 ttl Attached File- Added bug_59128_v02.patch, #49821
    2020-09-18 ttl Attached File- Added bug_59128_v01.patch, #49814
    2020-09-18 apjanke Attached File- Added unreadable@Octave@fonts@on@Catalina.png, #49807

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code