<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Broken fonts break fallback"
   href="https://bugs.webkit.org/show_bug.cgi?id=157414">157414</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Broken fonts break fallback
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Text
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mmaxfield&#64;apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>mmaxfield&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=278236" name="attach_278236" title="Reproduction">attachment 278236</a> <a href="attachment.cgi?id=278236&amp;action=edit" title="Reproduction">[details]</a></span>
Reproduction

When the first item in a font-family list is a web font which points to a file which is broken (CTFontManagerCreateFontDescriptorFromData() returns nullptr), we don't try the next item in the font-family list. Instead, we use Times.

This is due to FontCascadeFonts::realizeFallbackRangesAt() treating the first font-family as special (since this is the font we use for line metrics).

In the following code block, we are hitting the fontRangesForFamily line, which explicitly passes in standardFamily.

    if (!index) {
        fontRanges = realizeNextFallback(description, m_lastRealizedFallbackIndex, m_fontSelector.get());
        if (fontRanges.isNull() &amp;&amp; m_fontSelector)
            fontRanges = m_fontSelector-&gt;fontRangesForFamily(description, standardFamily);
        if (fontRanges.isNull())
            fontRanges = FontRanges(FontCache::singleton().lastResortFallbackFont(description));
        return fontRanges;
    }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>