Bug 104533 - Text disappears when selecting Script font
Summary: Text disappears when selecting Script font
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Hardware: All Windows (All)
: medium normal
Assignee: Khaled Hosny
Whiteboard: target:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Fonts Regressions-HarfBuzz
  Show dependency treegraph
Reported: 2016-12-09 16:26 UTC by cvaliant
Modified: 2016-12-16 01:33 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description cvaliant 2016-12-09 16:26:18 UTC
Title pretty much self explanatory.

How to reproduce:
1. Create document
2. Write something
3. Select data -> font=Script

Text will dissappear
Comment 1 pcharalk 2016-12-09 16:34:20 UTC
Same problem appears with fonts:

Comment 2 Telesto 2016-12-09 16:46:30 UTC
Confirming with:
Build ID: a9f56091b6422ec8c42f09b8472200ae4ab12548
CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-12-05_23:12:26
Locale: nl-NL (nl_NL); Calc: CL
Comment 3 Aron Budea 2016-12-09 18:28:41 UTC
commit 2396893edae9ad6f3dc135c02c288d0e583c581c
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Tue Nov 22 10:50:08 2016 -0800

    source sha:34d7602954d4483b3bc9db700e7df2c15348947a

    source sha:34d7602954d4483b3bc9db700e7df2c15348947a
# bad: [479ca41474b9720803421ab7717aa69fa6c60528] source sha:f8c463b393885b660500bf4f7f73b4fb90ce2389
# good: [9eaeeb4c4a8c422b8572397d643097991a6faa85] source sha:90646b4966c73637ddf592acd05b3091fb3fa41f
git bisect start '479ca41474b9720803421ab7717aa69fa6c60528' '9eaeeb4c4a8c422b8572397d643097991a6faa85'
# good: [a8dc1812d951151e50b3fa6778bdee90acaa763f] source sha:5a4e106be6778f7e96fa36d2076ef4e7a90f81d9
git bisect good a8dc1812d951151e50b3fa6778bdee90acaa763f
# bad: [220f9740420000b272f2d9e957626c627611a634] source sha:5f9bd7677047abfc9d3bde0db78f74ff23204f0d
git bisect bad 220f9740420000b272f2d9e957626c627611a634
# bad: [5e198fe6e2d74492dd75ae48eea703eb7b8b401f] source sha:4234b099f1ced2c1929a98ef6133b5280697f00a
git bisect bad 5e198fe6e2d74492dd75ae48eea703eb7b8b401f
# good: [42dc258f83983a0dbfef8e7e1a931f75d4534c46] source sha:e010834dc1a82fcb80dc23025001a752a0fb60a4
git bisect good 42dc258f83983a0dbfef8e7e1a931f75d4534c46
# good: [c4858efef4662f04ae2aa440bf761d0e40134e07] source sha:294bfdfaada9ba85ddcf853650a8da9c10f25281
git bisect good c4858efef4662f04ae2aa440bf761d0e40134e07
# bad: [d65fb8911c80ab3c005a9555f3748f47ae89a8f2] source sha:e19ffa13594640655841f26d797fcd8f49733932
git bisect bad d65fb8911c80ab3c005a9555f3748f47ae89a8f2
# good: [74ea28c97da59ce784aa4d139ad011a73e910c2f] source sha:bba580fad5ebe7643d4c6879f065d49102bf5069
git bisect good 74ea28c97da59ce784aa4d139ad011a73e910c2f
# bad: [2396893edae9ad6f3dc135c02c288d0e583c581c] source sha:34d7602954d4483b3bc9db700e7df2c15348947a
git bisect bad 2396893edae9ad6f3dc135c02c288d0e583c581c
# good: [f5b0dad4998955dcc581efb778d47d3cf73a25be] source sha:c855aec445628f96d3d32cfde6efd4e51e4489c9
git bisect good f5b0dad4998955dcc581efb778d47d3cf73a25be
# first bad commit: [2396893edae9ad6f3dc135c02c288d0e583c581c] source sha:34d7602954d4483b3bc9db700e7df2c15348947a

(partial log, because last commit of previous pull was still good)
Comment 4 Aron Budea 2016-12-09 18:32:42 UTC
The text disappears upon font change starting with the below commit. Adding Cc: to Khaled Hosny, please take a look.
Note that at some point between 5.2 and 5.3 the fallback font changed. Not sure if that's an issue, I didn't bibisect that.

author	Khaled Hosny <khaledhosny@eglug.org>	2016-11-09 13:22:43 (GMT)
committer	Khaled Hosny <khaledhosny@eglug.org>	2016-11-22 15:32:11 (GMT)

