<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>120499</bug_id>
          
          <creation_ts>2013-08-29 15:39:54 -0700</creation_ts>
          <short_desc>Font-faces with different styles should not be mixed in a CSSSegmentedFontFace</short_desc>
          <delta_ts>2026-03-17 18:39:55 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>https://jsfiddle.net/pwzcn41h/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BlinkMergeCandidate, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>309822</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Brent Fulgham">bfulgham</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>d-r</cc>
    
    <cc>enrica</cc>
    
    <cc>fantasai.bugs</cc>
    
    <cc>hyatt</cc>
    
    <cc>jonlee</cc>
    
    <cc>mitz</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>922703</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-08-29 15:39:54 -0700</bug_when>
    <thetext>Consider merging https://chromium.googlesource.com/chromium/blink/+/7823ceba809d5c05bffeeb9e732e92fe76fab7e9

Before this patch, when a glyph for the character to be rendered is not
in the matched @font-face, glyph from other @font-face (with different
style) in the family or system font with the same name were used as fallback.
This behavior does not follow the font matching algorithm
(http://www.w3.org/TR/css3-fonts/#font-matching-algorithm):

&quot;6. If no matching face exists or the matched face does not contain a glyph
    for the character to be rendered, the next family name is selected and
    the previous three steps repeated. Glyphs from other faces in the family
    are not considered.&quot;

This patch fixes the issue by changing CSSSegmentedFontFace to represent fonts
of single font traits. This also fixes a bug that the browser downloads fonts
for unused styles.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1315656</commentid>
    <comment_count>1</comment_count>
    <who name="Dominik Röttsches (drott)">d-r</who>
    <bug_when>2017-06-05 01:53:26 -0700</bug_when>
    <thetext>Myles, while looking at WebKit&apos;s code for variable fonts matching on style, stretch, weight, I came across this again. WebKit nightly r217775 still falls back across the boundaries of the initial style/stretch/weight &quot;narrow-down&quot;. &quot;Narrow-down&quot; in the sense of the font matching algorithm, which aims to reduce the set of stretch, style, weight options down to one.

5.2.6 Font Style Matching https://drafts.csswg.org/css-fonts-3/#font-style-matching still says: 

&quot;If no matching face exists or the matched face does not contain a glyph for the character to be rendered, the next family name is selected and the previous three steps repeated. Glyphs from other faces in the family are not considered. &quot;

As far as I understand, the code in 
https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/css/CSSFontFaceSet.cpp#L431 just sorts the set, instead of narrowing it down to matching only one set of identical traits, so that the list of faces as members of CSSSegmentedFontFace would only differ in unicode-range.

https://codepen.io/anon/pen/GEgjyV is a reproduction: FF and Chrome only display the first &apos;a&apos; in &quot;Great Vibes&quot;, whereas WebKit nightly r217775 also shows the &apos;b&apos; in Great Vibes, which it shouldn&apos;t do according to the font matching algorithm, since the @font-face which has unicode-range coverage for &apos;b&apos; is of a different font-stretch: variant.

Could you perhaps comment on this issue? I&apos;d like to find out whether we have the same understanding of the font matching algorithm. Thanks in advance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1315696</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-06-05 08:59:32 -0700</bug_when>
    <thetext>&lt;rdar://problem/32566994&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1316158</commentid>
    <comment_count>3</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2017-06-06 12:13:43 -0700</bug_when>
    <thetext>You&apos;re right, we&apos;re not following the spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1316440</commentid>
    <comment_count>4</comment_count>
    <who name="Dominik Röttsches (drott)">d-r</who>
    <bug_when>2017-06-07 04:53:49 -0700</bug_when>
    <thetext>Thanks for taking a look.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1965422</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-07-06 13:37:10 -0700</bug_when>
    <thetext>Adding test case from Chrome / Blink commit in URL field.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2187633</commentid>
    <comment_count>6</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2026-03-05 17:41:39 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/60035</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2189451</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-03-12 00:58:23 -0700</bug_when>
    <thetext>Committed 309121@main (d026972d8525): &lt;https://commits.webkit.org/309121@main&gt;

Reviewed commits have been landed. Closing PR #60035 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2191205</commentid>
    <comment_count>8</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-03-17 18:39:55 -0700</bug_when>
    <thetext>Committed 305413.507@safari-7624-branch (554415a70bf3): &lt;https://commits.webkit.org/305413.507@safari-7624-branch&gt;

Reviewed commits have been landed. Closing PR #4688 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>