Repository: flutter
Issue: Text widget with stroke style renders incorrectly at large font sizes
Labels: engine,a: typography,c: rendering,has reproducible steps,P2,team-engine,triaged-engine,found in release: 3.24,found in release: 3.27

### Steps to reproduce

We have discovered a rendering issue with Text widgets under specific conditions in Flutter. This problem affects both Android and iOS platforms, including iOS with Impeller enabled and disabled.

Conditions to reproduce the issue:
1. Set the Text widget's foreground property to `Paint()..style = PaintingStyle.stroke`
2. Set `fontWeight` to `FontWeight.bold`
3. Increase the font size beyond a certain threshold

When these conditions are met, the text rendering becomes distorted at a specific font size threshold. This threshold varies between devices, suggesting a possible dependency on screen size or resolution.

Steps to reproduce:
1. Create a new Flutter project.
2. Add the google_fonts package to your pubspec.yaml.
3. Replace the main.dart content with the provided sample code.
4. Run the app on both Android and iOS devices or simulators.
5. Observe the text rendering as you increase the font size.
6. Note the point at which the text begins to distort or appear cut off.

### Expected results

The Text widget should render correctly at all font sizes, maintaining its shape and not being cut off, regardless of the stroke style and font weight settings.

### Actual results

- The issue is present in many fonts, but some fonts and characters are less affected or unaffected.
- Android and iOS exhibit slightly different behaviors:
- On Android: Text shape becomes distorted.
  - On iOS: Text shape distorts and appears partially cut off.
  - On iOS, setting `fontWeight` to `FontWeight.normal` resolves the shape distortion but the cut-off issue persists.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
           Text("Font Size 127"),
           Text(
              'ABC',
              style: GoogleFonts.craftyGirls(
                fontSize: 127,
                fontWeight: FontWeight.bold,
                foreground: Paint()
                  ..style = PaintingStyle.stroke
                  ..strokeWidth = 20
              ),
            ),
            const SizedBox(height: 20),
            Text("Font Size 128"),
            Text(
              'ABC',
              style: GoogleFonts.craftyGirls(
                fontSize: 128,
                fontWeight: FontWeight.bold,
                foreground: Paint()
                  ..style = PaintingStyle.stroke
                  ..strokeWidth = 20
              ),
            ),
          ],
        ),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

| Pixel 6 (Android 14, physical device) | Pixel Tablet (Android 12, simulator) |
| --------------- | --------------- |
<img width="400" src="https://github.com/user-attachments/assets/7119be21-68d6-43ac-ae65-d2644f0c414a"> | <img width="400" src="https://github.com/user-attachments/assets/40cc1efc-e9f0-4347-8113-34c8f93c36c0">

| iPhone 15 (iOS 17.5, enabled impeller)  | iPhone 15 (iOS 17.5, disabled impeller)  |
| --------------- | --------------- |
<img width="400" src="https://github.com/user-attachments/assets/dab24892-96bd-40dc-b6a8-7415b01b0f6f"> | <img width="400" src="https://github.com/user-attachments/assets/441cbe80-3208-43da-8968-2cc073151bfb">



</details>


### Logs

_No response_

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.6.1 23G93 darwin-arm64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] Android Studio (version 2022.3)
[✓] Android Studio (version 2024.1)
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.92.2)
[✓] Connected device (6 available)
```

</details>