<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/116065/">https://git.reviewboard.kde.org/r/116065/</a>
     </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 5th, 2014, 10:08 a.m. UTC, <b>Anton Kreuzkamp</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://git.reviewboard.kde.org/r/116065/diff/2/?file=246157#file246157line2095" style="color: black; font-weight: bold; text-decoration: underline;">src/qtcore.js</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2095</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="nx">self</span><span class="p">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">font_name</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Why do you set the name property here, before actually loading the font? You wouldn't need all the touchName-stuff, if you just make font_name (->fontName) a private member (==constructor local) and set the name when the font finished loading, would you?
Regarding to how i understand the Qt-docs and what I observed, this is what QtQuick does as well.</pre>
 </blockquote>



 <p>On April 10th, 2014, 12:25 p.m. UTC, <b>Nikita Skovoroda</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">touchName would still be needed for the fallback case.</pre>
 </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Fallback case (without FontLoader.js):
1) Setting the font.name earlier is better because we don't know when the font is actually loaded. It's not nice to delay setting the font name for a fixed timeout if the font is already loaded.
2) At the moment of styling the first element with that font in a browser, the font is not actually loaded, so measuring dimensions will return old results. We need to make sure that some element has that font name applied some time before triggering re-measuring. Could be solved with adding some invisible elements, but that doesn't look better than touching the name to me.

FontLoader.js:
I thought that it might be better to set the name earlier, because if the font is loaded after the timeout, it would be still applied this way (without triggering re-measuring or setting the status). That can be alternatively solved by setting 'name' property if the timeout is reached and the font is not loaded, but if the FontLoader.js is somewhy not functioning correctly, the 'name' property won't be set at all. I guess that it's reasonable to assume that if FontLoader.js is loaded then it's working correctly, so font FontLoader.js code path I will remove touchName()-stuff.</pre>
<br />




<p>- Nikita</p>


<br />
<p>On February 25th, 2014, 11:20 p.m. UTC, Nikita Skovoroda wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for QML Web and Anton Kreuzkamp.</div>
<div>By Nikita Skovoroda.</div>


<p style="color: grey;"><i>Updated Feb. 25, 2014, 11:20 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
qmlweb
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Implement FontLoader type.

See http://qt-project.org/doc/qt-5/qml-qtquick-fontloader.html and http://qt-project.org/doc/qt-4.7/qml-fontloader.html

This currently depends on smnh's MIT-licensed FontLoader.js library
to get notifications when a font is loaded and trigger all events in time.

Elements that are using that font through 'font.family: fontId.name' get their dimensions recalculated correctly when the font loads.

If FontLoader.js is not provided the font is still loaded, but 'status' property is set to Error and dimensions recalculation is triggered after a fixed timeout (3 seconds).
In this case the user gets a notice in console.log.


Timeout (3 seconds) is the maximum time for a font to load. If font isn't loaded in this time, status is set to Error.
Without FontLoader.js dimensions recalculations for elements are triggered after that time.

For both cases (with and without FontLoader.js) if the font takes more than this time to load, dimensions recalculations for elements that are using this font will not be triggered or will have no effect.

On the other hand, if the font could not be loaded (with FontLoader.js enabled), the Error status will be set only when this timeout expires.
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Works as expected (as described above) with or without FontLoader.js.
Tested cases when the font should load and when it should fail to load.

Tested «Text {font.family: fontId.name}» dimensions recalculations.

Works well for me.
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/qtcore.js <span style="color: grey">(c219e2e)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/116065/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>