tdf#55469 Consistent line spacing across platforms
Comment 5 V Stuart Foote 2016-12-09 19:13:35 UTC
This is by design, essentially ignoring bitmap fonts. The font "Script.fon", Roman.fon are bitmap script and those are now explicitly substituted as in


    { "MS Sans Serif", "Microsoft Sans Serif" },
    { "MS Serif",      "Times New Roman" },
    { "Small Fonts",   "Arial" },
    { "Courier",       "Courier New" },
    { "Roman",         "Times New Roman" },
    { "Script",        "Mistral" }

Unfortunately, Mistral is not as common as we might like.

@Khaled, can we find a different substitute font assignment for Script.fon other than Mistral.ttf? When Mistral is not present with what ever fallback occurs we get blanks.
Comment 6 Aron Budea 2016-12-09 19:39:43 UTC
I've got Mistral font, so the cause must be different.
There's another bitmap font that disappears in 5.3 instead of being substituted: Modern.
Comment 7 V Stuart Foote 2016-12-10 18:28:01 UTC
@Khaled, *

Seems we had two issues--because initial implementation was not behaving for Script, Roman and according to Aron also Modern


TextLayoutEngine -> "new", i.e. run with SAL_USE_COMMON_LAYOUT set or from Expert Configuration

Open attachment 128326 [details] from bug 103514 -- with "new"


Script is replaced by SegoeUI system font rather than Mistral (or fallback)
Roman is replaced by SegoeUI system font rather than TNR

Courier, Small Fonts, MS Serif, MS Sans Serif are correctly replaced by the fall back indicated.

With "old" the bitmap fonts are not replaced, but OpenGL rendering does not render them visible to canvas.

Then, just at the beta1 branch (2016-11-23) we actually start to clobber the missing strings, which I suspect to have happened in:


=-bibisect-= (builds on hand)
good (but an apparent implementation glitch)
with "new" two fonts showing but w SegoeUI rather than expected Mistral & TNR
with "old" two fonts show with the bitmap font Script & Roman  (** with old layout and OpenGL rendering, text is present but bitmap font is blank on canvas, spell check highlights it)

4b4abb73fcd7f2802e73102b3e7c30face8d309c 2016-10-31 **
f6391d9696bfa7485bf785ac81edef4d5441e232 2016-11-10 **
9745d29227e471ce40e9992fefd92e10a48696fb 2016-11-19 **
0f3861e65d8e652dcc31cf9a2f2b5c1a0a73b86d 2016-11-20 **
883024d657fb45c7da459017d2f936aac5644bfb 2016-11-22 **

bad -- lines of text are gone! (both new and old layout)
690f553ecb3efd19143acbf01f3af4e289e94536 2016-11-23 beta1 branch
9691cea443a74885b3f81c602efdd3345de1e3f9 2016-11-24
2e0ab512592e2e134faf9612a293fb8fdd0527d0 2016-11-30 

Comment 8 Khaled Hosny 2016-12-10 19:00:23 UTC
So just to get things straight, the expected behavior in 5.3 with the new layout engine and 5.4+ is:

* Bitmap fonts are not listed in the fonts dropdown.
* Manually typing a bitmap font name or opening a document using a bitmap font should result in a fallback font being used.
* For few select bitmap fonts we should get specific fallback fonts, otherwise it is just arbitrary fallback.

If any of this is not working as outlined above, then it is a bug.

With old layout engine, it is plausible that bitmap fonts have regressed due to the line height change since the new code does not work with bitmap fonts by design, I will see if we can re-use the old line height code as a fallback with the old layout engine in 5.3.
Comment 9 V Stuart Foote 2016-12-10 19:19:06 UTC
(In reply to Khaled Hosny from comment #8)
> If any of this is not working as outlined above, then it is a bug.

Despite having an assigned fallback, with "new" layout Roman and Script were getting system font (Modern was also, but it didn't have an assigned TTF/OTF fallback). While with OpenGL rendering with the "old" layout, the font was blank.

So that was an issue with


Then--just at the 5.3.0 branch off, the paragraphs with Script and Roman (and I assume Modern) are simply being dropped from the document.  A paragraph with default style but empty of text is being rendered to canvas!  That was coincident with


So--yes we have a bug in the mix-- :(
Comment 10 Volga 2016-12-14 12:37:26 UTC
(In reply to Khaled Hosny from comment #8)
I will see if we can re-use the old line height code as a
> fallback with the old layout engine in 5.3.

To avoid unexpected results, I guess adding special codes to judge font type firstly, then calculating line height for specific font, i.e. using old line height codes for bitmap fonts and new codes for outline fonts.
Comment 11 Commit Notification 2016-12-16 01:31:23 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":


tdf#104533: Fix font metrics for non-SFNT fonts

It will be available in

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

Affected users are encouraged to test the fix and report feedback.
Comment 12 Khaled Hosny 2016-12-16 01:33:59 UTC
This should be fixed now, on master and 5.3 with the new layout engine or OpenGL, not bitmap fonts will be allowed (see the last commits referenced in bug 103514). In 5.3 with the old layout engine *and* no OpenGL, they are allowed and the line height is calculated as before.