[Webkit-unassigned] [Bug 172165] New: Canvas measureText brings wrong results in the first time for custom font face

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 16 05:04:24 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=172165

            Bug ID: 172165
           Summary: Canvas measureText brings wrong results in the first
                    time for custom font face
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Canvas
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: erezg at microsoft.com
                CC: dino at apple.com

Created attachment 310255

  --> https://bugs.webkit.org/attachment.cgi?id=310255&action=review

HTML + WOFF for a repro

I have a custom font in a WOFF file that is dynamically loaded when needed.
In the first use (before the font is loaded), I call the canvas's measureText and I get a wrong result.
The returned result is much bigger than the final result, causing dynamic elements to render wrong.

I attached a demo using HTML and WOFF.
Call the measureTest() function several times. It uses the font-face declared in the style.
In the first time, the result is 103.271484375
In the next times, the result is 49.6240234375.
This function doesn't do any random calculation and should return the correct result (49.6240234375) every time.

In iOS 9, the first result is 51.123046875, and I think this was the case until iOS 10.3 (not including).
The small diff on older OSs didn't matter much but does matter now in the latest iOS.

The problem happens on all latest Safari + Safari Mobile + Safari Technology Preview versions.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170516/5e0a55c6/attachment.html>


More information about the webkit-unassigned mailing list