flutter_html icon indicating copy to clipboard operation
flutter_html copied to clipboard

[BUG] When using <ruby> for specific notations, the text disappears.

Open L4Ph opened this issue 6 months ago • 0 comments

Describe the bug:

When using the flutter_html library to render HTML containing <ruby> tags with <rp> and <rt> elements for furigana (as shown in the provided HTML snippet), the base text (e.g., "そういう") is not displayed. Instead, only the ruby text (furigana, represented by "・・・・" in the attached image due to the character in <rt>) is visible. This issue prevents proper rendering of Japanese text with furigana, making the content difficult to read and understand.

Image

HTML to reproduce the issue:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<ruby>そ<rp>(</rp><rt>・</rt><rp>)</rp></ruby><ruby>う<rp>(</rp><rt>・</rt><rp>)</rp></ruby><ruby>い<rp>(</rp><rt>・</rt><rp>)</rp></ruby><ruby>う<rp>(</rp><rt>・</rt><rp>)</rp></ruby>

</body>
</html>

Html widget configuration:

              child: Html(
                data: content,
                style: {
                  "body": Style(
                    fontSize: FontSize(settings.fontSize),
                    color: settings.colorScheme.onSurface,
                    whiteSpace: WhiteSpace.normal,
                  ),
                },
              ),

Expected behavior:

Ensure that both the ruby text and the base text display correctly, as with attached images or CodePen examples.

https://codepen.io/Unillu/pen/eZjdZV Image

Screenshots:

Device details and Flutter/Dart/flutter_html versions:

Dart: 3.8.1 Flutter: 3.32.5 flutter_html: ^3.0.0

Additional info:

A picture of a cute animal (not mandatory but encouraged)

LGTMeow

L4Ph avatar Jul 02 '25 06:07 L4Ph