Bug 87535 - Styles-dropdown preview always uses “Western” font
Summary: Styles-dropdown preview always uses “Western” font
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
4.3.4.1 release
Hardware: Other All
: medium normal
Assignee: ⁨خالد حسني⁩
URL:
Whiteboard: target:7.5.0 inReleaseNotes:7.5
Keywords:
Depends on:
Blocks: Styles-Preview
  Show dependency treegraph
 
Reported: 2014-12-20 20:33 UTC by ⁨خالد حسني⁩
Modified: 2022-12-11 11:58 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Test document (10.30 KB, application/vnd.oasis.opendocument.text)
2014-12-20 20:33 UTC, ⁨خالد حسني⁩
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ⁨خالد حسني⁩ 2014-12-20 20:33:24 UTC
Created attachment 111087 [details]
Test document

The Styles-dropdown preview always uses the “Western” font even if the previwed text is CTL text. For example, the attached document have a single word set in a style that uses “DejaVu Serif” for Western text and “DejaVu Sans” for CTL text, the preview contains Arabic text (when using Arabic interface) but it will use “DejaVu Serif” not “DejaVu Sans” and thus does not reflect the actual effect of applying this style to Arabic text.
Comment 1 Adolfo Jayme Barrientos 2014-12-20 21:40:57 UTC
Thanks, marking as NEW.
Comment 2 ⁨خالد حسني⁩ 2014-12-20 22:14:33 UTC
This is apparently because in https://gerrit.libreoffice.org/gitweb?p=core.git;a=blob;f=svx/source/tbxctrls/tbcontrl.cxx;hb=HEAD#l589 only SID_ATTR_CHAR_FONT is used, bit not SID_ATTR_CHAR_CTL_FONT nor SID_ATTR_CHAR_CJK_FONT. Apparently OutputDevice takes only one font, so it probably does not do script itemization, but I’m not sure what is the proper way to handle the itemization.
Comment 3 QA Administrators 2016-01-17 20:03:24 UTC Comment hidden (noise)
Comment 4 Jan Holesovsky 2016-01-18 06:57:32 UTC
Khaled: IIRC there is now some style preview in the sidebar too.  Please does the style preview in the sidebar render this correctly?  If yes, I suppose we should just share the code here with what is in the sidebar :-)
Comment 5 ⁨خالد حسني⁩ 2016-01-28 17:02:49 UTC
(In reply to Jan Holesovsky from comment #4)
> Khaled: IIRC there is now some style preview in the sidebar too.  Please
> does the style preview in the sidebar render this correctly?  If yes, I
> suppose we should just share the code here with what is in the sidebar :-)

The sidebar in 5.0 shows the same behaviour reported here, I can’t test on master right now. I suspect the same problem in comment 2 is the cause here.
Comment 6 QA Administrators 2017-03-06 14:08:35 UTC Comment hidden (noise, obsolete)
Comment 7 QA Administrators 2019-12-03 14:27:52 UTC Comment hidden (noise)
Comment 8 QA Administrators 2021-12-03 04:33:27 UTC Comment hidden (noise)
Comment 9 Commit Notification 2022-08-22 13:45:23 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/044fc5c8b225732d57970d3bf0720c13a5a9e0a4

tdf#87535: Preview styles using CTL/CJK fonts in the styles menu

It will be available in 7.5.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 10 Commit Notification 2022-08-22 13:45:31 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0483fbd1d05d74c394d9274bdee77b3b2aebb495

tdf#87535: Preview styles using CTL/CJK fonts in the sidebar

It will be available in 7.5.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 11 Stéphane Guillou (stragu) 2022-12-08 18:21:38 UTC
Khaled, a follow-up, maybe a regression:

In 7.4, the 1 was on the left of the heading preview (which is correct according to the style properties). In 7.5, it is now displayed to the right.

Version: 7.5.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: ad085990b8073a122ac5222e5220f8f1d6826dcf
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 12 ⁨خالد حسني⁩ 2022-12-08 19:03:05 UTC
(In reply to Stéphane Guillou (stragu) from comment #11)
> Khaled, a follow-up, maybe a regression:
> 
> In 7.4, the 1 was on the left of the heading preview (which is correct
> according to the style properties). In 7.5, it is now displayed to the right.


Yes, thanks for the reminder. This is a common issue in all these preview widgets, they are splitting text in a simplistic way (I think you can get the same issue with, say, font preview in the Characters dialog).

We probably should track thi sin a different bug as it needs addressing in general, may be by finding away to use the real layout engine from EditEngine and not try to replicate it and do bad job at it.
Comment 13 Stéphane Guillou (stragu) 2022-12-10 23:16:59 UTC
(In reply to خالد حسني from comment #12)

> We probably should track thi sin a different bug as it needs addressing in
> general, may be by finding away to use the real layout engine from
> EditEngine and not try to replicate it and do bad job at it.

To make sure the regression itself is tracked, we have now: Bug 152460 

Note that regarding this bug here, the style previews in the Tabbed UI still use the Western front. Not sure if it is straight forward to apply your fix to that part of the UI too?

In any case, use of proper font is verified in both the sidebar and the dropdown. Thanks!
Comment 14 ⁨خالد حسني⁩ 2022-12-11 11:55:45 UTC
(In reply to Stéphane Guillou (stragu) from comment #13)
> (In reply to خالد حسني from comment #12)
> 
> > We probably should track thi sin a different bug as it needs addressing in
> > general, may be by finding away to use the real layout engine from
> > EditEngine and not try to replicate it and do bad job at it.
> 
> To make sure the regression itself is tracked, we have now: Bug 152460 
> 
> Note that regarding this bug here, the style previews in the Tabbed UI still
> use the Western front. Not sure if it is straight forward to apply your fix
> to that part of the UI too?
> 
> In any case, use of proper font is verified in both the sidebar and the
> dropdown. Thanks!

LibreOffice grew more preview widgets since I opened this issue, and I think I overlooked this one. I’ll give it a try.