Skip to content

Commit

Permalink
Disable code font features (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
Airyzz authored Aug 10, 2024
1 parent b5a6cb6 commit 5b1a97a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion commet/lib/ui/atoms/code_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ class Codeblock extends StatelessWidget {
text.trim(),
language: language,
theme: theme,
textStyle: const TextStyle(fontFamily: "Code"),
textStyle: const TextStyle(
fontFamily: "Code",
fontFeatures: [FontFeature.disable("calt")]),
)
: Text(
text.trim(),
Expand Down
5 changes: 4 additions & 1 deletion commet/lib/ui/atoms/rich_text/matrix_html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ class CodeHtmlExtension extends HtmlExtension {

return TextSpan(
text: context.node.text,
style: TextStyle(fontFamily: "Code", color: color));
style: TextStyle(
fontFamily: "Code",
color: color,
fontFeatures: const [FontFeature.disable("calt")]));
}

static const Set<String> tags = {"code"};
Expand Down
8 changes: 6 additions & 2 deletions commet/lib/ui/atoms/rich_text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@ class RichTextEditingController extends TextEditingController {
var color =
Theme.of(context).extension<ExtraColors>()?.codeHighlight ??
Theme.of(context).colorScheme.primary;
style = style.copyWith(color: color, fontFamily: "code");
style = style.copyWith(
color: color,
fontFamily: "code",
fontFeatures: const [FontFeature.disable("calt")]);
break;
case "pre":
style = style.copyWith(
color: Theme.of(context).colorScheme.surfaceContainerHighest,
fontFamily: "code");
fontFamily: "code",
fontFeatures: const [FontFeature.disable("calt")]);
break;
case "a":
style = style.copyWith(color: Theme.of(context).colorScheme.primary);
Expand Down

0 comments on commit 5b1a97a

Please sign in to comment.