Bug 41556

Summary: VIEWING: Incomplete font substitution when FontConfig matches italic font
Product: LibreOffice Reporter: Maxim Iorsh <iorsh>
Component: UIAssignee: Caolán McNamara <caolan.mcnamara>
Status: VERIFIED FIXED    
Severity: normal    
Priority: medium    
Version: Master old -3.6   
Hardware: Other   
OS: All   
Whiteboard: BSA
Crash report or crash signature: Regression By:
Attachments: Windows look, using "Guttman Adii" Regular
Current behavior on Linux - missing font substituted by "David CLM Regular"
Expected behavior on Linux - missing font substituted by "David CLM Italic"
FontConfig config file
MS Word document - test case
Incomplete patch, worked for OOo

Description Maxim Iorsh 2011-10-07 06:13:30 UTC
Problem description: 
When fontconfig matches italic font, italicity is ignored. In the particular
case (Hebrew) a Windows font "Guttman Adii" should be replaced by "David CLM
Italic", but it is replaced by "David CLM" instead.

Current behavior: see attachment

Expected behavior: see attachment
Comment 1 Maxim Iorsh 2011-10-07 06:19:33 UTC
Created attachment 52083 [details]
Windows look, using "Guttman Adii" Regular

"Guttman Adii" is used in Windows to create a doc file
Comment 2 Maxim Iorsh 2011-10-07 06:21:00 UTC
Created attachment 52084 [details]
Current behavior on Linux - missing font substituted by "David CLM Regular"
Comment 3 Maxim Iorsh 2011-10-07 07:57:58 UTC
Created attachment 52086 [details]
Expected behavior on Linux - missing font substituted by "David CLM Italic"
Comment 4 Maxim Iorsh 2011-10-07 07:59:15 UTC
Created attachment 52087 [details]
FontConfig config file

The section
        <match target="pattern" >
                <test name="family" >
                        <string>Guttman Adii</string>
                </test>
                <edit mode="append" binding="same" name="family" >
                        <string>David CLM</string>
                </edit>
                <edit mode="assign" binding="same" name="slant" >
                        <const>italic</const>
                </edit>
        </match>
instructs to replace "Guttman Adii" with "David CLM Italic"
Comment 5 Maxim Iorsh 2011-10-19 04:12:00 UTC
Created attachment 52525 [details]
MS Word document - test case
Comment 6 Maxim Iorsh 2011-10-19 04:23:07 UTC
It seems there is a regression since LibO 3.3.1:
In the trunk the test file is opened with first word in David font, and the second in Times New Roman font.
In LibO 3.3.1 the test file is entirely set in David.
Comment 7 Maxim Iorsh 2011-10-19 04:26:57 UTC
Created attachment 52526 [details]
Incomplete patch, worked for OOo

This patch fixed the same issue in Open Office, but didn't cure LibO. Maybe the mentioned regression is related to this.
Comment 8 Caolán McNamara 2011-10-19 07:37:41 UTC
Looks likes its a cache, which doesn't know about the possibility of an italic/bold variant being the sub, which causes this not to work.
Comment 9 Caolán McNamara 2011-10-19 08:15:08 UTC
http://cgit.freedesktop.org/libreoffice/core/commit/?id=3f9a28f1f704967446b411b3b7e176deeb78ca83 for the font sub problem

The other .doc issue looks like a .doc import bug, might have a look at that too
Comment 10 Caolán McNamara 2011-10-20 02:37:44 UTC
and http://cgit.freedesktop.org/libreoffice/core/commit/?id=625a032f820234b0d55e44b2263c5847993dcc7d fixes the font in the .doc import again.

Looks good now I think
Comment 11 Maxim Iorsh 2011-10-21 07:45:42 UTC
I checked in master, it works fine now. Thanks!
Comment 12 Lior Kaplan 2011-12-24 11:13:24 UTC
Verified in 3.5.0 Beta2.