RESOLVED FIXED151650
[SVG -> OTF Converter] Force UnitsPerEm to 1000
https://bugs.webkit.org/show_bug.cgi?id=151650
Summary [SVG -> OTF Converter] Force UnitsPerEm to 1000
Myles C. Maxfield
Reported 2015-11-29 22:20:13 PST
[SVG -> OTF Converter] Force UnitsPerEm to 1000
Attachments
Patch (14.97 KB, patch)
2015-11-29 22:25 PST, Myles C. Maxfield
no flags
Archive of layout-test-results from ews102 for mac-yosemite (2.30 MB, application/zip)
2015-11-29 23:11 PST, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (2.25 MB, application/zip)
2015-11-29 23:14 PST, Build Bot
no flags
Archive of layout-test-results from ews112 for mac-yosemite (2.37 MB, application/zip)
2015-11-29 23:18 PST, Build Bot
no flags
Patch (14.96 KB, patch)
2015-11-30 14:15 PST, Myles C. Maxfield
no flags
Needs rebaselines (21.90 KB, patch)
2015-11-30 17:24 PST, Myles C. Maxfield
no flags
Archive of layout-test-results from ews101 for mac-yosemite (2.04 MB, application/zip)
2015-11-30 18:08 PST, Build Bot
no flags
Archive of layout-test-results from ews104 for mac-yosemite-wk2 (2.01 MB, application/zip)
2015-11-30 18:14 PST, Build Bot
no flags
Archive of layout-test-results from ews112 for mac-yosemite (2.39 MB, application/zip)
2015-11-30 18:16 PST, Build Bot
no flags
Patch (129.07 KB, patch)
2015-11-30 18:54 PST, Myles C. Maxfield
koivisto: review+
buildbot: commit-queue-
Archive of layout-test-results from ews102 for mac-yosemite (964.56 KB, application/zip)
2015-11-30 19:40 PST, Build Bot
no flags
Archive of layout-test-results from ews114 for mac-yosemite (866.46 KB, application/zip)
2015-11-30 19:47 PST, Build Bot
no flags
Patch for committing (130.34 KB, patch)
2015-12-01 13:57 PST, Myles C. Maxfield
no flags
Enable on Windows (4.58 KB, patch)
2016-02-06 20:56 PST, Myles C. Maxfield
no flags
Myles C. Maxfield
Comment 1 2015-11-29 22:25:32 PST
Build Bot
Comment 2 2015-11-29 23:11:37 PST
Comment on attachment 266235 [details] Patch Attachment 266235 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/495667 New failing tests: svg/W3C-SVG-1.1/fonts-elem-02-t.svg svg/custom/glyph-setting-d-attribute.svg svg/W3C-SVG-1.1/fonts-elem-06-t.svg svg/text/svg-font-word-rounding-hacks-spaces.html svg/W3C-SVG-1.1/text-intro-02-b.svg svg/W3C-SVG-1.1/fonts-elem-07-b.svg svg/custom/glyph-selection-non-bmp.svg svg/custom/glyph-selection-lang-attribute.svg svg/batik/text/textEffect3.svg fast/ruby/ruby-expansion-cjk-5.html svg/W3C-SVG-1.1/fonts-elem-04-b.svg svg/W3C-SVG-1.1/text-intro-01-t.svg fast/ruby/ruby-expansion-cjk-3.html fast/ruby/ruby-expansion-cjk.html svg/W3C-SVG-1.1/text-intro-03-b.svg svg/W3C-SVG-1.1/fonts-elem-01-t.svg svg/wicd/test-rightsizing-b.xhtml svg/custom/glyph-selection-arabic-forms.svg svg/batik/text/textPosition2.svg svg/custom/glyph-selection-bidi-mirror.svg svg/W3C-SVG-1.1/fonts-elem-03-b.svg svg/custom/acid3-test-77.html svg/W3C-SVG-1.1/text-align-08-b.svg platform/mac/svg/fonts/svg-font-general.html svg/W3C-SVG-1.1/text-intro-04-t.svg fast/ruby/ruby-expansion-cjk-4.html svg/W3C-SVG-1.1/fonts-glyph-03-t.svg
Build Bot
Comment 3 2015-11-29 23:11:40 PST
Created attachment 266237 [details] Archive of layout-test-results from ews102 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 4 2015-11-29 23:14:17 PST
Comment on attachment 266235 [details] Patch Attachment 266235 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/495671 New failing tests: svg/W3C-SVG-1.1/fonts-elem-02-t.svg svg/custom/glyph-setting-d-attribute.svg svg/W3C-SVG-1.1/fonts-elem-06-t.svg svg/text/svg-font-word-rounding-hacks-spaces.html svg/W3C-SVG-1.1/text-intro-02-b.svg svg/custom/glyph-selection-bidi-mirror.svg svg/custom/glyph-selection-non-bmp.svg svg/W3C-SVG-1.1/fonts-elem-07-b.svg svg/batik/text/textEffect3.svg fast/ruby/ruby-expansion-cjk-5.html svg/custom/glyph-selection-lang-attribute.svg svg/batik/text/textPosition2.svg fast/ruby/ruby-expansion-cjk-3.html fast/ruby/ruby-expansion-cjk.html svg/W3C-SVG-1.1/text-intro-03-b.svg fast/ruby/ruby-expansion-cjk-2.html svg/W3C-SVG-1.1/fonts-elem-01-t.svg svg/wicd/test-rightsizing-b.xhtml svg/custom/glyph-selection-arabic-forms.svg svg/W3C-SVG-1.1/text-intro-01-t.svg svg/W3C-SVG-1.1/fonts-elem-03-b.svg svg/custom/acid3-test-77.html svg/W3C-SVG-1.1/text-align-08-b.svg platform/mac/svg/fonts/svg-font-general.html svg/W3C-SVG-1.1/text-intro-04-t.svg fast/ruby/ruby-expansion-cjk-4.html svg/W3C-SVG-1.1/fonts-glyph-03-t.svg
Build Bot
Comment 5 2015-11-29 23:14:19 PST
Created attachment 266238 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 6 2015-11-29 23:18:05 PST
Comment on attachment 266235 [details] Patch Attachment 266235 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/495670 New failing tests: svg/W3C-SVG-1.1/fonts-elem-02-t.svg svg/custom/glyph-setting-d-attribute.svg svg/W3C-SVG-1.1/fonts-elem-06-t.svg svg/text/svg-font-word-rounding-hacks-spaces.html svg/W3C-SVG-1.1/text-intro-02-b.svg svg/custom/glyph-selection-lang-attribute.svg svg/custom/glyph-selection-non-bmp.svg svg/custom/glyph-selection-bidi-mirror.svg svg/batik/text/textEffect3.svg fast/ruby/ruby-expansion-cjk-5.html svg/W3C-SVG-1.1/fonts-elem-04-b.svg svg/W3C-SVG-1.1/text-intro-01-t.svg fast/ruby/ruby-expansion-cjk-3.html fast/ruby/ruby-expansion-cjk.html svg/W3C-SVG-1.1/fonts-elem-07-b.svg svg/W3C-SVG-1.1/text-intro-03-b.svg svg/W3C-SVG-1.1/fonts-elem-01-t.svg svg/wicd/test-rightsizing-b.xhtml svg/custom/glyph-selection-arabic-forms.svg svg/batik/text/textPosition2.svg svg/W3C-SVG-1.1/fonts-elem-03-b.svg svg/custom/acid3-test-77.html svg/W3C-SVG-1.1/text-align-08-b.svg platform/mac/svg/fonts/svg-font-general.html svg/W3C-SVG-1.1/text-intro-04-t.svg fast/ruby/ruby-expansion-cjk-4.html svg/W3C-SVG-1.1/fonts-glyph-03-t.svg
Build Bot
Comment 7 2015-11-29 23:18:08 PST
Created attachment 266240 [details] Archive of layout-test-results from ews112 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-yosemite Platform: Mac OS X 10.10.5
Myles C. Maxfield
Comment 8 2015-11-30 10:42:33 PST
It looks like there are some real failures: platform/mac/svg/fonts/svg-font-general.html svg/W3C-SVG-1.1/fonts-elem-06-t.svg svg/W3C-SVG-1.1/fonts-glyph-03-t.svg svg/W3C-SVG-1.1/text-align-08-b.svg svg/custom/glyph-selection-bidi-mirror.svg svg/custom/glyph-selection-lang-attribute.svg svg/custom/glyph-setting-d-attribute.svg svg/text/svg-font-word-rounding-hacks-spaces.html svg/custom/glyph-selection-arabic-forms.svg
Darin Adler
Comment 9 2015-11-30 11:32:11 PST
Comment on attachment 266235 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=266235&action=review > Source/WebCore/svg/SVGToOTFFontConversion.cpp:235 > + template <typename T> > + T scaleUnitsPerEm(T value) const > + { > + return value / static_cast<double>(m_inputUnitsPerEm) * s_outputUnitsPerEm; > + } Strange to cast m_inputUnitsPerEm to double. Seems like an arbitrary choice. Why not cast "value" to double instead? Or do the entire thing with integers by multiplying first and then dividing? The algorithm involves conversion to floating point, scaling, and then truncation. I’d think we’d want to round instead of truncating. Do we have a guarantee that m_inputUnitsPerEm is not zero? Do we have a guarantee that the scaling won’t result in overflow? What’s the desired behavior if it does? In new code I’ve been using this format: template<typename T> T scaleUnitsPerEm(T value) const Putting the template on the same line seems to make sense in a case like this, making it easier to read rather than harder. And the lack of space after "template" is a style that both Anders and I prefer.a
Myles C. Maxfield
Comment 10 2015-11-30 14:15:01 PST
Myles C. Maxfield
Comment 11 2015-11-30 16:06:24 PST
svg/text/svg-font-word-rounding-hacks-spaces.html may still be a real failure.
Myles C. Maxfield
Comment 12 2015-11-30 17:24:22 PST
Created attachment 266307 [details] Needs rebaselines
Build Bot
Comment 13 2015-11-30 18:08:43 PST
Comment on attachment 266307 [details] Needs rebaselines Attachment 266307 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/499219 New failing tests: fast/ruby/ruby-expansion-cjk-3.html fast/ruby/ruby-expansion-cjk-5.html svg/batik/text/textEffect3.svg svg/W3C-SVG-1.1/fonts-elem-02-t.svg svg/custom/acid3-test-77.html svg/W3C-SVG-1.1/text-intro-03-b.svg svg/batik/text/textPosition2.svg svg/W3C-SVG-1.1/text-intro-04-t.svg fast/ruby/ruby-expansion-cjk.html fast/ruby/ruby-expansion-cjk-4.html svg/W3C-SVG-1.1/fonts-elem-01-t.svg svg/W3C-SVG-1.1/text-intro-02-b.svg svg/wicd/test-rightsizing-b.xhtml svg/W3C-SVG-1.1/fonts-elem-07-b.svg svg/W3C-SVG-1.1/fonts-elem-04-b.svg svg/W3C-SVG-1.1/text-intro-01-t.svg svg/W3C-SVG-1.1/fonts-elem-03-b.svg
Build Bot
Comment 14 2015-11-30 18:08:47 PST
Created attachment 266312 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 15 2015-11-30 18:14:47 PST
Comment on attachment 266307 [details] Needs rebaselines Attachment 266307 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/499235 New failing tests: fast/ruby/ruby-expansion-cjk-3.html fast/ruby/ruby-expansion-cjk-5.html svg/batik/text/textEffect3.svg svg/W3C-SVG-1.1/fonts-elem-02-t.svg svg/custom/acid3-test-77.html svg/W3C-SVG-1.1/text-intro-03-b.svg svg/W3C-SVG-1.1/text-intro-04-t.svg svg/batik/text/textPosition2.svg fast/ruby/ruby-expansion-cjk-2.html fast/ruby/ruby-expansion-cjk.html fast/ruby/ruby-expansion-cjk-4.html svg/W3C-SVG-1.1/fonts-elem-01-t.svg svg/W3C-SVG-1.1/text-intro-02-b.svg svg/wicd/test-rightsizing-b.xhtml svg/W3C-SVG-1.1/fonts-elem-07-b.svg svg/W3C-SVG-1.1/text-intro-01-t.svg svg/W3C-SVG-1.1/fonts-elem-03-b.svg
Build Bot
Comment 16 2015-11-30 18:14:50 PST
Created attachment 266313 [details] Archive of layout-test-results from ews104 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 17 2015-11-30 18:16:20 PST
Comment on attachment 266307 [details] Needs rebaselines Attachment 266307 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/499223 New failing tests: fast/ruby/ruby-expansion-cjk-3.html fast/ruby/ruby-expansion-cjk-5.html svg/batik/text/textEffect3.svg svg/W3C-SVG-1.1/fonts-elem-02-t.svg svg/custom/acid3-test-77.html svg/W3C-SVG-1.1/text-intro-03-b.svg svg/batik/text/textPosition2.svg svg/W3C-SVG-1.1/text-intro-04-t.svg fast/ruby/ruby-expansion-cjk.html fast/ruby/ruby-expansion-cjk-4.html svg/W3C-SVG-1.1/fonts-elem-01-t.svg svg/W3C-SVG-1.1/text-intro-02-b.svg svg/wicd/test-rightsizing-b.xhtml svg/W3C-SVG-1.1/fonts-elem-07-b.svg svg/W3C-SVG-1.1/fonts-elem-04-b.svg svg/W3C-SVG-1.1/text-intro-01-t.svg svg/W3C-SVG-1.1/fonts-elem-03-b.svg
Build Bot
Comment 18 2015-11-30 18:16:24 PST
Created attachment 266314 [details] Archive of layout-test-results from ews112 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-yosemite Platform: Mac OS X 10.10.5
Myles C. Maxfield
Comment 19 2015-11-30 18:54:40 PST
Build Bot
Comment 20 2015-11-30 19:40:41 PST
Comment on attachment 266318 [details] Patch Attachment 266318 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/499615 New failing tests: svg/W3C-SVG-1.1/fonts-elem-04-b.svg
Build Bot
Comment 21 2015-11-30 19:40:44 PST
Created attachment 266327 [details] Archive of layout-test-results from ews102 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 22 2015-11-30 19:47:01 PST
Comment on attachment 266318 [details] Patch Attachment 266318 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/499612 New failing tests: svg/W3C-SVG-1.1/fonts-elem-04-b.svg
Build Bot
Comment 23 2015-11-30 19:47:04 PST
Created attachment 266328 [details] Archive of layout-test-results from ews114 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-yosemite Platform: Mac OS X 10.10.5
Antti Koivisto
Comment 24 2015-12-01 06:37:47 PST
Comment on attachment 266318 [details] Patch r=me
Darin Adler
Comment 25 2015-12-01 10:47:00 PST
Did you see my comments and my questions?
Myles C. Maxfield
Comment 26 2015-12-01 11:36:49 PST
(In reply to comment #25) > Did you see my comments and my questions? Yes; this latest patch wasn't intended to be a real proposal; it only fixes some of the tests which were failing. I will address your comments in the next patch.
Myles C. Maxfield
Comment 27 2015-12-01 13:51:40 PST
Comment on attachment 266235 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=266235&action=review >> Source/WebCore/svg/SVGToOTFFontConversion.cpp:235 >> + } > > Strange to cast m_inputUnitsPerEm to double. Seems like an arbitrary choice. Why not cast "value" to double instead? Or do the entire thing with integers by multiplying first and then dividing? > > The algorithm involves conversion to floating point, scaling, and then truncation. I’d think we’d want to round instead of truncating. > > Do we have a guarantee that m_inputUnitsPerEm is not zero? Do we have a guarantee that the scaling won’t result in overflow? What’s the desired behavior if it does? > > In new code I’ve been using this format: > > template<typename T> T scaleUnitsPerEm(T value) const > > Putting the template on the same line seems to make sense in a case like this, making it easier to read rather than harder. And the lack of space after "template" is a style that both Anders and I prefer.a Doing this all with integers is probably the most elegant solution. We know m_inputUnitsPerEm isn't zero, because we check for this condition (and set it to 1). The result will only overflow if the font author uses values that are wildly outside of the em square; in this case, they will have bigger problems than this one.
Myles C. Maxfield
Comment 28 2015-12-01 13:57:11 PST
Created attachment 266390 [details] Patch for committing
WebKit Commit Bot
Comment 29 2015-12-01 16:57:55 PST
Comment on attachment 266390 [details] Patch for committing Clearing flags on attachment: 266390 Committed r192930: <http://trac.webkit.org/changeset/192930>
Myles C. Maxfield
Comment 30 2016-02-06 20:56:08 PST
Created attachment 270812 [details] Enable on Windows
Note You need to log in before you can comment on or make changes to this bug.