Review Request 116065: Implement FontLoader type.

Nikita Skovoroda chalkerx at gmail.com
Thu Apr 10 14:54:22 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116065/
-----------------------------------------------------------

(Updated April 10, 2014, 2:54 p.m.)


Review request for QML Web and Anton Kreuzkamp.


Changes
-------

1) Use camelCase.
2) Maximum timeout increased to 15 seconds.
3) With FontLoader.js the 'name' property is set only when the font is loaded, touchName() is not used. If the font is not loaded in 15 seconds, the 'name' property is also set (for the case if the font is loaded in, for example, 16 seconds, because we can't get a real loading error).
4) If FontLoader.js is not provided the font is still loaded, but 'status' property is set to Error, 'name' property is set imediately, and dimensions recalculation is triggered 10 times from 0.02 to 15 seconds. This change actually makes the class more useful without FontLoader.js: when the font is loaded fast — it gets displayed fast enough with proper size re-calculation and the maximum timeout for which size-recalculation still works is the same as with FontLoader.js: 15 seconds.


Repository: qmlweb


Description
-------

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.


Diffs (updated)
-----

  src/qtcore.js a3f408e 

Diff: https://git.reviewboard.kde.org/r/116065/diff/


Testing
-------

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.


Thanks,

Nikita Skovoroda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/qmlweb/attachments/20140410/87fb898a/attachment-0001.html>


More information about the QmlWeb mailing list