Skip to content

Conversation

amake
Copy link
Contributor

@amake amake commented Jul 18, 2019

Currently, applying a different fontFamily to a nested node doesn't work:

Html(
      data: 'Hello, <em>world</em>',
      customTextStyle: (node, style) {
        if (node is dom.Element) {
          switch (node.localName) {
            case 'em':
              return style.copyWith(fontFamily: 'DM_Serif_Display'); // or whatever
          }
        }
        return style;
      },
    )

One would expect world to be shown in the specified font, but it isn't. (It is correctly displayed in italics, though.)

The cause is, apparently, this: flutter/flutter#35992

The workaround is easy, but yucky. I personally can't wait for the core issue to be fixed and the fix to make its way to the stable channel, so I will just use my fork, but I understand if you'd prefer to wait for this to be fixed upstream rather than merge this.

@Sub6Resources
Copy link
Owner

Thanks for the PR. I'm going to wait a week or two to see if there's any progress towards resolving that Flutter issue you mentioned. If there isn't I'll consider merging this pr.

amake added 2 commits July 19, 2019 00:37
Workaround for bug where fontFamily styling is not applied to child spans if the
root span is given a style. See:
flutter/flutter#35992
Due to workaround, two widgets are created instead of one
@amake amake force-pushed the font-family-fix branch from c08f848 to 3ad3e3b Compare July 18, 2019 15:37
@amake
Copy link
Contributor Author

amake commented Aug 1, 2019

What are your thoughts on merging this? My concerns are:

  1. The real fix will take a long time to get out
  2. I have a feature PR I'd like to open that I currently have implemented on top of this fix, so I am blocked on your decision at the moment. If you'd like to pass on this fix, I will redo it on master.

I'm happy either way, so please let me know.

@amake
Copy link
Contributor Author

amake commented Aug 9, 2019

The core fix appears to have made it to the beta channel now (1.8.3): flutter/flutter@c15cfdd

That's actually good enough for me. Shall I close this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants