Skip to content

Commit

Permalink
content: Follow web app in using Source Sans 3, size 14, height 17
Browse files Browse the repository at this point in the history
From looking at the "Computed" tab in the Chrome DevTools element
inspector, on CZO at 8.0-dev-2850-gef1c1ce05f.

Technically the web app has a computed `line-height` of 16.996px,
but that seems like a rounding error.

One reason for doing this now is to opt out of a default that would
take effect with the upcoming migration to Material 3. The text
would otherwise get a line height of 1.43 times the font size, and
we want it to be denser than that. We briefly explored how to
preserve the line height exactly, across the M3 migration, but the
solutions we found seemed more awkward than just taking care of
this:
  zulip#380 (comment)

Fixes-partly: zulip#294
  • Loading branch information
chrisbobbe committed Nov 15, 2023
1 parent 29672a0 commit b8a6414
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/widgets/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ class Paragraph extends StatelessWidget {
// The paragraph has vertical CSS margins, but those have no effect.
if (node.nodes.isEmpty) return const SizedBox();

final text = _buildBlockInlineContainer(node: node, style: null);
final text = _buildBlockInlineContainer(
node: node,
style: const TextStyle(
fontFamily: 'Source Sans 3',
fontSize: 14,
height: (17 / 14),
).merge(weightVariableTextStyle(context)),
);

// If the paragraph didn't actually have a `p` element in the HTML,
// then apply no margins. (For example, these are seen in list items.)
Expand Down
2 changes: 1 addition & 1 deletion test/widgets/content_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void main() {
group('LinkNode interactions', () {
// The Flutter test font uses square glyphs, so width equals height:
// https://github.com/flutter/flutter/wiki/Flutter-Test-Fonts
const fontSize = 48.0;
const fontSize = 14.0;

Future<void> prepareContent(WidgetTester tester, String html) async {
await testBinding.globalStore.add(eg.selfAccount, eg.initialSnapshot());
Expand Down

0 comments on commit b8a6414

Please sign in to comment.