Bug 148470 - simple Chinese user interface tooltip display error on Apple M1 Macos 12
Summary: simple Chinese user interface tooltip display error on Apple M1 Macos 12
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.2.6.2 release
Hardware: ARM macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0 target:7.3.4
Keywords:
: 108042 123555 148091 (view as bug list)
Depends on:
Blocks: macOS-UI-polish Font-Rendering CJK Toolbars-Tooltips Tooltip Regressions-HarfBuzz
  Show dependency treegraph
 
Reported: 2022-04-08 17:42 UTC by enhua_2008
Modified: 2023-01-02 13:35 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
issue’s screenshot (2.78 MB, image/png)
2022-04-09 09:27 UTC, enhua_2008
Details
a debugging patch (1.54 KB, patch)
2022-05-10 10:27 UTC, Caolán McNamara
Details
debug output (254.80 KB, text/plain)
2022-05-10 12:43 UTC, enhua_2008
Details

Note You need to log in before you can comment on or make changes to this bug.
Description enhua_2008 2022-04-08 17:42:45 UTC
Description:
The tools bar tips such as save button,should display 保存(⌘S), but the ⌘ can’t be displayed. And the same error with the other buttons.
And the Chinese Characters at status bar can not be displayed.
This error happens on macOS with M1 cpu version, and the intel cpu is ok.

Steps to Reproduce:
1.install apple silicon version LO
2.install simple Chinese language pack
3.set the interface to simple Chinese 
4.watch the status bar and put the mouse over the save button wait for the tips

Actual Results:
⌘ Display error

Expected Results:
Status bar Chinese characters Display correct


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
Version: 7.2.6.2 / LibreOffice Community
Build ID: b0ec3a565991f7569a5a7f5d24fed7f52653d754
CPU threads: 10; OS: Mac OS X 12.3.1; UI render: default; VCL: osx
Locale: zh-CN (zh_Hans.UTF-8); UI: zh-CN
Calc: threaded
Comment 1 enhua_2008 2022-04-09 09:27:30 UTC
Created attachment 179423 [details]
issue’s screenshot
Comment 2 enhua_2008 2022-04-24 03:57:45 UTC
This problem has been more than six months, not only on MacOS , linux also has the same problem, see bug 148477. 

Hope the problem will be resolved as soon as possible.
Comment 3 Luboš Luňák 2022-05-04 04:04:07 UTC

