Fixing superscript and subscript baseline for tiny fonts in SVG
When the font size is small (<1), superscript and subscript tags
(baseline-shift="super" and baseline-shift="sub") do not make any
difference in the baseline.
BUG=656638
Description was changed from ========== Patch set 1. BUG=656638 ========== to ========== Fixing superscript and ...
4 years, 2 months ago
(2016-10-17 19:01:37 UTC)
#1
Description was changed from
==========
Patch set 1.
BUG=656638
==========
to
==========
Fixing superscript and subscript baseline for tiny fonts in SVG
When the font size is small (<1), superscript and subscript tags
(baseline-shift="super" and baseline-shift="sub") do not make any
difference in the baseline.
BUG=656638
==========
4 years, 2 months ago
(2016-10-17 19:02:01 UTC)
#3
New patch submitted.
eae
Thanks for your patience, this code is suprt old and quite messy :( https://codereview.chromium.org/2427773002/diff/1/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp File ...
4 years, 2 months ago
(2016-10-17 20:14:23 UTC)
#4
https://codereview.chromium.org/2427773002/diff/1/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp File third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp (right): https://codereview.chromium.org/2427773002/diff/1/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp#newcode405 third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp:405: scaledFont.getFontDescription().setSubpixelAscentDescent(true); On 2016/10/17 20:14:23, eae wrote: > It's not ...
4 years, 2 months ago
(2016-10-18 15:51:16 UTC)
#5
https://codereview.chromium.org/2427773002/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp (right):
https://codereview.chromium.org/2427773002/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp:405:
scaledFont.getFontDescription().setSubpixelAscentDescent(true);
On 2016/10/17 20:14:23, eae wrote:
> It's not clear that updateScaledFont is guaranteed to run before m_scaledFont
is
> used, perhaps you could set a breakpoint there or add an assert to see if that
> is the case.
Correct. The problem is that the rounding at the beginning of platformInit()
affects the calculation of other metrics as well. The current call to
setSubpixelAscentDescent() does not update the previous calculations, so you
have to do that before the font gets initiated, which brings you to the change
needed in LayoutText.cpp which is outside SVG code and affects others too (like
Canvas). We can either go with something universal, or to remain more cautious,
we can change setSubpixelAscentDescent() to update the previous calculations if
needed. WDYT?
> There is also SVGTextLayoutEngine::layoutTextOnLineOrPath that access the font
> directly which might need updating.
No benefit there as the font is already created there, unless we update the
previous metrics in setSubpixelAscentDescent(). In this case IMO this will
complete the CL.
https://codereview.chromium.org/2427773002/diff/1/third_party/WebKit/Source/p...
File third_party/WebKit/Source/platform/fonts/FontDescription.h (right):
https://codereview.chromium.org/2427773002/diff/1/third_party/WebKit/Source/p...
third_party/WebKit/Source/platform/fonts/FontDescription.h:20: * along with this
library; see the file COPYING.LIB. If not, write to
On 2016/10/17 20:14:23, eae wrote:
> ?
It seems to has been replaced by someone by mistake previously.
https://codereview.chromium.org/2427773002/diff/1/third_party/WebKit/Source/p...
third_party/WebKit/Source/platform/fonts/FontDescription.h:420:
other2.setSubpixelAscentDescent(m_fields.m_subpixelAscentDescent);
On 2016/10/17 20:14:23, eae wrote:
> This shouldn't be needed, the fields are compared by comparing the
> fieldsAsUnsigned masks. The fields should also be included in the hash
> (styleHashWithoutFamilyList) as it uses the full width of the bit fields.
>
Acknowledged.
zakerinasab
New patch submitted. PTAL. IMHO this one is better as it is focused on baseline ...
4 years, 2 months ago
(2016-10-18 19:15:15 UTC)
#6
New patch submitted. PTAL. IMHO this one is better as it is focused on baseline
and calculateBaselineShift()
is always called in SVGTextLayoutEngine::layoutTextOnLineOrPath() so I think it
provides the coverage too. If you were okay with the code I'll go ahead to
prepare the new layout test results by trying rebaseline-cl again.
zakerinasab
Patchset #3 (id:40001) has been deleted
4 years, 2 months ago
(2016-10-18 19:17:57 UTC)
#7
Patchset #3 (id:40001) has been deleted
eae
This looks great, thank you! https://codereview.chromium.org/2427773002/diff/60001/third_party/WebKit/Source/platform/fonts/FontDescription.h File third_party/WebKit/Source/platform/fonts/FontDescription.h (right): https://codereview.chromium.org/2427773002/diff/60001/third_party/WebKit/Source/platform/fonts/FontDescription.h#newcode20 third_party/WebKit/Source/platform/fonts/FontDescription.h:20: * along with this ...
4 years, 2 months ago
(2016-10-18 22:12:04 UTC)
#8
New patch uploaded after rebaseline-cl. - It seems that this CL has affected other layout ...
4 years, 2 months ago
(2016-10-19 14:14:41 UTC)
#10
New patch uploaded after rebaseline-cl.
- It seems that this CL has affected other layout tests. Please advise on
keeping the updated TestExpectations or revert to the older version.
- CL works fine on Linux and Mac but it doesn't work on Mac Retina. Needs more
investigation. Any ideas?
- CL does not seem to work on Windows. Looking into that.
zakerinasab
On my Windows desktop the patch works fine, still doesn't generate the proper output on ...
4 years, 2 months ago
(2016-10-19 14:45:43 UTC)
#11
On my Windows desktop the patch works fine, still doesn't generate the proper
output on Windows try-bots.
zakerinasab
The CL also works fine on my Mac Retina.
4 years, 2 months ago
(2016-10-19 15:18:36 UTC)
#12
The CL also works fine on my Mac Retina.
zakerinasab
Patchset #6 (id:120001) has been deleted
4 years, 2 months ago
(2016-10-19 23:31:03 UTC)
#13
Patchset #6 (id:120001) has been deleted
zakerinasab
Patchset #5 (id:100001) has been deleted
4 years, 2 months ago
(2016-10-20 14:38:58 UTC)
#14
Patchset #5 (id:100001) has been deleted
zakerinasab
Patchset #5 (id:140001) has been deleted
4 years, 2 months ago
(2016-10-20 14:42:55 UTC)
#15
Patchset #5 (id:140001) has been deleted
zakerinasab
Patchset #7 (id:200001) has been deleted
4 years, 1 month ago
(2016-10-25 14:04:11 UTC)
#16
Patchset #7 (id:200001) has been deleted
zakerinasab
Patchset #7 (id:220001) has been deleted
4 years, 1 month ago
(2016-10-25 14:04:19 UTC)
#17
Patchset #7 (id:220001) has been deleted
zakerinasab
Patchset #7 (id:240001) has been deleted
4 years, 1 month ago
(2016-10-25 14:04:29 UTC)
#18
Patchset #7 (id:240001) has been deleted
zakerinasab
Patchset #7 (id:260001) has been deleted
4 years, 1 month ago
(2016-10-25 14:04:39 UTC)
#19
Patchset #7 (id:260001) has been deleted
zakerinasab
Patchset #9 (id:320001) has been deleted
4 years, 1 month ago
(2016-10-25 20:25:18 UTC)
#20
Patchset #9 (id:320001) has been deleted
zakerinasab
Patchset #9 (id:340001) has been deleted
4 years, 1 month ago
(2016-10-25 20:25:27 UTC)
#21
Patchset #9 (id:340001) has been deleted
zakerinasab
Patchset #9 (id:360001) has been deleted
4 years, 1 month ago
(2016-10-26 15:31:57 UTC)
#22
Patchset #9 (id:360001) has been deleted
zakerinasab
Patchset #8 (id:300001) has been deleted
4 years, 1 month ago
(2016-10-26 17:40:22 UTC)
#23
Patchset #8 (id:300001) has been deleted
zakerinasab
Patchset #8 (id:370011) has been deleted
4 years, 1 month ago
(2016-10-26 17:43:42 UTC)
#24
Patchset #8 (id:370011) has been deleted
zakerinasab
Patchset #8 (id:390001) has been deleted
4 years, 1 month ago
(2016-10-26 20:40:37 UTC)
#25
Patchset #8 (id:390001) has been deleted
zakerinasab
Patchset #9 (id:420001) has been deleted
4 years, 1 month ago
(2016-10-26 20:45:41 UTC)
#26
Patchset #9 (id:420001) has been deleted
zakerinasab
Patchset #8 (id:370012) has been deleted
4 years, 1 month ago
(2016-10-31 15:42:10 UTC)
#27
Patchset #8 (id:370012) has been deleted
zakerinasab
Patchset #9 (id:460001) has been deleted
4 years, 1 month ago
(2016-10-31 16:47:46 UTC)
#28
Patchset #9 (id:460001) has been deleted
zakerinasab
New patch submitted. The issue with Mac Retina try-bots is resolved. The issue with Windows ...
4 years, 1 month ago
(2016-10-31 16:57:05 UTC)
#29
New patch submitted. The issue with Mac Retina try-bots is resolved. The issue
with Windows try-bots however needs to turn on subpixel text rendering for small
fonts.
@eae, PTAL.
eae
LGTM
4 years, 1 month ago
(2016-10-31 17:04:14 UTC)
#30
LGTM
zakerinasab
New patch submitted. Cleaning up FontPlatformDataWin.cpp after removing the check for subpixel text rendering. @eae ...
4 years, 1 month ago
(2016-10-31 17:57:31 UTC)
#31
New patch submitted. Cleaning up FontPlatformDataWin.cpp after removing the
check for subpixel text rendering.
@eae PTAL.
eae
On 2016/10/31 17:57:31, zakerinasab wrote: > New patch submitted. Cleaning up FontPlatformDataWin.cpp after removing the ...
4 years, 1 month ago
(2016-10-31 18:01:42 UTC)
#32
On 2016/10/31 17:57:31, zakerinasab wrote:
> New patch submitted. Cleaning up FontPlatformDataWin.cpp after removing the
> check for subpixel text rendering.
> @eae PTAL.
NOT LGTM
Why did you remove the check for subpixel text rendering? That has nothing to do
with subscript and is there to make certain legacy fonts legible at smaller
sizes on windows.
zakerinasab
On 2016/10/31 18:01:42, eae wrote: > On 2016/10/31 17:57:31, zakerinasab wrote: > > New patch ...
4 years, 1 month ago
(2016-10-31 18:16:12 UTC)
#33
On 2016/10/31 18:01:42, eae wrote:
> On 2016/10/31 17:57:31, zakerinasab wrote:
> > New patch submitted. Cleaning up FontPlatformDataWin.cpp after removing the
> > check for subpixel text rendering.
> > @eae PTAL.
>
> NOT LGTM
>
> Why did you remove the check for subpixel text rendering? That has nothing to
do
> with subscript and is there to make certain legacy fonts legible at smaller
> sizes on windows.
This code has the same effect as the code in the previous patch (patch set 9)
which you LGTM. It just sets the SkPaint::kSubpixelText_Flag by default. If it
is not acceptable, we need to plumb a variable from SimpleFontData::platformInit
to FontPlatformData::setupPaint to specify that we have a sub-/superscript here.
I'll do that and upload another patch. However, I suspect this might not solve
the issue with Windows try-bots. The problem here is that the Windows try-bots
do not use/assume a high DPI screen, so the 0.3 px font size falls below the
threshold and does not receive subpixel text rendering. Turning on subpixel
rendering for sub/super in these fonts does not make sense when the original
baseline does not have it.
eae
You are removing a set of functionality that is unrelated to your change. If you ...
4 years, 1 month ago
(2016-10-31 18:23:01 UTC)
#34
You are removing a set of functionality that is unrelated to your change. If you
want to change how we enable subpixel rendering for all text on windows then
please do that as a separate change so that we can have a discussion about it
instead of doing it as a part of a seemingly unrelated change to svg baselines.
zakerinasab
On 2016/10/31 18:23:01, eae wrote: > You are removing a set of functionality that is ...
4 years, 1 month ago
(2016-10-31 19:06:04 UTC)
#35
On 2016/10/31 18:23:01, eae wrote:
> You are removing a set of functionality that is unrelated to your change. If
you
> want to change how we enable subpixel rendering for all text on windows then
> please do that as a separate change so that we can have a discussion about it
> instead of doing it as a part of a seemingly unrelated change to svg
baselines.
To clarify, as long as subpixel text rendering for these small fonts is off, the
subscript and superscript will not work properly on Windows try-bots for very
small fonts. So these changes are related. The CL works fine on my local Windows
machine because the display is high DPI, which is not the case on try-bots. It
makes sense to keep this for another bug, so I will revert the changes of
FontPlatformDataWin.cpp and will submit another patch. If that was okay, I will
rebaseline and commit.
eae
On 2016/10/31 19:06:04, zakerinasab wrote: > On 2016/10/31 18:23:01, eae wrote: > > You are ...
4 years, 1 month ago
(2016-10-31 19:11:27 UTC)
#36
On 2016/10/31 19:06:04, zakerinasab wrote:
> On 2016/10/31 18:23:01, eae wrote:
> > You are removing a set of functionality that is unrelated to your change. If
> you
> > want to change how we enable subpixel rendering for all text on windows then
> > please do that as a separate change so that we can have a discussion about
it
> > instead of doing it as a part of a seemingly unrelated change to svg
> baselines.
>
> To clarify, as long as subpixel text rendering for these small fonts is off,
the
> subscript and superscript will not work properly on Windows try-bots for very
> small fonts. So these changes are related. The CL works fine on my local
Windows
> machine because the display is high DPI, which is not the case on try-bots. It
> makes sense to keep this for another bug, so I will revert the changes of
> FontPlatformDataWin.cpp and will submit another patch. If that was okay, I
will
> rebaseline and commit.
That might be but you aren't changing this just for sub/sup for SVG, you are
changing it for all text. We've spent *years* working on making sure our text
rendering is legible across scripts, fonts and operating systems. This code is
there for a reason. You can't fundamentally change how we do text rendering on
a whim to fix one edge case.
I'm sorry but this needs to go back to the drawing board.
zakerinasab
On 2016/10/31 19:11:27, eae wrote: > On 2016/10/31 19:06:04, zakerinasab wrote: > > On 2016/10/31 ...
4 years, 1 month ago
(2016-10-31 19:28:20 UTC)
#37
On 2016/10/31 19:11:27, eae wrote:
> On 2016/10/31 19:06:04, zakerinasab wrote:
> > On 2016/10/31 18:23:01, eae wrote:
> > > You are removing a set of functionality that is unrelated to your change.
If
> > you
> > > want to change how we enable subpixel rendering for all text on windows
then
> > > please do that as a separate change so that we can have a discussion about
> it
> > > instead of doing it as a part of a seemingly unrelated change to svg
> > baselines.
> >
> > To clarify, as long as subpixel text rendering for these small fonts is off,
> the
> > subscript and superscript will not work properly on Windows try-bots for
very
> > small fonts. So these changes are related. The CL works fine on my local
> Windows
> > machine because the display is high DPI, which is not the case on try-bots.
It
> > makes sense to keep this for another bug, so I will revert the changes of
> > FontPlatformDataWin.cpp and will submit another patch. If that was okay, I
> will
> > rebaseline and commit.
>
> That might be but you aren't changing this just for sub/sup for SVG, you are
> changing it for all text. We've spent *years* working on making sure our text
> rendering is legible across scripts, fonts and operating systems. This code is
> there for a reason. You can't fundamentally change how we do text rendering
on
> a whim to fix one edge case.
>
> I'm sorry but this needs to go back to the drawing board.
Right. I'll revert and rebaseline. If it was okay I'll file another bug for the
sub/superscript issue with small fonts on Windows.
zakerinasab
Patchset #11 (id:520001) has been deleted
4 years, 1 month ago
(2016-10-31 20:00:05 UTC)
#38
Patchset #11 (id:520001) has been deleted
zakerinasab
Patchset #12 (id:560001) has been deleted
4 years, 1 month ago
(2016-11-01 15:22:29 UTC)
#39
Patchset #12 (id:560001) has been deleted
zakerinasab
New patch submitted. Changes in FontPlatformDataWin.cpp reverted. This fix doesn't solve the problem for tiny ...
4 years, 1 month ago
(2016-11-01 15:52:39 UTC)
#40
New patch submitted. Changes in FontPlatformDataWin.cpp reverted. This fix
doesn't solve the problem for tiny fonts on Windows machines with low DPI
screens (deviceScaleFactor <= 1.5). New bug filed: crbug.com/661178
@eae PTAL. Thanks.
Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/258624)
4 years, 1 month ago
(2016-11-08 21:46:55 UTC)
#53
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/334053)
4 years, 1 month ago
(2016-11-09 16:03:31 UTC)
#57
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/360962)
Issue 2427773002: Fixing superscript and subscript baseline for tiny fonts in SVG
Created 4 years, 2 months ago by zakerinasab
Modified 3 years, 10 months ago
Reviewers: eae, Justin Novosad, zakerinasab1
Base URL:
Comments: 11