Repository: flutter
Issue: RichText renders empty text's height incorrectly when TextStyle.height > 1
Labels: framework,a: typography,platform-web,a: desktop,has reproducible steps,P3,team-engine,triaged-engine,found in release: 3.24,found in release: 3.27

### Steps to reproduce

Use this code, works in DartPad (web platform affected as well).

1. Create 2 RichText widgets, where one contains empty TextSpan and the other non-empty (single character is fine).
2. Set both have TextStyle.height set to 1.8.
3. Observe heights of the two RichTexts, the empty RichText is taller.


### Expected results

RichText heights to be identical.

I believe the correct one should be the non-empty version.

### Actual results

The empty RichText gets bigger height. On desktop (macos) I observed difference of 2px.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  GlobalKey _key1 = GlobalKey();
  GlobalKey _key2 = GlobalKey();

  double _height1 = 0;
  double _height2 = 0;

  void _incrementCounter() {
    setState(() {
      _height1 = _key1.currentContext!.size!.height;
      _height2 = _key2.currentContext!.size!.height;
    });
  }

  @override
  Widget build(BuildContext context) {
    final style = TextStyle(height: 1.8);
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text('empty'),
            RichText(
              key: _key1,
              text: TextSpan(text: '', style: style),
            ),
            Text(
              '$_height1',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
            RichText(
              key: _key2,
              text: TextSpan(text: 'non empty', style: style),
            ),
            Text(
              '$_height2',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

<img width="200" alt="image" src="https://github.com/user-attachments/assets/ce75083a-ce7c-4e53-8a78-337fbe5ce425">


</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
 flutter doctor -v

┌─────────────────────────────────────────────────────────┐
│ A new version of Flutter is available!                  │
│                                                         │
│ To update to the latest version, run "flutter upgrade". │
└─────────────────────────────────────────────────────────┘
[✓] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4460], locale en-US)
    • Flutter version 3.24.3 on channel stable at C:\Users\anato\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (3 months ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\anato\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.2)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.11.35222.181
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[✓] VS Code (version 1.94.0)
    • VS Code at C:\Users\anato\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.98.0

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.4460]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 131.0.6778.86
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 131.0.2903.63

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>