Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented May 30, 2023

fixes flutter/flutter#127714

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke gaaclarke changed the title Fixed overlapping test Fixed TypographerTest.MaybeHasOverlapping May 30, 2023
@gaaclarke gaaclarke changed the title Fixed TypographerTest.MaybeHasOverlapping [Impeller] Fixed TypographerTest.MaybeHasOverlapping May 30, 2023
@gaaclarke gaaclarke marked this pull request as ready for review May 30, 2023 21:33
@gaaclarke gaaclarke requested a review from jonahwilliams May 30, 2023 21:33
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSLGTM

Why do we get away with this on iOS? relying on some internal state somewhere?

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSLGTM

Why do we get away with this on iOS? relying on some internal state somewhere?

@gaaclarke
Copy link
Member Author

gaaclarke commented May 30, 2023

Why do we get away with this on iOS? relying on some internal state somewhere?

@jonahwilliams Well, at first I thought it was because the default font was different per operating system. But I just looked and this still passes on macos with arial 12, where on linux I needed arial 0.5 to get them to overlap.

Here are the first 2 glyph rects:

(x:0.000000 y:-10.000000 w:6.000000 h:11.000000)
(x:5.673828 y:-10.000000 w:9.000000 h:11.000000)

I don't know why they overlap. I could guess the ttf files are different or there is some ifdef code or skia is using different libraries for typesetting? If you have an optimization that requires that the glyphs aren't overlapping, I don't think it's getting hit as much as you had hoped.

@jonahwilliams
Copy link
Contributor

Yeah I think its making some assumptions based on what the font will do. Perhaps instead we should hardcode the font?

Its entirely reasonable that they would overlap, and this test might just be poorly written to assume they wont

@jonahwilliams
Copy link
Contributor

but at any rate, this fix is still fine if using a different font stabilizes it

@gaaclarke
Copy link
Member Author

@jonahwilliams I tried switching the test to use a specific font:

TEST_P(TypographerTest, MaybeHasOverlapping) {
  static constexpr const char* kTestFontFixture = "Roboto-Regular.ttf";
  auto mapping = OpenFixtureAsSkData(kTestFontFixture);
  FML_CHECK(mapping);
  SkFont sk_font(SkTypeface::MakeFromData(mapping), 12.0);

  auto frame = TextFrameFromTextBlob(SkTextBlob::MakeFromString("1", sk_font));
  // Single character has no overlapping
  ASSERT_FALSE(frame.MaybeHasOverlapping());

  auto frame_2 =
      TextFrameFromTextBlob(SkTextBlob::MakeFromString("123456789", sk_font));
  // Characters probably have overlap due to low fidelity text metrics, but this
  // could be fixed.
  ASSERT_TRUE(frame_2.MaybeHasOverlapping());
}

This still passes on macos but fails on linux.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label May 30, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 30, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented May 30, 2023

auto label is removed for flutter/engine, pr: 42429, due to - The status or check suite Linux linux_clang_tidy has failed. Please fix the issues identified (or deflake) before re-applying this label.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label May 30, 2023
@auto-submit auto-submit bot merged commit dff1847 into flutter:main May 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Impeller] Play/TypographerTest.MaybeHasOverlapping/Vulkan fails on linux

2 participants