Skip to content

Commit 2f1e16e

Browse files
committed
content: Follow web app in using Source Sans 3, size 14, height 17
Values obtained by 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 now: zulip#380 (comment) Fixes-partly: zulip#157 Fixes-partly: zulip#294
1 parent 29672a0 commit 2f1e16e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/widgets/content.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,14 @@ class Paragraph extends StatelessWidget {
104104
// The paragraph has vertical CSS margins, but those have no effect.
105105
if (node.nodes.isEmpty) return const SizedBox();
106106

107-
final text = _buildBlockInlineContainer(node: node, style: null);
107+
final text = _buildBlockInlineContainer(
108+
node: node,
109+
style: const TextStyle(
110+
fontFamily: 'Source Sans 3',
111+
fontSize: 14,
112+
height: (17 / 14),
113+
).merge(weightVariableTextStyle(context)),
114+
);
108115

109116
// If the paragraph didn't actually have a `p` element in the HTML,
110117
// then apply no margins. (For example, these are seen in list items.)

test/widgets/content_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void main() {
6565
group('LinkNode interactions', () {
6666
// The Flutter test font uses square glyphs, so width equals height:
6767
// https://github.com/flutter/flutter/wiki/Flutter-Test-Fonts
68-
const fontSize = 48.0;
68+
const fontSize = 14.0;
6969

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

0 commit comments

Comments
 (0)