Skip to content

Commit c86192f

Browse files
#7005 Fixed sub tag for font without glymps.
1 parent 035fdb0 commit c86192f

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

lib/src/builtins/styled_element_builtin.dart

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -390,18 +390,9 @@ class StyledElementBuiltIn extends HtmlExtension {
390390
case "strong":
391391
continue bold;
392392
case "sub":
393-
if (_hasOnlyDigits(children)) {
394-
// We can use FontFeature.subscripts since this just looks nice
395-
styledElement.style = Style(
396-
fontFeatureSettings: [const FontFeature.subscripts()],
397-
);
398-
} else {
399-
// For the rest we should just reduce the height of the text
400-
// Using WidgetSpan with translation should not be used because line breaks can occur just before subscript text
401-
styledElement.style = Style(
402-
fontSize: FontSize(50, Unit.percent),
403-
);
404-
}
393+
styledElement.style = Style(
394+
fontSize: FontSize(50, Unit.percent),
395+
);
405396
break;
406397
case "summary":
407398
styledElement.style = Style(
@@ -429,20 +420,6 @@ class StyledElementBuiltIn extends HtmlExtension {
429420
return styledElement;
430421
}
431422

432-
bool _hasOnlyDigits(List<StyledElement> children) {
433-
if (children.isEmpty) return true;
434-
for (var child in children) {
435-
if (child is TextContentElement) {
436-
final text = child.text;
437-
if (text == null || text.isEmpty) continue;
438-
for (int codeUnit in text.codeUnits) {
439-
if ((codeUnit ^ 0x30) > 9) return false;
440-
}
441-
}
442-
}
443-
return true;
444-
}
445-
446423
@override
447424
InlineSpan build(ExtensionContext context) {
448425
if (context.styledElement!.style.display == Display.listItem ||

0 commit comments

Comments
 (0)