Bug 117788 - [freetype] Small-Caps and Italic combination is rendering in normal font instead of italic for small-caps
Summary: [freetype] Small-Caps and Italic combination is rendering in normal font inst...
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-19 03:16 PDT by Tanvir Rizvi
Modified: 2017-03-11 11:01 PST (History)
8 users (show)

See Also:


Attachments
Failed Test Case attached (378 bytes, text/html)
2013-06-19 03:16 PDT, Tanvir Rizvi
no flags Details
Patch (2.04 KB, patch)
2013-06-19 04:54 PDT, Tanvir Rizvi
beidson: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tanvir Rizvi 2013-06-19 03:16:05 PDT
Created attachment 204982 [details]
Failed Test Case attached

The combination of Font Property for small-caps and Italic is not making the text Italicized for small-caps characters.
For the Italic font the characters are Italicized but for the small-caps, the characters are not italicized. 

The attachement below shows the failure.
Actual-:        Complete text should be Italicized.
Observation-:   Small-caps variant is not Italicized.
Comment 1 Tanvir Rizvi 2013-06-19 04:54:47 PDT
Created attachment 204990 [details]
Patch
Comment 2 Eric Seidel (no email) 2013-06-24 17:39:06 PDT
Martin would be a much better reviewer than I.
Comment 3 Martin Robinson 2013-06-26 11:02:17 PDT
Comment on attachment 204990 [details]
Patch

Wouldn't it be better to try to find an appropriate font first and then fall back when it isn't possible?
Comment 4 Tanvir Rizvi 2013-06-26 11:20:23 PDT
In the case when there is no italic version of a font present in the system, the ft-font face will be created as a italic glyph for the character,it also creates the scaled font for that font-face so that next time if we want that font face we can quey the scaled font face.
 Now when the Variant font( small -caps ) is queried, the glyph that i get is not italic from the scaled font face.

Now your question  
So if we query and get the appropriate font, i.e with italic font, then again the font-face we create from the scaled font-face will not be italic.


(In reply to comment #3)
> (From update of attachment 204990 [details])
> Wouldn't it be better to try to find an appropriate font first and then fall back when it isn't possible?
Comment 5 Martin Robinson 2013-06-26 11:31:09 PDT
(In reply to comment #4)
> In the case when there is no italic version of a font present in the system, the ft-font face will be created as a italic glyph for the character,it also creates the scaled font for that font-face so that next time if we want that font face we can quey the scaled font face.
>  Now when the Variant font( small -caps ) is queried, the glyph that i get is not italic from the scaled font face.
> 
> Now your question  
> So if we query and get the appropriate font, i.e with italic font, then again the font-face we create from the scaled font-face will not be italic.


I'm afraid I do not follow what you are trying to say. Can you clarify it? Also, can you specify if you are speaking about the situation before or after your patch is applied.

For instance, when you say: "In the case when there is no italic version of a font present in the system, the ft-font face will be created as a italic glyph for the character" Are you trying to say that when an italic version of the font is not found, Fontconfig instructs us to emulate it via italic synthesis / slanting?

I do not understand this at all: "it also creates the scaled font for that font-face so that next time if we want that font face we can quey the scaled font face."

What I'm suggesting is that we first try to query a font that matches what we are looking for ie italic + small caps. When we receive a font that isn't appropriate. For instance, Fontconfig matches a font that is italic, but not smallcaps, we fall back to looking for one that is just small-caps and use synthesized italics. Another thing to investigate is if Fontconfig gives us APIs to give precedence to certain font features.
Comment 6 Tanvir Rizvi 2013-06-26 12:10:18 PDT
The situation i am speaking about is before the patch is being applied and the font property is italic and font-variant is small caps and there is no italic font file present. I have attached a test script wherein few characters are rendered in italic with caps , and few are rendered with italic and small-caps.


1) We query the fontConfig to get the appropriate font based on font italic property, at this point of time while querying we don't have option of querying for the small caps property. So the font-face we get is a italic font. What i observed is that even if the italic font is not present, the font-face i get is italic without any synthesization.  
2) during the glyph rendering
 a) if the font-variant is small-caps , the path followed is variant path, wherein whatever the scaled font face was created , we will initialize the font face again and get the variant font for the glyph, in this case i should get the small-caps with italic, but i am getting the normal font.

Since small-caps is a font variant property i doubt that FC is giving any precedence to us for these variant properties. 



(In reply to comment #5)
> (In reply to comment #4)
> > In the case when there is no italic version of a font present in the system, the ft-font face will be created as a italic glyph for the character,it also creates the scaled font for that font-face so that next time if we want that font face we can quey the scaled font face.
> >  Now when the Variant font( small -caps ) is queried, the glyph that i get is not italic from the scaled font face.
> > 
> > Now your question  
> > So if we query and get the appropriate font, i.e with italic font, then again the font-face we create from the scaled font-face will not be italic.
> 
> 
> I'm afraid I do not follow what you are trying to say. Can you clarify it? Also, can you specify if you are speaking about the situation before or after your patch is applied.
> 
> For instance, when you say: "In the case when there is no italic version of a font present in the system, the ft-font face will be created as a italic glyph for the character" Are you trying to say that when an italic version of the font is not found, Fontconfig instructs us to emulate it via italic synthesis / slanting?
> 
> I do not understand this at all: "it also creates the scaled font for that font-face so that next time if we want that font face we can quey the scaled font face."
> 
> What I'm suggesting is that we first try to query a font that matches what we are looking for ie italic + small caps. When we receive a font that isn't appropriate. For instance, Fontconfig matches a font that is italic, but not smallcaps, we fall back to looking for one that is just small-caps and use synthesized italics. Another thing to investigate is if Fontconfig gives us APIs to give precedence to certain font features.
Comment 7 Brady Eidson 2016-05-24 22:01:01 PDT
Comment on attachment 204990 [details]
Patch

Assuming that patches for review since 2013 are stale, r-