*** This bug has been marked as a duplicate of bug 148477 ***
Comment 4 enhua_2008 2022-05-04 05:00:50 UTC
(In reply to Luboš Luňák from comment #3)
> 
> *** This bug has been marked as a duplicate of bug 148477 ***
This is not a duplicate question. 14870 contains 14877, and 14870 reported the tools bar problems also, the '⌘' and '⌥' can’t be displayed in toolsbartip for Chinese UI on macOS.
And the commit "do not allow reusing already used SalLayoutGlyphs (tdf#148477)"  introduced a new bug, the status bar state can't update now. After type some words, the counts of word is still 0, and the pages number is still 1.
Comment 5 Luboš Luňák 2022-05-04 05:51:34 UTC
There are two problems in this bugreport. The statusbar is a duplicate of bug #148477, and then the toolbar tooltip, which is an unrelated bug.
Comment 6 Caolán McNamara 2022-05-04 08:52:23 UTC
For the missing "⌘" this suggests the font used for the UI doesn't have the glyph and the glyph fallback for mac doesn't work.

It might be worth finding out what font is used there. I think the font used is picked by vcl/osx/salframe.cxx AquaSalFrame::UpdateSettings and I guess that it is the font of aTooltipFont. If you can debug that to find out what font is used there on your system where it doesn't appear to work vs a system where it does it could help find out what the difference is.
Comment 7 enhua_2008 2022-05-04 12:15:03 UTC
(In reply to Caolán McNamara from comment #6)
> For the missing "⌘" this suggests the font used for the UI doesn't have the
> glyph and the glyph fallback for mac doesn't work.
> 
> It might be worth finding out what font is used there. I think the font used
> is picked by vcl/osx/salframe.cxx AquaSalFrame::UpdateSettings and I guess
> that it is the font of aTooltipFont. If you can debug that to find out what
> font is used there on your system where it doesn't appear to work vs a
> system where it does it could help find out what the difference is.

I try to debug but I can't get the aTooltipFont's font name. Then I add two line after line 1267, because  the menus with '⌘' displays correctly.
aStyleSettings.SetHelpFont(aMenuFont);
aStyleSettings.SetToolFont(aMenuFont); 
But it has no effect.
Comment 8 Caolán McNamara 2022-05-04 14:26:35 UTC
> I try to debug but I can't get the aTooltipFont's font name.

dumping it to stderr with something like

fprintf(stderr, "fontname is %s\n", aTooltipFont.GetFamilyName().toUtf8().getStr());

might be good enough to get it

> Then I add two
> line after line 1267, because  the menus with '⌘' displays correctly.
> aStyleSettings.SetHelpFont(aMenuFont);
> aStyleSettings.SetToolFont(aMenuFont); 
> But it has no effect.

On mac I think the menus are rendered by the OS and not directly by us so things are complicated there.
Comment 9 Adolfo Jayme Barrientos 2022-05-04 14:46:58 UTC
IIRC, LO is using Liberation as its UI font since commit 06299d6c1620e5b2f2a3588d7c93790278397cbd (it used Arial before). It has never behaved correctly in this regard: it should use the platform UI font (see tdf#91400)
Comment 10 enhua_2008 2022-05-04 14:57:44 UTC
(In reply to Caolán McNamara from comment #8)
> > I try to debug but I can't get the aTooltipFont's font name.
> 
> dumping it to stderr with something like
> 
> fprintf(stderr, "fontname is %s\n",
> aTooltipFont.GetFamilyName().toUtf8().getStr());
> 
> might be good enough to get it
> 
> > Then I add two
> > line after line 1267, because  the menus with '⌘' displays correctly.
> > aStyleSettings.SetHelpFont(aMenuFont);
> > aStyleSettings.SetToolFont(aMenuFont); 
> > But it has no effect.
> 
> On mac I think the menus are rendered by the OS and not directly by us so
> things are complicated there.

I got it according to your code:
fontname is .AppleSystemUIFont
Comment 11 enhua_2008 2022-05-04 15:02:30 UTC
(In reply to Caolán McNamara from comment #8)
> > I try to debug but I can't get the aTooltipFont's font name.
> 
> dumping it to stderr with something like
> 
> fprintf(stderr, "fontname is %s\n",
> aTooltipFont.GetFamilyName().toUtf8().getStr());
> 
> might be good enough to get it
> 
> > Then I add two
> > line after line 1267, because  the menus with '⌘' displays correctly.
> > aStyleSettings.SetHelpFont(aMenuFont);
> > aStyleSettings.SetToolFont(aMenuFont); 
> > But it has no effect.
> 
> On mac I think the menus are rendered by the OS and not directly by us so
> things are complicated there.

It displays correct when type  '⌘ ⌥' in LO writer and then set font to AppleSystemUIFont.
Comment 12 enhua_2008 2022-05-04 23:36:11 UTC
(In reply to Adolfo Jayme Barrientos from comment #9)
> IIRC, LO is using Liberation as its UI font since commit
> 06299d6c1620e5b2f2a3588d7c93790278397cbd (it used Arial before). It has
> never behaved correctly in this regard: it should use the platform UI font
> (see tdf#91400)


It displays correct when type  '⌘ ⌥' in LO writer and then set font to Liberation. 
There is not no such phenomenons as tdf#91400  except the '⌘ ⌥' characters in tooltip  and tip of the day dialogues yet.
Comment 13 enhua_2008 2022-05-05 01:14:56 UTC
(In reply to Caolán McNamara from comment #8)
> > I try to debug but I can't get the aTooltipFont's font name.
> 
> dumping it to stderr with something like
> 
> fprintf(stderr, "fontname is %s\n",
> aTooltipFont.GetFamilyName().toUtf8().getStr());
> 
> might be good enough to get it
> 
> > Then I add two
> > line after line 1267, because  the menus with '⌘' displays correctly.
> > aStyleSettings.SetHelpFont(aMenuFont);
> > aStyleSettings.SetToolFont(aMenuFont); 
> > But it has no effect.
> 
> On mac I think the menus are rendered by the OS and not directly by us so
> things are complicated there.

I find that the tooltip is returned in File vcl/source/helper/commandinfoprovider.cxx Line 291, then add a print line  after line 289 like below
fprintf(stderr,"sShortCut is %s\n",sShortCut.toUtf8().getStr());
The print like this:
sShortCut is xe2x8cx98T
sShortCut is xe2x87xa7xe2x8cx98F11
sShortCut is xe2x87xa7F11
sShortCut is xe2x8cx98]
sShortCut is xe2x8cx98[
sShortCut is xe2x8cx98B
sShortCut is xe2x8cx98I
sShortCut is xe2x8cx98U
sShortCut is xe2x8cx98D
sShortCut is xe2x8cx98N
sShortCut is xe2x87xa7xe2x8cx98N
sShortCut is xe2x8cx98O
sShortCut is 
sShortCut is xe2x8cx98S  // I guess xe2x8cx98 is for ⌘
sShortCut is xe2x87xa7xe2x8cx98S
sShortCut is 
sShortCut is xe2x87xa7xe2x8cx98M
sShortCut is 
sShortCut is xe2x8cx98P

If print without toUtf8() , the print like this:
fprintf(stderr,"sShortCut is %s\n",sShortCut.getStr());
sShortCut is x18#S     // I guess x18# is for ⌘
sShortCut is xe7!x18#S
sShortCut is 
sShortCut is xe7!x18#M
3
sShortCut is 
sShortCut is x18#P
sShortCut is 
sShortCut is xe7!x18#O
sShortCut is x18#X
sShortCut is x18#C
sShortCut is x18#V
Comment 14 enhua_2008 2022-05-09 07:24:45 UTC

(In reply to Caolán McNamara from comment #6)
> For the missing "⌘" this suggests the font used for the UI doesn't have the
> glyph and the glyph fallback for mac doesn't work.
> 
> It might be worth finding out what font is used there. I think the font used
> is picked by vcl/osx/salframe.cxx AquaSalFrame::UpdateSettings and I guess
> that it is the font of aTooltipFont. If you can debug that to find out what
> font is used there on your system where it doesn't appear to work vs a
> system where it does it could help find out what the difference is.

Hello, is there any progress on this issue?
Comment 15 Caolán McNamara 2022-05-10 10:27:03 UTC
Created attachment 180037 [details]
a debugging patch

I don't have any solutions, the problem doesn't exist for me on my mac. What might be of some use is the attached patch which outputs the glyph fallback attempts, the glyphs that are missing and the font that macOS suggests. That at least helps to show what code is involved on macOS.

For me when I move the mouse over the save icon and the tooltip appears then the output includes a glyph fallback attempt for 0x2318 (the "place of interest" glyph) and for me the suggested font i get back is "Hiragino Sans". And indeed if I then use insert special character and select that font I can see that it does include that glyph which is rendered ok for me in the tooltip.
Comment 16 enhua_2008 2022-05-10 12:43:47 UTC
Created attachment 180042 [details]
debug output
Comment 17 enhua_2008 2022-05-10 12:54:08 UTC
(In reply to Caolán McNamara from comment #15)

I added debug output file https://bug-attachments.documentfoundation.org/attachment.cgi?id=180042 , thank you for your patience.
Comment 18 Caolán McNamara 2022-05-10 15:39:16 UTC
The output is double utf-8 encoded but I can reconstruct that the font chosen is
苹方-简 which I believe is "PingFang SC".

Looking at the font, then indeed it does not have 0x2318 though it probably does have the other glyphs in the request so it doesn't cover the full set of requested glyphs only some of them.

In our Linux fontconfig version of this we would try again with the missing glyphs so I think we need to teach the macOS version to make that attempt.
Comment 19 Caolán McNamara 2022-05-10 15:46:52 UTC
my attempt at this is https://gerrit.libreoffice.org/c/core/+/134131
Comment 20 Commit Notification 2022-05-10 18:34:24 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4b693a0c594fb3b73f4a4c1e03e9916f1a107012

tdf#148470 if macOS glyph fallback provided a partial result flag what failed

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 enhua_2008 2022-05-10 22:48:43 UTC
(In reply to Caolán McNamara from comment #19)
> my attempt at this is https://gerrit.libreoffice.org/c/core/+/134131

Hi, it works, thank you very much!
Comment 22 Commit Notification 2022-05-14 09:24:31 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/e083f38ab8f2ee864b9e20829bf9fe45c415ddff

tdf#148470 if macOS glyph fallback provided a partial result flag what failed

It will be available in 7.3.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Adolfo Jayme Barrientos 2022-05-14 23:18:13 UTC
*** Bug 108042 has been marked as a duplicate of this bug. ***
Comment 24 Adolfo Jayme Barrientos 2022-05-16 12:08:58 UTC
*** Bug 123555 has been marked as a duplicate of this bug. ***
Comment 25 Christian Lohmaier 2023-01-02 13:35:14 UTC
*** Bug 148091 has been marked as a duplicate of this bug. ***